Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update xml_writer for improper dihedral (for example, EMIM+ using GAFF) #477

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions foyer/xml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,21 @@ def _write_periodic_torsions(root, dihedrals, unique):
dihedral_force.set("id4", str(dihedral.atom4.idx))
for id in range(4):
dihedral_force.set("type{}".format(id + 1), atypes[id])
dihedral_force.set("periodicity1", str(dihedral.type.per))
dihedral_force.set(
"phase1", str(round(dihedral.type.phase * (np.pi / 180), 8))
)
dihedral_force.set("k1", str(round(dihedral.type.phi_k * 4.184, 3)))

try:
dihedral_force.set("periodicity1", str(dihedral.type.per))
dihedral_force.set(
"phase1", str(round(dihedral.type.phase * (np.pi / 180), 8))
)
dihedral_force.set("k1", str(round(dihedral.type.phi_k * 4.184, 3)))
except:
dihedral_force.set("periodicity1", str(dihedral.type[0].per))
dihedral_force.set(
"phase1", str(round(dihedral.type[0].phase * (np.pi / 180), 8))
)
dihedral_force.set(
"k1", str(round(dihedral.type[0].phi_k * 4.184, 3))
)
if last_dihedral_force is not None:
# Check to see if this current dihedral force needs to be
# "merged" into the last dihedral force
Expand Down