forked from wolberlab/OpenMMDL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
openmmdl/tests/openmmdl_simulation/forcefield_water_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import pytest | ||
import simtk.openmm.app as app | ||
from openff.toolkit.topology import Molecule | ||
from openmmforcefields.generators import GAFFTemplateGenerator | ||
from openmmdl.openmmdl_simulation.scripts.forcefield_water import ff_selection, water_forcefield_selection, water_model_selection, generate_forcefield, generate_transitional_forcefield | ||
|
||
# Replace 'your_module' with the actual name of the module containing your functions. | ||
|
||
@pytest.fixture | ||
def sample_rdkit_molecule(): | ||
""" | ||
A sample RDKit molecule for testing. | ||
""" | ||
from rdkit import Chem | ||
mol = Chem.MolFromSmiles("CCO") | ||
return mol | ||
|
||
def test_ff_selection(): | ||
assert ff_selection('AMBER14') == 'amber14-all.xml' | ||
assert ff_selection('CHARMM36') == 'charmm36.xml' | ||
assert ff_selection('NonexistentFF') is None | ||
|
||
def test_water_forcefield_selection(): | ||
assert water_forcefield_selection('TIP3P', 'amber14-all.xml') == 'amber14/tip3p.xml' | ||
assert water_forcefield_selection('TIP3P', 'charmm36.xml') == 'amber14/tip3p.xml' | ||
assert water_forcefield_selection('TIP3P', 'NonexistentFF') is None | ||
|
||
def test_water_model_selection(): | ||
assert water_model_selection('TIP3P', 'amber14-all.xml') == 'tip3p' | ||
assert water_model_selection('TIP3P', 'charmm36.xml') == 'tip3p' | ||
assert water_model_selection('TIP3P', 'NonexistentFF') is None | ||
|
||
def test_generate_forcefield(sample_rdkit_molecule): | ||
forcefield = generate_forcefield('amber14-all.xml', 'amber14/tip3p.xml', False, sample_rdkit_molecule) | ||
assert isinstance(forcefield, app.ForceField) | ||
|
||
def test_generate_transitional_forcefield(sample_rdkit_molecule): | ||
transitional_forcefield = generate_transitional_forcefield('amber14-all.xml', 'tip3p.xml', True, sample_rdkit_molecule) | ||
assert isinstance(transitional_forcefield, app.ForceField) |