Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
aaf535b8
Commit
aaf535b8
authored
Aug 24, 2016
by
Rafal P. Wiewiora
Browse files
add ordering attribute to impropers
parent
18253db9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
18 deletions
+23
-18
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+23
-18
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
aaf535b8
...
...
@@ -1802,6 +1802,7 @@ class PeriodicTorsion(object):
self
.
periodicity
=
[]
self
.
phase
=
[]
self
.
k
=
[]
self
.
ordering
=
'default'
## @private
class
PeriodicTorsionGenerator
(
object
):
...
...
@@ -1817,9 +1818,15 @@ class PeriodicTorsionGenerator(object):
if
torsion
is
not
None
:
self
.
proper
.
append
(
torsion
)
def
registerImproperTorsion
(
self
,
parameters
):
def
registerImproperTorsion
(
self
,
parameters
,
ordering
=
'default'
):
torsion
=
self
.
ff
.
_parseTorsion
(
parameters
)
if
torsion
is
not
None
:
if
ordering
==
'default'
:
pass
elif
ordering
==
'amber'
:
torsion
.
ordering
=
ordering
else
:
raise
ValueError
(
'Illegal ordering type for improper torsion %s'
%
torsion
)
self
.
improper
.
append
(
torsion
)
@
staticmethod
...
...
@@ -1833,7 +1840,7 @@ class PeriodicTorsionGenerator(object):
for
torsion
in
element
.
findall
(
'Proper'
):
generator
.
registerProperTorsion
(
torsion
.
attrib
)
for
torsion
in
element
.
findall
(
'Improper'
):
generator
.
registerImproperTorsion
(
torsion
.
attrib
)
generator
.
registerImproperTorsion
(
torsion
.
attrib
,
element
.
attrib
[
'ordering'
]
)
def
createForce
(
self
,
sys
,
data
,
nonbondedMethod
,
nonbondedCutoff
,
args
):
existing
=
[
sys
.
getForce
(
i
)
for
i
in
range
(
sys
.
getNumForces
())]
...
...
@@ -1903,14 +1910,12 @@ class PeriodicTorsionGenerator(object):
e2
=
data
.
atoms
[
a2
].
element
e3
=
data
.
atoms
[
a3
].
element
e4
=
data
.
atoms
[
a4
].
element
# the following for AMBER only - TODO: decide how to pass this in ffxml's
if
isAmber
:
if
not
hasWildcard
:
if
tordef
.
ordering
==
'default'
:
if
t2
[
0
]
==
t4
[
0
]
and
(
r2
>
r4
or
(
r2
==
r4
and
ta2
>
ta4
)):
(
a2
,
a4
)
=
(
a4
,
a2
)
r2
=
data
.
atoms
[
a2
].
residue
.
index
r4
=
data
.
atoms
[
a4
].
residue
.
index
ta2
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a
2
]]
ta2
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a
3
]]
ta4
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a4
]]
if
t3
[
0
]
==
t4
[
0
]
and
(
r3
>
r4
or
(
r3
==
r4
and
ta3
>
ta4
)):
(
a3
,
a4
)
=
(
a4
,
a3
)
...
...
@@ -1920,38 +1925,38 @@ class PeriodicTorsionGenerator(object):
ta4
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a4
]]
if
t2
[
0
]
==
t3
[
0
]
and
(
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
)):
(
a2
,
a3
)
=
(
a3
,
a2
)
else
:
if
e2
==
e4
and
(
r2
>
r4
or
(
r2
==
r4
and
ta2
>
ta4
)):
elif
hasTwoWildcards
and
(
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
)):
(
a2
,
a3
)
=
(
a3
,
a2
)
elif
tordef
.
ordering
==
'amber'
:
if
not
hasWildcard
:
if
t2
[
0
]
==
t4
[
0
]
and
(
r2
>
r4
or
(
r2
==
r4
and
ta2
>
ta4
)):
(
a2
,
a4
)
=
(
a4
,
a2
)
r2
=
data
.
atoms
[
a2
].
residue
.
index
r4
=
data
.
atoms
[
a4
].
residue
.
index
ta2
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a2
]]
ta4
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a4
]]
if
e3
==
e4
and
(
r3
>
r4
or
(
r3
==
r4
and
ta3
>
ta4
)):
if
t3
[
0
]
==
t4
[
0
]
and
(
r3
>
r4
or
(
r3
==
r4
and
ta3
>
ta4
)):
(
a3
,
a4
)
=
(
a4
,
a3
)
r3
=
data
.
atoms
[
a3
].
residue
.
index
r4
=
data
.
atoms
[
a4
].
residue
.
index
ta3
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a3
]]
ta4
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a4
]]
if
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
):
if
t2
[
0
]
==
t3
[
0
]
and
(
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
)
)
:
(
a2
,
a3
)
=
(
a3
,
a2
)
# the following is OpenMM default
else
:
if
t2
[
0
]
==
t4
[
0
]
and
(
r2
>
r4
or
(
r2
==
r4
and
ta2
>
ta4
)):
else
:
if
e2
==
e4
and
(
r2
>
r4
or
(
r2
==
r4
and
ta2
>
ta4
)):
(
a2
,
a4
)
=
(
a4
,
a2
)
r2
=
data
.
atoms
[
a2
].
residue
.
index
r4
=
data
.
atoms
[
a4
].
residue
.
index
ta2
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a
3
]]
ta2
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a
2
]]
ta4
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a4
]]
if
t3
[
0
]
==
t4
[
0
]
and
(
r3
>
r4
or
(
r3
==
r4
and
ta3
>
ta4
)):
if
e3
==
e4
and
(
r3
>
r4
or
(
r3
==
r4
and
ta3
>
ta4
)):
(
a3
,
a4
)
=
(
a4
,
a3
)
r3
=
data
.
atoms
[
a3
].
residue
.
index
r4
=
data
.
atoms
[
a4
].
residue
.
index
ta3
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a3
]]
ta4
=
data
.
atomTemplateIndexes
[
data
.
atoms
[
a4
]]
if
t2
[
0
]
==
t3
[
0
]
and
(
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
)):
(
a2
,
a3
)
=
(
a3
,
a2
)
elif
hasTwoWildcards
and
(
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
)):
if
r2
>
r3
or
(
r2
==
r3
and
ta2
>
ta3
):
(
a2
,
a3
)
=
(
a3
,
a2
)
match
=
(
a2
,
a3
,
torsion
[
0
],
a4
,
tordef
)
break
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment