-
Notifications
You must be signed in to change notification settings - Fork 667
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
Add 'PairIJ Coeffs' section to the list of sections in LAMMPS parser #3959
Conversation
… This ensures correct processing of LAMMPS data files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on the developer mailing list so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS
as part of this PR.
Codecov ReportBase: 93.49% // Head: 93.49% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #3959 +/- ##
========================================
Coverage 93.49% 93.49%
========================================
Files 190 190
Lines 24963 24963
Branches 3527 3527
========================================
+ Hits 23338 23340 +2
+ Misses 1102 1101 -1
+ Partials 523 522 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
This should actually solve the issue #3336 |
Hi @mglagolev thanks for the contribution! Would you be able to add a test with a small example test file to show the issue is resolved. You will also need to update I would also ask you to possibly introduce yourself on the developer mailing list to welcome you to the community and have a means of contacting you. :) |
@hmacdope Thank you for the suggestions! I pushed the changes to AUTHORS and CHANGELOG to my branch, shall I do anything else? This is my first pull request ever. |
Added a datafile and a reading script to testsuite/MDAnalysisTests/topology |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good start :) See my comments. Ping me if unsure of anything.
@@ -0,0 +1,17 @@ | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can become part of the other LAMMPS Topology tests in test_lammpsdata.py
it doesn't need its own file.
import MDAnalysis as mda | ||
|
||
|
||
PAIRIJ_COEFFS_DATA = "PR3959_test.data" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be added as a datafile
see datafiles.py on how to do that.
@@ -0,0 +1,3228 @@ | |||
LAMMPS data file via write_data, version 23 Jun 2022, timestep = 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be moved to data
and added to datafiles.py.
This reverts commit 383423f. The test needs to be integrated into the test_lammpsdata.py instead of a separate script, and the sample datafile needs to be placed in the appropriate directory.
@hmacdope Thank you for your guiding! I tried to replicate what I saw in test_lammpsdata.py, and committed to the branch. When I run the test: cd testsuite/MDAnalysisTests It shows errors in some other modules, but not topology. I'm also wondering, shall my datafile state the number of impropers and charges, because these are mentioned as expected_attrs in LammpsBase. |
well done on getting the test files sorted out!
EDIT: Looks like the testing is working, sorry I didn't see that it was being done in the base class.
|
To test only your module go to |
Done that. |
@@ -0,0 +1,3228 @@ | |||
LAMMPS data file via write_data, version 23 Jun 2022, timestep = 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to gzip or bzip2 this? i.e. is this something we support (I know we do for PDBs and similar, so I assume it should work here too?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IAlibay I'm sorry, I'm lost a little bit. How can I help at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compress the file(s) with bzip2
and store it as testsuite/MDAnalysisTests/data/lammps/pairij_coeffs.data.bz2
. MDAnalysis will just read it the compressed file and we use up less space in the package and on disk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Recommitted with a zipped file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to make that last one blocking, I'll unblock if it turns out to not be feasible.
Thank you all, I've reverted the previous commit and recommitted with a zipped file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple things from my side of things, thanks for bzipping that datafile.
@mglagolev If you could fix the failing tests and the merge conflicts, we can move forward from there. |
…lev/mdanalysis into lammps_topology_add_pairij
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one quick thing from me.
package/CHANGELOG
Outdated
@@ -13,11 +13,14 @@ The rules for this file: | |||
* release numbers follow "Semantic Versioning" http://semver.org | |||
|
|||
------------------------------------------------------------------------------ | |||
??/??/?? IAlibay, pgbarletta | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thank you for your contribution @mglagolev !
Yes, as you can see, when working on software that's used by a few thousand researchers, there's a lot more to do for maintaining quality than just to add a few lines of code and hoping it will be fine. We do all this reviewing and insisting on tests with the goal to keep MDAnalysis a useful and maintainable piece of software for the foreseeable future. |
"""Tests the reading of lammps .data topology file with a | ||
PairIJ Coeffs section | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work @mglagolev! Thanks for the contribution 😄 Many LAMMPS users will appreciate this one I'm sure. 👍
When called with "pair ij" option, the write_data command in LAMMPS writes a data file with a 'PairIJ Coeffs' section, as stated https://docs.lammps.org/write_data.html
Absence of this section in the SECTIONS list of LAMMPSParser.py can lead to an error.
This fix ensures correct processing of LAMMPS data files with a 'PairIJ Coeffs' section.
Changes made in this Pull Request:
'PairIJ Coeffs' added to the list of sections in LAMMPSParser.py