From: Ashish .Chauniyal (
Date: Tue Apr 08 2014 - 12:23:05 CDT

Dear all,
I have to read a Lammps data file and make it into a .pdb format. It
contains only two types of atoms. File given below.

LAMMPS data file via write_data, version 1 Feb 2014, timestep = 21000

19200 atoms
2 atom types

-4.1606734782448356e+01 4.1606734782448356e+01 xlo xhi
-8.3213469564896712e+01 8.3213469564896712e+01 ylo yhi
-1.2482020434734403e+01 1.2482020434734403e+01 zlo zhi


1 63.546 #Cu
2 91.224 #Zr


4003 2 -3.6948671457303270e+01 -8.2178357941409985e+01
-1.0333348401063144e+01 0 0 1
807 1 -3.6990060733492541e+01 -8.0262837680770645e+01
-8.2698926717344481e+00 0 0 0
1 1 -4.1360378365219930e+01 -8.0595341475920435e+01 -1.1523945200048335e+01
0 0 0
85 2 -3.8964145243144991e+01 -7.9837065660776460e+01
-1.0375438044916475e+01 0 0 0

I wrote in a tcl script as follows.
set $fname
topo readlammpsdata $fname full
topo guessatom element mass
topo guessatom name element
topo guessatom radius element

# set atom types
set selc [atomselect top "all"]
$selc set type Cu
$selc set resname PPP
# set residue ID to residue index+1
set resid {}
foreach r [$selc get residue] {
    incr r
    lappend resid $r
$selc set resid $resid
$selc delete

When i generate a .pdb file from this , it does not have the desired
I wanted to use the same to read both kinds of atoms. How exactly do I use
atomselect to store
Cu atoms in $selc
and Zr atoms in $selz