Global Variables

NMRView provides some built-in global variables. These can be accessed in TCL scripts.
natoms
The number of atoms in the current structure. READ ONLY.
fatom
The index of the first atom in the current structure. READ ONLY.
latom
The index of the last atom in the current structure. READ ONLY.
fresidue
The number of the first residue in the current structure. READ ONLY.
lresidue
The number of the last residue in the current structure. READ ONLY.
nresidues
The number of residues in the current structure. READ ONLY.
nstructures
The number of conformations of the current structure. READ ONLY.
structure(i)
A boolean array variable. The index i refers to the structure number. If set true (1,true,on) that structure will be used in superpositions and display. If set false (0,false,off) that structure will not be used in superpositions and display. READ-WRITE.
If accessed in a TCL procedure you must use the global command. For example, to list out the x,y and z coordinates of the atoms in the structure you could use the following procedure.
proc listatoms {} {
global fatom latom
for {set i $fatom} {$i<=$latom} {incr i} {
  set x [atom -elem x $i]
  set y [atom -elem y $i]
  set z [atom -elem z $i]
  puts stdout $x $y $z
}
}