veloxchem package

Submodules

veloxchem.blockdavidson module

class veloxchem.blockdavidson.BlockDavidsonSolver

Bases: object

Implements block Davidson solver for symmetric eigenvalues/eigenvectors problems i.e. A * X = e X. Reference: SIAM J. Sci. Comput. 15 (1994), 62-76.

Instance variables
  • neigenpairs: The number of eigenpairs of A matrix determined by solver.

  • sigma_matrices: The sigma vectors A * X in matrix format {A * X_0, A * X_1,…}.

  • trial_matrices: The trial vectors in matrix format {X_0, X_1,…}.

add_iteration_data(sig_mat, trial_mat, iteration)

Add sigma and trial vectors to sigma and trial matrices for specific iteration.

Parameters
  • sig_mat – The sigma vectors {A * X_i} i = 0..l.

  • trial_mat – The trial vectors {X_i} i = 0..l.

  • iteration – The index of block Davidson iteration.

check_convergence(conv_thresh)

Checks if residual norm is bellow given convergence threshold for all requested eigenpairs of symmetric A matrix.

Parameters

conv_thresh – The convergence threshold for the solver.

Returns

True if residual norms are converged for all eigenpairs, False otherwise.

comp_residual_vectors()

Computes residual vectors and their norms by diagonalizing interaction matrix in reduced space.

comp_trial_vectors(diag_mat)

Computes new trial vectors by applying Davidson preconditioner to residual vectors.

Parameters

diag_mat – The approximate diagonal of symmetric A matrix as column matrix.

Returns

The trial vectors.

compute(diag_mat)

Computes new set of trial vectors by solving eigenvalues problem by diagonalizing interaction matrix in reduced space.

Parameters

diag_mat – The approximate diagonal of symmetric A matrix as column matrix.

Returns

The new set of trial vectors.

get_eigenvalues()

Gets smallest eigenvalues of symmetric A matrix and associated residual norms.

Returns

tuple (eigenvalues, residual norms).

max_min_residual_norms()

Determines maximum and minumum residual norms within set of requested eigenpairs.

Returns

tuple (max. residual norm, min. residual norm).

project_trial_vectors(tvecs)

Projects out trial vector components already present in reduced space expansion and renormalizes resulting trial vectors.

Parameters

tvecs – The trial vectors.

reduced_space_size()

Gets number of trial vectors in residual space.

Returns

The number of trial vectors in residual space.

veloxchem.c2diis module

class veloxchem.c2diis.CTwoDiis

Bases: object

Implements direct inversion of the iterative subspace in C2 form proposed by H. Seller.

Instance variables
  • error_vectors: The list of error vectors.

comp_bmatrix()

Computes B-matrix of C2-DIIS method using error vectors.

Returns

The B-matrix.

compute_error_vectors(fock_matrices, density_matrices, overlap_matrix, oao_matrix)

Computes error vectors for list of AO Fock matrices using (FDS - SDF) in orthogonal AO basis.

Parameters
  • fock_matrices – The list of AO Fock matrices.

  • density_matrices – The list of AO density matrices.

  • overlap_matrix – The overlap matrix.

  • oao_matrix – The orthogonalization matrix.

compute_unrestricted_error_vectors(fock_matrices, fock_matrices_beta, density_matrices, density_matrices_beta, overlap_matrix, oao_matrix)

Computes error vectors for list of AO Fock matrices using (FDS - SDF) in orthogonal AO basis.

Parameters
  • fock_matrices – The list of AO Fock matrices (alpha spin).

  • fock_matrices_beta – The list of AO Fock matrices (beta spin).

  • density_matrices – The list of AO density matrices (alpha spin).

  • density_matrices_beta – The list of AO density matrices (beta spin).

  • overlap_matrix – The overlap matrix.

  • oao_matrix – The orthogonalization matrix.

compute_weights()

Computes C2-DIIS weights from error vectors using H. Sellers method (Int. J. Quantum Chem., vol. 45, pp. 31-41, 1993).

Returns

The array of C2-DIIS weights with smallest residual error.

norm_bvectors(bvectors)

Normalizes B-matrix eigenvectors by rescaling them to 1.0.

Parameters

bvectors – The array of B-matrix eigenvectors.

Returns

The normalized B-matrix eigenvectors.

pick_weights(weights)

Picks normalize B-matrix eigenvector with smallest residual error by computing residual error for all eigenvectors of B_matrix.

Parameters

bvectors – The array of B-matrix eigenvectors.

Returns

The normalized B-matrix eigenvector.

veloxchem.c6solver module

class veloxchem.c6solver.C6Solver(comm, ostream)

Bases: veloxchem.linearsolver.LinearSolver

Implements the C6 value response solver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • a_operator: The A operator.

  • a_components: Cartesian components of the A operator.

  • b_operator: The B operator.

  • b_components: Cartesian components of the B operator.

  • n_points: The number of integration points.

  • w0: The transformation function prefactor.

compute(molecule, basis, scf_tensors)

Solves for the response vector iteratively while checking the residuals for convergence.

Parameters
  • molecule – The molecule.

  • basis – The AO basis.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

A dictionary containing response functions and solutions.

get_full_solution_vector(solution)

Gets a full solution vector from the distributed solution.

Parameters

solution – The distributed solution as a tuple.

Returns

The full solution vector.

get_precond(orb_ene, nocc, norb, iw)

Constructs the preconditioners.

Parameters
  • orb_ene – The orbital energies.

  • nocc – The number of doubly occupied orbitals.

  • norb – The number of orbitals.

  • iw – The imaginary frequency.

Returns

The distributed preconditioners.

precond_trials(vectors, precond)

Applies preconditioner to distributed trial vectors.

Parameters
  • vectors – The set of vectors.

  • precond – The preconditioner.

Returns

The preconditioned gerade and ungerade trial vectors.

preconditioning(precond, v_in)

Applies preconditioner to a tuple of distributed trial vectors.

Parameters
  • precond – The preconditioner.

  • v_in – The input trial vectors.

Returns

A tuple of distributed trail vectors after preconditioning.

print_iteration(relative_residual_norm, xvs)

Prints information of the iteration.

Parameters
  • relative_residual_norm – Relative residual norms.

  • xvs – A list of tuples containing operator component, imaginary frequency, and property.

update_settings(rsp_dict, method_dict=None)

Updates response and method settings in C6 solver.

Parameters
  • rsp_dict – The dictionary of response dict.

  • method_dict – The dictionary of method rsp_dict.

veloxchem.checkpoint module

veloxchem.checkpoint.append_rsp_solution_hdf5(fname, key, vec)

Appends a solution vector to checkpoint file.

Parameters
  • fname – The name of the checkpoint file.

  • key – The key for the solution vector.

  • vec – The solution vector.

veloxchem.checkpoint.check_rsp_hdf5(fname, labels, molecule, basis, dft_dict, pe_dict)

Checks validity of the checkpoint file. Nuclear charges and basis set will be used to validate the checkpoint file.

Parameters
  • fname – Name of the checkpoint file.

  • labels – The list of labels for trial vecotrs and transformed vectors.

  • molecule – The molecule.

  • basis – The AO basis set.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

Returns

True if the checkpoint file is valid, False otherwise.

veloxchem.checkpoint.read_rsp_hdf5(fname, labels, molecule, basis, dft_dict, pe_dict, ostream)

Reads response vectors from checkpoint file. Nuclear charges and basis set will be used to validate the checkpoint file.

Parameters
  • fname – Name of the checkpoint file.

  • labels – The list of labels for trial vecotrs and transformed vectors.

  • molecule – The molecule.

  • basis – The AO basis set.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

  • ostream – The output stream.

Returns

The trial vectors and transformed vectors.

veloxchem.checkpoint.write_rsp_hdf5(fname, arrays, labels, molecule, basis, dft_dict, pe_dict, ostream)

Writes response vectors to checkpoint file. Nuclear charges and basis set can also be written to the checkpoint file.

Parameters
  • fname – Name of the checkpoint file.

  • arrays – The response vectors.

  • labels – The list of labels for trial vecotrs and transformed vectors.

  • molecule – The molecule.

  • basis – The AO basis set.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

  • ostream – The output stream.

Returns

True if checkpoint file is written. False if checkpoint file is not valid.

veloxchem.cppsolver module

class veloxchem.cppsolver.ComplexResponse(comm, ostream)

Bases: veloxchem.linearsolver.LinearSolver

Implements the complex linear response solver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • a_operator: The A operator.

  • a_components: Cartesian components of the A operator.

  • b_operator: The B operator.

  • b_components: Cartesian components of the B operator.

  • frequencies: The frequencies.

  • damping: The damping parameter.

compute(molecule, basis, scf_tensors, v1=None)

Solves for the response vector iteratively while checking the residuals for convergence.

Parameters
  • molecule – The molecule.

  • basis – The AO basis.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

  • v1 – The gradients on the right-hand side. If not provided, v1 will be computed for the B operator.

Returns

A dictionary containing response functions, solutions and a dictionarry containing solutions and kappa values when called from a non-linear response module.

get_full_solution_vector(solution)

Gets a full solution vector from the distributed solution.

Parameters

solution – The distributed solution as a tuple.

Returns

The full solution vector.

get_precond(orb_ene, nocc, norb, w, d)

Constructs the preconditioners.

Parameters
  • orb_ene – The orbital energies.

  • nocc – The number of doubly occupied orbitals.

  • norb – The number of orbitals.

  • w – The frequency.

  • d – The damping parameter.

Returns

The distributed preconditioners.

precond_trials(vectors, precond)

Applies preconditioner to distributed trial vectors.

Parameters
  • vectors – The set of vectors.

  • precond – The preconditioner.

Returns

The preconditioned gerade and ungerade trial vectors.

preconditioning(precond, v_in)

Applies preconditioner to a tuple of distributed trial vectors.

Parameters
  • precond – The preconditioner.

  • v_in – The input trial vectors.

Returns

A tuple of distributed trail vectors after preconditioning.

print_iteration(relative_residual_norm, xvs)

Prints information of the iteration.

Parameters
  • relative_residual_norm – Relative residual norms.

  • xvs – A list of tuples containing operator component, frequency, and property.

update_settings(rsp_dict, method_dict=None)

Updates response and method settings in complex liner response solver.

Parameters
  • rsp_dict – The dictionary of response dict.

  • method_dict – The dictionary of method rsp_dict.

veloxchem.denguess module

class veloxchem.denguess.DensityGuess(guess_type='SAD', checkpoint_file=None)

Bases: object

Implements initial density guess generator with set of different methods for generation of initial density.

Parameters
  • guess_type – The type of initial guess.

  • checkpoint_file – The name of checkpoint file.

property guess_type

Getter function for protected guess_type attribute.

prcmo_density(molecule, ao_basis, red_basis, red_orbs)

Computes initial AO density from molecular orbitals obtained by inserting molecular orbitals from reduced basis into molecular orbitals in full AO basis.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis.

  • red_basis – The reduced AO basis for generation of molecular orbitals.

  • red_orbs – The molecular orbitals in reduced AO basis.

Returns

The AO density matrix from PRCMO.

restart_density(molecule, rank, ostream)

Reads initial molecular orbitals and AO density from checkpoint file.

Parameters
  • molecule – The molecule.

  • rank – The rank of the MPI process.

  • ostream – The output stream.

Returns

The AO density matrix to restart from.

sad_density(molecule, ao_basis, min_basis, overlap_matrix, restricted, comm, ostream)

Computes initial AO density using superposition of atomic densities scheme.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis.

  • min_basis – The minimal AO basis for generation of atomic densities.

  • overlap_matrix – The AO overlap matrix.

  • restricted – The flag for generating restricted initial guess.

  • comm – The local MPI communicator.

  • ostream – The output stream.

Returns

The AO density matrix from SAD initial guess.

validate_checkpoint(rank, comm, nuclear_charges, basis_set, restricted)

Validates the checkpoint file by checking nuclear charges and basis set.

Parameters
  • rank – The rank of the MPI process.

  • comm – The MPI communicator.

  • nuclear_charges – Numpy array of the nuclear charges.

  • basis_set – Name of the AO basis.

  • restricted – The flag for restricted molecular orbitals.

Returns

Validity of the checkpoint file.

veloxchem.distributedarray module

class veloxchem.distributedarray.DistributedArray(array, comm, distribute=True)

Bases: object

Impements distributed array.

Parameters
  • array – The numpy array stored on the master node.

  • comm – The communicator.

  • distribute – The flag for distributing the array via scatter.

Instance variable
  • comm: The communicator.

  • rank: The MPI rank.

  • nodes: Number of MPI processes.

  • data: The numpy array stored in the distributed array.

append(dist_array, axis=None)

Appends a distributed array to self.

Parameters
  • dist_array – The distributed array.

  • axis – The axis parameter as in numpy.append.

append_to_hdf5_file(fname, label)

Appends an array to checkpoint file.

Parameters
  • fname – The name of the checkpoint file.

  • label – The label for the array.

Returns

The time spent in writing to checkpoint file.

array()

Returns the numpy array stored in the object.

Returns

The numpy array.

dot(i, dist_array, j)

Returns the dot product between a column vector in self and a column vector in a distributed array.

Parameters
  • i – The column index in self.

  • dist_array – The distributed array.

  • j – The column index in dist_array.

Returns

The dot product.

get_full_vector(col=None)

Gets a full column vector from a distributed array.

Param

col: The column index (used only when self.data.ndim is 2).

Returns

The full vector on the master node, None on other nodes.

matmul_AB(array, factor=None)

Computes matrix-matrix multiplication between self and a numpy array that is available on all nodes.

Parameters
  • array – The numpy array.

  • factor – The factor to be multiplied to the result.

Returns

A numpy array on the master node, None on other nodes.

matmul_AB_no_gather(array, factor=None)

Computes matrix-matrix multiplication between self and a numpy array that is available on all nodes.

Parameters
  • array – The numpy array.

  • factor – The factor to be multiplied to the result.

Returns

A distributed array.

matmul_AtB(dist_array, factor=None)

Computes matrix-matrix multiplication between self.T and a distributed array.

Parameters
  • dist_array – The distributed array.

  • factor – The factor to be multiplied to the result.

Returns

A numpy array on the master node, None on other nodes.

matmul_AtB_allreduce(dist_array, factor=None)

Computes matrix-matrix multiplication between self.T and a distributed array, and makes the result available on all nodes.

Parameters
  • dist_array – The distributed array.

  • factor – The factor to be multiplied to the result.

Returns

A numpy array that is available on all nodes.

norm(axis=None)

Returns the norm of the distributed array along axis.

Parameters

axis – The axis.

Returns

The norm along axis.

classmethod read_from_hdf5_file(fname, label, comm)

Reads an array from checkpoint file and returns a distributed array.

Parameters
  • fname – The name of the checkpoint file.

  • label – The label for the array.

  • comm – The communicator.

Returns

The distributed array.

shape(axis)

Returns the shape of the distributed array along axis.

Parameters

axis – The axis.

Returns

The shape along axis.

veloxchem.errorhandler module

veloxchem.errorhandler.assert_msg_critical(condition, msg='')

Asserts that the condition is true. Otherwise terminates the program with an error message.

Parameters
  • condition – The condition.

  • msg – The error message.

veloxchem.excitondriver module

class veloxchem.excitondriver.ExcitonModelDriver(comm, ostream)

Bases: object

Implements the exciton model.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • H: The exciton model Hamiltonian matrix.

  • trans_dipoles: The diabatic electric transition dipole moments in length form.

  • velo_trans_dipoles: The diabatic electric transition dipole moments in velocity form.

  • magn_trans_dipoles: The diabatic magnetic transition dipole moments.

  • center_of_mass: The center of mass of the whole system.

  • state_info: Information of the diabatic excited states.

  • monomers: The monomer dictionaries.

  • natoms: The list containing number of atoms in each monomer.

  • charges: The list containing net charges of each monomer.

  • qq_type: The electron repulsion integrals screening scheme.

  • eri_thresh: The electron repulsion integrals screening threshold.

  • dft: The flag for running DFT.

  • grid_level: The accuracy level of DFT grid.

  • xcfun_label: The name of XC functional.

  • scf_conv_thresh: The convergence threshold for the SCF driver.

  • scf_max_iter: The maximum number of SCF iterations.

  • nstates: The number of locally excited states for each monomer.

  • ct_nocc: The number of occupied orbitals to be involved in charge-transfer excited states.

  • ct_nvir: The number of virtual orbitals to be involved in charge-transfer excited states.

  • tda_conv_thresh: The convergence threshold for the TDA driver.

  • tda_max_iter: The maximum number of TDA iterations.

  • comm: The MPI communicator.

  • rank: The MPI rank.

  • nodes: Number of MPI processes.

  • ostream: The output stream.

  • restart: The flag for restarting from checkpoint file.

  • checkpoint_file: Name of the exciton model checkpoint file.

compute(molecule, basis, min_basis)

Executes exciton model calculation and writes checkpoint file.

Parameters
  • molecule – The molecule.

  • basis – The AO basis.

  • min_basis – The minimal AO basis for generating initial guess.

print_absorption(title, eigvals, osc_str)

Prints absorption spectrum.

Parameters
  • title – The title.

  • eigvals – The eigenvalues (adiabatic excitation energies).

  • osc_str – The oscillator strengths.

print_banner(title)

Prints header.

Parameters

title – The text to be shown in the header.

print_ecd(title, rot_str)

Prints electronic circular dichroism spectrum.

Parameters
  • title – The title.

  • rot_str – The rotatory strengths in 10**(-40) (esu**2)*(cm**2).

print_title(num_LE, num_CT)

Prints exciton model title.

Parameters
  • num_LE – The total number of locally excited states.

  • num_CT – The total number of charge-transfer excited states.

update_settings(exciton_dict, method_dict=None)

Updates settings in exciton model driver.

Parameters

exciton_dict – The settings dictionary.

veloxchem.inputparser module

exception veloxchem.inputparser.InputError

Bases: Exception

class veloxchem.inputparser.InputParser(filename, outname=None)

Bases: object

Implements the input parser and provides functions for parsing VeloxChem input files into a format, which passes the needed information to the rest of the program.

Parameters
  • filename – The name of the input file.

  • outname – The name of the output file.

Instance variables
  • input_dict: The input dictionary.

  • success_monitor: The monitor for successful parsing.

  • filename: The name of the input file.

  • is_basis_set: The flag for parsing a basis set file.

  • basis_set_name: The name of the basis set.

clear_interspace()

Deletes content that is not within a group.

consistency_checks()

Checks consistency in the input groups.

convert_dict()

Converting the list of lists into a dictionary with groupnames as keys and group content as a dictionary itself. The geometry definition of the molecule group is stored in a different dictionary. Converting the molecular structure into the required format.

empty_group_check()

Checks for any empty groups.

get_dict()

Gets the input dictonary.

Returns

A dictionary containing all information form the input file.

groupsplit()

Creates a list in which every element is a list itself containing every line of a group, while deleting ‘@’ and @end’ tags.

incomplete_group_check()

Checks for any incomplete groups.

parse()

Calls every function needed for the parsing process depending on the success of the parsing in different stages.

static parse_frequencies(input_frequencies)

Parses frequencies input for response solver. Input example: ‘0.0 - 0.2525 (0.0025), 0.5 - 1.0 (0.02), 2.0’

Parameters

input_frequencies – The string of input frequencies.

read_file()

Reads and stores content of selected file as a string type. Deletes comments (marked by ‘!’) and unnecassary whitespace.

verify_options(group)

Detect input errors for selected input group. Checks and messages defined by verifiers dict.

Parameters

group – The input group.

veloxchem.linearsolver module

class veloxchem.linearsolver.LinearSolver(comm, ostream)

Bases: object

Implements linear solver.

Parameters
  • comm – The MPI communicator.

  • use_split_comm – The flag for using split communicators.

Instance variables
  • eri_thresh: The electron repulsion integrals screening threshold.

  • qq_type: The electron repulsion integrals screening scheme.

  • batch_size: The batch size for computation of Fock matrices.

  • dft: The flag for running DFT.

  • grid_level: The accuracy level of DFT grid.

  • xcfun: The XC functional.

  • pe: The flag for running polarizable embedding calculation.

  • pe_options: The dictionary with options for polarizable embedding.

  • use_split_comm: The flag for using split communicators.

  • split_comm_ratio: The list of ratios for split communicators.

  • conv_thresh: The convergence threshold for the solver.

  • max_iter: The maximum number of solver iterations.

  • cur_iter: Index of the current iteration.

  • small_thresh: The norm threshold for a vector to be considered a zero vector.

  • lindep_thresh: The threshold for removing linear dependence in the trial vectors.

  • is_converged: The flag for convergence.

  • comm: The MPI communicator.

  • rank: The MPI rank.

  • nodes: Number of MPI processes.

  • ostream: The output stream.

  • restart: The flag for restarting from checkpoint file.

  • checkpoint_file: The name of checkpoint file.

  • program_start_time: The start time of the program.

  • maximum_hours: The timelimit in hours.

  • timing: The flag for printing timing information.

  • profiling: The flag for printing profiling information.

  • memory_profiling: The flag for printing memory usage.

  • memory_tracing: The flag for tracing memory allocation.

  • dist_bger: The distributed gerade trial vectors.

  • dist_bung: The distributed ungerade trial vectors.

  • dist_e2bger: The distributed gerade sigma vectors.

  • dist_e2bung: The distributed ungerade sigma vectors.

append_sigma_vectors(e2bger, e2bung)

Appends distributed sigma (E2 b) vectors.

Parameters
  • e2bger – The distributed gerade sigma vectors.

  • e2bung – The distributed ungerade sigma vectors.

append_trial_vectors(bger, bung)

Appends distributed trial vectors.

Parameters
  • bger – The distributed gerade trial vectors.

  • bung – The distributed ungerade trial vectors.

check_convergence(relative_residual_norm)

Checks convergence.

Parameters

relative_residual_norm – Relative residual norms.

comp_lr_fock(fock, dens, molecule, basis, eri_dict, dft_dict, pe_dict, timing_dict)

Computes Fock/Fxc matrix (2e part) for linear response calculation.

Parameters
  • fock – The Fock matrix (2e part).

  • dens – The density matrix.

  • molecule – The molecule.

  • basis – The basis set.

  • eri_dict – The dictionary containing ERI information.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

  • timing_dict – The dictionary containing timing information.

comp_lr_fock_split_comm(fock, dens, molecule, basis, eri_dict, dft_dict, pe_dict)

Computes linear response Fock/Fxc matrix on split communicators.

Parameters
  • fock – The Fock matrix (2e part).

  • dens – The density matrix.

  • molecule – The molecule.

  • basis – The basis set.

  • eri_dict – The dictionary containing ERI information.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

compute(molecule, basis, scf_tensors, v1=None)

Solves for the linear equations.

Parameters
  • molecule – The molecule.

  • basis – The AO basis.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

  • v1 – The gradients on the right-hand side. If not provided, v1 will be computed for the B operator.

Returns

A dictionary containing response functions, solutions, etc.

static construct_ed_sd(orb_ene, nocc, norb)

Gets the E0 and S0 diagonal elements as arrays.

Parameters
  • orb_ene – Orbital energies.

  • nocc – Number of occupied orbitals.

  • norb – Number of orbitals.

Returns

The E0 and S0 diagonal elements as numpy arrays.

static construct_ed_sd_half(orb_ene, nocc, norb)

Gets the upper half of E0 and S0 diagonal elements as arrays.

Parameters
  • orb_ene – Orbital energies.

  • nocc – Number of occupied orbitals.

  • norb – Number of orbitals.

Returns

The upper half of E0 and S0 diagonal elements as numpy arrays.

decomp_grad(grad)

Decomposes gradient into gerade and ungerade parts.

Parameters

grad – The gradient.

Returns

A tuple containing gerade and ungerade parts of gradient.

e2n_half_size(vecs_ger, vecs_ung, molecule, basis, scf_tensors, eri_dict, dft_dict, pe_dict, timing_dict)

Computes the E2 b matrix vector product.

Parameters
  • vecs_ger – The gerade trial vectors in half-size.

  • vecs_ung – The ungerade trial vectors in half-size.

  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

  • eri_dict – The dictionary containing ERI information.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

  • timing_dict – The dictionary containing timing information.

Returns

The gerade and ungerade E2 b matrix vector product in half-size.

get_complex_rhs(operator, components, molecule, basis, scf_tensors)

Creates right-hand side of linear response equations.

Parameters
  • operator – The string for the operator.

  • components – The string for Cartesian components.

  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

The right-hand sides (gradients).

get_precond(orb_ene, nocc, norb, w)
get_rhs(operator, components, molecule, basis, scf_tensors)

Creates right-hand side of linear response equations.

Parameters
  • operator – The string for the operator.

  • components – The string for Cartesian components.

  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

The right-hand sides (gradients).

graceful_exit(molecule, basis, dft_dict, pe_dict, labels)

Gracefully exits the program.

Parameters
  • molecule – The molecule.

  • basis – The basis set.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

  • labels – The list of labels.

Returns

The return code.

init_dft(molecule, scf_tensors)

Initializes DFT.

Parameters
  • molecule – The molecule.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

The dictionary of DFT information.

init_eri(molecule, basis)

Initializes ERI.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

Returns

The dictionary of ERI information.

init_pe(molecule, basis)

Initializes polarizable embedding.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

Returns

The dictionary of polarizable embedding information.

initial_guess(v1, precond)
static lrmat2vec(mat, nocc, norb)

Converts matrices to vectors.

Parameters
  • mat – The matrices.

  • nocc – Number of occupied orbitals.

  • norb – Number of orbitals.

Returns

The vectors.

static lrvec2mat(vec, nocc, norb)

Converts vectors to matrices.

Parameters
  • vec – The vectors.

  • nocc – Number of occupied orbitals.

  • norb – Number of orbitals.

Returns

The matrices.

need_graceful_exit(next_iter_in_hours)

Checks if a graceful exit is needed.

Param

next_iter_in_hours: The predicted time for the next iteration in hours.

Returns

True if a graceful exit is needed, False otherwise.

static normalize(vecs)

Normalizes vectors by dividing by vector norm.

Parameters
  • vecs – The vectors.

  • Retruns – The normalized vectors.

static normalize_half(vecs)

Normalizes half-sized vectors by dividing by vector norm.

Parameters
  • vecs – The half-sized vectors.

  • Retruns – The normalized vectors.

normalize_half_distributed(vecs)

Normalizes half-sized vectors by dividing by vector norm.

Parameters
  • vecs – The half-sized vectors.

  • Retruns – The normalized vectors.

static orthogonalize_gram_schmidt(tvecs)

Applies modified Gram Schmidt orthogonalization to trial vectors.

Parameters

tvecs – The trial vectors.

Returns

The orthogonalized trial vectors.

static orthogonalize_gram_schmidt_half(tvecs)

Applies modified Gram Schmidt orthogonalization to trial vectors.

Parameters

tvecs – The trial vectors.

Returns

The orthogonalized trial vectors.

orthogonalize_gram_schmidt_half_distributed(tvecs)

Applies modified Gram Schmidt orthogonalization to trial vectors.

Parameters

tvecs – The trial vectors.

Returns

The orthogonalized trial vectors.

precond_trials(vectors, precond)

Applies preconditioner to trial vectors.

Parameters
  • vectors – The set of vectors.

  • precond – The preconditioner.

Returns

The preconditioned trial vectors.

preconditioning(precond, v_in)
print_convergence(title)

Prints information after convergence.

Parameters

title – The name of the solver.

print_header(title, nstates=None, n_points=None)

Prints linear response solver setup header to output stream.

Parameters
  • title – The name of the solver.

  • nstates – The number of excited states.

print_iteration(relative_residual_norm, xvs)
read_vectors(rsp_vector_labels)

Reads vectors from checkpoint file.

Parameters

rsp_vector_labels – The list of labels of response vectors.

static remove_linear_dependence(basis, threshold)

Removes linear dependence in a set of vectors.

Parameters
  • basis – The set of vectors.

  • threshold – The threshold for removing linear dependence.

Returns

The new set of vectors.

static remove_linear_dependence_half(basis, threshold)

Removes linear dependence in a set of symmetrized vectors.

Parameters
  • basis – The set of upper parts of symmetrized vectors.

  • threshold – The threshold for removing linear dependence.

Returns

The new set of vectors.

remove_linear_dependence_half_distributed(basis, threshold)

Removes linear dependence in a set of symmetrized vectors.

Parameters
  • basis – The set of upper parts of symmetrized vectors.

  • threshold – The threshold for removing linear dependence.

Returns

The new set of vectors.

setup_trials(vectors, precond, dist_bger=None, dist_bung=None, renormalize=True)

Computes orthonormalized trial vectors.

Parameters
  • vectors – The set of vectors.

  • precond – The preconditioner.

  • dist_bger – The distributed gerade subspace.

  • dist_bung – The distributed ungerade subspace.

  • renormalize – The flag for normalization.

Returns

The orthonormalized gerade and ungerade trial vectors.

update_settings(rsp_dict, method_dict=None)

Updates response and method settings in linear solver.

Parameters
  • rsp_dict – The dictionary of response dict.

  • method_dict – The dictionary of method rsp_dict.

write_checkpoint(molecule, basis, dft_dict, pe_dict, labels)

Writes checkpoint file.

Parameters
  • molecule – The molecule.

  • basis – The basis set.

  • dft_dict – The dictionary containing DFT information.

  • pe_dict – The dictionary containing PE information.

  • labels – The list of labels.

veloxchem.loprop module

class veloxchem.loprop.LoPropDriver(task)

Bases: object

compute()
count_contracted()
get_coordinates()
get_cpa()
get_opa()

Returns list of occupied for case of single atom i.e. first row 1s, second row 1s, 2s, 2p, whole shell

save_coordinates()
save_density()
save_orbital_info()
save_overlap()
update_settings()
veloxchem.loprop.count_contracted(atombasis: list) → dict

Given atomic block in basis filei format return dict which maps angular momentum to number of contracted >>> count_contracted(‘S: 1 1

1.0 1.9 ‘)

{‘S’: 1}

veloxchem.loprop.count_contracted_on_atom(atombasis: dict) → int

Returns total contracted given angular momentum count >>> count_contracted_on_atom({‘S’: 1}) 1 >>> count_contracted_no_atom({‘S’: 2, ‘P’: 1}) 5

veloxchem.loprop.get_basis_file(basis)

veloxchem.lreigensolver module

class veloxchem.lreigensolver.LinearResponseEigenSolver(comm, ostream)

Bases: veloxchem.linearsolver.LinearSolver

Implements linear response eigensolver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • nstates: Number of excited states.

compute(molecule, basis, scf_tensors)

Performs linear response calculation for a molecule and a basis set.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

A dictionary containing eigenvalues, eigenvectors, transition dipole moments, oscillator strengths and rotatory strengths.

get_full_solution_vector(solution)

Gets a full solution vector from the distributed solution.

Parameters

solution – The distributed solution as a tuple.

Returns

The full solution vector.

get_precond(orb_ene, nocc, norb, w)

Constructs the preconditioners.

Parameters
  • orb_ene – The orbital energies.

  • nocc – The number of doubly occupied orbitals.

  • norb – The number of orbitals.

  • w – The frequency.

Returns

The distributed preconditioners.

initial_excitations(nstates, ea, nocc, norb)

Gets initial guess for excitations.

Parameters
  • nstates – Number of excited states.

  • ea – Orbital energies.

  • nocc – Number of occupied orbitals.

  • norb – Number of orbitals.

Returns

A list of initial excitations (excitation energy and distributed vector).

precond_trials(excitations, precond)

Applies preconditioner to distributed trial vectors.

Parameters
  • excitations – The set of excitations.

  • precond – The preconditioner.

Returns

The preconditioned gerade and ungerade trial vectors.

preconditioning(precond, v_in)

Applies preconditioner to a tuple of distributed trial vectors.

Parameters
  • precond – The preconditioner.

  • v_in – The input trial vectors.

Returns

A tuple of distributed trail vectors after preconditioning.

print_iteration(relative_residual_norm, ws)

Prints information of the iteration.

Parameters
  • relative_residual_norm – Relative residual norms.

  • ws – Excitation energies.

update_settings(rsp_dict, method_dict=None)

Updates response and method settings in linear response eigensolver.

Parameters
  • rsp_dict – The dictionary of response dict.

  • method_dict – The dictionary of method rsp_dict.

veloxchem.lrsolver module

class veloxchem.lrsolver.LinearResponseSolver(comm, ostream)

Bases: veloxchem.linearsolver.LinearSolver

Implements linear response solver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • a_operator: The A operator.

  • a_components: Cartesian components of the A operator.

  • b_operator: The B operator.

  • b_components: Cartesian components of the B operator.

  • frequencies: The frequencies.

compute(molecule, basis, scf_tensors, v1=None)

Performs linear response calculation for a molecule and a basis set.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

  • v1 – The gradients on the right-hand side. If not provided, v1 will be computed for the B operator.

Returns

A dictionary containing response functions, solutions and a dictionarry containing solutions and kappa values when called from a non-linear response module.

get_full_solution_vector(solution)

Gets a full solution vector from the distributed solution.

Parameters

solution – The distributed solution as a tuple.

Returns

The full solution vector.

get_precond(orb_ene, nocc, norb, w)

Constructs the preconditioners.

Parameters
  • orb_ene – The orbital energies.

  • nocc – The number of doubly occupied orbitals.

  • norb – The number of orbitals.

  • w – The frequency.

Returns

The distributed preconditioners.

precond_trials(vectors, precond)

Applies preconditioner to distributed trial vectors.

Parameters
  • vectors – The set of vectors.

  • precond – The preconditioner.

Returns

The preconditioned gerade and ungerade trial vectors.

preconditioning(precond, v_in)

Applies preconditioner to a tuple of distributed trial vectors.

Parameters
  • precond – The preconditioner.

  • v_in – The input trial vectors.

Returns

A tuple of distributed trail vectors after preconditioning.

print_iteration(relative_residual_norm, xvs)

Prints information of the iteration.

Parameters
  • relative_residual_norm – Relative residual norms.

  • xvs – A list of tuples containing operator component, frequency, and property.

update_settings(rsp_dict, method_dict=None)

Updates response and method settings in linear response solver.

Parameters
  • rsp_dict – The dictionary of response dict.

  • method_dict – The dictionary of method rsp_dict.

veloxchem.mointsdriver module

class veloxchem.mointsdriver.MOIntegralsDriver(comm, ostream)

Bases: object

Implements MO integrals driver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variable
  • qq_type: The electron repulsion integrals screening scheme.

  • eri_thresh: The electron repulsion integrals screening threshold.

  • num_matrices: Number of Fock matrices to be computed.

  • batch_size: Batch size for computing Fock matrices.

  • comm: The MPI communicator.

  • rank: The MPI rank.

  • nodes: Number of MPI processes.

  • ostream: The output stream.

collect_moints_batches(moints_batch, grps)

Collects MO integrals to the master node.

Parameters
  • moints_batch – The MO integrals batch.

  • grps – The color group for creating MPI subcommunicators.

Returns

The collected MO integrals batch.

compute(molecule, ao_basis, mol_orbs, mints_type, grps)

Performs MO integrals calculation for a molecule and a basis set.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • mol_orbs – The molecular orbitals.

  • mints_type – The type of MO integrals to be calculated.

  • grps – The color group for creating MPI subcommunicators.

Returns

The computed MO integrals batch.

compute_in_mem(molecule, basis, mol_orbs, mints_type)

Performs in-memory MO integrals calculation for a molecule and a basis set.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • mol_orbs – The molecular orbitals.

  • mints_type – The type of MO integrals to be calculated.

Returns

The computed MO integrals.

get_batch_dimensions(vec_ids)

Gets the dimension of the batches.

Parameters

vec_ids – The list of vector id.

Returns

The tuple containing the position and the dimension of the batch.

get_external_indexes(mints_type)

Gets external indices.

Parameters

mints_type – Type of MO integrals.

Returns

The external indices.

get_moints_type(mints_type)

Gets MO integrals type.

Parameters

mints_type – Type of MO integrals.

Returns

The MO integrals type.

get_num_orbitals(mol_orbs, molecule)

Gets number of occupied and virtual orbitals.

Parameters
  • mol_orbs – The molecular orbitals.

  • molecule – The molecule.

Returns

The number of occupied and virtual orbitals.

get_transformation_vectors(mints_type, mol_orbs, molecule)

Gets transformation matrices.

Parameters
  • mints_type – Type of MO integrals.

  • mol_orbs – The molecular orbitals.

  • molecule – The molecule.

Returns

The tuple containing transformation matrices.

print_finish(start_time)

Prints header for the MO integrals driver.

Parameters

start_time – The starting time of the calculation.

print_header()

Prints header for the MO integrals driver.

set_fock_matrices_type(mints_type, fock_matrices)

Sets Fock matrix types.

Parameters
  • mints_type – Type of MO integrals.

  • fock_matrices – The Fock matrices.

set_orbital_pairs(mints_type, mol_orbs, molecule)

Sets up bra and ket orbitals list.

Parameters
  • mints_type – Type of MO integrals.

  • mol_orbs – The molecular orbitals.

  • molecule – The molecule.

Returns

The tuple containing the lists of bra and ket ids.

use_symmetry(mints_type)

Checks if symmetry is used.

Parameters

mints_type – Type of MO integrals.

Returns

Whether symmetry is used.

veloxchem.mp2driver module

class veloxchem.mp2driver.Mp2Driver(comm, ostream)

Bases: object

Implements MP2 driver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variable
  • e_mp2: The MP2 correlation energy.

  • comm: The MPI communicator.

  • rank: The MPI rank.

  • nodes: Number of MPI processes.

  • qq_type: The electron repulsion integrals screening scheme.

  • eri_thresh: The electron repulsion integrals screening threshold.

  • batch_size: The number of Fock matrices in each batch.

  • comm_size: The size of each subcommunicator.

  • ostream: The output stream.

  • conventional: The flag for using conventional (in-memory) AO-to-MO integral transformation.

compute(molecule, ao_basis, mol_orbs)

Performs MP2 calculation.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • mol_orbs – The molecular orbitals.

compute_conventional(molecule, ao_basis, mol_orbs)

Performs conventional MP2 calculation.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • mol_orbs – The molecular orbitals.

compute_distributed(molecule, basis, mol_orbs)

Performs MP2 calculation via distributed Fock builds.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • mol_orbs – The molecular orbitals.

print_header(num_matrices)

Prints header for the MP2 driver.

Parameters

num_matrices – The number of Fock matrices to be computed.

update_settings(mp2_dict)

Updates settings in MP2 driver.

Parameters

mp2_dict – The dictionary of MP2 settings.

veloxchem.mpitask module

class veloxchem.mpitask.MpiTask(fname_list, mpi_comm)

Bases: object

Implements the MPI task.

Parameters
  • fname_list – List of the intput/output filenames.

  • mpi_comm – The MPI communicator.

Instance variable
  • mpi_comm: The MPI communicator.

  • mpi_rank: The MPI rank.

  • mpi_size: Number of MPI processes.

  • molecule: The molecule.

  • ao_basis: The AO basis set.

  • min_basis: The minimal AO basis set for generating initial guess.

  • ostream: The output stream.

  • input_dict: The input dictionary.

  • start_time: The start time of the task.

finish()

Finalizes the MPI task.

veloxchem.outputstream module

class veloxchem.outputstream.OutputStream(filename=None, width=122)

Bases: object

Implements the output stream.

Parameters
  • filename – Name of the output file (or sys.stdout).

  • width – Width of the output.

Instance variables
  • width: Width of the output.

  • buffer_lines: The buffered lines of output.

  • stream: The stream to which output is printed.

  • state: The flag for writing to the stream.

flush()

Flushes the buffered output to stream.

get_state()
Returns

State of the output stream.

static header(line, width)

Gets the header string.

Parameters
  • line – The line of text.

  • width – Width of the output.

Returns

The header string.

static info(line, width)

Gets the information string.

Parameters
  • line – The line of text.

  • width – Width of the output.

Returns

The information string.

print_blank()

Prints a blank line to stream.

print_block(block_lines)

Prints a block of lines to stream.

Parameters

block_lines – The multiple lines of text.

print_finish_header(start_time)

Prints finish header to output stream.

Parameters

start_time – The start time of the computation.

print_header(line)

Prints a header line to stream.

Parameters

line – The line of text.

print_info(line)

Prints an information line to stream.

Parameters

line – The line of text.

print_line(line)

Prints the line to stream.

Parameters

line – The line of text.

print_separator()

Prints a separator line to stream.

print_start_header(num_nodes)

Prints start header to output stream.

Parameters

num_nodes – The number of MPI processes.

print_title(line)

Prints a title line to stream.

Parameters

line – The line of text.

static title(line, width)

Gets the title string.

Parameters
  • line – The line of text.

  • width – Width of the output.

Returns

The title string.

static tsep(width)

Gets the separator string.

Parameters

width – Width of the output.

Returns

The separator string.

veloxchem.polembed module

class veloxchem.polembed.PolEmbed(molecule, basis, comm, pe_dict)

Bases: object

Implements interface to the CPPE library.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • comm – The MPI communicator.

  • pe_dict – The dictionary with options for CPPE.

Instance variables
  • molecule: The molecule.

  • basis: The AO basis set.

  • comm: The MPI communicator.

  • rank: The rank of MPI process.

  • nodes: The number of MPI processes.

  • V_es: The multipole contribution to Fock matrix.

  • options: The dictionary with options for CPPE.

  • cppe_state: The CPPE state object.

  • polarizable_coords: The coordinates of the polarizable sites.

check_cppe_version()

Checks the version of CPPE.

compute_electric_field_value(dm)

Computes electric field at the polarizable sites.

Parameters

dm – The density matrix.

Returns

The electric field.

compute_induction_operator(moments)

Computes contribution from induction operator.

Parameters

moments – The induced moments.

Returns

The induction contribution to Fock matrix.

compute_multipole_potential_integrals()

Computes contribution from multipoles.

Returns

The multipole contribution to Fock matrix.

get_pe_contribution(dm, elec_only=False)

Computes contributions from polarizable embedding.

Parameters
  • dm – The density matrix.

  • elec_only – The flag for computing electronic contribution only.

Returns

The polarizable embedding contributions to energy and Fock matrix.

print_callback(output)

Handles the output from the CPPE library.

Parameters

output – The output from the CPPE library.

update_options(pe_dict)

Updates PE options based on the input dictionary.

Parameters

pe_dict – The dictionary with options for CPPE.

veloxchem.profiler module

class veloxchem.profiler.Profiler(settings=None)

Bases: object

Impements multifunctional profiler.

Parameters

settings – The dictionary of profiler settings.

Instance variable
  • timing: The flag for printing timing information.

  • profiling: The flag for printing profiling information.

  • memory_profiling: The flag for printing memory usage.

  • memory_tracing: The flag for tracing memory allocation using

  • start_time: The starting time.

  • start_avail_mem: The starting available memory.

  • timing_list: The list containing information about timing.

  • memory_usage: The list containing information about memory usage.

  • pr: The Profile object.

begin(settings)

Starts the multifunctional profiler.

Parameters

settings – The dictionary containing profiler settings.

check_memory_usage(remark='')

Checks memory usage.

Parameters

remark – Descriptive text about the point of checking.

comp_memory_object(obj, counted_ids=None)

Computes the memory usage of an object recursively.

Parameters
  • obj – The object.

  • counted_ids – The list of id’s of counted objects.

Returns

The memory usage in bytes.

end(ostream, scf_flag=False)

Stops the profiler and print the output.

Parameters
  • ostream – The output stream.

  • scf_flag – The flag for SCF.

get_available_memory()

Gets available memory as text string.

Returns

The amount of available memory as text string.

get_memory_dictionary(d)

Gets memory usage of a dictionary.

Parameters

d – The dictionary.

Returns

Memory usage of the dictionary and the list of memory usage of each item.

get_memory_object(obj)

Gets memory usage of an object as text string.

Parameters

obj – The object.

Returns

The amount of memory usage of the object as text string.

memory_to_string(memsize)

Gets memory size as text string.

Parameters

memsize – The memory size.

Returns

The text string for memory size.

print_memory_subspace(d, ostream)

Prints memory usage in subspace solver.

Parameters
  • d – The dictionary containing the data used in subspace.

  • ostream – The output stream.

print_memory_tracing(ostream)

Prints memory tracing output.

Parameters

ostream – The output stream.

print_memory_usage(ostream, scf_flag=False)

Prints memory usage.

Parameters
  • ostream – The output stream.

  • scf_flag – The flag for SCF.

print_profiling_summary(ostream)

Prints profiling summary.

Parameters

ostream – The output stream.

print_timing(ostream, scf_flag=False)

Prints timing.

Parameters
  • ostream – The output stream.

  • scf – The flag for SCF.

start_timer(iteration, label)

Starts the timer for an iteration and a label.

Parameters
  • iteration – The iteration.

  • label – The label.

stop_timer(iteration, label)

Stops the timer for an iteration and a label.

Parameters
  • iteration – The iteration.

  • label – The label.

update_timer(iteration, timing_dict)

Updates the timer with a dictionary of timing information.

Parameters
  • iteration – The iteration.

  • timing_dict – The dictionary containing timing information.

veloxchem.pulsedrsp module

class veloxchem.pulsedrsp.PulsedResponse(comm, ostream)

Bases: object

Pulsed Reponse class for computing molecular responses to a resonant or non-resonant laser pulse.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variable
  • comm: The MPI communicator.

  • rank: The MPI rank.

  • nodes: The number of MPI processes.

  • ostream: The output stream.

  • field_cutoff_ratio: Float - Ratio between the smallest field amplitude to be included in the calculation wrt. the maximum field amplitude. Frequencies with associated field amplitudes smaller than this ratio will NOT be included in the calculation.

  • envelope: String - Envelope of the of pulse - available arguments: [‘gaussian’, ]

  • number_pulses: Integer - The number of different pulse settings to expect ‘N’. Currently limited to one.

  • pulse_widths: List of floats (len(N)) - pulse widths in [au].

  • carrier_frequencies: List of floats (len(N)) - carrier frequencies in [au].

  • field_max: List of floats (len(N)) - pulse amplitudes in [au].

  • centers: List of floats (len(N)) - time centers for the pulses in [au].

  • pol_dir: string - polarization directions, arguments given in combinations of x, y and z - e.g.: ‘x’ for [1 0 0], yz for [0 1 1].

  • frequency_range: List of frequencies to map solution to. Given as range: ‘start-end(df)’ in [au], e.g. 0.2-0.4(0.007) for 0.2 -> 0.4 au in steps of 0.007 au. Zero-padding will be applied if range does not start at 0.

  • CEP: List of floats (len(N)) - carrier envelope phases in [radians].

  • h5file: String - optional - name of requested h5 formatted result file.

  • ascii: String - optional - name of requested ASCII formatted file.

apply_zero_pad(results)

Adds zeros between 0 and the requested start frequency with dw increments.

The zero padding may be necessary due to:
  1. the limited number of frequencies for which the complex response function is being computed as dictated by ‘field_cutoff_ratio’

  2. the need for extending the frequency range to achieve higher temporal resolution

Example of zero padding:

w: 0~~~zero_pad~~~|===DATA===|~~~zero_pad~~~end_freq

Parameters

results – A dictionary containing properties, solutions and kappas (the results dict from .compute()).

Returns

A dictionary containing properties, solutions and kappas and zeropadded properties.

compute(molecule, ao_basis, scf_tensors)

Invoke complex response solver to compute complex response function at requested frequencies

Parameters
  • molecule – The molecule.

  • aobasis – The AO basis.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

A dictionary containing properties, solutions and kappas and possibly zeropadded properties if requested (self.zero_pad).

gauss_env_pulse_w(w, F0, t0, delta_t, w_carrier, cep)

Gaussian pulse from frequency domain input.

Parameters
  • w – np.array - list of frequencies.

  • F0 – float - pulse amplitude in [au].

  • t0 – float - time center for pulse in [au].

  • delta_t – float - pulse width in [au].

  • w_carrier – float - carrier frequency in [au].

  • cep – float - carrier envelope phases in [radians].

Returns

Numpy array of the pulse amplitude in the frequency domain.

print_header()

Prints Pulsed Lionear Response calculation setup details to output stream.

update_settings(settings, cpp_settings)

Updates settings in PulsedRespnse

Parameters
  • settings – The settings dictionary for the driver.

  • cpp_settings – The settings dictionary for complex response driver.

verify_freqs(frequencies)

Takes a list or nd-array of frequencies and verifies that it have or can be extended to include zero frequency

Parameters

frequencies – List of frequencies.

Returns

Numpy array of zero-padded frequencies and numpy array of truncated frequencies.

write_ascii(fname)

Writes the Pulsed response vectors to the specified output file in ASCII format.

Parameters

fname – Name of the checkpoint file.

Returns

The ASCII file saved contains the the amplitudes for all frequencies for each of the following directions:

  • ’xx’, ‘xy’, ‘xz’, ‘yx’, ‘yy’, ‘yz’, ‘zx’, ‘zy’, ‘zz’

    => Amplitudes for all directions

write_hdf5(fname)

Writes the Pulsed response vectors to the specified output file in h5 format. The h5 file saved contains the following datasets: - amplitudes

The pulse amplitudes for the calculated truncated_freqs

  • zero_padded

    Is the dataset zero padded or not

  • ‘xx’, ‘xy’, ‘xz’, ‘yx’, ‘yy’, ‘yz’, ‘zx’, ‘zy’, ‘zz’

    => Amplitudes for all directions

  • zero_padded_freqs

    The zero padded frequency list

  • zero_padded_amplitudes

    The pulse amplitudes for the calculated frequencies zero padded to match th zero padded frequencies.

Parameters

fname – Name of the checkpoint file.

veloxchem.qqscheme module

veloxchem.qqscheme.get_qq_scheme(qq_type)

Converts screening scheme string to C++ enum.

Parameters

qq_type – The label of electron repulsion integrals screening scheme.

Returns

The C++ enum with screening scheme.

veloxchem.qqscheme.get_qq_type(qq_type)

Gets string with type of electron repulsion integrals screening scheme (Cauchy Schwarz and it’s variations).

Parameters

qq_type – The label of electron repulsion integrals screening scheme.

Returns

The string with type of electron repulsion integrals screening scheme.

veloxchem.rspabsorption module

class veloxchem.rspabsorption.Absorption(rsp_dict, method_dict=None)

Bases: veloxchem.rspproperty.ResponseProperty

Implements the absorption property.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_property: The dictionary of response property.

get_property(key)

Gets excitation energies, CI vectors, or oscillator stengths.

Parameters

key – The keyword to the absorption property.

Returns

The absorption property.

print_absorption(ostream, spin_str, title)

Prints absorption to output stream.

Parameters
  • ostream – The output stream.

  • spin_str – The string representation of spin.

  • title – The title to be printed to the output stream.

print_ecd(ostream, spin_str, title)

Prints electronic circular dichroism to output stream.

Parameters
  • ostream – The output stream.

  • spin_str – The string representation of spin.

  • title – The title to be printed to the output stream.

print_property(ostream)

Prints absorption to output stream.

Parameters

ostream – The output stream.

print_transition_dipoles(ostream, spin_str, title, trans_dipoles)

Prints transition dipole moments to output stream.

Parameters
  • ostream – The output stream.

  • spin_str – The string representation of spin.

  • title – The title to be printed to the output stream.

  • trans_dipoles – The transition dipole moments.

veloxchem.rspc6 module

class veloxchem.rspc6.C6(rsp_dict, method_dict=None)

Bases: veloxchem.rspproperty.ResponseProperty

Implements the C6 dispersion coefficient property.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_property: The dictionary of response property.

get_property(key)

Gets excitation energies, CI vectors, or oscillator stengths.

Parameters

key – The keyword to the C6 property.

Returns

The C6 property.

static integrate(rsp_property, imagfreqs, points, weights, w0)

Calculates the C6 value with a Gauss-Legendre quadrature for the integral in the Casimir-Polder relation using integration by substitution.

Parameters
  • imagfreqs – The list of imaginary frequencies.

  • points – The list of integration points.

  • weights – The list of weights for integration points.

  • w0 – A constant conversion factor.

Returns

The C6 value.

print_property(ostream)

Prints response property to output stream.

Parameters

ostream – The output stream.

veloxchem.rspcdspec module

class veloxchem.rspcdspec.CircularDichroismSpectrum(rsp_dict, method_dict=None)

Bases: veloxchem.rspproperty.ResponseProperty

Implements the circular dichroism spectrum property.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_property: The dictionary of response property.

get_property(key)

Gets response functions or solutions.

Parameters

key – The keyword ‘response_functions’ or ‘solutions’.

Returns

The response functions or solutions.

print_property(ostream)

Prints response property to output stream.

Parameters

ostream – The output stream.

veloxchem.rspcustomproperty module

class veloxchem.rspcustomproperty.CustomProperty(rsp_dict, method_dict=None)

Bases: veloxchem.rspproperty.ResponseProperty

Implements a custom, user-defined property.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_property: The dictionary of response property.

get_property(key)

Gets response functions or solutions.

Parameters

key – The keyword ‘response_functions’ or ‘solutions’.

Returns

The response functions or solutions.

print_property(ostream)

Prints custom property to output stream.

Parameters

ostream – The output stream.

veloxchem.rspdriver module

class veloxchem.rspdriver.ResponseDriver(comm, ostream)

Bases: object

Implements response driver for molecular property calculations using conventional Hartree-Fock/Kohn-Sham response theory.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • prop_type: The type of the property to be calculated.

  • tamm_dancoff: The flag for using Tamm-Dancoff approximation.

  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • comm: The MPI communicator.

  • rank: The rank of MPI process.

  • nodes: The number of MPI processes.

  • ostream: The output stream.

  • is_converged: The flag for convergence.

compute(molecule, ao_basis, scf_tensors)

Performs molecular property calculation using molecular data

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

The results from the actual response solver.

prop_str()

Gets string with type of molecular property calculation (Excited states, linear and non-linear spectroscopies).

Returns

The string with type of molecular property calculation.

update_settings(rsp_dict, method_dict=None)

Updates settings in response solver.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

veloxchem.rsplinabscross module

class veloxchem.rsplinabscross.LinearAbsorptionCrossSection(rsp_dict, method_dict=None)

Bases: veloxchem.rspproperty.ResponseProperty

Implements the linear absorption cross-section property.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_property: The dictionary of response property.

get_property(key)

Gets response functions or solutions.

Parameters

key – The keyword ‘response_functions’ or ‘solutions’.

Returns

The response functions or solutions.

print_property(ostream)

Prints response property to output stream.

Parameters

ostream – The output stream.

veloxchem.rsppolarizability module

class veloxchem.rsppolarizability.Polarizability(rsp_dict, method_dict=None)

Bases: veloxchem.rspproperty.ResponseProperty

Implements the polarizability property.

Parameters
  • rsp_dict – The dictionary of response input.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_property: The dictionary of response property.

get_property(key)

Gets response functions or solutions.

Parameters

key – The keyword ‘response_functions’ or ‘solutions’.

Returns

The response functions or solutions.

print_property(ostream)

Prints polarizability to output stream.

Parameters

ostream – The output stream.

veloxchem.rspproperty module

class veloxchem.rspproperty.ResponseProperty(rsp_dict, method_dict=None)

Bases: object

Implements the base class for response property/spectroscopy.

Parameters
  • rsp_dict – The input dictionary that defines the property/spectroscopy.

  • method_dict – The dictionary of method settings.

Instance variables
  • rsp_dict: The dictionary of response input.

  • method_dict: The dictionary of method settings.

  • rsp_driver: The response driver.

  • rsp_property: The dictionary of response property.

compute(molecule, basis, scf_tensors)

Computes response property/spectroscopy.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

converged()

Checks if the response calculation is converged.

Returns

True if the response calculation is converged, False otherwise.

get_property(key)

Gets response property/spectroscopy.

Parameters

key – The keyword for the property.

Returns

The property.

init_driver(comm, ostream)

Initializes response driver.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

print_property(ostream)

Prints response property/spectroscopy to output stream.

Parameters

ostream – The output stream.

veloxchem.scfdriver module

class veloxchem.scfdriver.ScfDriver(comm, ostream)

Bases: object

Implements SCF method with C2-DIIS and two-level C2-DIIS convergence accelerators.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • den_guess: The initial density guess driver.

  • acc_type: The type of SCF convergence accelerator.

  • max_err_vecs: The maximum number of error vectors.

  • max_iter: The maximum number of SCF iterations.

  • first_step: The flag for first step in two-level C2-DIIS convergence acceleration.

  • qq_type: The electron repulsion integrals screening scheme.

  • qq_dyn: The flag for enabling dynamic thresholds in electron repulsion integrals screening scheme.

  • conv_thresh: The SCF convergence threshold.

  • eri_thresh: The electron repulsion integrals screening threshold.

  • ovl_thresh: The atomic orbitals linear dependency threshold.

  • diis_thresh: The C2-DIIS switch on threshold.

  • use_level_shift: The flag for usage of level shifting in SCF iterations.

  • iter_data: The list of SCF iteration data (electronic energy, electronic energy change, gradient, density change).

  • is_converged: The flag for SCF convergence.

  • skip_iter: The flag for SCF iteration data storage.

  • old_energy: The electronic energy of previous SCF iteration.

  • num_iter: The current number of SCF iterations.

  • fock_matrices: The list of stored Fock/Kohn-Sham matrices.

  • den_matrices: The list of stored density matrices.

  • density: The current density matrix.

  • mol_orbs: The current molecular orbitals.

  • nuc_energy: The nuclear repulsion energy of molecule.

  • comm: The MPI communicator.

  • rank: The rank of MPI process.

  • nodes: The number of MPI processes.

  • restart: The flag for restarting from checkpoint file.

  • checkpoint_file: The name of checkpoint file.

  • ref_mol_orbs: The reference molecular orbitals read from checkpoint file.

  • restricted: The flag for restricted SCF.

  • dft: The flag for running DFT.

  • grid_level: The accuracy level of DFT grid.

  • xcfun: The XC functional.

  • molgrid: The molecular grid.

  • pe: The flag for running polarizable embedding calculation.

  • V_es: The polarizable embedding matrix.

  • pe_options: The dictionary with options for polarizable embedding.

  • pe_summary: The summary string for polarizable embedding.

  • use_split_comm: The flag for using split communicators.

  • split_comm_ratio: The list of ratios for split communicators.

  • timing: The flag for printing timing information.

  • profiling: The flag for printing profiling information.

  • memory_profiling: The flag for printing memory usage.

  • memory_tracing: The flag for tracing memory allocation using

add_iter_data(d)

Adds SCF iteration data (electronic energy, electronic energy change, electronic gradient, density difference) to SCF iterations list.

Parameters

d – The dictionary containing SCF iteration data.

check_convergence()

Sets SCF convergence flag by checking if convergence condition for electronic gradient is fullfiled.

comp_2e_fock(fock_mat, den_mat, molecule, basis, screening, e_grad=None)

Computes Fock/Kohn-Sham matrix (only 2e part).

Parameters
  • fock_mat – The AO Fock matrix (only 2e-part).

  • den_mat – The AO density matrix.

  • molecule – The molecule.

  • basis – The basis set.

  • screening – The screening container object.

  • e_grad – The electronic gradient.

Returns

The AO Kohn-Sham (Vxc) matrix.

comp_2e_fock_single_comm(fock_mat, den_mat, molecule, basis, screening, e_grad=None)

Computes Fock/Kohn-Sham matrix on single communicator.

Parameters
  • fock_mat – The AO Fock matrix (only 2e-part).

  • den_mat – The AO density matrix.

  • molecule – The molecule.

  • basis – The basis set.

  • screening – The screening container object.

  • e_grad – The electronic gradient.

Returns

The AO Kohn-Sham (Vxc) matrix.

comp_2e_fock_split_comm(fock_mat, den_mat, molecule, basis, screening, e_grad=None)

Computes Fock/Kohn-Sham matrix on split communicators.

Parameters
  • fock_mat – The AO Fock matrix (only 2e-part).

  • den_mat – The AO density matrix.

  • molecule – The molecule.

  • basis – The basis set.

  • screening – The screening container object.

  • e_grad – The electronic gradient.

Returns

The AO Kohn-Sham (Vxc) matrix.

comp_density_change(den_mat, old_den_mat)

Computes norm of density change between two density matrices.

Parameters
  • den_mat – The current density matrix.

  • old_den_mat – The previous density matrix.

Returns

The norm of change between two density matrices.

comp_diis(molecule, ao_basis, min_basis, profiler)

Performs SCF calculation with C2-DIIS acceleration.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • min_basis – The minimal AO basis set.

  • profiler – The profiler.

comp_energy(fock_mat, vxc_mat, e_pe, kin_mat, npot_mat, den_mat)

Computes SCF energy components: electronic energy, kinetic energy, and nuclear potential energy.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix (only 2e-part).

  • vxc_mat – The Vxc matrix.

  • e_pe – The polarizable embedding energy.

  • kin_mat – The kinetic energy matrix.

  • npot_mat – The nuclear potential matrix.

  • den_mat – The density matrix.

Returns

The tuple (electronic energy, kinetic energy, nuclear potential energy).

comp_full_fock(fock_mat, vxc_mat, pe_mat, kin_mat, npot_mat)

Computes full Fock/Kohn-Sham matrix by adding to 2e-part of Fock/Kohn-Sham matrix the kinetic energy and nuclear potential matrices.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix (2e-part).

  • vxc_mat – The Vxc matrix.

  • pe_mat – The polarizable embedding matrix.

  • kin_mat – The kinetic energy matrix.

  • npot_mat – The nuclear potential matrix.

comp_gradient(fock_mat, ovl_mat, den_mat, oao_mat)

Computes electronic gradient using Fock/Kohn-Sham matrix.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • ovl_mat – The overlap matrix.

  • den_mat – The density matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The electronic gradient.

comp_guess_density(molecule, ao_basis, min_basis, ovl_mat)

Computes initial density guess for SCF using superposition of atomic densities or molecular orbitals projection methods.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • min_basis – The minimal AO basis set.

  • ovl_mat – The overlap matrix between minimal and full AO basis.

Returns

The density matrix.

comp_npot_mat_split_comm(molecule, basis)

Computes one-electron nuclear potential integral on split communicators.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

Returns

The one-electron nuclear potential matrix.

comp_one_ints(molecule, basis)

Computes one-electron integrals (overlap, kinetic energy and nuclear potential) using molecular data.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

Returns

The one-electron integrals.

compute(molecule, ao_basis, min_basis=None)

Performs SCF calculation using molecular data.

Parameters
  • molecule – The molecule.

  • ao_basis – The AO basis set.

  • min_basis – The minimal AO basis set.

compute_s2(molecule, smat, mol_orbs)

Computes expectation value of the S**2 operator.

Parameters
  • molecule – The molecule.

  • smat – The overlap matrix (numpy array).

  • mol_orbs – The molecular orbitals.

Returns

Expectation value <S**2>.

delete_mos(mol_orbs, mol_eigs)

Generates trimmed molecular orbital by deleting MOs with coeficients exceeding 1.0 / sqrt(ovl_thresh).

Parameters
  • mol_orbs – The molecular orbitals.

  • mol_eigs – The eigenvalues of molecular orbitals.

Returns

The tuple (trimmed molecular orbitals, eigenvalues).

gen_molecular_orbitals(fock_mat, oao_mat)

Generates molecular orbital by diagonalizing Fock/Kohn-Sham matrix.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The molecular orbitals.

gen_new_density(molecule)

Generates density matrix from current molecular orbitals.

Parameters

molecule – The molecule.

Returns

The density matrix.

get_acc_type()

Gets string with type of SCF convergence accelerator (DIIS or two level DIIS).

Returns

The string with type of SCF convergence accelerator.

get_dyn_threshold(e_grad)

Computes screening threshold for electron repulsion integrals based on value of electronic gradient.

Parameters

e_grad – The electronic gradient.

Returns

The screening threshold.

get_effective_fock(fock_mat, ovl_mat, oao_mat)

Computes effective Fock/Kohn-Sham matrix in OAO basis by applying Lowdin or canonical orthogonalization to AO Fock/Kohn-Sham matrix.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • ovl_mat – The overlap matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The effective Fock/Kohn-Sham matrix.

get_guess_type()

Gets string with type of initial guess (superposition of atomic densities or projection of molecular orbitals).

Returns

The string with type of initial guess.

get_qq_dyn()

Gets string with application method (static or dynamic) of electron repulsion integrals screening.

Returns

The string with application method of electron repulsion integrals screening.

get_scf_energy()

Gets SCF energy from previous SCF iteration.

Returns

The SCF energy.

get_scf_range()

Creates range of SCF iterations from maximum number of SCF iterations.

Returns

The range of SCF iterations.

get_scf_type()

Gets string with type of SCF calculation (defined in derrived classes).

Returns

The string with type of SCF calculation.

graceful_exit(molecule, basis)

Gracefully exits the program.

Parameters
  • molecule – The molecule.

  • basis – The basis set.

Returns

The return code.

need_graceful_exit(iter_in_hours)

Checks if a graceful exit is needed.

Parameters

iter_in_hours – The time spent in one iteration (in hours).

Returns

True if a graceful exit is needed, False otherwise.

need_min_basis()

Determines if minimal AO basis is needed in SCF calculation. Usage of two level DIIS accelerator or superposition of atomic densities initial guess requires minimal AO basis.

Returns

The flag for need of minimal AO basis.

print_energy_components()

Prints SCF energy components to output stream.

print_ground_state(molecule, s2)

Prints ground state information to output stream.

Parameters
  • molecule – The molecule.

  • s2 – The expectation value of S**2.

print_header()

Prints SCF calculation setup details to output stream,

print_iter_data(i)

Prints SCF iteration data to output stream,

Parameters

i – The current SCF iteration.

print_scf_energy()

Prints SCF energy information to output stream.

print_scf_finish(start_time)

Prints SCF calculation finish message to output stream,

Parameters

start_time – The start time of SCF calculation.

print_scf_title()

Prints SCF cycles header to output stream.

set_skip_iter_flag(e_grad)

Sets SCF iteration skiping flag based on C2-DIIS switch on threshold.

Parameters

e_grad – The electronic gradient at current SCF iteration.

store_diis_data(i, fock_mat, den_mat)

Stores Fock/Kohn-Sham and density matrices for current iteration.

Parameters
  • i – The number of current SCF iteration.

  • fock_mat – The Fock/Kohn-Sham matrix.

  • den_mat – The density matrix.

update_fock_type(fock_mat)

Updates Fock matrix to fit selected functional in Kohn-Sham calculations.

Parameters

fock_mat – The Fock/Kohn-Sham matrix.

update_mol_orbs_phase()

Updates phase of molecular orbitals.

update_settings(scf_dict, method_dict=None)

Updates settings in SCF driver.

Parameters
  • scf_dict – The input dictionary of scf group.

  • method_dict – The input dicitonary of method settings group.

write_checkpoint(nuclear_charges, basis_set)

Writes molecular orbitals to checkpoint file.

Parameters
  • nuclear_charges – The nuclear charges.

  • basis_set – Name of the basis set.

veloxchem.scfrestdriver module

class veloxchem.scfrestdriver.ScfRestrictedDriver(comm, ostream)

Bases: veloxchem.scfdriver.ScfDriver

Implements spin restricted closed shell SCF method with C2-DIIS and two-level C2-DIIS convergence accelerators.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

comp_density_change(den_mat, old_den_mat)

Computes norm of spin restricted closed shell density change between two density matrices. Overloaded base class method.

Parameters
  • den_mat – The current density matrix.

  • old_den_mat – The previous density matrix.

Returns

The norm of change between two density matrices.

comp_gradient(fock_mat, ovl_mat, den_mat, oao_mat)

Computes spin restricted closed shell electronic gradient using Fock/Kohn-Sham matrix. Overloaded base class method.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • ovl_mat – The overlap matrix.

  • den_mat – The density matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The electronic gradient.

gen_molecular_orbitals(fock_mat, oao_mat)

Generates spin restricted molecular orbital by diagonalizing spin restricted closed shell Fock/Kohn-Sham matrix. Overloaded base class method.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The molecular orbitals.

get_effective_fock(fock_mat, ovl_mat, oao_mat)

Computes effective spin restricted closed shell Fock/Kohn-Sham matrix in OAO basis by applying Lowdin or canonical orthogonalization to AO Fock/Kohn-Sham matrix. Overloaded base class method.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • ovl_mat – The overlap matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The effective Fock/Kohn-Sham matrix.

get_scaled_fock(weights)

Computes effective spin restricted closed shell Fock/Kohn-Sham matrix by summing Fock/Kohn-Sham matrices scalwd with weigths.

Parameters

weights – The weights of Fock/Kohn-Sham matrices.

Returns

The scaled Fock/Kohn-Sham matrix.

get_scf_type()

Gets string for spin restricted closed shell SCF calculation. Overloaded base class method.

Returns

The string for spin restricted closed shell SCF calculation.

store_diis_data(i, fock_mat, den_mat)

Stores spin restricted closed shell Fock/Kohn-Sham and density matrices for current iteration. Overloaded base class method.

Parameters
  • i – The number of current SCF iteration.

  • fock_mat – The Fock/Kohn-Sham matrix.

  • den_mat – The density matrix.

update_fock_type(fock_mat)

Updates Fock matrix to fit selected functional in Kohn-Sham calculations.

Parameters

fock_mat – The Fock/Kohn-Sham matrix.

veloxchem.scfunrestdriver module

class veloxchem.scfunrestdriver.ScfUnrestrictedDriver(comm, ostream)

Bases: veloxchem.scfdriver.ScfDriver

Implements spin unrestricted open shell SCF method with C2-DIIS and two-level C2-DIIS convergence accelerators.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

comp_density_change(den_mat, old_den_mat)

Computes norm of spin unrestricted open shell density change between two density matrices. Overloaded base class method.

Parameters
  • den_mat – The current density matrix.

  • old_den_mat – The previous density matrix.

Returns

The norm of change between two density matrices.

comp_gradient(fock_mat, ovl_mat, den_mat, oao_mat)

Computes spin unrestricted open shell electronic gradient using Fock/Kohn-Sham matrix. Overloaded base class method.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • ovl_mat – The overlap matrix.

  • den_mat – The density matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The electronic gradient.

compute_s2(molecule, smat, mol_orbs)

Computes expectation value of the S**2 operator.

Parameters
  • molecule – The molecule.

  • smat – The overlap matrix (numpy array).

  • mol_orbs – The molecular orbitals.

Returns

Expectation value <S**2>.

gen_molecular_orbitals(fock_mat, oao_mat)

Generates spin unrestricted molecular orbital by diagonalizing spin unrestricted open shell Fock/Kohn-Sham matrix. Overloaded base class method.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The molecular orbitals.

get_effective_fock(fock_mat, ovl_mat, oao_mat)

Computes effective spin unrestricted open shell Fock/Kohn-Sham matrix in OAO basis by applying Lowdin or canonical orthogonalization to AO Fock/Kohn-Sham matrix. Overloaded base class method.

Parameters
  • fock_mat – The Fock/Kohn-Sham matrix.

  • ovl_mat – The overlap matrix.

  • oao_mat – The orthogonalization matrix.

Returns

The effective Fock/Kohn-Sham matrices.

get_scaled_fock(weights)

Computes effective spin unrestricted open shell Fock/Kohn-Sham matrix by summing Fock/Kohn-Sham matrices scalwd with weigths.

Parameters

weights – The weights of Fock/Kohn-Sham matrices.

Returns

The scaled Fock/Kohn-Sham matrices.

get_scf_type()

Gets string for spin unrestricted open shell SCF calculation. Overloaded base class method.

Returns

The string for spin unrestricted open shell SCF calculation.

store_diis_data(i, fock_mat, den_mat)

Stores spin unrestricted open shell Fock/Kohn-Sham and density matrices for current iteration. Overloaded base class method.

Parameters
  • i – The number of current SCF iteration.

  • fock_mat – The Fock/Kohn-Sham matrix.

  • den_mat – The density matrix.

veloxchem.signalhandler module

class veloxchem.signalhandler.SignalHandler

Bases: object

Impements signal handler.

Instance variable
  • func: The exit function.

  • args: The arguments for the exit function.

  • original_sigterm_handler: The original SIGTERM handler.

add_sigterm_function(func, *args)

Sets the handler for SIGTERM.

Parameters
  • func – The exit function.

  • args – The arguments for the exit function.

remove_sigterm_function()

Resets the handler for SIGTERM.

sigterm_handler(signum, frame)

Handles the SIGTERM signal.

Parameters
  • signum – The signum parameter as in the handler function.

  • frame – The frame parameter as in the handler function.

veloxchem.slurminfo module

veloxchem.slurminfo.executable_in_path(executable)

Checks if the executable is in PATH.

Parameters

executable – The executable.

Returns

True if the executable is in PATH, False otherwise.

veloxchem.slurminfo.get_command_output(command)

Gets the output of a command.

Parameters

command – The command as a list of strings.

Returns

The output as a string.

veloxchem.slurminfo.get_slurm_job_id()

Gets SLURM job ID as a string.

veloxchem.slurminfo.get_slurm_maximum_hours()

Gets SLURM timelimit in hours.

Returns

The SLURM timelimit in hours (None if not a SLURM job).

veloxchem.subcommunicators module

class veloxchem.subcommunicators.SubCommunicators(global_comm, grps)

Bases: object

Implements the MPI subcommunicator.

Parameters
  • global_comm – The global communicator.

  • grps – The color group for creating MPI subcommunicators.

Instance variables
  • local_comm: The local subcommunicator.

  • cross_comm: The cross subcommunicator consisting of the local master nodes.

veloxchem.tdaexcidriver module

class veloxchem.tdaexcidriver.TDAExciDriver(comm, ostream)

Bases: veloxchem.linearsolver.LinearSolver

Implements TDA excited states computation schheme for Hartree-Fock/Kohn-Sham level of theory.

Parameters
  • comm – The MPI communicator.

  • ostream – The output stream.

Instance variables
  • nstates: The number of excited states determined by driver.

  • solver: The eigenvalues solver.

check_convergence(iteration)

Checks convergence of excitation energies and set convergence flag on all processes within MPI communicator.

Parameters

iteration – The current excited states solver iteration.

comp_angular_momentum_ints(molecule, basis)

Computes one-electron angular momentum integrals.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

Returns

The Cartesian components of one-electron angular momentum integrals.

comp_dipole_ints(molecule, basis)

Computes one-electron dipole integrals.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

Returns

The Cartesian components of one-electron dipole integrals.

comp_elec_trans_dipoles(dipole_ints, eigvecs, mo_occ, mo_vir)

Computes electric transition dipole moments in length form.

Parameters
  • dipole_ints – One-electron dipole integrals.

  • eigvecs – The CI vectors.

  • mo_occ – The occupied MO coefficients.

  • mo_vir – The virtual MO coefficients.

Returns

The electric transition dipole moments in length form.

comp_linear_momentum_ints(molecule, basis)

Computes one-electron linear momentum integrals.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

Returns

The Cartesian components of one-electron linear momentum integrals.

comp_magn_trans_dipoles(angmom_ints, eigvecs, mo_occ, mo_vir)

Computes magnetic transition dipole moments.

Parameters
  • angmom_ints – One-electron angular momentum integrals.

  • eigvecs – The CI vectors.

  • mo_occ – The occupied MO coefficients.

  • mo_vir – The virtual MO coefficients.

Returns

The magnetic transition dipole moments.

comp_oscillator_strengths(transition_dipoles, eigvals)

Computes oscillator strengths.

Parameters
  • transition_dipoles – The electric transition dipole moments in length form.

  • eigvals – The excitation energies.

Returns

The oscillator strengths.

comp_rotatory_strengths(velo_trans_dipoles, magn_trans_dipoles)

Computes rotatory strengths in CGS unit.

Parameters
  • velo_trans_dipoles – The electric transition dipole moments in velocity form.

  • magn_trans_dipoles – The magnetic transition dipole moments.

Returns

The rotatory strengths in CGS unit.

comp_velo_trans_dipoles(linmom_ints, eigvals, eigvecs, mo_occ, mo_vir)

Computes electric transition dipole moments in velocity form.

Parameters
  • linmom_ints – One-electron linear momentum integrals.

  • eigvals – The excitation energies.

  • eigvecs – The CI vectors.

  • mo_occ – The occupied MO coefficients.

  • mo_vir – The virtual MO coefficients.

Returns

The electric transition dipole moments in velocity form.

compute(molecule, basis, scf_tensors)

Performs TDA excited states calculation using molecular data.

Parameters
  • molecule – The molecule.

  • basis – The AO basis set.

  • scf_tensors – The dictionary of tensors from converged SCF wavefunction.

Returns

A dictionary containing eigenvalues, eigenvectors, transition dipole moments, oscillator strengths and rotatory strengths.

convert_to_trial_matrix(trial_vecs)

Converts set of Z vectors from std::vector<CExcitationVector> to numpy 2D array.

Parameters

trial_vecs – The Z vectors as std::vector<CExcitationVector>.

Returns

The 2D Numpy array.

convert_to_trial_vectors(mol_orbs, molecule, zvecs)

Converts set of Z vectors from numpy 2D array to std::vector<CExcitationVector>.

Parameters
  • mol_orbs – The molecular orbitals.

  • molecule – The molecule.

  • zvecs – The Z vectors as 2D Numpy array.

Returns

The Z vectors as std::vector<CExcitationVector>.

gen_trial_vectors(mol_orbs, molecule)

Generates set of TDA trial vectors for given number of excited states by selecting primitive excitations wirh lowest approximate energies E_ai = e_a-e_i.

Parameters
  • mol_orbs – The molecular orbitals.

  • molecule – The molecule.

Returns

tuple (approximate diagonal of symmetric A, set of trial vectors).

get_densities(trial_vecs, tensors, molecule)

Computes the ground-state and transition densities, and initializes the Fock matrix.

Parameters
  • trial_vecs – The Z vectors as std::vector<CExcitationVector>.

  • tensors – The dictionary of tensors from converged SCF wavefunction.

  • molecule – The molecule.

Returns

The initialized Fock matrix, the transition density matrix, and the ground-state density matrix.

get_sigmas(fock, tensors, molecule, trial_mat)

Computes the sigma vectors.

Parameters
  • fock – The Fock matrix.

  • tensors – The dictionary of tensors from converged SCF wavefunction.

  • molecule – The molecule.

  • trial_mat – The trial vectors as 2D Numpy array.

Returns

The sigma vectors as 2D Numpy array.

print_iter_data(iteration)

Prints excited states solver iteration data to output stream.

Parameters

iteration – The current excited states solver iteration.

update_settings(rsp_dict, method_dict=None)

Updates response and method settings in TDA excited states computation driver.

Parameters
  • rsp_dict – The dictionary of response dict.

  • method_dict – The dictionary of method settings.

veloxchem.veloxchem module

veloxchem.veloxchem.main = <Mock id='140353762641792'>

Module contents

veloxchem.module_path = '/home/www/sites/docs.veloxchem.org/src/docs/Reference Guide/veloxchem'
veloxchem.ncores = 1