#!perl #========================================================= # Author: Andrea Minoia # Date: 03/09/2010 # # Rename all the atoms in the given structure files # as "Atomic_Symbol"-N, where N is the position # of the atom in the structure (e.g. C-1, C-2, H-10,...) # # The script has to be in the same directory of the # structure to modify and the user has to update the # variable $filename (line 20) according to the name of the # file containing the atomic structure. # use strict; use MaterialsScript qw(:all); #open the structure file or die my $filename="octane.xsd"; my $doc = $Documents{$filename}; if (!$doc) {die "no document";} my $atoms=$doc->Atoms; #init atomic intex my $atomindex=0; # now loop over the atoms foreach my $atom (@$atoms) { $atomindex++; #assign newname my $newname=$atom->ElementSymbol.'-'.$atomindex; $atom->Name=$newname; } print "Atom names have been uptaded for all atoms in ". $filename #end