From: Josh Vermaas (
Date: Fri Oct 03 2014 - 12:21:34 CDT

Hi Dave,

The issue here is actually something that is usually quite benign (I
think). You say you are loading in pdbs, which normally don't have
connectivity information (I dunno how packmol does it, but I don't see
many with PDBs with conect records filled in). This means you are
implicitly counting on VMD's bond-search algorithm to determine all of
your connectivity. VMD's bond-search algorithm is efficient, which means
it breaks down the N particles, and assigns them to grid patches based
on their location in space (not the order they were loaded), searching
for atoms that are close from a small subset of the system, vastly
reducing the number of distance comparisons that need to be made. Now
you said you let packmol make all of these systems independently, which
means that by chance alone, some molecules are split across these
patches differently in one structure relative to another. The order of
the bonds stored internally will be different each time! You can test
this by asking VMD to write out a psf after the bonds, angles and
dihedrals have been guessed. I'm betting the order of the indices will
not be sorted, and that the bondlists will be different for each system.
Now topotools iterates linearly over this bondlist to build up angles
and dihedrals, which I *think* is why it has this weird behavior. Why
does the order of the angles and dihedrals matter though? Is this
something LAMMPS specific? I'm also confused as to why the angles and
dihedrals are specified based on what look like atomnames and not
indices, but I'm sure its just a formatting thing.

-Josh Vermaas

On 10/03/2014 11:08 AM, Dave Schall wrote:
> Hi vmd-users,
> I am converting pdb files to a lammps coord files using vmd/topotools.
> I have a system with two types of molecules, say A and B. I am using
> packmol to generate pdb files for systems with different mole
> fractions of A and B. Packmol generates lists all the A molecules
> first then, all the B molecules after.
> I take this pdb file and read into vmd, do some atom selections to set
> charges/types/masses, etc. I have topotools guess the angles and
> dihedrals. Then I dump to a lammps coord file via topotools. I have a
> tcl script set up to do this the same way every time.
> Since I am running a fairly large set of simulations, I'd like this to
> be somewhat automated, but what I find when I inspect the lammps coord
> files is that the order of angles and dihedrals is not always the
> same. This means I have to check each coord file against my lammps
> input file to make sure the order of the parameters match.
> For example for some files I get:
> # 1 C3-C4-H1
> # 2 C-C1-H
> # 3 C1-C-H
> # 4 C2-C-H
> # 5 H1-C3-H1
> # 6 C-C2-H
> For some others:
> # 1 C3-C4-H1
> # 2 C-C1-H
> # 3 C1-C-H
> # 4 C2-C-H
> # 5 C-C2-H
> # 6 H1-C3-H1
> (5 and 6 as switched)
> Dihedrals are much more mixed up than angles.
> Am I wrong in assuming that if the order of molecules (and atoms
> therein) are the same in every pdb file they should be read in the
> same order by vmd/topotools? Is this some function of how "topo
> guessangles" and "topo guessdihedrals" works? If so I guess I better
> get busy building a a parameter database and script that can create
> input decks from lammps coord files.
> Thanks,
> Dave
> --
> J. David Schall, Assistant Professor
> Dept. of Mechanical Engineering, Oakland University
> 328 Engineering Center, Rochester, MI 48309
> 248-370-2870 <tel:248-370-2870>