From: Diego Gomes (
Date: Thu Dec 07 2023 - 09:31:44 CST

Hi Shivan, did you get this issue resolved?

During the improper dihedral assignment, make sure to notice that
"index" starts from 0, while "serial" starts from 1.


On Tue, Nov 21, 2023 at 12:58 AM SHIVAM TIWARI <> wrote:
> Dear all,
> I want to generate a lammps input file for sodium laurate molecules solvated in a box of water. I generated the initial coordinates with packmol. The topotools is guessing the bonds, angles and dihedrals correctly for this system. But sodium laurate has an improper which I am trying to assign explicitly with following section of code in my script:
> set lau [atomselect top "resname LAU"]
> set res_list [lsort -unique [$lau get residue]]
> foreach r $res_list {
> set improp_ats [atomselect top "residue $r and name C12 O1 O2 C11"]
> set improp_ids [$improp_ats get index]
> topo addimproper [lindex $improp_ids 1] [lindex $improp_ids 2] [lindex $improp_ids 3] [lindex $improp_ids 0]
> $improp_ats delete
> $improp_ids delete
> }
> The script is generating the desired output. However, when I am checking the indices of impropers from the output file visually in vmd (with command "index 95687 95688 95689 95690) one of the atoms(C11) belongs to a different residue of sodium laurate. However, if i check these indices with the command "serial 95687 95688 95689 95690" in vmd representation, it shows the correct group of atoms. Can anybody help rectify this.
> regards,

Diego Enry B. Gomes, PhD
Department of Physics at Auburn University &
NIH Center for Macromolecular Modeling and Visualization
Leach Science Center - Ste. 3182 - Auburn, AL