New user - loading lammps trajectory file and number of hydrogen bonds.

270 views
Skip to first unread message

Emerson Parazzi Lyra

unread,
Oct 12, 2021, 8:04:46 PM10/12/21
to MDnalysis discussion
Dear colleagues,

I am a new user of MDAnalysis and would like to clear some doubts about the procedures I am trying to perform with this tool.

First, I would like to know how I could properly load the trajectory file of LAMMPS in the format below:

ITEM: TIMESTEP
4000
ITEM: NUMBER OF ATOMS
3307
ITEM: BOX BOUNDS pp pp pp
0.0000000000000000e+00 2.0000000000000000e+02
0.0000000000000000e+00 2.0000000000000000e+02
0.0000000000000000e+00 2.0000000000000000e+02
ITEM: ATOMS id mol type x y z 
1256 145 4 28.582 6.7699 5.53938 
1255 145 3 29.6614 6.43411 5.66957 
1257 145 4 30.1218 5.92495 4.7018 
1258 145 10 29.9107 5.1793 6.92761 
1252 145 3 30.4795 7.8466 5.87416 
1253 145 4 31.0322 8.25515 4.98143 
...

I have been trying the commands below:

import MDAnalysis as mda
import numpy as np
u = mda.Universe("traj_reorient1_2.lammpstrj",format='lammpsdump')

ps: the name of my trajectory file (generated by dump command) is "traj_reorient1_2.lammpstrj".

Question 1: Is command highlighted in red suitable for my file format or should I enter other flags? When running it I don't get any kind of error message, but I'm not sure if I loaded the file information correctly.

Question 2: How could I display the positions of the atom id 1 (for example) for each of the frames of the file "traj_reorient1_2.lammpstrj"? The idea is to compare the read values ​​with the original file.

My other question is regarding the calculation of the number of hydrogen bonds per frame through the trajectory file "traj_reorient1_2.lammpstrj".

However, the person who created the discussion uses the ".dcd" path format in LAMMPS. However on the LAMMPS forum it is said that "DCD files are binary and thus may not be portable to different machines." (https://docs.lammps.org/dump.html). So I'm trying not to use this extension because I run my calculations on a cluster and do post-processing on my computer.

However, in my trajectory file, I would have columns for the atom type ID and molecule ID of the respective atom.

Question 3: Any idea how I could calculate the number of hydrogen bonds per frame from the file format "traj_reorient1_2.lammpstrj"?

As I understand it, I would need to assign the atom type IDs correctly in the form of elements ("O", "H"...). The commands below suggested in the discussion I mentioned could be used, but I'm not sure they would be suitable for my file type.

u.add_TopologyAttr('names')
u.atoms.names = 'X'
u.select_atoms("type 2").names = "O"
u.select_atoms("type 4").names = "H"

I would be grateful if someone with more experience could kindly help me with the issues highlighted.

If I need to provide any more information, let me know.

Sorry if my questions are too basic, I'm a new user yet.

Thanks in advance.

Best Regards,

Emerson
Reply all
Reply to author
Forward
0 new messages