18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

7.12.2 PrimiPlotter<br />

The PrimiPlotter is intended to do on-the-fly plotting of the positions of the atoms during long molecular dynamics<br />

simulations. The module ase.visualize.primiplotter contains the PrimiPlotter and the various output<br />

modules, see below.<br />

class ase.visualize.primiplotter.PrimiPlotter(atoms, verbose=0, timing=0, interval=1,<br />

initframe=0)<br />

Primitive PostScript-based plots during a simulation.<br />

The PrimiPlotter plots atoms during simulations, extracting the relevant information from the list of atoms.<br />

It is created using the list of atoms as an argument to the constructor. Then one or more output devices must<br />

be attached using set_output(device). The list of supported output devices is at the end.<br />

The atoms are plotted as circles. The system is first rotated using the angles specified by set_rotation([vx,<br />

vy, vz]). The rotation is vx degrees around the x axis (positive from the y toward the z axis), then vy degrees<br />

around the y axis (from x toward z), then vz degrees around the z axis (from x toward y). The rotation<br />

matrix is the same as the one used by RasMol.<br />

Per default, the system is scaled so it fits within the canvas (autoscale mode). Autoscale mode is enabled and<br />

disables using autoscale(“on”) or autoscale(“off”). A manual scale factor can be set with set_scale(scale),<br />

this implies autoscale(“off”). The scale factor (from the last autoscale event or from set_scale) can be<br />

obtained with get_scale(). Finally, an explicit autoscaling can be triggered with autoscale(“now”), this is<br />

mainly useful before calling get_scale or before disabling further autoscaling. Finally, a relative scaling<br />

factor can be set with SetRelativeScaling(), it is multiplied to the usual scale factor (from autoscale or from<br />

set_scale). This is probably only useful in connection with autoscaling.<br />

The radii of the atoms are obtained from the first of the following methods which work:<br />

1.If the radii are specified using PrimiPlotter.set_radii(r), they are used. Must be an array, or a single<br />

number.<br />

2.If the atoms has a get_atomic_radii() method, it is used. This is unlikely.<br />

3.If the atoms has a get_atomic_numbers() method, the corresponding covalent radii are extracted from<br />

the <strong>ASE</strong>.ChemicalElements module.<br />

4.If all else fails, the radius is set to 1.0 Angstrom.<br />

The atoms are colored using the first of the following methods which work.<br />

1.If colors are explicitly set using PrimiPlotter.set_colors(), they are used.<br />

2.If these colors are specified as a dictionary, the tags (from atoms.get_tags()) are used as an index into<br />

the dictionary to get the actual colors of the atoms.<br />

3.If a color function has been set using PrimiPlotter.set_color_function(), it is called with the atoms as<br />

an argument, and is expected to return an array of colors.<br />

4.If the atoms have a get_colors() method, it is used to get the colors.<br />

5.If these colors are specified as a dictionary, the tags (from atoms.get_tags()) are used as an index into<br />

the dictionary to get the actual colors of the atoms.<br />

6.If all else fails, the atoms will be white.<br />

The colors are specified as an array of colors, one color per atom. Each color is either a real number from<br />

0.0 to 1.0, specifying a grayscale (0.0 = black, 1.0 = white), or an array of three numbers from 0.0 to 1.0,<br />

specifying RGB values. The colors of all atoms are thus a Numerical Python N-vector or a 3xN matrix.<br />

In cases 1a and 3a above, the keys of the dictionary are integers, and the values are either numbers<br />

(grayscales) or 3-vectors (RGB values), or strings with X11 color names, which are then translated to RGB<br />

values. Only in case 1a and 3a are strings recognized as colors.<br />

Some atoms may be invisible, and thus left out of the plot. Invisible atoms are determined from the following<br />

algorithm. Unlike the radius or the coloring, all points below are tried and if an atom is invisible by any<br />

criterion, it is left out of the plot.<br />

104 Chapter 7. Documentation for modules in <strong>ASE</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!