Skip to content

Commit

Permalink
Cassandra gmso (mosdef-hub#756)
Browse files Browse the repository at this point in the history
* Add fixed length bonds and angles to potential templates library.

* Working to make MCF writer feature complete. Tests in progress.

* Add fixed angle support
* Fix charge sign error (gmso-wide)
* Update ring identification to handle fused systems (mbuild mosdef-hub#744)
* Increase floating point accuracy
* Increase element type length and atom type length
* Correctly write atom indices for bonds/angles/dihedrals/impropers

* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci

* Add dimensions to Fixed Bond and Angle templates

* Update keys in OPLS dihedral parameters dict

* Modify dihedral constant indexing from k0 to k3
to k1 to k4 in the OPLSTorsionPotential template.

* Fix typed OPLS ethane test for MCF format

* Updated from old Mie Xenon test to OPLS ethane.
* Remove assertions related to n and m parameters of the Mie potential.
* Fix floating point format issues in MCF writer.

* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci

* Add typed ethane test.

This test is not complete yet. The 1/2 factor
in the angles and OPLS dihedral is not
accounted for.

* Fix code style

* Add fixture to parse mcf into sections

* Support Pydantic v1 and v2 (mosdef-hub#752)

Co-authored-by: Co Quach <[email protected]>

* Update MCF with GMSO builtin top site sorting

* Use PotentialFilters to check for unique atomtypes

* Add test to check charge neutrality

* Add test for incompatible expressions

* Test full MCF for Mie-Xe and LJ-Ar

* Check charge neutrality in each molecule test

* Add exception for not neutral system in MCF writer

* Move parsing and neutrality check as utils

* minor docstring/comment fixes, swap out simplify with symengine expand

* [pre-commit.ci] pre-commit autoupdate (mosdef-hub#763)

updates:
- [github.com/psf/black: 23.7.0 → 23.9.1](psf/black@23.7.0...23.9.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Test for 0.5 factor of OPLS dihedral potential

* Test to account for 0.5 factor in harmonic angles

* Test for rigid angles using the TIP3P model

* MCF writer test with topology with 10 argon mols

* Tentative output of multiple MCF from one Topology

* Change psi to phi and consts for ethylene xml test

* Test for 0.5 factor in OPLS dihedrals

* Add cassandra test for gmso

* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci

* Add test for two atom fragment

* Test for molecule with one ring

* Change nitrogen test to ethane ua

* Add ethane rigid reference xml

* Use Fourier dihedrals as MCF standard dihedrals.

* Fix dihedral type output fourier to opls

* Match MCF GMSO Angle header to mb Angle header

* Add a test comparing gmso and mbuild mcf writers

* Use the Fourier converter for ethylene dihedrals

* Write atom type masses instead of atom masses to account for UA beads

* Output correct case for dihedral styles in MCFs

* Run an energy calculation to compare GMSO and mBuild MCF writers

* Update gmso/tests/test_mcf.py

* Update gmso/tests/test_mcf.py

---------

Co-authored-by: Ryan S. DeFever <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Matt Thompson <[email protected]>
Co-authored-by: Co Quach <[email protected]>
Co-authored-by: Co Quach <[email protected]>
Co-authored-by: CalCraven <[email protected]>
  • Loading branch information
7 people authored Sep 22, 2023
1 parent ff94811 commit 7537899
Show file tree
Hide file tree
Showing 11 changed files with 834 additions and 234 deletions.
366 changes: 222 additions & 144 deletions gmso/formats/mcf.py

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions gmso/lib/jsons/FixedAnglePotential.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "FixedAnglePotential",
"expression": "DiracDelta(theta-theta_eq)",
"independent_variables": "theta",
"expected_parameters_dimensions": {
"theta_eq": "angle"
}
}
8 changes: 8 additions & 0 deletions gmso/lib/jsons/FixedBondPotential.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "FixedBondPotential",
"expression": "DiracDelta(r-r_eq)",
"independent_variables": "r",
"expected_parameters_dimensions": {
"r_eq": "length"
}
}
8 changes: 8 additions & 0 deletions gmso/tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ def typed_water_system(self, water_system):
top = apply(top, ff)
return top

@pytest.fixture
def typed_tip3p_rigid_system(self, water_system):
top = water_system
top.identify_connections()
ff = ForceField(get_path("tip3p-rigid.xml"))
top = apply(top, ff)
return top

@pytest.fixture
def foyer_fullerene(self):
from foyer.tests.utils import get_fn
Expand Down
23 changes: 23 additions & 0 deletions gmso/tests/files/ethane-rigid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version='1.0' encoding='UTF-8'?>
<ForceField name="nitrogen" version="0.0.1">
<FFMetaData electrostatics14Scale="0.0" nonBonded14Scale="0.0" combiningRule="lorentz">
<Units energy="kJ/mol" mass="amu" charge="elementary_charge" distance="nm"/>
</FFMetaData>
<AtomTypes expression="4*epsilon * ((sigma/r)**12 - (sigma/r)**6)">
<ParametersUnitDef parameter="epsilon" unit="kJ/mol"/>
<ParametersUnitDef parameter="sigma" unit="nm"/>
<AtomType name="_CH3" atomclass="_CH3" element="_CH3" charge="0.0" mass="15.0" definition="[_CH3;X1]" description="UA carbon"> <Parameters>
<Parameter name="epsilon" value="0.814772"/>
<Parameter name="sigma" value="0.375"/>
</Parameters>
</AtomType>
</AtomTypes>
<BondTypes expression="DiracDelta(r-r_eq)">
<ParametersUnitDef parameter="r_eq" unit="nm"/>
<BondType name="BondType-Harmonic-1" type1="_CH3" type2="_CH3">
<Parameters>
<Parameter name="r_eq" value="0.154"/>
</Parameters>
</BondType>
</BondTypes>
</ForceField>
26 changes: 13 additions & 13 deletions gmso/tests/files/ethylene.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@
</Parameters>
</AngleType>
</AngleTypes>
<DihedralTypes expression="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">
<ParametersUnitDef parameter="c_0" unit="kJ/mol"/>
<ParametersUnitDef parameter="c_1" unit="kJ/mol"/>
<ParametersUnitDef parameter="c_2" unit="kJ/mol"/>
<ParametersUnitDef parameter="c_3" unit="kJ/mol"/>
<ParametersUnitDef parameter="c_4" unit="kJ/mol"/>
<ParametersUnitDef parameter="c_5" unit="kJ/mol"/>
<DihedralTypes expression="c0 + c1 * cos(phi) + c2 * cos(phi)**2 + c3 * cos(phi)**3 + c4 * cos(phi)**4 + c5 * cos(phi)**5">
<ParametersUnitDef parameter="c0" unit="kJ/mol"/>
<ParametersUnitDef parameter="c1" unit="kJ/mol"/>
<ParametersUnitDef parameter="c2" unit="kJ/mol"/>
<ParametersUnitDef parameter="c3" unit="kJ/mol"/>
<ParametersUnitDef parameter="c4" unit="kJ/mol"/>
<ParametersUnitDef parameter="c5" unit="kJ/mol"/>
<DihedralType name="DihedralType-RyckaertBellemans-1" type1="opls_144" type2="opls_143" type3="opls_143" type4="opls_144">
<Parameters>
<Parameter name="c_0" value="58.576"/>
<Parameter name="c_1" value="0.0"/>
<Parameter name="c_2" value="-58.576"/>
<Parameter name="c_3" value="0.0"/>
<Parameter name="c_4" value="0.0"/>
<Parameter name="c_5" value="0.0"/>
<Parameter name="c0" value="58.576"/>
<Parameter name="c1" value="0.0"/>
<Parameter name="c2" value="-58.576"/>
<Parameter name="c3" value="0.0"/>
<Parameter name="c4" value="0.0"/>
<Parameter name="c5" value="0.0"/>
</Parameters>
</DihedralType>
</DihedralTypes>
Expand Down
38 changes: 38 additions & 0 deletions gmso/tests/files/tip3p-rigid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<ForceField name="TIP3P" version="0.0.1">
<FFMetaData electrostatics14Scale="0.5" nonBonded14Scale="0.5" combiningRule="lorentz">
<Units energy="kJ/mol" mass="amu" charge="elementary_charge" distance="nm"/>
</FFMetaData>
<AtomTypes expression="4*epsilon * ((sigma/r)**12 - (sigma/r)**6)">
<ParametersUnitDef parameter="epsilon" unit="kJ/mol"/>
<ParametersUnitDef parameter="sigma" unit="nm"/>
<AtomType name="opls_111" atomclass="OW" element="O" charge="-0.834" mass="16" definition="[O;X2]" description="water O">
<Parameters>
<Parameter name="epsilon" value="0.636386"/>
<Parameter name="sigma" value="0.315061"/>
</Parameters>
</AtomType>
<AtomType name="opls_112" atomclass="HW" element="H" charge="0.417" mass="1.011" definition="[H;X1]" description="water H">
<Parameters>
<Parameter name="epsilon" value="0.0"/>
<Parameter name="sigma" value="1.0"/>
</Parameters>
</AtomType>
</AtomTypes>
<BondTypes expression="DiracDelta(r-r_eq)">
<ParametersUnitDef parameter="r_eq" unit="nm"/>
<BondType name="BondType-Harmonic-1" type1="opls_111" type2="opls_112">
<Parameters>
<Parameter name="r_eq" value="0.09572"/>
</Parameters>
</BondType>
</BondTypes>
<AngleTypes expression="DiracDelta(theta-theta_eq)">
<ParametersUnitDef parameter="theta_eq" unit="radian"/>
<AngleType name="AngleType-Harmonic-1" type1="opls_112" type2="opls_111" type3="opls_112">
<Parameters>
<Parameter name="theta_eq" value="1.824218134"/>
</Parameters>
</AngleType>
</AngleTypes>
</ForceField>
Loading

0 comments on commit 7537899

Please sign in to comment.