From 936ec96be948c4eb2e8220c8e088162518b02b0b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 20:53:21 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- gmso/formats/lammpsdata.py | 20 ++++++++++++++++---- gmso/tests/test_lammps.py | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gmso/formats/lammpsdata.py b/gmso/formats/lammpsdata.py index d01cf0037..034bb3551 100644 --- a/gmso/formats/lammpsdata.py +++ b/gmso/formats/lammpsdata.py @@ -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) @@ -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: @@ -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"]: @@ -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 = [] @@ -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() @@ -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 @@ -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 = [] @@ -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 = [] @@ -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") diff --git a/gmso/tests/test_lammps.py b/gmso/tests/test_lammps.py index 300509ce7..41f3390b9 100644 --- a/gmso/tests/test_lammps.py +++ b/gmso/tests/test_lammps.py @@ -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