Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pycgtool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James Graham
pycgtool
Commits
384cfaee
Commit
384cfaee
authored
8 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Added optional empirical correction to bond eqms
Clean write_itp function
parent
e43a88a7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pycgtool.py
+2
-1
2 additions, 1 deletion
pycgtool.py
pycgtool/bondset.py
+26
-36
26 additions, 36 deletions
pycgtool/bondset.py
with
28 additions
and
37 deletions
pycgtool.py
+
2
−
1
View file @
384cfaee
...
@@ -34,7 +34,8 @@ if __name__ == "__main__":
...
@@ -34,7 +34,8 @@ if __name__ == "__main__":
(
"
temperature
"
,
310
),
(
"
temperature
"
,
310
),
(
"
angle_default_fc
"
,
True
),
(
"
angle_default_fc
"
,
True
),
(
"
generate_angles
"
,
True
),
(
"
generate_angles
"
,
True
),
(
"
generate_dihedrals
"
,
False
)],
(
"
generate_dihedrals
"
,
False
),
(
"
empirical_corr
"
,
False
)],
args
)
args
)
if
not
args
.
map
and
not
args
.
bnd
:
if
not
args
.
map
and
not
args
.
bnd
:
...
...
This diff is collapsed.
Click to expand it.
pycgtool/bondset.py
+
26
−
36
View file @
384cfaee
...
@@ -100,10 +100,20 @@ class BondSet:
...
@@ -100,10 +100,20 @@ class BondSet:
self
.
_molecules
=
{}
self
.
_molecules
=
{}
self
.
_fconst_constr_threshold
=
options
.
constr_threshold
self
.
_fconst_constr_threshold
=
options
.
constr_threshold
self
.
_empirical_correction_factor
=
1.
try
:
self
.
_empirical_correction
=
options
.
empirical_corr
if
self
.
_empirical_correction
:
self
.
_empirical_correction_factor
=
1.05
except
AttributeError
:
self
.
_empirical_correction
=
False
try
:
try
:
self
.
_temperature
=
options
.
temperature
self
.
_temperature
=
options
.
temperature
except
AttributeError
:
except
AttributeError
:
self
.
_temperature
=
310.
self
.
_temperature
=
310.
try
:
try
:
self
.
_angle_default_fc
=
options
.
angle_default_fc
self
.
_angle_default_fc
=
options
.
angle_default_fc
except
AttributeError
:
except
AttributeError
:
...
@@ -226,6 +236,18 @@ class BondSet:
...
@@ -226,6 +236,18 @@ class BondSet:
self
.
_populate_atom_numbers
(
mapping
)
self
.
_populate_atom_numbers
(
mapping
)
backup_file
(
filename
,
verbose
=
True
)
backup_file
(
filename
,
verbose
=
True
)
def
write_bond_angle_dih
(
bonds
,
section_header
,
itp
,
fconst
=
True
):
if
bonds
:
print
(
"
\n
[ {0:s} ]
"
.
format
(
section_header
),
file
=
itp
)
for
bond
in
bonds
:
# Factor is usually 1, unless doing correction
eqm
=
bond
.
eqm
*
self
.
_empirical_correction_factor
line
=
"
"
.
join
([
"
{0:4d}
"
.
format
(
atnum
+
1
)
for
atnum
in
bond
.
atom_numbers
])
line
+=
"
{0:12.5f}
"
.
format
(
eqm
)
if
fconst
:
line
+=
"
{0:12.5f}
"
.
format
(
bond
.
fconst
)
print
(
line
,
file
=
itp
)
with
open
(
filename
,
"
w
"
)
as
itp
:
with
open
(
filename
,
"
w
"
)
as
itp
:
header
=
(
"
;
\n
"
header
=
(
"
;
\n
"
"
; Topology prepared automatically using PyCGTOOL
\n
"
"
; Topology prepared automatically using PyCGTOOL
\n
"
...
@@ -247,42 +269,10 @@ class BondSet:
...
@@ -247,42 +269,10 @@ class BondSet:
i
+
1
,
bead
.
type
,
1
,
mol
,
bead
.
name
,
i
+
1
,
bead
.
charge
i
+
1
,
bead
.
type
,
1
,
mol
,
bead
.
name
,
i
+
1
,
bead
.
charge
),
file
=
itp
)
),
file
=
itp
)
bonds
=
self
.
get_bond_lengths
(
mol
)
write_bond_angle_dih
(
self
.
get_bond_lengths
(
mol
),
"
bonds
"
,
itp
)
if
len
(
bonds
):
write_bond_angle_dih
(
self
.
get_bond_angles
(
mol
),
"
angles
"
,
itp
)
print
(
"
\n
[ bonds ]
"
,
file
=
itp
)
write_bond_angle_dih
(
self
.
get_bond_dihedrals
(
mol
),
"
dihedrals
"
,
itp
)
for
bond
in
bonds
:
write_bond_angle_dih
(
self
.
get_bond_length_constraints
(
mol
),
"
constraints
"
,
itp
,
fconst
=
False
)
print
(
"
{0:4d} {1:4d} {2:4d} {3:12.5f} {4:12.5f}
"
.
format
(
bond
.
atom_numbers
[
0
]
+
1
,
bond
.
atom_numbers
[
1
]
+
1
,
1
,
bond
.
eqm
,
bond
.
fconst
),
file
=
itp
)
bonds
=
self
.
get_bond_angles
(
mol
)
if
len
(
bonds
):
print
(
"
\n
[ angles ]
"
,
file
=
itp
)
for
bond
in
bonds
:
print
(
"
{0:4d} {1:4d} {2:4d} {3:4d} {4:12.5f} {5:12.5f}
"
.
format
(
bond
.
atom_numbers
[
0
]
+
1
,
bond
.
atom_numbers
[
1
]
+
1
,
bond
.
atom_numbers
[
2
]
+
1
,
1
,
bond
.
eqm
,
bond
.
fconst
),
file
=
itp
)
bonds
=
self
.
get_bond_dihedrals
(
mol
)
if
len
(
bonds
):
print
(
"
\n
[ dihedrals ]
"
,
file
=
itp
)
for
bond
in
bonds
:
print
(
"
{0:4d} {1:4d} {2:4d} {3:4d} {4:4d} {5:12.5f} {6:12.5f} {7:4d}
"
.
format
(
bond
.
atom_numbers
[
0
]
+
1
,
bond
.
atom_numbers
[
1
]
+
1
,
bond
.
atom_numbers
[
2
]
+
1
,
bond
.
atom_numbers
[
3
]
+
1
,
1
,
bond
.
eqm
,
bond
.
fconst
,
1
),
file
=
itp
)
bonds
=
self
.
get_bond_length_constraints
(
mol
)
if
len
(
bonds
):
print
(
"
\n
[ constraints ]
"
,
file
=
itp
)
for
bond
in
bonds
:
print
(
"
{0:4d} {1:4d} {2:4d} {3:12.5f}
"
.
format
(
bond
.
atom_numbers
[
0
]
+
1
,
bond
.
atom_numbers
[
1
]
+
1
,
1
,
bond
.
eqm
),
file
=
itp
)
def
apply
(
self
,
frame
):
def
apply
(
self
,
frame
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment