Tutorial for Processing Multiple Input Files¶
This is an advanced tutorial which shows...
- How to Read a List of Files
- How to Order the Molecular Orbital Coefficients
- How to Save and Read the Information Obtained to and from an HDF5-File
- How to Depict Several Molecular Orbitals
- How to Perform a Standard ORBKIT Computation for One Molecular Structures
- How to Process Data of Two or More dimensions
We assume that you have followed the Installation Instructions and that
you have navigated to the folder
Please note that the input files are compressed in .tar.gz file in the examples
$ORBKITPATH/examples/basic_examples/NaCl_molden_files.tar.gz) and need to be
decompressed before performing this tutorial.
This tutorial explains parts of the example file
As a starting point, you have to import the ORBKIT module for processing multiple files:
from orbkit import multiple_files
Now, we have to create a list of input file names:
import os path = 'NaCl_molden_files' # How are input files formatted? fid = 'nacl.%03d.molden' fid_list =  for i in range(0,16,1): f = os.path.join(path,fid % i) if not os.path.exists(f): raise IOError('%s does not exist!' % f) fid_list.append(f)
Here, we have used the
os module to get sure that all input files exist.
The input files can be read with:
Now, all input variables are global values in the module
These variables are named according to their analogue in the
(cf. Central Variables):
||Contains all molecular geometries, see geo_spec in Central Variables.|
||See geo_info in Central Variables.|
||See ao_spec in Central Variables.|
||See ao_spherical in Central Variables.|
||Contains all molecular orbital coefficients. List of
||Contains all molecular orbital energies. List of
||Contains all molecular orbital occupations. List of
||Python dictionary containing the molecular orbital symmetries and the
corresponding position in
||After the execution of the ordering routine, it contains the new indices of the
molecular orbitals. If index < 0, the molecular orbital changes its sign.
ORBKIT provides different schemes to order molecular orbitals, of which the best shall be presented here: the ordering using analytical integrals between neighboring molecular orbitals.
This procedure is a black box procedure and can be called with:
index_list, mo_overlap = multiple_files.order_using_analytical_overlap(None)
The input argument
None has been used since we have read already the
This function changes all global variables and returns an index list containing the new indices of the molecular orbitals.
If the index is negative, the molecular orbital changes its sign.
Moreover, it returns the molecular orbital
overlap matrix between the molecular orbitals of two neighboring
mo_overlap[i,j,k] corresponds to overlap between the
th molecular orbital at geometry to the th molecular orbital at
All global variables of the module
multiple_files can be stored to an
To read this file and recover the global variables, simply call:
You can use this module to depict snapshots of selected molecular orbitals with simple contour plots:
selected_mos = ['24.1','23.2'] # Specifies, which MOs to be plotted r0 = 1 # Specifies the starting structure geo_spec_all[r0] steps = 5 # Specifies, how many steps to printed in one graph select_slice = 'xz' # Selects which plane to be plotted where = 0.0 # Selects where to place the plane (Here, y=0) multiple_files.show_selected_mos(selected_mos,r0=r0,steps=steps, select_slice=select_slice,where=where)
You can cast the global variables of
multiple_files automatically to a list
QCinfo classes (cf. Central Variables) by:
QC = multiple_files.construct_qc()
Now, you can access every data point separately and perform ORBKIT calculations, e.g.:
import orbkit as ok r = 0 # Index to be calculated out_fid = 'nacl_r%d' % r # Specifies the name of the output file # Initialize orbkit with default parameters and options ok.init() # Set some options ok.options.adjust_grid= [5, 0.5] # adjust the grid to the geometry ok.options.otype = 'mayavi' # output file (base) name # Run orbkit with one instance of qc as input ok.run_orbkit(QC)
Since the ordering routine is only suitable for one dimensional data, the input data has to be rearranged if you want to treat problems of higher dimensionality.
We suggest two different approaches, which may be applied to an arbitrary number of dimensions:
Please make always sure that the ordering procedure was successful by plotting and checking the final molecular orbital overlaps and molecular orbital coefficients!