diff -Naur lammps-28Mar08/doc/Section_tools.html lammps-30Mar08/doc/Section_tools.html --- lammps-28Mar08/doc/Section_tools.html 2008-03-18 14:18:54.000000000 -0600 +++ lammps-30Mar08/doc/Section_tools.html 2008-03-28 09:03:22.000000000 -0600 @@ -52,6 +52,7 @@
  • lmp2arc
  • lmp2cfg
  • lmp2traj +
  • lmp2vmd
  • matlab
  • micelle2d
  • msi2lmp @@ -189,6 +190,21 @@


    +

    lmp2vmd tool +

    +

    The lmp2vmd sub-directory contains some scripts for converting LAMMPS +files into formats suitable for visualizing with the VMD +package. +

    +

    One script extracts bond topology info from a LAMMPS data file. A +second script attached amino acid (residue) information to what is +extracted from a data file. See the README file for more information. +

    +

    These scripts were written by Axel Kohlmeyer (akohlmey at +cmm.chem.upenn.edu) at U Penn. +

    +
    +

    matlab tool

    The matlab sub-directory contains several MATLAB scripts for diff -Naur lammps-28Mar08/doc/Section_tools.txt lammps-30Mar08/doc/Section_tools.txt --- lammps-28Mar08/doc/Section_tools.txt 2008-03-18 14:18:54.000000000 -0600 +++ lammps-30Mar08/doc/Section_tools.txt 2008-03-28 09:03:22.000000000 -0600 @@ -48,6 +48,7 @@ "lmp2arc"_#arc "lmp2cfg"_#cfg "lmp2traj"_#traj +"lmp2vmd"_#vmd "matlab"_#matlab "micelle2d"_#micelle "msi2lmp"_#msi @@ -185,6 +186,21 @@ :line +lmp2vmd tool :h4,link(vmd) + +The lmp2vmd sub-directory contains some scripts for converting LAMMPS +files into formats suitable for visualizing with the "VMD +package"_http://www.ks.uiuc.edu/Research/vmd/. + +One script extracts bond topology info from a LAMMPS data file. A +second script attached amino acid (residue) information to what is +extracted from a data file. See the README file for more information. + +These scripts were written by Axel Kohlmeyer (akohlmey at +cmm.chem.upenn.edu) at U Penn. + +:line + matlab tool :h4,link(matlab) The matlab sub-directory contains several "MATLAB"_matlab scripts for diff -Naur lammps-28Mar08/tools/lmp2vmd/README lammps-30Mar08/tools/lmp2vmd/README --- lammps-28Mar08/tools/lmp2vmd/README 1969-12-31 17:00:00.000000000 -0700 +++ lammps-30Mar08/tools/lmp2vmd/README 2008-03-28 09:02:29.000000000 -0600 @@ -0,0 +1,109 @@ +This directory contains utility scripts for using VMD to visualize and +analyze LAMMPS trajectories (well, right now there is only two +scripts, but more are to come). Below are short descriptions and +examples on how to use them. Additional information on VMD as well as +additional scripts can be found at: +http://www.ks.uiuc.edu/Research/vmd/ + +The scripts here are maintained by Axel Kohlmeyer +. + +------------------------- + +1. lmpbonds2vmd.tcl - translate bonding information from a LAMMPS data + file into VMD. + +1a. Background. + With VMD one typically reads bonding information from a topology file and + then reads a trajectory with the coordinate information on top of that. + The most common use is the combination of a (CHARMM or X-PLOR style) .psf + file and a .dcd file. If the bonding information is not avaiable, VMD uses + a heuristic guess, which does not always work, but can be particularly + cumbersome in coarse grained MD or similar systems. The lmpbonds2vmd.tcl + script provide an option to transfer bonding information from a LAMMPS data + file into VMD. + +1b. Usage + The script defines a new procedure "lmpbondsfromdata". To activate it + type at the VMD command prompt: + + source lmpbonds2vmd.tcl + + To then build a .psf file that can be used for subsequent + visualizations you can load one frame of a native LAMMPS trajectory + (not binary, not custom!), e.g. perusing the output from the + micelle example. + + mol new dump.micelle type lammpstrj waitfor all + lmpbondsfromdata 0 data.micelle + + now you should only see the bonds that actually have bonded interactions. + + to avoid having to run the script all the time you can save the bonding + information in an (incomplete) .psf file. + + animate write psf micelle.psf + + and now in the future you can load this psf file first and then + the dump file (or a more compact and faster loading .dcd or .xtc file). + e.g., with: + + vmd micelle.psf -lammpstrj dump.micelle + +1c. Problems + The data file format is quite flexible and thus not always easy to parse + independent from context. As a consequence, the lmpbondsfromdata parser + may be confused by your specific setup. + +1d. History + First version. 2007, axel kohlmeyer + +------------------------- + +2. lmpresid2vmd.tcl - translate residue information from a LAMMPS data + file into VMD. + +2a Background. LAMMPS dump files contain information about the + (numerical) atom type, but not a molecule or residue id as it is + typically used in .psf or .pdf files to define subunits of a + system. Adding this information can be very helpful for analysis + and postprocessing of LAMMPS data in VMD. + +2b Usage. + The script defines a new procedure "lmpresidfromdata". To activate it + type at the VMD command prompt: + + source lmpresid2vmd.tcl + + To then add the residue information to a .psf file, see the steps for from + item 1 from above and then type into the VMD console. + + lmpresidfromdata 0 data.micelle + + to avoid having to run the script all the time you can save the bonding + information in an (incomplete) .psf file. + + animate write psf micelle2.psf + + and now in the future you can load this psf file first and then + the dump file (or a more compact and faster loading .dcd or .xtc file). + e.g., with: + + vmd micelle2.psf -lammpstrj dump.micelle + + now you can use the residue information to "join" the bonds split + across the periodic boundaries with: + + pbc join residue -all + + and then enjoy a nice visualization of the micelle example with VMD. :) + +2c. Problems + The data file format is quite flexible and thus not always easy to parse + independent from context. As a consequence, the lmpresidfromdata parser + may be confused by your specific setup. + +2d. History + First version. 2008, axel kohlmeyer + + diff -Naur lammps-28Mar08/tools/lmp2vmd/lmpbonds2vmd.tcl lammps-30Mar08/tools/lmp2vmd/lmpbonds2vmd.tcl --- lammps-28Mar08/tools/lmp2vmd/lmpbonds2vmd.tcl 1969-12-31 17:00:00.000000000 -0700 +++ lammps-30Mar08/tools/lmp2vmd/lmpbonds2vmd.tcl 2008-03-28 09:02:29.000000000 -0600 @@ -0,0 +1,56 @@ +# small script to extract bonding info from a lammps data file +# so that VMD will display the correct bonds for CG-MD. +# (c) 2007 Axel Kohlmeyer + +proc lmpbondsfromdata {mol filename} { + + # create an empty bondlist + set na [molinfo $mol get numatoms]; # number of atoms + set nb 0; # number of bonds + set bl {}; # bond list + for {set i 0} {$i < $na} {incr i} { + lappend bl {} + } + + # open lammps data file + if {[catch {open $filename r} fp]} { + puts stderr "could not open file $filename" + return -1 + } + + # read file line by line until we hit the Bonds keyword + while {[gets $fp line] >= 0} { + # pick number of bonds + regexp {^\s*(\d+)\s+bonds} $line dummy nb + + if { [regexp {^\s*Bonds} $line] } { + puts "nbonds= $nb\n now reading Bonds section" + break + } + } + + # skip one line + gets $fp line + # read the bonds file + for {set i 0} {$i < $nb} {incr i} { + gets $fp line + # grep bond numbers from entry and adjust to VMD numbering style + regexp {^\s*\d+\s+\d+\s+(\d+)\s+(\d+)} $line dummy ba bb + incr ba -1 + incr bb -1 + + set bn [lindex $bl $ba] + lappend bn $bb + set bl [lreplace $bl $ba $ba $bn] + + set bn [lindex $bl $bb] + lappend bn $ba + set bl [lreplace $bl $bb $bb $bn] + } + close $fp + + set sel [atomselect $mol all] + $sel setbonds $bl + $sel delete +} + diff -Naur lammps-28Mar08/tools/lmp2vmd/lmpresid2vmd.tcl lammps-30Mar08/tools/lmp2vmd/lmpresid2vmd.tcl --- lammps-28Mar08/tools/lmp2vmd/lmpresid2vmd.tcl 1969-12-31 17:00:00.000000000 -0700 +++ lammps-30Mar08/tools/lmp2vmd/lmpresid2vmd.tcl 2008-03-28 09:02:29.000000000 -0600 @@ -0,0 +1,47 @@ +# small script to extract residue info from a lammps data file +# (c) 2008 Axel Kohlmeyer + +proc lmpresidfromdata {mol filename} { + + # create an empty bondlist + set na [molinfo $mol get numatoms]; # number of atoms of molecule + set nb 0; # number of atoms in data file + set bl {}; # resid list + for {set i 0} {$i < $na} {incr i} { + lappend bl 0 + } + + # open lammps data file + if {[catch {open $filename r} fp]} { + puts stderr "could not open file $filename" + return -1 + } + + # read file line by line until we hit the Bonds keyword + while {[gets $fp line] >= 0} { + # pick number of bonds + regexp {^\s*(\d+)\s+atoms} $line dummy nb + + if { [regexp {^\s*Atoms} $line] } { + puts "atoms= $nb\n now reading Atoms section" + break + } + } + + # skip one line + gets $fp line + # read the Atoms data + for {set i 0} {$i < $nb} {incr i} { + gets $fp line + # grep bond numbers from entry and adjust to VMD numbering style + regexp {^\s*(\d+)\s+(\d+)\s+\d+.*} $line dummy ba bb + incr ba -1 + lset bl $ba $bb + } + close $fp + + set sel [atomselect $mol all] + $sel set resid $bl + $sel delete +} +