Documentation
PYXAID distribution is a collection of the module written in either python or C/C++. The language the module is written in defines the hierarchical
level of such module - the lower level corresponds to the code written in C/C++ while the higher-level code is mostly written in python.
The lower-level code implements the basic or performance-critical functions and data types, while the higher-level code is build on the functions and
classes provided by the lower-level modules. The overall structure of the PYXAID distribution with the classification of the modules according to the
code level is summarized below.
pyxaid
- Level 1 modules
- Level 2 modules
modules that depend on Level 1 modules
modules that do not depend on Level 1 modules
- Level 3 scripts
These are the input files customized for specific problem. They make use of the functions defined in other modules (Levels 1 and 2) and are
executed as normal python scripts. In addition, the files of this level can include templates for running some claculations and written in other
languages than python (e.g. PBS/shell scripts). The collection of examples showing typical types of usage of other modules is coming with the
PYXAID distribution, but is not its integral part. It only gives the user predefined templates of the execution scripts that may need to be
customized for particular project. We advise you to start learning the PYXAID package by checking these examples and proceeding through tutorials.
Below we present an overwiev of each module: its content, purpose, functionality, etc.
Module pyxaid_core
This module implements the basic functionality of the PYXAID package. This includes, all the time-consuming calculations (matrix operations, integrators,
operations with the wavefunction, NA-MD algorithm, basic and advanced math) and the most important data types (matrix, vectors, wavefunctions).
Therefore, it is written in a mix of C/C++ languages to achieve high performance. The classes and the methods are exposed to Python interface
via Boost.Python library. The list of such function and classes implemented in pyxaid_core module is described below.
Module functions:
- Purpose:
One of the main function of the distribution - in computes NA-MD in a variety of ways, as specified by artument params.
- Arguments:
params - dictionary, containing a set of the key - value pairs
Because the function delivers the main NA-MD functionaliy of the PYXAID, the parameters will be discussed in a bit more details
than for other functions of the distribution, on a separate page.
- Used in:
Directly in user-defined script. See, for example, "py-scr3.py" - one of the level-3 codes coming with this distribution.
- Uses:
It is of level-1, so it uses C/C++ functions and classes.
Module runMD
This module implements the basic functionality for pre-computing electronic Hamiltonian matrices along a single MD trajectory. Depending on the
parameters this can be done in a variety of ways.
Module functions:
- Purpose:
Auxiliary function that extracts value of given type from the dictionary
- Parameters:
params - dictionary, containing a set of the key - value pairs
key - a string defining the key the value of which we want to extract from the dictionary
default - the default value corresponding to the key given, in the case if dictionary does not define it
typ - a string defining the data type of value corresponding to given key. The parameter 'default' must be of this type.
Allowed values:
- "i" - for extracting integer values
- "s" - for extracting string values
- "f" - for extracting floating-point values
- Used in:
runMD.runMD(...)
- Uses:
...
- Example:
params = {"EXE_EXPORT":"path_to_my_exe", dt:1.0, minband:1, maxband:10 } # define dictionary of parameters
dt = get_value(params,"dt","1.0","f") # extract the value of variable params["dt"] and convert it to floating point type
- Purpose:
Runs a serial job - organizes a series of the single-point electronic structure calculations for the configurations
sampled along the MD trajectory. This allows one to compute the electronic Hamiltonian matrix elements (non-adiabatic couplings
and energies of the basis states) for the TD-SE. This is done numerically using the wavefunction for adjacent time steps.
This is the heart of the Step 2 (as defined in our paper).
- Parameters:
params - dictionary, containing a set of the key - value pairs determining the details of calculations
Allowed key values (with the explanation of the value meaning):
- "NP" - integer, specifying on how many CPUs to run the electronic structure calculations (with the QE code). Default value = 1
- "EXE" - string, specifying the path the quantum-mechanical driver (pw program of QE package). Default value = ""
- "EXE_EXPORT" - string, specifying the path of the post-processing utility to transform the wavefunction to the
text format (pw_export program of QE package). Default value = ""
- "start_indx" - integer, specifying the index of the starting MD trajectory point used for electronic Hamiltonian computations.
Default value = 0
- "stop_indx" - integer, specifying the index of the final MD trajectory point used for electronic Hamiltonian computations.
Default value = 1
- "dt" - real number, specifying the nuclear time step (in fs) used to produce MD trajectory. Default value = 1.0
- "pp_type" - string, specifying the type of the pseudo-potential(PP) to be employed in electronic structure calculations.
Default value = "NC" - norm-conserving PP. Currently is not actually used.
- "wd" - string, specifying the path (relatively to the directory from which the function is called) to the directory
where all calculations will be performed (working directory). This directory will be created, if it does not exist yet. Default value = "wd"
- "rd" - string, specifying the path (absolute!!!) to the directory where all results (Ham_ files, Hprime_ files, etc.) will
be collected (results directory). This directory must already be created by the user. Default value = same as for "wd"
- "minband" - integer, specifying the index (starting from 1, not to exceed the number of bands used in scf calculations)
of the minimal KS orbital to be included in the basis set of adiabatic KS (one-electron) states for which the Ham_ and Hprime_
files to be computed, including it. Default value = 1
- "maxband" - integer, specifying the index (starting from 1, not to exceed the number of bands used in scf calculations)
of the maximal KS orbital to be included in the basis set of adiabatic KS (one-electron) states for which the Ham_ and Hprime_
files to be computed, including it. Default value = 2.
Together with "minband" defines the dimensionality of the one-electron (KS basis) Hamiltonian matrix: maxband - minband + 1.
Thus, for the default values of maxband = 2 and minband = 1 the electronic Hamiltonian is a 2 x 2 matrix, computed using the
KS wavefunctions for the bands numbered 1 and 2, where 1 - is the first band (MO) given by QE code.
- "nocc" - integer, specifying the index (starting from 1, not to exceed the number of bands used in scf calculations) of
the occupied KS orbital. Default value = 1. Together with default values for "minband" and "maxband" this corresponds to
one occupied orbital (index 1) and one virtual orbital (index 2).
- "nac_method" - integer, specifying the type of an ad hoc NAC correction method.
Available values:
- 0 - no correction, NAC is computed as prescribed by Hammess-Schiffer and Tully[1]. See details in the PYXAIS paper.
- 1 - use the NAC and band gap correction as described in our work (to be published).
Default value = 0.
- "prefix0" - string, specifying the prefix for the files containing the input files for the electronic structure calculations
used in this step. This is for the case when params["nac_method"] = 0 or params["nac_method"] = 1. Default value = "x0.scf". The
prefix only defines the part of the input file, the full name of the input file also contains the integer that enumerates the
MD trajectory point and the suffix - ".in". In other words, for the MD configuration 10 (this value must be between "start_indx"
and "stop_indx" defined above) the input file will look like "x0.scf.10.in". Note that this file must be present in the directory
from which the runMD2() function is called (current working directory).
- "prefix1" - similarly to "prefix0", but is used only if params["nac_method"] = 1. Default value = "x1.scf".
- "wfc_preprocess" - string, specifying how to process (transform) the wavefunction read from the raw wavefunction file
(e.g. in "../curr0/x0.export/wfc.1") before using it to compute non-adiabatic couplings.
Available values:
- "normalize" - normalize all KS orbitals read from wfc. file to unity. Because such wfc is only pseudized one (unless this
was excplicitly performed by the pw_export program), the KS orbitals will neither be orthogonal to each other nor they will
be normalized. With this preprocessing option we help to make sure that they are at least normalized (this condition is
used in derivation of the numeriacal expression for the NAC given by Hammess-Schiffer and Tully[1]). Still, KS orbitals may be
non-orthogonal (but for the relatively large systems such non-orthogonality is relatively small)
- "complete" - needed if the calculations are performed at the gamma-point. In this case only a half or the wavefunction is
stored to save space. The other half (except for one point at the origin g = (0,0,0)) is obtained by complex conjugation of the
first part due to symmetry: c(g) = c*(-g). So with this option we restore the full wavefunction before it is used to compute
Hamiltonian matrix elements in the KS basis (Ham_ files) and other related quantities (such as Hprime_ files).
- "restore" - as it has already be mentioned above, the originally produced (pseudized) KS orbitals are not orthogonal.
With this option we "uproject" the pseudized wavefunctions to produce the true, "all-electron" wavefunctions (see out NAC correction
paper for details). This ensures that the wavefunctions are orthogonal and normalized before we compute NACs and other related
properties
Default value = "restore".
- "do_complete" - integer, specifying if the wavefunction must be completed (see "complete" option to "wfc_preprocess" key) before
it is restored (see "restore" option to "wfc_preprocess" key).
Available values:
- 0 - do not complete, restore the wavefunction straight ahead from what has been read
- 1 - complete the wavefunction first, then restore the all-electron wavefunction from the restored pseudized one. This is needed
if the gamma-trick is used, otherwise there may be problems in diagonalization procedures
Default value = 1.
- "compute_Hprime" - integer, specifying if the transition dipole moments (Hprime_ files) are to be computed (along 3 directions)
in addition to the Hamiltonian matrix elements (Ham_ files).
Available values:
- 0 - do not compute Hprime_ files
- 1 - compute Hprime_ files
Default value = 0.
- Used in:
level 3 codes
- Uses:
runMD.get_value(...)
pyxaid_core.wfc - class
pyxaid_core.wfc.QE_read_acsii_index(...)
pyxaid_core.wfc.QE_read_acsii_wfc(...)
pyxaid_core.wfc.normalize()
pyxaid_core.wfc.complete()
pyxaid_core.wfc.restore(...)
pyxaid_core.wfc.QE_read_acsii_grid(...)
pyxaid_core.wfc.compute_Hprime(...)
pyxaid_core.ham(...)
...
- Example:
See this tutorial
Module aux
Module average