Abstract class that should be subclassed when adding a new code interace.
Set the executable
Parse the value of the objective
from the file fname
Return scratch
Wrapper for running Dalton program
Parse a value from the output file fname
based on the
objective
.
If the value of the objective
is regexp
then the
regularexp
will be used to parse the file.
Run a single job
A dictionary with keys mol
and dal
and their
respective file name strings as values
Name of the dalton output file
Write dalton input files: fname.dal
and system.mol
Name of the input file .dal
Dictionary with templates for the dal
and mol
with those strings as keys and actual templates as
values
An instance of
BasisSet
class or a dictionary of
BasisSet
objects with element symbols as keys
chemtools.molecule.Molecule
Molecule object with the system geometry
Core definition
Container object for Gamess-us jobs.
Run a single gamess job interactively - without submitting to the queue.
Return the runopts
Return the version.
Write the molpro input to “fname” file based on the information from the keyword arguments.
chemtools.molecule.Molecule
Molecule object instance
BasisSet
An instance of BasisSet
class or a dictionary of BasisSet
objects with element symbols as keys
Molpro core specification
str
Template of the input file
str
Name of the input file to be used
Wrapper for the Molpro program.
Parse a value from the output file fname
based on the
objective
.
If the value of the objective
is regexp
then the
regularexp
will be used to parse the file.
Run a single molpro job interactively - without submitting to the queue.
Write the molpro input to “fname” file based on the information from the keyword arguments.
chemtools.molecule.Molecule
Molecule object instance
BasisSet
An instance of BasisSet
class or a
dictionary of BasisSet
objects with
element symbols as keys
Molpro core specification
str
Template of the input file
str
Name of the input file to be used
Wrapper for the Psi4 program.
Parse a value from the output file fname
based on the objective
.
If the value of the objective
is regexp
then the regularexp
will
be used to parse the file.
Run a single Psi4 job interactively - without submitting to the queue.
Write the Psi4 input to “fname” file based on the information from the keyword arguments.
chemtools.molecule.Molecule
Molecule object instance
BasisSet
An instance of BasisSet
class or a
dictionary of BasisSet
objects with
element symbols as keys
Psi4 core specification
str
Template of the input file
str
Name of the input file to be used
Basis set module supporting basic operation on basis sets.
Name of the basis set
Symbol of the element
Classification of the basis set functions, diffuse, tight
basis set family
Dict of functions with s, p, d, f, … as keys
Parameters for generating the functions according to the model
Append functions from another BasisSet object
BasisSet object whose functions will be added to the existing ones
Calculate the completeness profile of each shell of the basis set
Scaning exponents
numpy array with values of the profile (shells, zetas)
Return the contraction coefficients for a given shell in a matrix form with size ne * nc, where ne is the number of exponents and nc is the number of contracted functions
shell label, s, p, d, …
2D array with contraction coefficients
Try to determine the contraction type: segmented, general, uncontracted, unknown.
Calculate how many contracted functions are in each shell.
out : list of ints
Read and parse a basis set from file and return a BasisSet object
File name
Format of the basis set in the file (molpro, gamessus)
Name of the basis set
Basisset object parsed from file or dictionary of BasisSet objects
Instantiate the BasisSet object from a JSON string
A JSON serialized string with the basis set
Return a basis set object generated from a sequence based on the specified arguments.
Parameters to generate the basis set as a continuous list or array
A list of tuple specifying the shell type, number of functions and parameters, e.g. [(‘s’, ‘et’, 4, (0.5, 2.0)), (‘p’, ‘et’, 3, (1.0, 3.0))]
Name of the basis set
Chemical symbol of the element
out : BasisSet
Read a pickled BasisSet object from a pickle file
File name containing the BasisSet
Extra arguments for the pickle.load method
When you try to read a python2 pickle using python3, to fix that use encoding=’latin1’ option
Return a basis set object generated from a sequence based on the specified arguments.
A list of tuple specifying the shell type, number of functions and parameters, e.g. [(‘s’, ‘et’, 4, (0.5, 2.0)), (‘p’, ‘et’, 3, (1.0, 3.0))]
Name of the basis set
Chemical symbol of the element
out : BasisSet
Parse a basis set from string
A string with the basis set
Format of the basis set in the file: molpro, gamessus
Name of the basis set
Basisset object parsed from string or dictionary of BasisSet objects
Return the exponents of a given shell or if the shell isn’t specified return all of the available exponents
returned
Calculate the number of basis functions
flag indicating if spherical or cartesian functions should be used, default: True
number of basis functions
For each function (contracted) calculate the norm and return a list of tuples containing the shell, function index and the norm respectively.
Normalize contraction coefficients for each contracted functions based on the primitive overlaps so that the norm is equal to 1.
Return the number of primitive functions assuming sphrical or cartesian gaussians.
A flag to select either spherical or cartesian gaussians
Number of primitive function in the basis set
From a given basis set with shells spdf… return a list of basis sets that are subsets of the entered basis set with increasing angular momentum functions included [s, sp, spd, spdf, …]
Calculate how many primities are used in each contracted function.
out : list of ints
Calculate how many primitive functions are in each shell.
out : list of ints
Return a string with the basis set.
string describing output format for the exponents, default: “20.10f”
string describing output format for the contraction coefficients, default: “15.8f”
basis set string
Calculate the overlap integrals for a given shell
Shell
Overlap integral matrix
Sort shells in the order of increasing angular momentum and for each shell sort the exponents.
If False sort the exponents in each shell in the descending order (default), else sort exponents in ascending order
Return a string with the basis set in (new) CFOUR format.
comment string
string describing output format for the exponents, default: “20.10f”
string describing output format for the contraction coefficients, default: “15.8f”
basis set string in Cfour format
Return a string with the basis set in DALTON format.
prec “20.10f”
default “10.4f”
or python format string e.g. “15.8f”
basis set string in Dalton format
Return a string with the basis set in GAMESS(US) format.
string describing output format for the exponents, default: “20.10f”
string describing output format for the contraction coefficients, default: “15.8f”
basis set string in Gamess(US) format
Return a string with the basis set in Gaussian format.
string describing output format for the exponents, default: “20.10f”
string describing output format for the contraction coefficients, default: “15.8f”
basis set string in Gaussian format
Return a string with the basis set as LaTeX table/
Output format for the exponents, default: “20.10f”
Output format for the contraction coefficients, default: “15.8f”
basis set string in LaTeX format
Return a string with the basis set in MOLPRO format.
A flag to indicate whether to wrap the basis with basis={ } string
Output format for the exponents, default: “20.10f”
Output format for the contraction coefficients, default: “15.8f”
basis set string
Return a string with the basis set in NWChem format.
string describing output format for the exponents, default: “20.10f”
string describing output format for the contraction coefficients, default: “15.8f”
basis set string in NwChem format
Check if all the contracted functions have consecutive indices
Basis functions for a given shell asa dict with structure
{'e' : np.array(), 'cf': [np.array(), np.array(), ...]}
Reorder the exponents so that the indices of the contracted functions have consecutive inidices.
Basis functions for a given shell asa dict with structure
{'e' : np.array(), 'cf': [np.array(), np.array(), ...]}
Same shell as on input but with reordered exponents and relabelled contracted functions
Merge functions from two BasisSet objects
First BasisSet object to merge
Second BasisSet object to merge
BasisSet instance with functions from first and other merged
Calculate the overlap integrals for a given shell l and two sets of exponents
Angular momentum quantum number of the shell
First vector of exponents
Second vector of exponents
Overlap integrals
Calculate the number of spherical components of a function with a given angular momentum value l.
Calculate the number of cartesian components of a function with a given angular momentum value l.
From a set of exponents (zetas), using least square fit calculate the expansion coefficients into the legendre polynomials of the order kmax.
length of the legendre expansion
list of exponents (floats) to be fitted
numpy array of legendre expansion coeffcients of length kmax
From a set of exponents (zetas), using least square fit calculate the approximate $alpha$ and $beta$ parameters from the even tempered expansion.
list of exponents (floats) to be fitted
numpy array of legendre expansion coeffcients of length kmax
Generate a sequence of nf even tempered exponents accodring to the even tempered formula
Number fo exponents to generate
Alpha and beta parameters
Array of generated exponents (floats)
Generate a sequence of nf well tempered exponents accodring to the well tempered fromula
Number fo exponents to generate
Alpha, beta, gamma and delta parameters
Array of generated exponents (floats)
Generate a sequence of nf exponents from expansion in the orthonormal legendre polynomials as described in: Peterson, G. A. et.al J. Chem. Phys., Vol. 118, No. 3 (2003), eq. (7).
Number fo exponents to generate
Polynomial coefficients (expansion parameters)
Array of generated exponents (floats)
Generate an array of \(l_x\), \(l_y\), \(l_z\) components of cartesian gaussian with a given angular momentum value in canonical order.
l = 0
generates the result array([[0, 0, 0]])
l = 1
generates array([[1, 0, 0], [0, 1, 0], [0, 0, 1])
etc.
The functions are coded by triples of powers of x, y, z, namely
[1, 2, 3]
corresponds to \(xy^{2}z^{3}\).
Angular momentum value
Array of monomial powers, where columns correspond to x, y, and z respectively and rows correspond to functions.
Generates the expansion coefficients of the real spherical harmonics in terms of products of cartesian components. Method based on [Schelegel1995]
Schlegel, H. B., & Frisch, M. J. (1995). “Transformation between Cartesian and pure spherical harmonic Gaussians”. International Journal of Quantum Chemistry, 54(2), 83–87. doi:10.1002/qua.560540202
Angular momentum value
Expansion coefficients of real spherical harmonics in terms of cartesian gaussians
Parsing basis set from different formats.
Concatenate the arrays a and b using only the unique items from both arrays
a : numpy.array b : numpy.array
res[0] sorted union of a and b
res[1] indices of a items in res[0]
res[2] indices of b items in res[0]
A wrapper for parsing the basis sets in different formats.
A string with the basis set
Format in which the basis set is specified
A dictionary of parsed basis sets with element symbols as keys and basis set functions as values
Parse the basis set into a list of dictionaries from a string in gamess format.
Parse a basis set function information from list of strings into three lists containg: exponents, indices, coefficients.
Remeber that python doesn’t recognise the 1.0d-3 format where d or D is used to the regex subsitution has to take care of that.
Parse the basis set into a list of dictionaries from a string in gaussian format.
Optimization of basis set exponents and contraction coefficients.
basisopt
is a module containing flexible methods for optimizing primitive
exponents of basis sets
Basis Set Optimizer class is a convenient wrapper for optimizing primitive exponents of Gaussian basis sets using different code interfaces for performing the actual electronic structure calculations.
Name of the objective using which the optimization will be evaluated, if it is a callable/function it should take the output name as argument
Calculator
Subclass of the Calculator
specifying the electronic structure program to use
Molecule specifying the system
BasisSet
Basis set or dict
of basis set with basis sets whose exponents
are not going to be optimized
A dictionary specifying the basis set to be optimized, the keys should be element/atom symbol and the values should contain lists of 4-tuples composed of: shell, type, number of functions and parameters/exponents, for example,
>>> fs = {'H' : [('s', 'et', 10, (0.5, 2.0))]}
describes 10 s
-type exponents for H generated from even
tempered formula with parameters 0.5 and 2.0
A dictionary specifying the optimization algorithm and its options
Name of the job/input file for the single point calculator
Use natural logarithms of exponents in optimization rather than
their values, this option is only relevant if functions asre given
as exp
or exponents
Regular expression to use in search for the objective if
objective
is regexp
Flag to mark wheather to run separate single point jobs with different numbers of frozen core orbitals to calculate core energy
Flag enabling the use of penalty function, when two exponent in
any shell are too close the objective is multiplied by a penalty
factor calculated in get_penalty
Keyword arguments for the penalty function, default
{'alpha' : 25.0, 'smallestonly' : True}
Construct the BasisSet object from the result of the optimized exponents and function definition.
Name to be assigned to the basis set
Element symbol for the basis set
BasisSet
object with
the optimized functions
Return a dictionary with BasisSet
objects as values and
element symbols as keys. The dictionary is composed based on the current
parameters x0
and attributes of the BSOptimizer
including
the staticbs
For a given dict of basis sets calculate the penalty for pairs of exponents being too close together.
Dictionary of BasisSet
objects
Parameter controlling the magnitude and range of the penalty
A flag to mark whether to use only the smallest ratio to calculate the penalty or all smallest ratios from each shell and calculate the penalty as a product of individual penalties
For each basis and shell within the basis ratios between pairs of sorted exponents are calculated. The minimal ratio (closest to 1.0) is taken to calculate the penalty according to the formula
where \(r\) is the ratio between the two closest exponents (>1).
Optimize a basis set by saturating the function space shell by shell
list of shells to be optimized, in the order the optimization should be performed,
list specifying a set of function numbers to be scanned per each shell,
list specifying a set of starting parameters per each shell,
maximal number of parameters to be used in the legendre expansion, (length of the expansion)
threshold controlling the termination of the shell optimization, if energy difference between two basis sets with subsequent number of functionsis larger than this threshold, another function is added to this shell and parameters are reoptimized
options for the basis set optimization driver, see driver function from the basisopt module
For a given shell optimize the functions until the convergence criterion is reached the energy difference for two consecutive function numbers is less than the threshold
string label for the shell to be optimized
list of integers representing the number of basis functions to be inceremented in the optimization,
maximal number of parameters to be used in the legendre expansion, (length of the expansion)
threshold controlling the termination of the shell optimization, if energy difference between two basis sets with subsequent number of functionsis larger than this threshold, another function is added to this shell and parameters are reoptimized,
a flag to trigger saving all the optimized basis functions for each shell,
options for the basis set optimization driver, see driver function from the basisopt module
BasisSet object instance with optimized functions for the specified shell
when shell is different from s, p, d, f, g, h, i when number of parameters equals 1 and there are more functions when there are more parameters than functions to optimize
Funtion for running two single point calculations and parsing the resulting energy (or property) as specified by the objective function, primarily designed to extract core energy.
contains a list of parameters to be optimized, may be explicit exponents or parametrized exponents in terms of some polynomial
bsopt, bsnoopt, code, job, mol, opt, needed for writing input and parsing output
parsed result of the single point calculation as speficied by the objective function in the “job” dictionary
Funtion for running a single point calculation and parsing the resulting energy (or property) as specified by the objective function.
contains a list of parameters to be optimized, may be explicit exponents or parametrized exponents in terms of some polynomial
bsopt, bsnoopt, code, job, mol, opt, needed for writing input and parsing output
parsed result of the single point calculation as speficied by the objective function in the “job” dictionary
Complete Basis Set (CBS) extrapolation techniques.
Module for Complete Basis Set (CBS) Extrapolations.
CBS extrapolation formula by exponential Dunning-Feller relation.
function object
Three-point formula for extrapolating the HF reference energy [2].
A flag marking the use of two point extrapolation with b=9.0
funtion object
Three point extrapolation through sum of exponentials expression
An interface for performing CBS extrapolations using various methods.
A vector of basis set cardinal numbers
A vector of corresponding energies
Method/formula to use to perform the extrapolation
Keyword arguments to be passed to the requested extrapolation function using the method argument
CBS extrapolation by polynomial relation.
A flag for choosing the two point extrapolation
Order of the polynomial, default=3.0
A parameter modifying the cardinal number, default=0.0
CBS extrapolation using uniform singlet and triplet pair extrapolation (USTE) scheme [Varandas2007].
Varandas, A. J. C. (2007). “Extrapolating to the one-electron basis-set limit in electronic structure calculations. The Journal of Chemical Physics, 126(24), 244105. doi:10.1063/1.2741259
Cardinal number of the basis set
Approximation to the energy value at the CBS limit
Empirical A3 parameter
One of: ci, cc
function object
Module for handling atoms and molecules.
Basic atom class representing an atom.
Module with convenience functions for parsing files
Get a list of lines from a file between specified line numbers startlno and endlno.
Name of the file to process
Number of the first line to obtain
Number of the last line to obtain
A list of lines from the file filename between line numbers startlno and endlno
Return the lines from the files based on tolocate
Name of the file
List of tuples with strings to find (queries) as first elements and integer offset values as second
Return:
Given a file and a list of strings return a dict with string as keys and line numbers in which they appear a values.
Name of the file
List of tuples with strings to find (queries) as first elements and integer offset values as second
Dictionary whose keys are indices corresponding to item in input list and values are lists of line numbers in which those string appear
add option to ignore the case of the strings to search
Parse a given list of strings “los” into a dictionary based on separation by “sep” character and return the dictionary.
Return “num” elements of a sequence “seq” present after the item “item”.
Orbitals class
A convenience class for handling GAMESS(US) orbitals.
Determine the eigenvalues of the Lz operator for each nondegenerate or a combination of degenerate orbitals and assign them to lzvals column in the DataFrame
The Lz integrals over atomic orbitals are read from the dictionary file record No. 379.
Number of decimals to keep when comparing float eigenvalues
Threshold for keeping wights of the eiegenvalues (squared eigenvector components)
currently this only works if the eigenvalues on input are sorted
Calculate the fragment populations and assign each orbital to a fragment
Initialize the Orbitals instance based on orbital information parsed from the logfile and read from the dictfile.
One of hf or ci
Name of the GAMESS(US) log file
Name of the GAMESS(US) dictionary file .F10
Name of the GAMESS(US) dat file
This funciton assumes that the array a is sorted
http://stackoverflow.com/questions/25264798/checking-for-and-indexing-non-unique-duplicate-values-in-a-numpy-array http://stackoverflow.com/questions/5426908/find-unique-elements-of-floating-point-array-in-numpy-with-comparison-using-a-d
GamessReader : reading gamess binary files.
Class representing a binary file (C or Fortran ordered).
The file handler.
The order for file (‘c’ or ‘fortran’).
Read an array of dtype and shape from current position.
shape must be any tuple made of integers or even () for scalars.
The current position will be updated to point to the end of read data.
Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to 0 (offset from start of file, offset should be >= 0); other values are 1 (move relative to current position, positive or negative), and 2 (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). If the file is opened in text mode, only offsets returned by tell() are legal. Use of other offsets causes undefined behavior.
Wrapper for reading GAMESS(US) dictionary file (*.F10).
$JOB.F08 : two electron integrals over AO’s, $JOB.F09 : two electron integrals over MO’s, $JOB.F10 : the dictionary file with 1-e integrals, orbitals etc., $JOB.F15 : GUGA and ORMAS two-electron reduced density matrix,
Get the size of the vector holding upper (or lower) triangle of a square matrix of size naos or nmos.
Get the size of the 1d vector holding upper (or lower) triangle of a supermatrix of size nmos (2RDM and two-electrons integrals).
$JOB.F08 : two electron integrals over AO’s,
$JOB.F09 : two electron integrals over MO’s,
$JOB.F15 : GUGA and ORMAS two-electron reduced density matrix,
CI coefficients, and CI hamiltonian matrix elements.
Get the size of the vector holding upper (or lower) triangle of a square matrix of size naos or nmos.
Return the index buffer size for reading 2-electron integrals
Based on the four orbital indices i,j,k,l return the address in the 1d vector.
Read CI coefficients from file NFT12 and return them as a numpy array of floats.
Read FORTRAN sequential unformatted file with two-electron quantities:
two electron integrals over AO’s: .F08 file
two electron integrals over MO’s: .F09 file
elements of the two particle density matrix: .F15 file
size of the buffer holding values to be read, in
gamessus it is stored under NINTMX
variable and in
Linux version is equal to 15000 which is the default
value
a flag indicating if large labels should were used, if
largest label i
(of the MO) is i<255
then
large_labels
should be False
(case LABSIZ=1
in gamessus), otherwise set to True
(case LABSIZ=2
in gamess(us),
skips the first record of the file is set to True,
numpy 1D array holding the values
Based on the orbitals indices return the factor that takes into account the index permutational symmetry.
Based on the four orbital indices i, j, k, l return the address in the 1d vector.
alias of record