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

Add compatibility with openforcefield 0.7.0 #121

Merged
merged 6 commits into from
Jun 24, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix handling of Molecule.total_charge
jchodera committed Jun 24, 2020
commit 5506300145a3c81abaf209d8d6a65ebe15b15a43
5 changes: 3 additions & 2 deletions openmmforcefields/generators/template_generators.py
Original file line number Diff line number Diff line change
@@ -570,9 +570,10 @@ def generate_residue_template(self, molecule, residue_atoms=None):

# Compute net formal charge
net_charge = molecule.total_charge
if type(net_charge) == float:
from simtk import unit
if type(net_charge) != unit.Quantity:
# openforcefield toolkit < 0.7.0 did not return unit-bearing quantity
net_charge *= unit.elementary_charge
net_charge = float(net_charge) * unit.elementary_charge
_logger.debug(f'Total charge is {net_charge}')

# Compute partial charges if required