-
Notifications
You must be signed in to change notification settings - Fork 668
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
Issue reading custom GROMACS TOP/ITP files in MDAnalysis 2.0.0 #3419
Comments
other packages in the environment used is:
|
Hello @mdd31 , I labeled this issue tentatively as a bug (but haven't confirmed further than looking at your report). Fixes are very welcome, the User Guide has a section to get you started https://userguide.mdanalysis.org/stable/contributing_code.html . In short, create a PR and we discuss details on the PR. |
Quick comment from looking at the ITP parser code: If you had to change anything in line 534
then I suspect that the actual problem is elsewhere in how charges are (or are not) picked up. |
@orbeckst Yes, you are correct, From my logging and investigation I found that it is the assignment for the charge values into the array actually causing the issue in the block around line 538-546: mdanalysis/package/MDAnalysis/topology/ITPParser.py Lines 538 to 546 in 3985021
Due to the previously set dtype it seems to only get the first character of the charge value. I found updating to explicitly set the dtype in line 534 meant the array was already of the appropriate type to not experience the later issues. |
I will work on committing my changes to a local branch and submitting a PR request tomorrow morning (CEST). Thank you for your help. |
… to solve issue MDAnalysis#3419. Update to test as extra decimal place is now picked up from file.
Expected behaviour
I'm using MDAnalysis for processing coarse grained simulations run in GROMACS. I need to assign the correct topology to systems to enable further processing. The easiest way to do this in MDAnalysis was to read in this information from the top/itp files to apply to the pdb/trr files from gromacs. This worked in MDAnalysis 1.1.1 (however charges were not detected).
Actual behaviour
In MDAnalysis 2.0.0 a Value error from reading charges in top/itp files is returned.
I added some extra logging statements to localise the issue, and I found the behaviour stems from ITPParser when it is reading charges into the array (detailed output in the attached log file mdanalysisissue.log).
The setting of the array in line 534 seems to cause the issue- the datatype is set to '<U1' which later causes only the '-' sign of any residues to be read (later causing the observed issue when type cast to a float).
This breaks my current analysis workflow. I'm upgrading to 2.0.0 to try and utilise the parallelisation support you have added.
I found that setting dtype=object in the array created on line 534 resolves this issue. If the issue is confirmed how would I go about a pull request/ getting this change committed into develop?
Code to reproduce the behavior
Example coarse grained files attached that cause the issue. Any residues with a negative charge result in the given error.
mdanalysisissueexamplefiles.zip
Current version of MDAnalysis
python -c "import MDAnalysis as mda; print(mda.__version__)"
)mdanalysis.version
Out[18]: '2.0.0'
python -V
)?Python 3.8.11
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: