Obtaining Specific Output for Dihedral Angle Values

Dear Axel and fellow LAMMPS users,

I am modeling a bulk polymer system and would like to obtain dihedral information in a specific format. The system is composed of 256 monomers, each with a side chain. I would like to pick a specific dihedral on this chain and see the value of this dihedral for each monomer at a given time slice. I envision the dump file looking something like this:

timestep x
dihedral value for monomer 1
dihedral value for monomer 2

dihedral value for monomer 256

timestep y

If it is helpful, I have previously been looking at individual dihedral values and have obtained my output in the following way:

group Dihe4 id 8 11 14 17
compute 4 Dihe4 dihedral local phi

dump dihe4 Dihe4 local 1000 dump_file.txt c_4

Also, a particular dihedral repeats every 25 atoms, so if dihedral 4 for monomer 1 is defined by the atoms 8, 11, 14, and 17; then dihedral 4 for monomer 2 is defined by atoms 33, 36, 39, and 42. In light of this, I tried using a loop to define 256 groups but ran into a few problems.

Thanks in advance for any advice,
Charles Belina

Dear Axel and fellow LAMMPS users,

I am modeling a bulk polymer system and would like to obtain dihedral information in a specific format. The system is composed of 256 monomers, each with a side chain. I would like to pick a specific dihedral on this chain and see the value of this dihedral for each monomer at a given time slice. I envision the dump file looking something like this:

timestep x
dihedral value for monomer 1
dihedral value for monomer 2

dihedral value for monomer 256

timestep y

If it is helpful, I have previously been looking at individual dihedral values and have obtained my output in the following way:

group Dihe4 id 8 11 14 17
compute 4 Dihe4 dihedral local phi

dump dihe4 Dihe4 local 1000 dump_file.txt c_4

Also, a particular dihedral repeats every 25 atoms, so if dihedral 4 for monomer 1 is defined by the atoms 8, 11, 14, and 17; then dihedral 4 for monomer 2 is defined by atoms 33, 36, 39, and 42. In light of this, I tried using a loop to define 256 groups but ran into a few problems.

You cannot define more than 32 (or 31?) groups in LAMMPS.

Perhaps I’m wrong, but this sounds like you will have to write a short script to keep only the dihedrals you want. (See below.)

If I am understanding the meaning of the “compute dihedral/local” command correctly, then it will generate a list of all of the dihedrals in your group (probably group “all”), not just the 256 dihedrals that you care about. Later you will have to write a short script (using python or awk) that throws away lines from the resulting dump file unless the corresponding atomID numbers (after dividing by 25 and keeping the remainder) are 8,11,14,17.

(This sounds like a job for awk.)

I don’t know if this helps, but if you can extract the coordinates you care about from an ordinary dump file, you can bypass compute dihedral/local and calculate dihedral angles from yourself. If you need inspiration, there’s a stand-alone script to calculate dihedral angles from x,y,z coordinates here:
https://github.com/jewettaij/dlpdb/blob/master/dlpdb/coords2dihedrals.py

(…but if you want to use that particular script, you will have to copy the x,y,z coordinates from the 4 atoms you care about out of the dump file and paste them on the same line, and do this for every monomer and for every time step. I’m not sure how much experience you have writing scripts to read text files. But its a good skill and you will probably eventually have to write scripts like that whenever you are trying to output something something in a format which LAMMPS does not quite know how to do already)