Dalton
(name='Dalton', **kwargs)[source]¶Wrapper for running Dalton program
parse
(fname, objective, regularexp=None)[source]¶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
(fname)[source]¶Run a single job
mol
and dal
and their
respective file name strings as valueswrite_input
(fname, template, basis, mol, core)[source]¶Write dalton input files: fname.dal
and system.mol
.dal
dal
and mol
with those strings as keys and actual templates as
valuesBasisSet
class or a dictionary of
BasisSet
objects with element symbols as keyschemtools.molecule.Molecule
GamessUS
(name='GamessUS', version='00', runopts=None, **kwargs)[source]¶Container object for Gamess-us jobs.
run
(inpfile, logfile=None, remove_dat=True)[source]¶Run a single gamess job interactively - without submitting to the queue.
runopts
¶Return the runopts
version
¶Return the version.
write_input
(fname, template=None, mol=None, basis=None, core=None)[source]¶Write the molpro input to “fname” file based on the information from the keyword arguments.
chemtools.molecule.Molecule
BasisSet
BasisSet
class or a dictionary of BasisSet
objects with element symbols as keysstr
str
Molpro
(name='Molpro', **kwargs)[source]¶Wrapper for the Molpro program.
parse
(fname, objective, regularexp=None)[source]¶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_multiple
(inputs)[source]¶Run a single molpro job interactively - without submitting to the queue.
write_input
(fname=None, template=None, mol=None, basis=None, core=None)[source]¶Write the molpro input to “fname” file based on the information from the keyword arguments.
chemtools.molecule.Molecule
BasisSet
BasisSet
class or a
dictionary of BasisSet
objects with
element symbols as keysstr
str
Psi4
(name='Psi4', **kwargs)[source]¶Wrapper for the Psi4 program.
parse
(fname, objective, regularexp=None)[source]¶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_multiple
(inputs)[source]¶Run a single Psi4 job interactively - without submitting to the queue.
write_input
(fname, template, mol=None, basis=None, core=None)[source]¶Write the Psi4 input to “fname” file based on the information from the keyword arguments.
chemtools.molecule.Molecule
BasisSet
BasisSet
class or a
dictionary of BasisSet
objects with
element symbols as keysstr
str
BasisSet
(name, element, family=None, kind=None, functions=None, info=None)[source]¶Basis set module supporting basic operation on basis sets.
append
(other)[source]¶Append functions from another BasisSet object
completeness_profile
(zetas)[source]¶Calculate the completeness profile of each shell of the basis set
contraction_matrix
(shell)[source]¶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
contraction_type
()[source]¶Try to determine the contraction type: segmented, general, uncontracted, unknown.
contractions_per_shell
()[source]¶Calculate how many contracted functions are in each shell.
from_file
(fname=None, fmt=None, name=None)[source]¶Read and parse a basis set from file and return a BasisSet object
from_json
(jsonstring, **kwargs)[source]¶Instantiate the BasisSet object from a JSON string
from_optpars
(x0, funs=None, name=None, element=None, explogs=False)[source]¶Return a basis set object generated from a sequence based on the specified arguments.
from_pickle
(fname, **kwargs)[source]¶Read a pickled BasisSet object from a pickle file
from_sequence
(funs=None, name=None, element=None)[source]¶Return a basis set object generated from a sequence based on the specified arguments.
from_str
(string, fmt=None, name=None)[source]¶Parse a basis set from string
get_exponents
(asdict=True)[source]¶Return the exponents of a given shell or if the shell isn’t specified return all of the available exponents
nf
(spherical=True)[source]¶Calculate the number of basis functions
normalization
()[source]¶For each function (contracted) calculate the norm and return a list of tuples containing the shell, function index and the norm respectively.
normalize
()[source]¶Normalize contraction coefficients for each contracted functions based on the primitive overlaps so that the norm is equal to 1.
nprimitive
(spherical=True)[source]¶Return the number of primitive functions assuming sphrical or cartesian gaussians.
partial_wave_expand
()[source]¶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, …]
primitives_per_contraction
()[source]¶Calculate how many primities are used in each contracted function.
primitives_per_shell
()[source]¶Calculate how many primitive functions are in each shell.
print_functions
(efmt='20.10f', cfmt='15.8f')[source]¶Return a string with the basis set.
shell_overlap
(shell)[source]¶Calculate the overlap integrals for a given shell
sort
(reverse=False)[source]¶Sort shells in the order of increasing angular momentum and for each shell sort the exponents.
to_cfour
(comment='', efmt='15.8f', cfmt='15.8f')[source]¶Return a string with the basis set in (new) CFOUR format.
to_dalton
(fmt='prec')[source]¶Return a string with the basis set in DALTON format.
to_gamessus
(efmt='20.10f', cfmt='15.8f')[source]¶Return a string with the basis set in GAMESS(US) format.
to_gaussian
(efmt='20.10f', cfmt='15.8f')[source]¶Return a string with the basis set in Gaussian format.
to_latex
(efmt='20.10f', cfmt='15.8f')[source]¶Return a string with the basis set as LaTeX table/
to_molpro
(withpars=False, efmt='20.10f', cfmt='15.8f')[source]¶Return a string with the basis set in MOLPRO format.
to_nwchem
(efmt='20.10f', cfmt='15.8f')[source]¶Return a string with the basis set in NWChem format.
has_consecutive_indices
(shell)[source]¶Check if all the contracted functions have consecutive indices
{'e' : np.array(), 'cf': [np.array(), np.array(), ...]}
reorder_shell_to_consecutive
(shell)[source]¶Reorder the exponents so that the indices of the contracted functions have consecutive inidices.
{'e' : np.array(), 'cf': [np.array(), np.array(), ...]}
merge
(first, other)[source]¶Merge functions from two BasisSet objects
primitive_overlap
(l, a, b)[source]¶Calculate the overlap integrals for a given shell l and two sets of exponents
nspherical
(l)[source]¶Calculate the number of spherical components of a function with a given angular momentum value l.
ncartesian
(l)[source]¶Calculate the number of cartesian components of a function with a given angular momentum value l.
zetas2legendre
(zetas, kmax)[source]¶From a set of exponents (zetas), using least square fit calculate the expansion coefficients into the legendre polynomials of the order kmax.
zetas2eventemp
(zetas)[source]¶From a set of exponents (zetas), using least square fit calculate the approximate $alpha$ and $beta$ parameters from the even tempered expansion.
eventemp
(numexp, params)[source]¶Generate a sequence of nf even tempered exponents accodring to the even tempered formula
welltemp
(numexp, params)[source]¶Generate a sequence of nf well tempered exponents accodring to the well tempered fromula
legendre
(numexp, coeffs)[source]¶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).
xyzlist
(l)[source]¶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])
The functions are coded by triples of powers of x, y, z, namely
[1, 2, 3]
corresponds to \(xy^{2}z^{3}\).
zlmtoxyz
(l)[source]¶Generates the expansion coefficients of the real spherical harmonics in terms of products of cartesian components. Method based on [Schelegel1995]
[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 |
Parsing basis set from different formats.
NumpyEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶merge_exponents
(a, b)[source]¶Concatenate the arrays a and b using only the unique items from both arrays
parse_basis
(string, fmt=None)[source]¶A wrapper for parsing the basis sets in different formats.
parse_gamessus_basis
(string)[source]¶Parse the basis set into a list of dictionaries from a string in gamess format.
parse_gamessus_function
(lines)[source]¶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_gaussian_basis
(string)[source]¶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
BSOptimizer
(objective=None, core=None, template=None, regexp=None, verbose=False, code=None, optalg=None, mol=None, fsopt=None, staticbs=None, fname=None, uselogs=True, runcore=False, penalize=None, penaltykwargs=None, logfile=None)[source]¶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.
Calculator
Calculator
specifying the electronic structure program to useBasisSet
dict
of basis set with basis sets whose exponents
are not going to be optimizedA 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
exp
or exponents
objective
is regexpget_penalty
{'alpha' : 25.0, 'smallestonly' : True}
get_basis
(name=None, element=None)[source]¶Construct the BasisSet object from the result of the optimized exponents and function definition.
BasisSet
object with
the optimized functionsget_basis_dict
(bso, x0)[source]¶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
get_penalty
(bsdict, alpha=25.0, smallestonly=True)[source]¶For a given dict of basis sets calculate the penalty for pairs of exponents being too close together.
BasisSet
objectsFor 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).
opt_multishell
(shells=None, nfps=None, guesses=None, max_params=5, opt_tol=0.0001, save=False, bsopt=None, **kwargs)[source]¶Optimize a basis set by saturating the function space shell by shell
opt_shell_by_nf
(shell=None, nfs=None, max_params=5, opt_tol=0.0001, save=False, bsopt=None, **kwargs)[source]¶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
run_core_energy
(x0, *args)[source]¶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.
run_total_energy
(x0, *args)[source]¶Funtion for running a single point calculation and parsing the resulting energy (or property) as specified by the objective function.
Complete Basis Set (CBS) extrapolation techniques.
Module for Complete Basis Set (CBS) Extrapolations.
expo
()[source]¶CBS extrapolation formula by exponential Dunning-Feller relation.
exposqrt
(twopoint=True)[source]¶Three-point formula for extrapolating the HF reference energy [2].
[2] | Karton, A., & Martin, J. M. L. (2006). Comment on: “Estimating the Hartree-Fock limit from finite basis set calculations” [Jensen F (2005) Theor Chem Acc 113:267]. Theoretical Chemistry Accounts, 115, 330–333. doi:10.1007/s00214-005-0028-6 |
exposum
()[source]¶Three point extrapolation through sum of exponentials expression
extrapolate
(x, energy, method, **kwargs)[source]¶An interface for performing CBS extrapolations using various methods.
poly
(p=0.0, z=3.0, twopoint=True)[source]¶CBS extrapolation by polynomial relation.
uste
(method='CI')[source]¶CBS extrapolation using uniform singlet and triplet pair extrapolation (USTE) scheme [Varandas2007].
[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 |
Module for handling atoms and molecules.
Atom
(identifier, xyz=(0.0, 0.0, 0.0), dummy=False, id=None)[source]¶Basic atom class representing an atom.
Module with convenience functions for parsing files
getchunk
(filename, startlno, endlno)[source]¶Get a list of lines from a file between specified line numbers startlno and endlno.
getlines
(filename, tolocate)[source]¶Return the lines from the files based on tolocate
Return:
locatelinenos
(filename, tolocate)[source]¶Given a file and a list of strings return a dict with string as keys and line numbers in which they appear a values.
parsepairs
(los, sep='=')[source]¶Parse a given list of strings “los” into a dictionary based on separation by “sep” character and return the dictionary.
sliceafter
(seq, item, num)[source]¶Return “num” elements of a sequence “seq” present after the item “item”.
Orbitals class
Orbitals
(*args, **kwargs)[source]¶A convenience class for handling GAMESS(US) orbitals.
assign_lz_values
(decimals=6, tolv=0.01)[source]¶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.
fragment_populations
()[source]¶Calculate the fragment populations and assign each orbital to a fragment
from_files
(name=None, logfile=None, dictfile=None, datfile=None)[source]¶Initialize the Orbitals instance based on orbital information parsed from the logfile and read from the dictfile.
check_duplicates
(a, decimals=6)[source]¶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.
BinaryFile
(filename, mode='r', order='fortran')[source]¶Class representing a binary file (C or Fortran ordered).
file
= None¶The file handler.
order
= None¶The order for file (‘c’ or ‘fortran’).
read
(dtype, shape=(1, ))[source]¶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.
seek
(offset, whence=0)[source]¶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.
DictionaryFile
(filename, irecln=4090, int_size=8)[source]¶Wrapper for reading GAMESS(US) dictionary file (*.F10).
GamessFortranReader
(log)[source]¶get_onee_size
(aos=True)[source]¶Get the size of the vector holding upper (or lower) triangle of a square matrix of size naos or nmos.
get_twoe_size
(aos=False)[source]¶Get the size of the 1d vector holding upper (or lower) triangle of a supermatrix of size nmos (2RDM and two-electrons integrals).
GamessReader
(log)[source]¶get_onee_size
(aos=True)[source]¶Get the size of the vector holding upper (or lower) triangle of a square matrix of size naos or nmos.
SequentialFile
(filename, logfile=None)[source]¶get_index_buffsize
(buff_size, int_size)[source]¶Return the index buffer size for reading 2-electron integrals
ijkl
(i, j, k, l)[source]¶Based on the four orbital indices i,j,k,l return the address in the 1d vector.
read_ci_coeffs
()[source]¶Read CI coefficients from file NFT12 and return them as a numpy array of floats.
readseq
(buff_size=15000, int_size=8, mos=False, skip_first=False)[source]¶Read FORTRAN sequential unformatted file with two-electron quantities:
NINTMX
variable and in
Linux version is equal to 15000 which is the default
valuei
(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),factor
(i, j, k, l)[source]¶Based on the orbitals indices return the factor that takes into account the index permutational symmetry.
ijkl
(i, j, k, l)[source]¶Based on the four orbital indices i, j, k, l return the address in the 1d vector.
rec
¶alias of chemtools.calculators.gamessreader.record