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

Changed the default forcefield to OPLSAA #38

Merged
merged 4 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
=======
History
=======
2024.12.14 -- Updated for changes in SMILES handling
* Changes in the handling of SMILES in MolSystem required small changes in the tests
to continue using Open Babel for SMILES.

2024.10.25 -- Changed the default forcefield to OPLSAA

2024.6.30 -- Bugfix: Error submitting jobs with local forcefield files.

2024.6.29 -- Bugfix: factor of 2 for dihedrals and impropers in ligpargen
Expand Down
2 changes: 1 addition & 1 deletion forcefield_step/forcefield_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ForcefieldParameters(seamm.Parameters):
"help_text": "What to do with the forcefield.",
},
"forcefield_file": {
"default": forcefields[0],
"default": "oplsaa.frc",
"kind": "enumeration",
"default_units": "",
"enumeration": tuple(forcefields),
Expand Down
64 changes: 33 additions & 31 deletions tests/test_oplsaa_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
When the default for SMILES was changed to RDKit, tests with explicit
hydrogens in the SMILES failed because RDKit produces a different order
of atoms than OpenBabel in these cases. For the time being, in these tests
the call to configuration.smiles adds the argument 'rdkit=False' to continue
the call to configuration.smiles adds the argument 'flavor="openbabel"' to continue
using OpenBabel.
"""

Expand Down Expand Up @@ -322,7 +322,7 @@ def test_opls_113(oplsaa_assigner, configuration):
+ ["opls_115", "opls_113", "opls_114"]
+ 5 * ["opls_118"]
)
configuration.from_smiles("C(O[H])C(O[H])CO[H]", rdkit=False)
configuration.from_smiles("C(O[H])C(O[H])CO[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -337,7 +337,7 @@ def test_opls_113(oplsaa_assigner, configuration):
+ 3 * ["opls_118"]
+ 6 * ["opls_85"]
)
configuration.from_smiles("C(O[H])C(O[H])C(O[H])(C)C", rdkit=False)
configuration.from_smiles("C(O[H])C(O[H])C(O[H])(C)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -937,7 +937,7 @@ def test_opls_160(oplsaa_assigner, configuration):
+ 2 * ["opls_85"]
+ 5 * ["opls_91"]
)
configuration.from_smiles("[H]OCc1ccccc1", rdkit=False)
configuration.from_smiles("[H]OCc1ccccc1", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -954,7 +954,7 @@ def test_opls_161(oplsaa_assigner, configuration):
+ 4 * ["opls_85"]
+ 5 * ["opls_91"]
)
configuration.from_smiles("[H]OC(C)c1ccccc1", rdkit=False)
configuration.from_smiles("[H]OC(C)c1ccccc1", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -971,7 +971,7 @@ def test_opls_162(oplsaa_assigner, configuration):
+ 6 * ["opls_85"]
+ 5 * ["opls_91"]
)
configuration.from_smiles("[H]OC(C)(C)c1ccccc1", rdkit=False)
configuration.from_smiles("[H]OC(C)(C)c1ccccc1", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1063,7 +1063,7 @@ def test_opls_174(oplsaa_assigner, configuration):
correct = (
["opls_221", "opls_174", "opls_220"] + 6 * ["opls_90"] + 5 * ["opls_91"]
)
configuration.from_smiles("[H]C(=O)c1ccccc1", rdkit=False)
configuration.from_smiles("[H]C(=O)c1ccccc1", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1093,7 +1093,7 @@ def test_opls_219(oplsaa_assigner, configuration):
opls 221, hydrogen in aldehyde -CH=O
"""
correct = ["opls_221", "opls_219", "opls_220", "opls_80"] + 3 * ["opls_85"]
configuration.from_smiles("[H]C(=O)C", rdkit=False)
configuration.from_smiles("[H]C(=O)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1350,7 +1350,7 @@ def test_opls_198(oplsaa_assigner, configuration):
+ 2 * ["opls_194", "opls_195", "opls_198"]
+ 6 * ["opls_85"]
)
configuration.from_smiles("N([H])(C(=O)C)C(=O)C", rdkit=False)
configuration.from_smiles("N([H])(C(=O)C)C(=O)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1383,7 +1383,7 @@ def test_opls_199(oplsaa_assigner, configuration):
+ 2 * ["opls_194", "opls_195", "opls_199", "opls_80"]
+ 10 * ["opls_85"]
)
configuration.from_smiles("N([H])(C(=O)CC)C(=O)CC", rdkit=False)
configuration.from_smiles("N([H])(C(=O)CC)C(=O)CC", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1416,7 +1416,7 @@ def test_opls_200(oplsaa_assigner, configuration):
+ 2 * (["opls_194", "opls_195", "opls_200"] + 2 * ["opls_80"])
+ 14 * ["opls_85"]
)
configuration.from_smiles("N([H])(C(=O)C(C)C)C(=O)C(C)C", rdkit=False)
configuration.from_smiles("N([H])(C(=O)C(C)C)C(=O)C(C)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1449,7 +1449,9 @@ def test_opls_201(oplsaa_assigner, configuration):
+ 2 * (["opls_194", "opls_195", "opls_201"] + 3 * ["opls_80"])
+ 18 * ["opls_85"]
)
configuration.from_smiles("N([H])(C(=O)C(C)(C)C)C(=O)C(C)(C)C", rdkit=False)
configuration.from_smiles(
"N([H])(C(=O)C(C)(C)C)C(=O)C(C)(C)C", flavor="openbabel"
)
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1497,7 +1499,7 @@ def test_opls_207(oplsaa_assigner, configuration):
+ 3 * ["opls_85"]
+ 5 * ["opls_91"]
)
configuration.from_smiles("CC(=O)N([H])c1ccccc1", rdkit=False)
configuration.from_smiles("CC(=O)N([H])c1ccccc1", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -1513,15 +1515,15 @@ def test_opls_209(oplsaa_assigner, configuration):
correct = ["opls_80", "opls_209", "opls_210", "opls_211", "opls_212"] + 3 * [
"opls_85"
]
configuration.from_smiles("CC(=O)O[H]", rdkit=False)
configuration.from_smiles("CC(=O)O[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
raise AssertionError(f"\n result: {result}\ncorrect: {correct}")

# Formic acid is an edge case
correct = ["opls_221", "opls_209", "opls_210", "opls_211", "opls_212"]
configuration.from_smiles("[H]C(=O)O[H]", rdkit=False)
configuration.from_smiles("[H]C(=O)O[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -1534,7 +1536,7 @@ def test_opls_213(oplsaa_assigner, configuration):
opls 221, hydrogen in aldehydes, formic acid, formamide...
"""
correct = ["opls_221", "opls_213", "opls_214", "opls_214"]
configuration.from_smiles("[H]C(=O)[O-]", rdkit=False)
configuration.from_smiles("[H]C(=O)[O-]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -1616,7 +1618,7 @@ def test_opls_225(oplsaa_assigner, configuration):
+ ["opls_183", "opls_177", "opls_178", "opls_80", "opls_212"]
+ 7 * ["opls_85"]
)
configuration.from_smiles("O=C(O)C(C)N([H])C(=O)C", rdkit=False)
configuration.from_smiles("O=C(O)C(C)N([H])C(=O)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -1631,7 +1633,7 @@ def test_opls_226(oplsaa_assigner, configuration):
+ ["opls_183", "opls_177", "opls_178", "opls_80", "opls_212"]
+ 5 * ["opls_85"]
)
configuration.from_smiles("O=C(O)CN([H])C(=O)C", rdkit=False)
configuration.from_smiles("O=C(O)CN([H])C(=O)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -1646,7 +1648,7 @@ def test_opls_227(oplsaa_assigner, configuration):
+ ["opls_180", "opls_183", "opls_177", "opls_178", "opls_80", "opls_212"]
+ 9 * ["opls_85"]
)
configuration.from_smiles("O=C(O)C(C)(C)N([H])C(=O)C", rdkit=False)
configuration.from_smiles("O=C(O)C(C)(C)N([H])C(=O)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -2006,7 +2008,7 @@ def test_opls_411(oplsaa_assigner, configuration):
+ ["opls_411", "opls_210", "opls_211", "opls_212"]
+ 5 * ["opls_91"]
)
configuration.from_smiles("c1ccccc1C(=O)O[H]", rdkit=False)
configuration.from_smiles("c1ccccc1C(=O)O[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -2523,7 +2525,7 @@ def test_opls_528(oplsaa_assigner, configuration):
+ ["opls_538", "opls_539", "opls_540", "opls_541"]
+ ["opls_542", "opls_543"]
)
configuration.from_smiles("n1([H])ccc2ccccc21", rdkit=False)
configuration.from_smiles("n1([H])ccc2ccccc21", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -2582,7 +2584,7 @@ def test_opls_561(oplsaa_assigner, configuration):
+ ["opls_566", "opls_567", "opls_568", "opls_569"]
+ ["opls_573", "opls_570", "opls_571", "opls_572"]
)
configuration.from_smiles("n1cnc2c(c1)ncn2[H]", rdkit=False)
configuration.from_smiles("n1cnc2c(c1)ncn2[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -2651,7 +2653,7 @@ def test_opls_585(oplsaa_assigner, configuration):
+ 2 * ["opls_739"]
+ ["opls_540", "opls_542", "opls_543"]
)
configuration.from_smiles("n1([H])cc(CCN)c2cc(O[H])ccc21", rdkit=False)
configuration.from_smiles("n1([H])cc(CCN)c2cc(O[H])ccc21", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -3551,7 +3553,7 @@ def test_opls_820(oplsaa_assigner, configuration):
+ ["opls_824"]
+ 3 * ["opls_85"]
)
configuration.from_smiles("CC(=O)N(O[H])[H]", rdkit=False)
configuration.from_smiles("CC(=O)N(O[H])[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -3572,7 +3574,7 @@ def test_opls_821(oplsaa_assigner, configuration):
+ ["opls_824"]
+ 5 * ["opls_91"]
)
configuration.from_smiles("c1ccccc1C(=O)N(O[H])[H]", rdkit=False)
configuration.from_smiles("c1ccccc1C(=O)N(O[H])[H]", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -3591,7 +3593,7 @@ def test_opls_820a(oplsaa_assigner, configuration):
+ ["opls_185"]
+ 6 * ["opls_85"]
)
configuration.from_smiles("CC(=O)N(O[H])C", rdkit=False)
configuration.from_smiles("CC(=O)N(O[H])C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -3780,7 +3782,7 @@ def test_opls_853(oplsaa_assigner, configuration):
+ 5 * ["opls_852"]
+ 3 * ["opls_85"]
)
configuration.from_smiles("[H]C(=O)N(C)CC", rdkit=False)
configuration.from_smiles("[H]C(=O)N(C)CC", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -3803,7 +3805,7 @@ def test_opls_850b(oplsaa_assigner, configuration):
+ 4 * ["opls_852"]
+ 6 * ["opls_85"]
)
configuration.from_smiles("[H]C(=O)N(C)C(C)C", rdkit=False)
configuration.from_smiles("[H]C(=O)N(C)C(C)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -3927,7 +3929,7 @@ def test_opls_900(oplsaa_assigner, configuration):
opls_903: central C =C=
"""
correct = ["opls_900", "opls_903", "opls_900"] + 4 * ["opls_899"]
configuration.from_smiles("C=C=C")
configuration.from_smiles("C=C=C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down Expand Up @@ -3994,7 +3996,7 @@ def test_opls_902(oplsaa_assigner, configuration):
+ 2 * ["opls_899"]
+ 6 * ["opls_85"]
)
configuration.from_smiles("C=C=C(C)C")
configuration.from_smiles("C=C=C(C)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand All @@ -4006,7 +4008,7 @@ def test_opls_902(oplsaa_assigner, configuration):
+ ["opls_80", "opls_80"]
+ 12 * ["opls_85"]
)
configuration.from_smiles("CC(C)=C=C(C)C")
configuration.from_smiles("CC(C)=C=C(C)C", flavor="openbabel")
result = oplsaa_assigner.assign(configuration)
if result != correct:
print(f"Incorrect typing. Should be:\n {correct}\nnot\n {result}")
Expand Down
Loading