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

LAMMPS.DATAWriter should allow to write residue ID #3548

Closed
XelaleX1 opened this issue Feb 27, 2022 · 7 comments · Fixed by #4114
Closed

LAMMPS.DATAWriter should allow to write residue ID #3548

XelaleX1 opened this issue Feb 27, 2022 · 7 comments · Fixed by #4114

Comments

@XelaleX1
Copy link

Dear all, I am currently working on a loop where each step consists in a short MD simulation, followed by an update of atoms charges, which are used in the MD simulation in the next step. MDAnalysis has proven very helpful to process and extract the MD data, so thank you for your hard work in developing this tool!
Unfortunately, it appears that I have a problem when using LAMMPS: I managed to read the output and update the charges, but when I try to write a new topology file, it seems that all the information about residues is lost , even though I do have it in the data I read, i.e. trj.atoms.resids.

Browsing the issues and the documentation (https://docs.mdanalysis.org/1.0.0/_modules/MDAnalysis/coordinates/LAMMPS.html#DATAWriter) it seems that this would be the right behaviour, i.e. do not write the residue information. Is it possible to implement a feature/flag to allow the molecule/residue IDs to be written in the new data file? Actually, I could try to modify and fork the current version myself, but before I do, I would like to be sure that there is currently no possibility to write the molecule/residue IDs using LAMMPS.DATAWriter or others. Indeed, it seems to me very strange that, even though I have this information about the residues I cannot write it. Am I missing something?

Thank you very much for your help.

I report here a very short sample of the code I am using:

trj = mda.Universe("datafile.data", "trajectory.lammpstrj",format = "LAMMPSDUMP")
trj.trajectory[-1]
## Update charges##
with mda.coordinates.LAMMPS.DATAWriter(newtopfile) as f:
        f.write(trj)
@orbeckst
Copy link
Member

Does the file format for LAMMPS Data file allow the inclusion of residue ID?

@mglagolev
Copy link
Contributor

Does the file format for LAMMPS Data file allow the inclusion of residue ID?

As stated at https://docs.lammps.org/99/data_format.html the LAMMPS Data includes the "molecule-tag":

"The molecule-tag is a second identifier which is attached to the atom; it can be 0, or a counter for the molecule the atom is part of, or any other number you wish."

@mglagolev
Copy link
Contributor

I would also be happy to see resids written as molecule-tag to the Lammps Data file. Is this behavior expected to break anything?

@orbeckst
Copy link
Member

Not sure, @hmacdope do you have any insights into the LAMMPS side of things?

@orbeckst
Copy link
Member

Generally speaking, if a file format specification defines something that MDAnalysis does not already implement, then we would favorably review a contribution that adds the feature.

@hmacdope
Copy link
Member

My only issue is according to my understanding molecule tag is not a commonly a 1:1 mapping between molecule_tag and resid as @mglagolev said it can be anything at all. Perhaps we could add writing of a ts.data['molecule_tag'] element to the trajectory instead?

@mglagolev
Copy link
Contributor

Thanks for the suggestions, I've tried to implement this:)

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