[lammps-users] display the centro symmetry parameter?

Hello Damien,
I also had this problem. It turns out that VMD along with the PDB format can be used to store an arbitrary parameter like the CSP. There is a simple tcl script found somewhere on the VMD site to load ( I can't remember where) to load the parameter into VMD's 'user' variable which is located in the 'color atoms by ...' drop-down box. I have attached the script below. However, before you can use this script you must convert LAMMPS's CSP format to the PDB format. My CSP output from LAMMPS looks like:

dump 0dumpCSP all custom 1000 indent-step_3-4.csp tag type x y z c_CSP

Once the output is created, I use an AWK script that I wrote to get my custom CSP format into PDB:

#!/usr/bin/awk -f
# AWK Script to convert one multi-frame dump file into one multi-frame PDB file
BEGIN { nskip = 9}
NR <= nskip
{ next}
/^ITEM/ { for (j=1; j<nskip; j++) {
getline }
print "END"
printf("%-4s 5i -3s %3s %4i %8.3f%8.3f%8.3f%6.2f%6.2f\n", "ATOM", $1, "Au", "grp", $2, $3, $4, $5, $6, 0.00);
END{print "END";}

Once you create the PDB file, invoke the pdbofactor.tcl script from the tcl counsole (found in the VMD) 'Tools' menu. The script follows:

# load multi-frame pdb file, storing occupancy factors 'my scripts store centro-symmetry parameter in occupancy slot' from each frame in user.
# usage: pdbbfactor <filename>
# Justin Gullingsrud & Modified by cjo to take input from occupancy field
# 3 September 2004 & 1/2007

proc pdbofactor { fname } {
mol new $fname waitfor all
set all [atomselect top all]
set frame 0
set in [open $fname r]
set occupancy {}
while { [gets $in line] != -1 } {
   switch -- [string range $line 0 3] {
     END {
       $all frame $frame
       $all set user $occupancy
       set occupancy {}
       incr frame
     ATOM -
     HETA {
       lappend occupancy [string range $line 55 60]; #column numbers changed to reflect occupancy column

Please let me know if you have any questions. Something like this should really be put on the LAMMPS or VMD website, since the CSP so very useful.

Hope this helps.
Chris O'Brien

hi chris and damien,

there is actually a more direct way (no pdb file needed)
to do this. have a look at section 5.3 and 5.4 of:


just adapt the load script to read from the LAMMPS dump directly,
and then store the information directly in the user field.


Axel - so where is the CSP data stored that LAMMPS outputs for input
to VMD. The example looks like its reading XYZ and DCD files, neither
of which have the extra field?


Axel - so where is the CSP data stored that LAMMPS outputs for input
to VMD. The example looks like its reading XYZ and DCD files, neither
of which have the extra field?

this is not done directly. there currently is no automatic way to
load data into the "user" field of VMD (as of the next release there
will be multiple user fields for additional flexibility).

apart from changes needed to the molecule loading API (which are not
too difficult to do), the major problem for LAMMPS dumps is that they
are not self descriptive enough to automatically detect its format
and then map values to the user fields.

as it stands now, VMD is not even able to read a lammps
trajectory written in any custom style.

however, as in the section 5.4, one can write a small parser in
tcl read the whatever property into VMD. i'd use two dump formats,
i'd dump the coordinates in a .dcd trajectory and then the additional
parameters into a lammps custom dump and then use tcl to read that
custom file _after_ the .dcd has been read in.

the example 5.3 shows how to store data in the user field (
in this case the property is computed on the fly). but essentially
both can be combined in any way one sees fit and with the expanded
capability of VMD to store multiple user fields, the 5.4 technique
to access additional data for visualization is obsolecent.

in the long run, i'm thinking to implement some sort of meta-format
for VMD's plugin API, where one provides a map that allows VMD to
loaded data from multiple formats simultaneously and tells it how
to assign the resulting data to internal structures (coordinates,
velocity, occupation, charges, radius etc. etc.).

if somebody can provide me with a reasonably representative
example input (and/or output), i can try to write a script
that demonstrates this.