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

LAMMPSParser cannot read DATA file with "pair ij" #3336

Open
amirhs1 opened this issue May 27, 2021 · 3 comments
Open

LAMMPSParser cannot read DATA file with "pair ij" #3336

amirhs1 opened this issue May 27, 2021 · 3 comments

Comments

@amirhs1
Copy link

amirhs1 commented May 27, 2021

Expected behavior

MDAnalysis recognizes both Pair Coeffs (the default pair ii setting in Lammps's write_data command) and PairIJ Coeffs (the pair ij setting Lammps's write_data command ) sections in a Lammps data file.

Actual behavior

Currently, MDAnalysis cannot recognize the PairIJ Coeffs. The MDAnalysis.topology.LAMMPSParser source code does not have a PairIJ Coeffs token in the list of the tokens defined by the variable SECTIONS.

Code to reproduce the behavior

import MDAnalysis as mda
from glob import glob

data_pair_ii_default = glob("./coeffs_ii_default.data")
u_ok = mda.Universe(data_pair_ii_default[0])

data_pair_ij = glob("./coeffs_ij.data")
u_error = mda.Universe(data_pair_ij[0])

Current version of MDAnalysis

  • MDAnalysis version 1.0.1
  • Python 3.8.2
  • macOS Catalina and CentOS Linux 7.0
  • The extensions of the attached data files are changed from data to data.txt to be able to upload them on Github.

coeffs_ii_default.data.txt
coeffs_ij.data.txt

@orbeckst
Copy link
Member

Can you please clarify what you need MDAnalysis to do?

Does write pair ij write force field coefficients to the data file and are you looking to obtain these coefficients through MDAnalysis?

@mnmelo
Copy link
Member

mnmelo commented May 30, 2021

I have no experience with LAMMPS, but took a look at the code and docs. It seems that the LAMMPS parser has an incomplete set (SECTIONS) of possible sections names. From what I could glean, and according to the docs pointed to by @amirhs1, there should be a section name "PairsIJ Coeffs".

Additionally, the header "Pairs LJCoeffs" that is in the list of parseable sections does not seem (from some quick googling) to actually be a LAMMPS name. Maybe it was mistakenly included instead of "PairsIJ Coeffs"? In any case, even if this really is a wrong name in SECTIONS it shouldn't be a problem, because they seem to just be markers for what counts as a section.

@richardjgowers might want to chip in further, as he was the last to touch that part of the code.

In any case, updating the set of SECTIONS to include "PairsIJ Coeffs" should allow for proper parsing of these cases. (I don't think MDA does anything with the interpretation of their actual values, but I might be wrong). Would you like to try and fix this, @amirhs1?

Incidentally, we don't seem to have any LAMMPS test files that use PairsIJ Coeffs. A new one should be added to the test set.

@amirhs1
Copy link
Author

amirhs1 commented May 30, 2021

Can you please clarify what you need MDAnalysis to do?

Does write pair ij write force field coefficients to the data file and are you looking to obtain these coefficients through MDAnalysis?

Yes, these are the force field coefficient written to the data file. I do not want to use them directly in my analysis; however, I want use the topology defined in the data file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants