diff --git a/gmso/external/convert_foyer_xml.py b/gmso/external/convert_foyer_xml.py index fa31c52df..9ba4a45df 100644 --- a/gmso/external/convert_foyer_xml.py +++ b/gmso/external/convert_foyer_xml.py @@ -484,9 +484,9 @@ def _write_rb_torsions(forcefield, ff_kwargs): forcefield, "DihedralTypes", attrib_dict={ - "expression": "c0 * cos(phi)**0 + c1 * cos(phi)**1 + " - "c2 * cos(phi)**2 + c3 * cos(phi)**3 + " - "c4 * cos(phi)**4 + c5 * cos(phi)**5", + "expression": "c0 + c1 * cos(psi)**1 + " + "c2 * cos(psi)**2 + c3 * cos(psi)**3 + " + "c4 * cos(psi)**4 + c5 * cos(psi)**5", }, ) diff --git a/gmso/external/convert_parmed.py b/gmso/external/convert_parmed.py index b1825455a..39d8baa74 100644 --- a/gmso/external/convert_parmed.py +++ b/gmso/external/convert_parmed.py @@ -398,10 +398,10 @@ def _dihedral_types_from_pmd(structure, dihedral_types_member_map=None): top_dihedraltype = gmso.DihedralType( parameters=dihedral_params, - expression="c0 * cos(phi)**0 + c1 * cos(phi)**1 + " - + "c2 * cos(phi)**2 + c3 * cos(phi)**3 + c4 * cos(phi)**4 + " - + "c5 * cos(phi)**5", - independent_variables="phi", + expression="c0 * cos(psi)**0 + c1 * cos(psi)**1 + " + + "c2 * cos(psi)**2 + c3 * cos(psi)**3 + c4 * cos(psi)**4 + " + + "c5 * cos(psi)**5", + independent_variables="psi", member_types=member_types, ) pmd_top_dihedraltypes[dihedraltype] = top_dihedraltype @@ -519,12 +519,12 @@ def to_parmed(top, refer_type=True): dihedral.connection_type and dihedral.connection_type.expression == parse_expr( - "c0 * cos(phi)**0 + " - + "c1 * cos(phi)**1 + " - + "c2 * cos(phi)**2 + " - + "c3 * cos(phi)**3 + " - + "c4 * cos(phi)**4 + " - + "c5 * cos(phi)**5" + "c0 * cos(psi)**0 + " + + "c1 * cos(psi)**1 + " + + "c2 * cos(psi)**2 + " + + "c3 * cos(psi)**3 + " + + "c4 * cos(psi)**4 + " + + "c5 * cos(psi)**5" ) ): structure.rb_torsions.append(pmd_dihedral) @@ -712,12 +712,12 @@ def _dihedral_types_from_gmso(top, structure, dihedral_map): # Add DihedralType to structure.dihedral_types structure.dihedral_types.append(dtype) elif dihedral_type.expression == parse_expr( - "c0 * cos(phi)**0 + " - + "c1 * cos(phi)**1 + " - + "c2 * cos(phi)**2 + " - + "c3 * cos(phi)**3 + " - + "c4 * cos(phi)**4 + " - + "c5 * cos(phi)**5" + "c0 * cos(psi)**0 + " + + "c1 * cos(psi)**1 + " + + "c2 * cos(psi)**2 + " + + "c3 * cos(psi)**3 + " + + "c4 * cos(psi)**4 + " + + "c5 * cos(psi)**5" ): dtype_c0 = float( dihedral_type.parameters["c0"].to("kcal/mol").value diff --git a/gmso/lib/jsons/PeriodicTorsionPotential.json b/gmso/lib/jsons/PeriodicTorsionPotential.json index 84ada496b..2a836ac6c 100644 --- a/gmso/lib/jsons/PeriodicTorsionPotential.json +++ b/gmso/lib/jsons/PeriodicTorsionPotential.json @@ -1,5 +1,5 @@ { "name": "PeriodicTorsionPotential", - "expression": "k * (1 + cos(n * phi - phi_eq))", + "expression": "k0 + k1 * (1 + cos(1 * phi - phi_eq1)) + k2 * (1 + cos(2 * phi - phi_eq2)) + k3 * (1 + cos(3 * phi - phi_eq3)) + k4 * (1 + cos(4 * phi - phi_eq4)) + k5 * (1 + cos(5 * phi - phi_eq5))", "independent_variables": "phi" } diff --git a/gmso/lib/jsons/RyckaertBellemansTorsionPotential.json b/gmso/lib/jsons/RyckaertBellemansTorsionPotential.json index ac59d0fe2..6748ccb17 100644 --- a/gmso/lib/jsons/RyckaertBellemansTorsionPotential.json +++ b/gmso/lib/jsons/RyckaertBellemansTorsionPotential.json @@ -1,5 +1,5 @@ { "name": "RyckaertBellemansTorsionPotential", - "expression": "c0 * cos(phi)**0 + c1 * cos(phi)**1 + c2 * cos(phi)**2 + c3 * cos(phi)**3 + c4 * cos(phi)**4 + c5 * cos(phi)**5", - "independent_variables": "phi" + "expression": "c0 + c1 * cos(psi)**1 + c2 * cos(psi)**2 + c3 * cos(psi)**3 + c4 * cos(psi)**4 + c5 * cos(psi)**5", + "independent_variables": "psi" } diff --git a/gmso/tests/files/carbon.xml b/gmso/tests/files/carbon.xml index 8b202f6b0..2cf7792e6 100644 --- a/gmso/tests/files/carbon.xml +++ b/gmso/tests/files/carbon.xml @@ -15,32 +15,48 @@ - + - - + + - + - - + + - - - - + + + + + + + + + + + + - - - + + + + + + + + + + + diff --git a/gmso/tests/files/ethylene.xml b/gmso/tests/files/ethylene.xml index 6345773dc..f32c1ab22 100644 --- a/gmso/tests/files/ethylene.xml +++ b/gmso/tests/files/ethylene.xml @@ -51,21 +51,21 @@ - - - - - - - + + + + + + + - - - - - - + + + + + + diff --git a/gmso/tests/files/ff-example1.xml b/gmso/tests/files/ff-example1.xml index 887ee8861..7f7de0255 100644 --- a/gmso/tests/files/ff-example1.xml +++ b/gmso/tests/files/ff-example1.xml @@ -90,7 +90,7 @@ - + diff --git a/gmso/tests/files/ff_missing_atom_types.xml b/gmso/tests/files/ff_missing_atom_types.xml index b2aed3a1a..bcc79aed1 100644 --- a/gmso/tests/files/ff_missing_atom_types.xml +++ b/gmso/tests/files/ff_missing_atom_types.xml @@ -31,16 +31,16 @@ - + - - + + - + - - + + @@ -48,16 +48,16 @@ - + - - + + - + - - + + @@ -65,16 +65,16 @@ - + - - + + - + - - + + @@ -82,15 +82,15 @@ - + - - + + - + diff --git a/gmso/tests/files/oplsaa-ethane_foyer.xml b/gmso/tests/files/oplsaa-ethane_foyer.xml index 617647962..69d0dce31 100644 --- a/gmso/tests/files/oplsaa-ethane_foyer.xml +++ b/gmso/tests/files/oplsaa-ethane_foyer.xml @@ -57,7 +57,7 @@ - + diff --git a/gmso/tests/test_forcefield.py b/gmso/tests/test_forcefield.py index f9e3c8e40..495c33d07 100644 --- a/gmso/tests/test_forcefield.py +++ b/gmso/tests/test_forcefield.py @@ -482,7 +482,7 @@ def test_forcefield_get_potential_dihedral_type(self, opls_ethane_foyer): assert "c4" in params assert "c5" in params - assert sympify("phi") in dt.independent_variables + assert sympify("psi") in dt.independent_variables assert allclose_units_mixed( params.values(), diff --git a/gmso/tests/test_internal_conversions.py b/gmso/tests/test_internal_conversions.py index 773f47820..3b4d8d379 100644 --- a/gmso/tests/test_internal_conversions.py +++ b/gmso/tests/test_internal_conversions.py @@ -33,7 +33,7 @@ def test_invalid_connection_type(self, templates): name = ryckaert_bellemans_torsion_potential.name expression = ( - str(ryckaert_bellemans_torsion_potential.expression) + " + 3 * psi" + str(ryckaert_bellemans_torsion_potential.expression) + " + 3 * phi" ) variables = ["phi", "psi"] @@ -49,7 +49,7 @@ def test_invalid_connection_type(self, templates): ryckaert_connection_type ) - expression = "c0+c1+c2+c3+c4+c5+phi" + expression = "c0+c1+c2+c3+c4+c5+psi" variables = ryckaert_bellemans_torsion_potential.independent_variables ryckaert_connection_type = DihedralType( name=name, @@ -149,7 +149,7 @@ def test_ryckaert_to_opls(self, templates): (param, val) for param, val in { **ryckaert_connection_type.parameters, - "phi": angle - np.pi, + "psi": angle - np.pi, }.items() ] ) @@ -206,7 +206,7 @@ def test_opls_to_ryckaert(self, templates): (param, val) for param, val in { **ryckaert_connection_type.parameters, - "phi": angle - np.pi, + "psi": angle - np.pi, }.items() ] ) diff --git a/gmso/tests/test_potential_templates.py b/gmso/tests/test_potential_templates.py index 508a6cb0b..a66a6b76f 100644 --- a/gmso/tests/test_potential_templates.py +++ b/gmso/tests/test_potential_templates.py @@ -39,7 +39,8 @@ def test_opls_torsion_potential(self, templates): opls_torsion_potential = templates["OPLSTorsionPotential"] assert opls_torsion_potential.name == "OPLSTorsionPotential" assert opls_torsion_potential.expression == sympy.sympify( - "0.5 * k0 + 0.5 * k1 * (1 + cos(phi)) +" + "0.5 * k0 + " + "0.5 * k1 * (1 + cos(phi)) +" "0.5 * k2 * (1 - cos(2*phi)) +" "0.5 * k3 * (1 + cos(3*phi)) +" "0.5 * k4 * (1 - cos(4*phi))" @@ -52,7 +53,12 @@ def test_periodic_torsion_potential(self, templates): periodic_torsion_potential = templates["PeriodicTorsionPotential"] assert periodic_torsion_potential.name == "PeriodicTorsionPotential" assert periodic_torsion_potential.expression == sympy.sympify( - "k * (1 + cos(n * phi - phi_eq))" + "k0 + " + "k1 * (1 + cos(1 * phi - phi_eq1)) + " + "k2 * (1 + cos(2 * phi - phi_eq2)) + " + "k3 * (1 + cos(3 * phi - phi_eq3)) + " + "k4 * (1 + cos(4 * phi - phi_eq4)) + " + "k5 * (1 + cos(5 * phi - phi_eq5))" ) assert periodic_torsion_potential.independent_variables == { sympy.sympify("phi") @@ -67,12 +73,12 @@ def test_ryckaert_bellemans_torsion_potential(self, templates): == "RyckaertBellemansTorsionPotential" ) assert ryckaert_bellemans_torsion_potential.expression == sympy.sympify( - "c0 * cos(phi)**0 + c1 * cos(phi)**1 +" - " c2 * cos(phi)**2 + c3 * cos(phi)**3 +" - " c4 * cos(phi)**4 + c5 * cos(phi)**5" + "c0 + c1 * cos(psi)**1 +" + " c2 * cos(psi)**2 + c3 * cos(psi)**3 +" + " c4 * cos(psi)**4 + c5 * cos(psi)**5" ) assert ryckaert_bellemans_torsion_potential.independent_variables == { - sympy.sympify("phi") + sympy.sympify("psi") } def test_harmonic_torsion_potential(self, templates): diff --git a/gmso/tests/test_reference_xmls.py b/gmso/tests/test_reference_xmls.py index cd5f69a48..b0192725c 100644 --- a/gmso/tests/test_reference_xmls.py +++ b/gmso/tests/test_reference_xmls.py @@ -451,7 +451,7 @@ def test_ethylene_forcefield(self): "4*epsilon*((sigma/r)**12 - (sigma/r)**6)", "0.5 * k * (r-r_eq)**2", "0.5 * k * (theta-theta_eq)**2", - "c_0 + c_1 * cos(psi) + c_2 * cos(psi)**2 + c_3 * cos(psi)**3 + c_4 * cos(psi)**4 + c_5 * cos(psi)**5", + "c0 + c1 * cos(psi) + c2 * cos(psi)**2 + c3 * cos(psi)**3 + c4 * cos(psi)**4 + c5 * cos(psi)**5", ] ] diff --git a/gmso/tests/test_top.py b/gmso/tests/test_top.py index 518b7be72..e0df05eb6 100644 --- a/gmso/tests/test_top.py +++ b/gmso/tests/test_top.py @@ -79,9 +79,17 @@ def test_ethane_periodic(self, typed_ethane): per_torsion = PotentialTemplateLibrary()["PeriodicTorsionPotential"] params = { - "k": 10 * u.Unit("kJ / mol"), - "phi_eq": 15 * u.Unit("degree"), - "n": 3 * u.Unit("dimensionless"), + "k0": 10 * u.Unit("kJ / mol"), + "k1": 1 * u.Unit("kJ / mol"), + "phi_eq1": 180 * u.Unit("degree"), + "k2": 2 * u.Unit("kJ / mol"), + "phi_eq2": 0 * u.Unit("degree"), + "k3": 3 * u.Unit("kJ / mol"), + "phi_eq3": 180 * u.Unit("degree"), + "k4": 4 * u.Unit("kJ / mol"), + "phi_eq4": 0 * u.Unit("degree"), + "k5": 5 * u.Unit("kJ / mol"), + "phi_eq5": 180 * u.Unit("degree"), } periodic_dihedral_type = ParametricPotential.from_template( potential_template=per_torsion, parameters=params