Skip to content

Commit

Permalink
Add other test back in
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahbaumann committed Sep 30, 2024
1 parent 839130e commit f269ff6
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions openfe_gromacs/tests/protocols/test_create_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,39 +58,39 @@ def test_interchange_gromacs(alanine_dipeptide_component, tmpdir):
assert atom_name in interchange_atom_names


# def test_user_charges(CN_molecule, tmpdir):
# solvent = gufe.SolventComponent()
# off_cn = CN_molecule.to_openff()
# off_cn.assign_partial_charges(partial_charge_method="am1-mulliken")
# off_charges = off_cn.partial_charges
# prot_settings = GromacsMDProtocol.default_settings()
# smc_components = {CN_molecule: off_cn}
# omm_system, omm_topology, omm_positions = create_systems.create_openmm_system(
# solvent,
# None,
# smc_components,
# prot_settings.partial_charge_settings,
# prot_settings.forcefield_settings,
# prot_settings.integrator_settings,
# prot_settings.thermo_settings,
# prot_settings.solvation_settings,
# prot_settings.output_settings_em,
# tmpdir,
# )
#
# interchange = create_systems.create_interchange(
# omm_system, omm_topology, omm_positions, smc_components
# )
# # Save to Gromacs .top file
# interchange.to_top(f"{tmpdir}/test.top")
# # Load Gromacs .top file back in as OpenMM system
# gromacs_system = GromacsTopFile(f"{tmpdir}/test.top").createSystem()
# # Get the partial charges of the ligand atoms
# nonbonded = [
# f for f in gromacs_system.getForces() if isinstance(f, NonbondedForce)
# ][0]
# gro_charges = []
# for i in range(len(off_charges)):
# charge, sigma, epsilon = nonbonded.getParticleParameters(i)
# gro_charges.append(charge._value)
# np.testing.assert_almost_equal(off_charges.m, gro_charges, decimal=5)
def test_user_charges(CN_molecule, tmpdir):
solvent = gufe.SolventComponent()
off_cn = CN_molecule.to_openff()
off_cn.assign_partial_charges(partial_charge_method="am1-mulliken")
off_charges = off_cn.partial_charges
prot_settings = GromacsMDProtocol.default_settings()
smc_components = {CN_molecule: off_cn}
omm_system, omm_topology, omm_positions = create_systems.create_openmm_system(
solvent,
None,
smc_components,
prot_settings.partial_charge_settings,
prot_settings.forcefield_settings,
prot_settings.integrator_settings,
prot_settings.thermo_settings,
prot_settings.solvation_settings,
prot_settings.output_settings_em,
tmpdir,
)

interchange = create_systems.create_interchange(
omm_system, omm_topology, omm_positions, smc_components
)
# Save to Gromacs .top file
interchange.to_top(f"{tmpdir}/test.top")
# Load Gromacs .top file back in as OpenMM system
gromacs_system = GromacsTopFile(f"{tmpdir}/test.top").createSystem()
# Get the partial charges of the ligand atoms
nonbonded = [
f for f in gromacs_system.getForces() if isinstance(f, NonbondedForce)
][0]
gro_charges = []
for i in range(len(off_charges)):
charge, sigma, epsilon = nonbonded.getParticleParameters(i)
gro_charges.append(charge._value)
np.testing.assert_almost_equal(off_charges.m, gro_charges, decimal=5)

0 comments on commit f269ff6

Please sign in to comment.