Commit 9128e9ef authored by peastman's avatar peastman
Browse files

Depressing compromise to make the ordering of atoms in improper torsions as...

Depressing compromise to make the ordering of atoms in improper torsions as consistent as possible with both AMBER and CHARMM
parent a993d7ab
...@@ -902,26 +902,20 @@ class PeriodicTorsionGenerator: ...@@ -902,26 +902,20 @@ class PeriodicTorsionGenerator:
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 wildcard in (types1, types2, types3, types4): # 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. a1 = torsion[t2[1]]
a1 = torsion[t2[1]] a2 = torsion[t3[1]]
a2 = torsion[t3[1]] e1 = data.atoms[a1].element
e1 = data.atoms[a1].element e2 = data.atoms[a2].element
e2 = data.atoms[a2].element if e1 == e2 and a1 > a2:
if e1 == e2 and a1 > a2: (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)):
for i in range(len(tordef.phase)): if tordef.k[i] != 0:
if tordef.k[i] != 0: force.addTorsion(a1, a2, torsion[0], torsion[t4[1]], tordef.periodicity[i], tordef.phase[i], tordef.k[i])
force.addTorsion(a1, a2, torsion[0], torsion[t4[1]], tordef.periodicity[i], tordef.phase[i], tordef.k[i])
else:
# There are no wildcards, so the order is unambiguous.
for i in range(len(tordef.phase)):
if tordef.k[i] != 0:
force.addTorsion(torsion[0], torsion[t2[1]], torsion[t3[1]], torsion[t4[1]], tordef.periodicity[i], tordef.phase[i], tordef.k[i])
done = True done = True
break break
...@@ -1549,7 +1543,6 @@ class CustomTorsionGenerator: ...@@ -1549,7 +1543,6 @@ 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)
print a1, a2, torsion[0], torsion[t4[1]]
force.addTorsion(a1, a2, torsion[0], torsion[t4[1]], tordef.paramValues) force.addTorsion(a1, a2, torsion[0], torsion[t4[1]], tordef.paramValues)
else: else:
# There are no wildcards, so the order is unambiguous. # There are no wildcards, so the order is unambiguous.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment