PageRenderTime 23ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/ase/gui/basics.rst

https://gitlab.com/vote539/ase
ReStructuredText | 190 lines | 135 code | 55 blank | 0 comment | 0 complexity | cfd0d3e02369531ffadfa59c601dd370 MD5 | raw file
  1.. module:: basics
  2
  3=======================================
  4ase-gui basics and command line options
  5=======================================
  6
  7General use
  8-----------
  9
 10Visualizing a system with ase-gui is straight-forward using a regular
 11mouse. The scroll function allows to change the magnification, the
 12left mouse button selects atoms, the right mouse button allows to
 13rotate, and the middle button allows to translate the system on the
 14screen.
 15
 16Depending on the number of selected atoms, ase-gui automatically measures
 17different quantities:
 18
 19================================= ======================================
 20Selection                         measurement
 21================================= ======================================
 22single atom                       xyz position and atomic symbol
 23two atoms                         interatomic distance and symbols
 24three atoms                       all three internal angles and
 25                                  symbols
 26four atoms, selected sequentially Measures the dihedral angle,
 27                                  e.g. the angle between bonds 12 and 34
 28more than four atoms              chemical composition of selection.
 29================================= ======================================
 30
 31ase-gui can save the following file formats:
 32
 33=========== =================================
 34File format Comment
 35=========== =================================
 36xyz         XYZ file
 37traj        ASE trajectory
 38pdb         PDB file
 39cube        Gaussian cube file
 40py          Python script
 41vnl         VNL file
 42png         Portable Network Graphics
 43pov         Persistance of Vision
 44eps         Encapsulated PostScript
 45in          FHI-aims geometry input
 46POSCAR      VASP geometry input
 47bundle      ASE bundle trajectory
 48cif         Crystallographic Information File
 49=========== =================================
 50
 51Files
 52-----
 53
 54The :ref:`ase-gui` program can read all the file formats the ASE's
 55:func:`~ase.io.read` function can understand.
 56
 57::
 58  
 59  $ ase-gui N2Fe110-path.traj
 60
 61
 62Selecting part of a trajectory
 63------------------------------
 64  
 65A Python-like syntax for selecting a subset of configurations can be
 66used.  Instead of the Python syntax ``list[start:stop:step]``, you use
 67:file:`filaname@start:stop:step`::
 68
 69  $ ase-gui x.traj@0:10:1  # first 10 images
 70  $ ase-gui x.traj@0:10    # first 10 images
 71  $ ase-gui x.traj@:10     # first 10 images
 72  $ ase-gui x.traj@-10:    # last 10 images
 73  $ ase-gui x.traj@0       # first image
 74  $ ase-gui x.traj@-1      # last image
 75  $ ase-gui x.traj@::2     # every second image
 76
 77If you want to select the same range from many files, the you can use
 78the :option:`-n` or :option:`--image-number` option::
 79
 80  $ ase-gui -n -1 *.traj   # last image from all files
 81  $ ase-gui -n 0 *.traj    # first image from all files
 82
 83.. tip::
 84
 85  Type :command:`ase-gui -h` for a description of all command line options.
 86
 87
 88Writing files
 89-------------
 90
 91::
 92
 93  $ ase-gui -n -1 a*.traj -o new.traj
 94
 95Possible formats are: ``traj``, ``xyz``, ``cube``, ``pdb``, ``eps``,
 96``png``, and ``pov``.  For details, see the :mod:`~ase.io` module
 97documentation.
 98
 99Interactive use
100---------------
101
102The :ref:`ase-gui` program can also be launched directly from a Python
103script or interactive session:
104
105>>> from ase import *
106>>> atoms = ...
107>>> view(atoms)
108
109or
110
111>>> view(atoms, repeat=(3, 3, 2))
112
113or, to keep changes to your atoms:
114
115>>> atoms.edit()
116
117
118NEB calculations
119----------------
120
121Use :menuselection:`Tools --> NEB` to plot energy barrier.
122
123::
124  
125  $ ase-gui --interpolate 3 initial.xyz final.xyz -o interpolated_path.traj
126
127
128Plotting data from the command line
129-----------------------------------
130Plot the energy relative to the energy of the first image as a
131function of the distance between atom 0 and 5::
132
133  $ ase-gui -g "d(0,5),e-E[0]" x.traj
134  $ ase-gui -t -g "d(0,5),e-E[0]" x.traj > x.dat  # No GUI, write data to stdout
135
136The symbols are the same as used in the plotting data function.
137
138
139Defaults for ase-gui
140--------------------
141
142Using a file ``~/.ase/gui.py``, certain defaults can be set. If it exists,
143this file is executed after initializing the variables and colours
144normally used in ase-gui. One can change the default graphs that are
145plotted, and the default radii for displaying specific atoms. This
146example will display the energy evolution and the maximal force in a
147graph and also display Cu atoms (Z=29) with a radius of 1.6 Angstrom.
148
149::
150
151  gui_default_settings['gui_graphs_string'] = "i, e - min(E), fmax"
152  gui_default_settings['covalent_radii'] = [[29,1.6]]
153
154
155.. _high contrast:
156
157High contrast settings for ase-gui
158----------------------------------
159
160In revision 2600 or later, it is possible to change the foreground and
161background colors used to draw the atoms, for instance to draw white
162graphics on a black background. This can be done in ``~/.ase/gui.py``.
163
164::
165
166  gui_default_settings['gui_foreground_color'] = '#ffffff' #white
167  gui_default_settings['gui_background_color'] = '#000000' #black
168
169To change the color scheme of graphs it is necessary to change the
170default behaviour of Matplotlib in a similar way by using a file
171``~/.matplotlib/matplotlibrc``.
172
173::
174
175  patch.edgecolor  : white
176  text.color       : white
177  axes.facecolor   : black
178  axes.edgecolor   : white
179  axes.labelcolor  : white
180  axes.color_cycle : b, g, r, c, m, y, w
181  xtick.color      : white
182  ytick.color      : white
183  grid.color       : white
184  figure.facecolor : 0.1
185  figure.edgecolor : black
186
187Finally, the color scheme of the windows themselves (i.e. menus, buttons
188and text etc.) can be changed by choosing a different desktop theme. In
189Ubuntu it is possible to get white on a dark background by selecting the
190theme HighContrastInverse under Appearances in the system settings dialog.