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
abdc6296
Commit
abdc6296
authored
Jan 25, 2016
by
Peter Eastman
Browse files
Improper torsions without wildcards override ones with
parent
d2fd6cee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
21 deletions
+33
-21
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+33
-21
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
abdc6296
...
@@ -1360,14 +1360,16 @@ class PeriodicTorsionGenerator:
...
@@ -1360,14 +1360,16 @@ class PeriodicTorsionGenerator:
type2
=
data
.
atomType
[
data
.
atoms
[
torsion
[
1
]]]
type2
=
data
.
atomType
[
data
.
atoms
[
torsion
[
1
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
torsion
[
2
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
torsion
[
2
]]]
type4
=
data
.
atomType
[
data
.
atoms
[
torsion
[
3
]]]
type4
=
data
.
atomType
[
data
.
atoms
[
torsion
[
3
]]]
done
=
Fals
e
match
=
Non
e
for
tordef
in
self
.
improper
:
for
tordef
in
self
.
improper
:
if
done
:
break
types1
=
tordef
.
types1
types1
=
tordef
.
types1
types2
=
tordef
.
types2
types2
=
tordef
.
types2
types3
=
tordef
.
types3
types3
=
tordef
.
types3
types4
=
tordef
.
types4
types4
=
tordef
.
types4
hasWildcard
=
(
wildcard
in
(
types1
,
types2
,
types3
,
types4
))
if
match
is
not
None
and
hasWildcard
:
# Prefer specific definitions over ones with wildcards
continue
if
type1
in
types1
:
if
type1
in
types1
:
for
(
t2
,
t3
,
t4
)
in
itertools
.
permutations
(((
type2
,
1
),
(
type3
,
2
),
(
type4
,
3
))):
for
(
t2
,
t3
,
t4
)
in
itertools
.
permutations
(((
type2
,
1
),
(
type3
,
2
),
(
type4
,
3
))):
if
t2
[
0
]
in
types2
and
t3
[
0
]
in
types3
and
t4
[
0
]
in
types4
:
if
t2
[
0
]
in
types2
and
t3
[
0
]
in
types3
and
t4
[
0
]
in
types4
:
...
@@ -1382,11 +1384,13 @@ class PeriodicTorsionGenerator:
...
@@ -1382,11 +1384,13 @@ class PeriodicTorsionGenerator:
(
a1
,
a2
)
=
(
a2
,
a1
)
(
a1
,
a2
)
=
(
a2
,
a1
)
elif
e1
!=
elem
.
carbon
and
(
e2
==
elem
.
carbon
or
e1
.
mass
<
e2
.
mass
):
elif
e1
!=
elem
.
carbon
and
(
e2
==
elem
.
carbon
or
e1
.
mass
<
e2
.
mass
):
(
a1
,
a2
)
=
(
a2
,
a1
)
(
a1
,
a2
)
=
(
a2
,
a1
)
for
i
in
range
(
len
(
tordef
.
phase
)):
match
=
(
a1
,
a2
,
torsion
[
0
],
torsion
[
t4
[
1
]],
tordef
)
if
tordef
.
k
[
i
]
!=
0
:
force
.
addTorsion
(
a1
,
a2
,
torsion
[
0
],
torsion
[
t4
[
1
]],
tordef
.
periodicity
[
i
],
tordef
.
phase
[
i
],
tordef
.
k
[
i
])
done
=
True
break
break
if
match
is
not
None
:
(
a1
,
a2
,
a3
,
a4
,
tordef
)
=
match
for
i
in
range
(
len
(
tordef
.
phase
)):
if
tordef
.
k
[
i
]
!=
0
:
force
.
addTorsion
(
a1
,
a2
,
a3
,
a4
,
tordef
.
periodicity
[
i
],
tordef
.
phase
[
i
],
tordef
.
k
[
i
])
parsers
[
"PeriodicTorsionForce"
]
=
PeriodicTorsionGenerator
.
parseElement
parsers
[
"PeriodicTorsionForce"
]
=
PeriodicTorsionGenerator
.
parseElement
...
@@ -1457,18 +1461,20 @@ class RBTorsionGenerator:
...
@@ -1457,18 +1461,20 @@ class RBTorsionGenerator:
type2
=
data
.
atomType
[
data
.
atoms
[
torsion
[
1
]]]
type2
=
data
.
atomType
[
data
.
atoms
[
torsion
[
1
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
torsion
[
2
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
torsion
[
2
]]]
type4
=
data
.
atomType
[
data
.
atoms
[
torsion
[
3
]]]
type4
=
data
.
atomType
[
data
.
atoms
[
torsion
[
3
]]]
done
=
Fals
e
match
=
Non
e
for
tordef
in
self
.
improper
:
for
tordef
in
self
.
improper
:
if
done
:
break
types1
=
tordef
.
types1
types1
=
tordef
.
types1
types2
=
tordef
.
types2
types2
=
tordef
.
types2
types3
=
tordef
.
types3
types3
=
tordef
.
types3
types4
=
tordef
.
types4
types4
=
tordef
.
types4
hasWildcard
=
(
wildcard
in
(
types1
,
types2
,
types3
,
types4
))
if
match
is
not
None
and
hasWildcard
:
# Prefer specific definitions over ones with wildcards
continue
if
type1
in
types1
:
if
type1
in
types1
:
for
(
t2
,
t3
,
t4
)
in
itertools
.
permutations
(((
type2
,
1
),
(
type3
,
2
),
(
type4
,
3
))):
for
(
t2
,
t3
,
t4
)
in
itertools
.
permutations
(((
type2
,
1
),
(
type3
,
2
),
(
type4
,
3
))):
if
t2
[
0
]
in
types2
and
t3
[
0
]
in
types3
and
t4
[
0
]
in
types4
:
if
t2
[
0
]
in
types2
and
t3
[
0
]
in
types3
and
t4
[
0
]
in
types4
:
if
w
ildcard
in
(
types1
,
types2
,
types3
,
types4
)
:
if
hasW
ildcard
:
# Workaround to be more consistent with AMBER. It uses wildcards to define most of its
# Workaround to be more consistent with AMBER. It uses wildcards to define most of its
# impropers, which leaves the ordering ambiguous. It then follows some bizarre rules
# impropers, which leaves the ordering ambiguous. It then follows some bizarre rules
# to pick the order.
# to pick the order.
...
@@ -1480,12 +1486,14 @@ class RBTorsionGenerator:
...
@@ -1480,12 +1486,14 @@ class RBTorsionGenerator:
(
a1
,
a2
)
=
(
a2
,
a1
)
(
a1
,
a2
)
=
(
a2
,
a1
)
elif
e1
!=
elem
.
carbon
and
(
e2
==
elem
.
carbon
or
e1
.
mass
<
e2
.
mass
):
elif
e1
!=
elem
.
carbon
and
(
e2
==
elem
.
carbon
or
e1
.
mass
<
e2
.
mass
):
(
a1
,
a2
)
=
(
a2
,
a1
)
(
a1
,
a2
)
=
(
a2
,
a1
)
force
.
addTorsion
(
a1
,
a2
,
torsion
[
0
],
torsion
[
t4
[
1
]],
tordef
.
c
[
0
],
tordef
.
c
[
1
],
tordef
.
c
[
2
],
tordef
.
c
[
3
],
tordef
.
c
[
4
],
tordef
.
c
[
5
]
)
match
=
(
a1
,
a2
,
torsion
[
0
],
torsion
[
t4
[
1
]],
tordef
)
else
:
else
:
# There are no wildcards, so the order is unambiguous.
# There are no wildcards, so the order is unambiguous.
force
.
addTorsion
(
torsion
[
0
],
torsion
[
t2
[
1
]],
torsion
[
t3
[
1
]],
torsion
[
t4
[
1
]],
tordef
.
c
[
0
],
tordef
.
c
[
1
],
tordef
.
c
[
2
],
tordef
.
c
[
3
],
tordef
.
c
[
4
],
tordef
.
c
[
5
])
match
=
(
torsion
[
0
],
torsion
[
t2
[
1
]],
torsion
[
t3
[
1
]],
torsion
[
t4
[
1
]],
tordef
)
done
=
True
break
break
if
match
is
not
None
:
(
a1
,
a2
,
a3
,
a4
,
tordef
)
=
match
force
.
addTorsion
(
a1
,
a2
,
a3
,
a4
,
tordef
.
c
[
0
],
tordef
.
c
[
1
],
tordef
.
c
[
2
],
tordef
.
c
[
3
],
tordef
.
c
[
4
],
tordef
.
c
[
5
])
parsers
[
"RBTorsionForce"
]
=
RBTorsionGenerator
.
parseElement
parsers
[
"RBTorsionForce"
]
=
RBTorsionGenerator
.
parseElement
...
@@ -1884,18 +1892,20 @@ class CustomTorsionGenerator:
...
@@ -1884,18 +1892,20 @@ class CustomTorsionGenerator:
type2
=
data
.
atomType
[
data
.
atoms
[
torsion
[
1
]]]
type2
=
data
.
atomType
[
data
.
atoms
[
torsion
[
1
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
torsion
[
2
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
torsion
[
2
]]]
type4
=
data
.
atomType
[
data
.
atoms
[
torsion
[
3
]]]
type4
=
data
.
atomType
[
data
.
atoms
[
torsion
[
3
]]]
done
=
Fals
e
match
=
Non
e
for
tordef
in
self
.
improper
:
for
tordef
in
self
.
improper
:
if
done
:
break
types1
=
tordef
.
types1
types1
=
tordef
.
types1
types2
=
tordef
.
types2
types2
=
tordef
.
types2
types3
=
tordef
.
types3
types3
=
tordef
.
types3
types4
=
tordef
.
types4
types4
=
tordef
.
types4
hasWildcard
=
(
wildcard
in
(
types1
,
types2
,
types3
,
types4
))
if
match
is
not
None
and
hasWildcard
:
# Prefer specific definitions over ones with wildcards
continue
if
type1
in
types1
:
if
type1
in
types1
:
for
(
t2
,
t3
,
t4
)
in
itertools
.
permutations
(((
type2
,
1
),
(
type3
,
2
),
(
type4
,
3
))):
for
(
t2
,
t3
,
t4
)
in
itertools
.
permutations
(((
type2
,
1
),
(
type3
,
2
),
(
type4
,
3
))):
if
t2
[
0
]
in
types2
and
t3
[
0
]
in
types3
and
t4
[
0
]
in
types4
:
if
t2
[
0
]
in
types2
and
t3
[
0
]
in
types3
and
t4
[
0
]
in
types4
:
if
w
ildcard
in
(
types1
,
types2
,
types3
,
types4
)
:
if
hasW
ildcard
:
# Workaround to be more consistent with AMBER. It uses wildcards to define most of its
# Workaround to be more consistent with AMBER. It uses wildcards to define most of its
# impropers, which leaves the ordering ambiguous. It then follows some bizarre rules
# impropers, which leaves the ordering ambiguous. It then follows some bizarre rules
# to pick the order.
# to pick the order.
...
@@ -1907,12 +1917,14 @@ class CustomTorsionGenerator:
...
@@ -1907,12 +1917,14 @@ class CustomTorsionGenerator:
(
a1
,
a2
)
=
(
a2
,
a1
)
(
a1
,
a2
)
=
(
a2
,
a1
)
elif
e1
!=
elem
.
carbon
and
(
e2
==
elem
.
carbon
or
e1
.
mass
<
e2
.
mass
):
elif
e1
!=
elem
.
carbon
and
(
e2
==
elem
.
carbon
or
e1
.
mass
<
e2
.
mass
):
(
a1
,
a2
)
=
(
a2
,
a1
)
(
a1
,
a2
)
=
(
a2
,
a1
)
force
.
addTorsion
(
a1
,
a2
,
torsion
[
0
],
torsion
[
t4
[
1
]],
tordef
.
paramValues
)
match
=
(
a1
,
a2
,
torsion
[
0
],
torsion
[
t4
[
1
]],
tordef
)
else
:
else
:
# There are no wildcards, so the order is unambiguous.
# There are no wildcards, so the order is unambiguous.
force
.
addTorsion
(
torsion
[
0
],
torsion
[
t2
[
1
]],
torsion
[
t3
[
1
]],
torsion
[
t4
[
1
]],
tordef
.
paramValues
)
match
=
(
torsion
[
0
],
torsion
[
t2
[
1
]],
torsion
[
t3
[
1
]],
torsion
[
t4
[
1
]],
tordef
)
done
=
True
break
break
if
match
is
not
None
:
(
a1
,
a2
,
a3
,
a4
,
tordef
)
=
match
force
.
addTorsion
(
a1
,
a2
,
a3
,
a4
,
tordef
.
paramValues
)
parsers
[
"CustomTorsionForce"
]
=
CustomTorsionGenerator
.
parseElement
parsers
[
"CustomTorsionForce"
]
=
CustomTorsionGenerator
.
parseElement
...
...
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