From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Apr 02 2012 - 15:59:06 CDT

On Mon, Apr 2, 2012 at 3:50 PM, Phelan Jr, Frederick R. Dr.
<frederick.phelan_at_nist.gov> wrote:
> I am running in a coarse-grained model in LAMMPS and then reading the
> results into VMD using  the topotools readlammpsdata routine … is there any
> way to AUTOMATICALLY associated the sigma values in the input file with the
> display size of the beads? i.e., without tying in by hand …

technically this is possible, but unpractical.
the force field information is deliberately ignored
when reading data files, since all of it can be
overridden in the input file. for this reason and
a number of other limitations using the data file
to store the field definition is not such a good idea.

on the other hand it would be easily possible to
write a small Tcl function that takes the data file
name as an argument, load the data file and then
opens and parses only the PairCoeff segment
to use the sigma information as radius. please
find below some (untested) draft implementation.

you can put this into your .vmdrc file and then
just load a data file with your preferred settings,
and generally adjust everything that you want to
adjust from within this function.

cheers,
     axel.

proc myreaddata {datafile {atomstyle full}} {

package require topotools

if { [catch {open $datafile r} fd] } {
     puts stderr "Could not open $datafile\n$fd"
     return -1
}

set molid [topo readlammpsdata $datafile $atomstyle]
set numat [topo numatomtypes]

while {[gets $fd line] >= 0} {
  if {[regexp {^\s*PairCoeff} $line ]} {
    gets $fd line
    for {set i 0} {$i < $numat} {
      gets $fd line
      lassign $line type eps sigma
      set sel [atomselect $molid "type $type"]
      $sel set radius $sigma
      $sel delete
    }
  }
}
close $fd
return $molid
}

>
>
>
> set sel1 [atomselect top {index 0 to 999}]
>
> $sel1 set radius 1.0
>
> $sel1 set name A
>
> $sel1 set type A
>
> $sel1 set mass 1
>
>
>
> Etc.
>
>
>
> Thanks,
>
> Fred
>
>
>
>
>
>
>
> ________________________________
>
> Frederick R. Phelan Jr., Ph.D.
> Complex Fluids Group
> Polymers Division
> National Institute of Standards and Technology
>
> ________________________________
>
> NIST, Bldg. 224/Rm. A209
> 100 Bureau Dr., STOP 8542
> Gaithersburg, MD 20899-8542
> 301.975.6761 (VOX)
> 301.975.4924 (FAX)
> frederick.phelan_at_nist.gov
>
> My Polymers Home Page
>
>
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.