VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Wed Nov 05 2008 - 16:24:57 CST
- Next message: Maria Sanchez: "RMSD error "Matrix: Warning: no convergence""
- Previous message: Anton Arkhipov: "Re: CG Map Tool Syntax Error"
- In reply to: Subramanian Vaitheeswaran: "Sequentially numbering atom names in pdb file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Wed, 5 Nov 2008, Subramanian Vaitheeswaran wrote:
SV> Hi all,
SV>
SV> I want to rename the atoms in a pdb file as C1, C2, C3 etc. I use the following script:
SV> *******************************
SV> # sets unique atom names
SV> mol load pdb tmp.pdb
SV> set var [atomselect top all]
SV> set at [$var get serial]
SV> for {set i 0} {$i < $at} {incr i} {
SV> $var set name C$i
SV> }
SV> $var writepdb rename.pdb exit
*******************************
SV> But, this renames all atoms as C1. How can I increment the index i
SV> for each line in the pdb file? I'd appreciate any help in fixing
SV> this seemingly simple problem.
the best help is to have a closer look at the documentation
and other example scripts. scripts do exactly what you ask
them to do and that may not be what seems reasonable.
the key here is that atomselections return lists on using
"get" and require lists as arguments for "set" unless you
want to assign the same value to all.
you get what you want by changing your loop to something like:
set nlist {}
foreach i $at {
lappend nlist "C$i"
}
$var set name $nlist
cheers,
axel.
SV>
SV> thanks,
SV> Vaithee
SV> ============================================
SV> S. Vaitheeswaran
SV> Post-doctoral Research Associate
SV> Institute for Physical Science & Technology
SV> Rm 2116, Bldg. 85
SV> University of Maryland
SV> College Park MD 20742
SV> email: vaithee_at_umd.edu
SV> Phone: 301-405-7568
SV> ============================================
SV>
-- ======================================================================= Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu Center for Molecular Modeling -- University of Pennsylvania Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323 tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425 ======================================================================= If you make something idiot-proof, the universe creates a better idiot.
- Next message: Maria Sanchez: "RMSD error "Matrix: Warning: no convergence""
- Previous message: Anton Arkhipov: "Re: CG Map Tool Syntax Error"
- In reply to: Subramanian Vaitheeswaran: "Sequentially numbering atom names in pdb file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]