Global Variables

NMRView provides some built-in global variables. These can be accessed in TCL scripts.
curr_list
An integer number specifying the current peak list (the one selected in the peak analysis panel.
curr_peak
An integer number specifying the current peak (the one selected in the peak analysis panel.
int_flag
This flag is set whenever a ctrl/c is typed in the shell window in which NMRView is started. It can be tested in scripts to interrupt processing.
Nv_Natoms
The number of atoms in the current structure. READ ONLY.
Nv_Nresidues
The number of residues in the current structure. READ ONLY.
Nv_Nstructures
The number of conformations of the current structure. READ ONLY.
Nv_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. Note the use of the test for the interrupt flag int_flag.
proc listatoms {} {
global Nv_Natoms int_flag
for {set i 1} {$i<=$Nv_Natoms} {incr i} {
  if {$int_flag} {
	set int_flag 0
	return
  }
  set x [atom -elem x $i]
  set y [atom -elem y $i]
  set z [atom -elem z $i]
  puts stdout $x $y $z
}
}