Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 8, 2023
1 parent f09aa7c commit 936ec96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions gmso/formats/lammpsdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ def identify_dihedral_parser(top, potential_typesDict):
assert (
len(potential_typesDict["dihedral_types"]) == 1
) # only allowing one potential type atm
dihedralparser = parserDict[potential_typesDict["dihedral_types"].pop()]
dihedralparser = parserDict[
potential_typesDict["dihedral_types"].pop()
]
return dihedralparser

dihedral_parser = identify_dihedral_parser(top, potential_typesDict)
Expand All @@ -185,9 +187,11 @@ def identify_improper_parser(top, potential_typesDict):
assert (
len(potential_typesDict["improper_types"]) == 1
) # only allowing one potential type atm
improper_parser = parserDict[potential_typesDict["improper_types"].pop()]
improper_parser = parserDict[
potential_typesDict["improper_types"].pop()
]
return improper_parser

improper_parser = identify_improper_parser(top, potential_typesDict)

if strict_units:
Expand Down Expand Up @@ -255,7 +259,9 @@ def reindex_molecules(top):
out_file, top, base_unyts, dihedral_parser, lj_cfactorsDict
)
if top.improper_types:
_write_impropertypes(out_file, top, base_unyts, improper_parser, lj_cfactorsDict)
_write_impropertypes(
out_file, top, base_unyts, improper_parser, lj_cfactorsDict
)

_write_site_data(out_file, top, atom_style, base_unyts, lj_cfactorsDict)
for conn in ["bonds", "angles", "dihedrals", "impropers"]:
Expand Down Expand Up @@ -1053,6 +1059,7 @@ def _write_dihedraltypes(out_file, top, base_unyts, parser, cfactorsDict):
)
)


def parse_opls_style_dihedral(dihedral_type):
"""Take a dihedral type and list parameters as expected in lammps outputs."""
parametersList = []
Expand All @@ -1062,6 +1069,7 @@ def parse_opls_style_dihedral(dihedral_type):

return parametersList, namesList


def parse_charmm_style_dihedral(dihedral_type, weightsArray=None):
"""Take a dihedral type and list parameters as expected in lammps outputs."""
kArray = dihedral_type.parameters["k"].flatten()
Expand All @@ -1074,6 +1082,7 @@ def parse_charmm_style_dihedral(dihedral_type, weightsArray=None):
allParamsList.append([a, b, c, d])
return allParamsList, ["k", "n", "phi_eq", "weights"]


def _write_impropertypes(out_file, top, base_unyts, parser, cfactorsDict):
"""Write out impropers to LAMMPS file."""
test_impropertype = top.impropers[0].improper_type
Expand Down Expand Up @@ -1135,6 +1144,7 @@ def _write_impropertypes(out_file, top, base_unyts, parser, cfactorsDict):
)
)


def parse_cvff_style_improper(improper_type):
"""Take a dihedral type and list parameters as expected in lammps outputs."""
parametersList = []
Expand All @@ -1143,6 +1153,7 @@ def parse_cvff_style_improper(improper_type):
parametersList.append(improper_type.parameters[k])
return parametersList, namesList


def parse_harmonic_style_improper(improper_type):
"""Take a dihedral type and list parameters as expected in lammps outputs."""
parametersList = []
Expand All @@ -1151,6 +1162,7 @@ def parse_harmonic_style_improper(improper_type):
parametersList.append(improper_type.parameters[k])
return parametersList, namesList


def _write_site_data(out_file, top, atom_style, base_unyts, cfactorsDict):
"""Write atomic positions and charges to LAMMPS file.."""
out_file.write(f"\nAtoms #{atom_style}\n\n")
Expand Down
2 changes: 1 addition & 1 deletion gmso/tests/test_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def test_charmm_improper_ff(self):

ff = gmso.ForceField(get_path("tfa_charmm.xml"))

cpd = mb.load("C(=O)(C(F)(F)F)N", smiles=True) #TFA molecule
cpd = mb.load("C(=O)(C(F)(F)F)N", smiles=True) # TFA molecule
top = cpd.to_gmso()
from gmso.parameterization import apply

Expand Down

0 comments on commit 936ec96

Please sign in to comment.