From: SHIVAM TIWARI (t.shivam_at_iitg.ac.in)
Date: Tue Nov 21 2023 - 00:21:27 CST

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,
SHIVAM