Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'PairIJ Coeffs' section to the list of sections in LAMMPS parser #3959

Merged
merged 17 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Chronological list of authors
- Jake Fennick
- Utsav Khatu
- Patricio Barletta
- Mikhail Glagolev


External code
Expand Down
5 changes: 4 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ The rules for this file:
* release numbers follow "Semantic Versioning" http://semver.org

------------------------------------------------------------------------------
??/??/?? IAlibay, pgbarletta

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Please don't add the extra line here (we try to keep the format of this file reasonably strict to make life easier on releases).

??/??/?? IAlibay, pgbarletta, mglagolev

* 2.5.0

Fixes
* Add 'PairIJ Coeffs' to the list of sections in LAMMPSParser.py
hmacdope marked this conversation as resolved.
Show resolved Hide resolved
(Issue #3336)

Enhancements

Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/topology/LAMMPSParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
'Impropers',
'Pair',
'Pair LJCoeffs',
'PairIJ Coeffs',
'Bond Coeffs',
'Angle Coeffs',
'Dihedral Coeffs',
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"LAMMPShyd", "LAMMPShyd2",
"LAMMPSdata_deletedatoms", # with deleted atoms
"LAMMPSdata_triclinic", # lammpsdata file to test triclinic dimension parsing, albite with most atoms deleted
"LAMMPSdata_PairIJ", # lammps datafile with a PairIJ Coeffs section
"LAMMPSDUMP",
"LAMMPSDUMP_long", # lammpsdump file with a few zeros sprinkled in the first column first frame
"LAMMPSDUMP_allcoords", # lammpsdump file with all coordinate conventions (x,xs,xu,xsu) present, from LAMMPS rdf example
Expand Down Expand Up @@ -513,6 +514,7 @@
LAMMPShyd2 = resource_filename(__name__, "data/lammps/hydrogen-class1.data2")
LAMMPSdata_deletedatoms = resource_filename(__name__, 'data/lammps/deletedatoms.data')
LAMMPSdata_triclinic = resource_filename(__name__, "data/lammps/albite_triclinic.data")
LAMMPSdata_PairIJ = resource_filename(__name__, "data/lammps/pairij_coeffs.data.bz2")
LAMMPSDUMP = resource_filename(__name__, "data/lammps/wat.lammpstrj.bz2")
LAMMPSDUMP_long = resource_filename(__name__, "data/lammps/wat.lammpstrj_long.bz2")
LAMMPSDUMP_allcoords = resource_filename(__name__, "data/lammps/spce_all_coords.lammpstrj.bz2")
Expand Down
21 changes: 21 additions & 0 deletions testsuite/MDAnalysisTests/topology/test_lammpsdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
LAMMPSdata_deletedatoms,
LAMMPSDUMP,
LAMMPSDUMP_long,
LAMMPSdata_PairIJ,
)


Expand Down Expand Up @@ -179,6 +180,26 @@ def test_traj(self, filename):
dtype=np.float32))

IAlibay marked this conversation as resolved.
Show resolved Hide resolved

class TestLammpsDataPairIJ(LammpsBase):
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
"""Tests the reading of lammps .data topology file with a
PairIJ Coeffs section
"""

Copy link
Member

@IAlibay IAlibay Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

No worries about the darker linting, as long as it's not breaching PEP8 it ends up just black trying to enforce its style.

That being said the above "whitespace on an empty line" is a PEP8 violation (I suspect the suggested edit here won't work well, essentially the empty line is fine, but it can't have any whitespaces on it)

Sorry about this, as @orbeckst explains re: keeping maintenance costs down, we end up requiring a lot of weird formatting rules that do tend to be rather unfriendly to new contributors :(

expected_attrs = ['types', 'resids', 'masses',
'bonds', 'angles', 'dihedrals', 'impropers']
ref_filename = LAMMPSdata_PairIJ
expected_n_atoms = 800
expected_n_atom_types = 2
expected_n_residues = 1
ref_n_bonds = 799
ref_bond = (397, 398)
ref_n_angles = 390
ref_angle = (722, 723, 724)
ref_n_dihedrals = 385
ref_dihedral = (722, 723, 724, 725)
ref_n_impropers = 0

IAlibay marked this conversation as resolved.
Show resolved Hide resolved

LAMMPS_NORESID = """\
LAMMPS data file via write_data, version 11 Aug 2017, timestep = 0

Expand Down