pymolresponse package
Subpackages
Submodules
pymolresponse.ao2mo module
Tools for performing AO-to-MO transformations of two-electron integrals.
- class pymolresponse.ao2mo.AO2MO(C: tuple[numpy.ndarray[tuple[int, ...], numpy.dtype[numpy.floating]], ...] | numpy.ndarray[tuple[int, int] | tuple[int, int, int], numpy.dtype[numpy.floating]], occupations: Occupations, I: ndarray[tuple[int, int, int, int], dtype[floating]] | None = None)[source]
Bases:
objectInterface for performing AO-to-MO tranformations of two-electron integrals.
- perform_rhf_full() None[source]
Perform the transformation \((\mu\nu|\lambda\sigma) \rightarrow (pq|rs)\).
- perform_rhf_partial() None[source]
Perform the transformation \((\mu\nu|\lambda\sigma) \rightarrow (ia|jb), (ij|ab)\).
- perform_uhf_full() None[source]
Perform the transformation \((\mu\nu|\lambda\sigma) \rightarrow (p^{\alpha}q^{\alpha}|r^{\alpha}s^{\alpha}), (p^{\alpha}q^{\alpha}|r^{\beta}s^{\beta}), (p^{\beta}q^{\beta}|r^{\alpha}s^{\alpha}), (p^{\beta}q^{\beta}|r^{\beta}s^{\beta})\).
- perform_uhf_partial() None[source]
Perform the transformation \((\mu\nu|\lambda\sigma) \rightarrow (i^{\alpha}a^{\alpha}|j^{\alpha}b^{\alpha}), (i^{\alpha}a^{\alpha}|j^{\beta}b^{\beta}), (i^{\beta}a^{\beta}|j^{\alpha}b^{\alpha}), (i^{\beta}a^{\beta}|j^{\beta}b^{\beta}), (i^{\alpha}j^{\alpha}|a^{\alpha}b^{\alpha}), (i^{\beta}j^{\beta}|a^{\beta}b^{\beta})\).
- static transform(I: ndarray[tuple[int, int, int, int], dtype[floating]], C1: ndarray[tuple[int, int], dtype[floating]], C2: ndarray[tuple[int, int], dtype[floating]], C3: ndarray[tuple[int, int], dtype[floating]], C4: ndarray[tuple[int, int], dtype[floating]]) ndarray[tuple[int, int, int, int], dtype[floating]][source]
Transforms the 4-index ERI I with the 4 transformation matrices C1 to C4.
pymolresponse.constants module
Storage of common physical constants. Uses scipy.constants: https://docs.scipy.org/doc/scipy/reference/constants.html.
pymolresponse.core module
Core types.
- class pymolresponse.core.AO2MOTransformationType(*values)[source]
Bases:
EnumFor routines that perform AO-to-MO transformations, specify the kind of transformation.
Starting from \((\mu\nu|\lambda\sigma)\),
a ‘partial’ transformation will produce \((ia|jb)\) and \((ij|ab)\) if needed
a ‘full’ transformation will produce \((pq|rs)\)
- full = 'full'
- partial = 'partial'
- class pymolresponse.core.Hamiltonian(*values)[source]
Bases:
EnumSpecify which approximation for the orbital Hessian should be used.
RPA indicates the random phase approximation: the orbital Hessian is exact for the first-order polarization propagator.
TDA indicates the Tamm-Dancoff approximation: the B matrix is set to zero.
Currently this is only capable of handling the usual first-order polarization propagator for CPHF and TDHF.
- RPA = 'rpa'
- TDA = 'tda'
- class pymolresponse.core.Program(*values)[source]
Bases:
EnumSpecify which program should be used for a particular step.
- DALTON = 'dalton'
- Psi4 = 'psi4'
- PySCF = 'pyscf'
- class pymolresponse.core.Spin(*values)[source]
Bases:
EnumSpecify whether the calculation should conserve spin (singlet) or flip spin (triplet).
For response properties, this affects both the orbital Hessian and the perturbing operator. Note that these two specifications are currently independent!
For excitation energies, this only affects the orbital Hessian and determines whether singlet or triplet excitation energies are calculated.
- singlet = 0
- triplet = 1
pymolresponse.cphf module
Driver for solving the coupled perturbed Hartree-Fock (CPHF) equations.
- class pymolresponse.cphf.CPHF(solver: LineqSolver)[source]
Bases:
DriverDriver for solving the coupled perturbed Hartree-Fock (CPHF) equations.
- add_operator(operator: Operator) None[source]
Add an operator to the list of operators that will be used as the right-hand side perturbation.
- run(hamiltonian: Hamiltonian, spin: Spin, program: Program | None, program_obj: Any) None[source]
pymolresponse.explicit_equations_full module
Explicit equations for orbital Hessian terms using fully-transformed MO-basis two-electron integrals, e.g., \((pq|rs)\).
- pymolresponse.explicit_equations_full.form_rpa_a_matrix_mo_singlet_full(E_MO: ndarray[tuple[int, int], dtype[floating]], TEI_MO: ndarray[tuple[int, int, int, int], dtype[floating]], nocc: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the A (CIS) matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(\left<aj||ib\right> = \left<aj|ib\right> - \left<aj|bi\right> = [ai|jb] - [ab|ji] = 2(ai|jb) - (ab|ji)\). It also includes the virt-occ energy difference on the diagonal.
- pymolresponse.explicit_equations_full.form_rpa_a_matrix_mo_singlet_os_full(TEI_MO_xxyy: ndarray[tuple[int, int, int, int], dtype[floating]], nocc_x: int, nocc_y: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the opposite-spin part of the A (CIS) matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_full.form_rpa_a_matrix_mo_singlet_ss_full(E_MO: ndarray[tuple[int, int], dtype[floating]], TEI_MO: ndarray[tuple[int, int, int, int], dtype[floating]], nocc: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the same-spin part of the A (CIS) matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_full.form_rpa_a_matrix_mo_triplet_full(E_MO: ndarray[tuple[int, int], dtype[floating]], TEI_MO: ndarray[tuple[int, int, int, int], dtype[floating]], nocc: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the A (CIS) matrix in the MO basis. [triplet].
The equation for element \(\{ia,jb\}\) is \(- \left<aj|bi\right> = - [ab|ji] = - (ab|ji)\). It also includes the virt-occ energy difference on the diagonal.
- pymolresponse.explicit_equations_full.form_rpa_b_matrix_mo_singlet_full(TEI_MO: ndarray[tuple[int, int, int, int], dtype[floating]], nocc: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the B matrix for RPA in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(\left<ab||ij\right> = \left<ab|ij\right> - \left<ab|ji\right> = [ai|bj] - [aj|bi] = 2(ai|bj) - (aj|bi)\).
- pymolresponse.explicit_equations_full.form_rpa_b_matrix_mo_singlet_os_full(TEI_MO_xxyy: ndarray[tuple[int, int, int, int], dtype[floating]], nocc_x: int, nocc_y: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the opposite-spin part of the RPA B matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_full.form_rpa_b_matrix_mo_singlet_ss_full(TEI_MO: ndarray[tuple[int, int, int, int], dtype[floating]], nocc: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the same-spin part of the RPA B matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_full.form_rpa_b_matrix_mo_triplet_full(TEI_MO: ndarray[tuple[int, int, int, int], dtype[floating]], nocc: int) ndarray[tuple[int, int], dtype[floating]][source]
Form the B matrix for RPA in the MO basis. [triplet].
The equation for element \(\{ia,jb\}\) is \(????\).
pymolresponse.explicit_equations_partial module
Explicit equations for orbital Hessian terms using partially-transformed MO-basis two-electron integrals, e.g., \((ia|jb), (ij|ab)\).
- pymolresponse.explicit_equations_partial.form_rpa_a_matrix_mo_singlet_os_partial(TEI_MO_iajb_xxyy: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the opposite-spin part of the A (CIS) matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_partial.form_rpa_a_matrix_mo_singlet_partial(E_MO: ndarray[tuple[int, int], dtype[floating]], TEI_MO_iajb: ndarray[tuple[int, int, int, int], dtype[floating]], TEI_MO_ijab: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the A (CIS) matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(\left<aj||ib\right> = \left<aj|ib\right> - \left<aj|bi\right> = [ai|jb] - [ab|ji] = 2(ai|jb) - (ab|ji)\). It also includes the virt-occ energy difference on the diagonal.
- pymolresponse.explicit_equations_partial.form_rpa_a_matrix_mo_singlet_ss_partial(E_MO: ndarray[tuple[int, int], dtype[floating]], TEI_MO_iajb: ndarray[tuple[int, int, int, int], dtype[floating]], TEI_MO_ijab: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the same-spin part of the A (CIS) matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_partial.form_rpa_a_matrix_mo_triplet_partial(E_MO: ndarray[tuple[int, int], dtype[floating]], TEI_MO_ijab: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the A (CIS) matrix in the MO basis. [triplet].
The equation for element \(\{ia,jb\}\) is \(- \left<aj|bi\right> = - [ab|ji] = - (ab|ji)\). It also includes the virt-occ energy difference on the diagonal.
- pymolresponse.explicit_equations_partial.form_rpa_b_matrix_mo_singlet_os_partial(TEI_MO_iajb_xxyy: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the opposite-spin part of the RPA B matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_partial.form_rpa_b_matrix_mo_singlet_partial(TEI_MO_iajb: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the B matrix for RPA in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(\left<ab||ij\right> = \left<ab|ij\right> - \left<ab|ji\right> = [ai|bj] - [aj|bi] = 2(ai|bj) - (aj|bi)\).
- pymolresponse.explicit_equations_partial.form_rpa_b_matrix_mo_singlet_ss_partial(TEI_MO_iajb: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the same-spin part of the RPA B matrix in the MO basis. [singlet].
The equation for element \(\{ia,jb\}\) is \(????\).
- pymolresponse.explicit_equations_partial.form_rpa_b_matrix_mo_triplet_partial(TEI_MO_iajb: ndarray[tuple[int, int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form the B matrix for RPA in the MO basis. [triplet].
The equation for element \(\{ia,jb\}\) is \(????\).
pymolresponse.helpers module
Utility functions that are core to calculating physical values.
- pymolresponse.helpers.calc_center_of_nuclear_charge(coords: ndarray, charges: ndarray) ndarray[source]
- pymolresponse.helpers.get_uhf_values(mat_uhf_a: ndarray, mat_uhf_b: ndarray, pair_rohf: tuple[int, int], nocc_a: int, nvirt_a: int, nocc_b: int, nvirt_b: int) list[float][source]
For a pair ROHF 1-based indices, find the corresponing alpha- and beta-spin UHF values.
pymolresponse.integrals module
- class pymolresponse.integrals.IntegralLabel(label: str, comp: int | None = None, symmetry: pymolresponse.integrals.IntegralSymmetry = <IntegralSymmetry.SYMMETRIC: 1>)[source]
Bases:
object- comp: int | None = None
- label: str
- symmetry: IntegralSymmetry = 1
- class pymolresponse.integrals.IntegralSymmetry(*values)[source]
Bases:
Enum- ANTISYMMETRIC = 2
- SYMMETRIC = 1
- class pymolresponse.integrals.Integrals[source]
Bases:
ABC- integrals(label: IntegralLabel) ndarray[tuple[int, int, int], dtype[floating]][source]
- class pymolresponse.integrals.JK[source]
Bases:
ABCInterface for computing Coulomb and exchange integrals pre-contracted with the density.
pymolresponse.molecular_property module
- class pymolresponse.molecular_property.MolecularProperty(program: Program, program_obj: Any, driver: Driver)[source]
Bases:
ABCA molecular property that is calculated from one or more operators.
The TODO
- run(hamiltonian: Hamiltonian, spin: Spin) None[source]
- class pymolresponse.molecular_property.ResponseProperty(program: Program, program_obj: Any, driver: CPHF, *, frequencies: Sequence[float])[source]
Bases:
MolecularProperty,ABCA molecular property that is calculated as the response to one or more perturbations, each represented by an operator.
- class pymolresponse.molecular_property.TransitionProperty(program: Program, program_obj: Any, driver: TDHF)[source]
Bases:
MolecularProperty,ABC
pymolresponse.operators module
- class pymolresponse.operators.Operator(*, label: str = '', is_imaginary: bool = False, is_spin_dependent: bool = False, triplet: bool = False, slice_idx: int = -1, ao_integrals: PropertyIntegrals)[source]
Bases:
objectHandle property integrals, taking them from the AO basis to a representation of a right-hand side perturbation for CPHF or transition properties.
pymolresponse.solvers module
- class pymolresponse.solvers.EigSolver(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
Solver,ABCBase class for all solvers of the type $AX = 0$ (eigensolvers).
- property eigvals
- property eigvecs
- class pymolresponse.solvers.EigSolverTDA(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
EigSolver,ABCBase class for eigensolvers that use the Tamm-Dancoff approximation (TDA) rather than the random phase approximation (RPA).
- class pymolresponse.solvers.ExactDiagonalizationSolver(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
EigSolverGet the eigenvectors and eigenvalues of the RPA Hamiltonian by forming the electronic Hessian explicitly and diagonalizing it exactly.
- form_explicit_hessian(hamiltonian: Hamiltonian, spin: Spin, frequency: float | None) None[source]
- run(hamiltonian: Hamiltonian, spin: Spin, program: Program | None, program_obj: Any) None[source]
Run the solver.
- class pymolresponse.solvers.ExactDiagonalizationSolverTDA(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
ExactDiagonalizationSolver,EigSolverTDAGet the eigenvectors and eigenvalues of the TDA Hamiltonian by forming the electronic Hessian explicitly and diagonalizing it exactly.
- form_explicit_hessian(hamiltonian: Hamiltonian, spin: Spin, frequency: float | None) None[source]
- class pymolresponse.solvers.ExactInv(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations, *, inv_func: Callable[[ndarray], ndarray] | None = None)[source]
Bases:
ExactLineqSolver
- class pymolresponse.solvers.ExactInvCholesky(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
ExactLineqSolver
- class pymolresponse.solvers.ExactLineqSolver(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
LineqSolver,ABCBase class for all solvers of the type $AX = B$, where $A$ is formed explicitly.
- form_explicit_hessian(hamiltonian: Hamiltonian, spin: Spin, frequency: float | None) None[source]
- abstractmethod invert_explicit_hessian() None[source]
Invert the full explicitly-constructed electronic Hessian.
- run(hamiltonian: Hamiltonian, spin: Spin, program: Program | None, program_obj: Any) None[source]
Run the solver.
- class pymolresponse.solvers.IterativeLinEqSolver(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations, jk_generator: JK, *, maxiter: int = 40, conv: float = 1e-09)[source]
Bases:
LineqSolver- run(hamiltonian: Hamiltonian, spin: Spin, program: Program | None, program_obj: Any) None[source]
Run the solver.
- class pymolresponse.solvers.LineqSolver(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
Solver,ABCBase class for all solvers of the type $AX = B$.
- class pymolresponse.solvers.Solver(mocoeffs: ndarray, moenergies: ndarray, occupations: Occupations)[source]
Bases:
ABCA Solver does all of the TODO.
There are two principal algorithm classes for forming response vectors:
Exact, where the full electronic Hessian is formed explicitly, diagonalized, and then contracted with property gradient vectors to response vectors, or
Iterative, where the electronic Hessian is never formed explicitly, TODO
- form_tei_mo(program: Program, program_obj: Any, tei_mo_type: AO2MOTransformationType) None[source]
- abstractmethod run(hamiltonian: Hamiltonian, spin: Spin, program: Program | None, program_obj: Any) None[source]
Run the solver.
pymolresponse.td module
Drivers for solving the time-dependent Hartree-Fock (TDHF) equations.
- class pymolresponse.td.TDA(solver: EigSolverTDA)[source]
Bases:
TDHFDriver for solving the time-dependent Hartree-Fock equations with the Tamm-Dancoff approximation (TDA), also called the configuration interaction with single excitation (CIS) equations when no XC contribution is present.
pymolresponse.utils module
Utility functions that are not core to calculating physical values.
- class pymolresponse.utils.Splitter(widths: Iterable[int])[source]
Bases:
objectSplit a line based on a number of field widths.
- pymolresponse.utils.fix_mocoeffs_shape(mocoeffs: tuple[numpy.ndarray[tuple[int, ...], numpy.dtype[numpy.floating]], ...] | numpy.ndarray[tuple[int, int] | tuple[int, int, int], numpy.dtype[numpy.floating]]) ndarray[tuple[int, int, int], dtype[floating]][source]
Clean up the dimensionality of molecular orbital coefficients.
The result is 3-D, where the first index is spin, the second is the atomic orbital, and the third is the molecular orbital. The first index will only ever be of length 1 or 2.
- pymolresponse.utils.fix_moenergies_shape(moenergies: tuple[ndarray[tuple[int, ...], dtype[floating]], ...] | ndarray[tuple[int] | tuple[int, int] | tuple[int, int, int], dtype[floating]]) ndarray[tuple[int, int, int], dtype[floating]][source]
Clean up the dimensionality of molecular orbital energies.
The result is 3-D, where the first index is spin and the second and third indices are molecular orbitals. For canonical orbitals, all off-diagonal elements will be zero, but it is more convenient to have the shape be a matrix rather than a vector.
- pymolresponse.utils.flip_triangle_sign(A: ndarray[tuple[int, int], dtype[number]], triangle: str = 'lower') ndarray[tuple[int, int], dtype[number]][source]
Flip the sign of either the lower or upper triangle of a square matrix.
Assumes nothing about the input matrix symmetry.
- Parameters:
- Anp.ndarray
- triangle{‘lower’, ‘upper’}
- Returns:
- np.ndarray
- pymolresponse.utils.form_first_hyperpolarizability_averages(beta: ndarray[tuple[int, int, int], dtype[floating]]) tuple[ndarray[tuple[int], dtype[floating]], floating][source]
Form the relevant averages from a complete (no symmetry) hyperpolarizability tensor.
- pymolresponse.utils.form_indices_orbwin(nocc: int, nvirt: int) list[tuple[int, int]][source]
Form all occupied-virtual pairs of indices starting from their absolute position.
- pymolresponse.utils.form_indices_zero(nocc: int, nvirt: int) list[tuple[int, int]][source]
Form all occupied-virtual pairs of indices, both starting from zero.
- pymolresponse.utils.form_results(vecs_property: ndarray[tuple[int, int, int], dtype[floating]], vecs_response: ndarray[tuple[int, int, int], dtype[floating]]) ndarray[tuple[int, int], dtype[floating]][source]
Form all possible results by contracting response vectors with property gradients.
- pymolresponse.utils.form_vec_energy_differences(moene_occ: ndarray[tuple[int], dtype[floating]], moene_virt: ndarray[tuple[int], dtype[floating]]) ndarray[tuple[int], dtype[floating]][source]
Form a vector of virtual-occupied MO energy differences.
In the compound-indexed result vector, the virtual index is fast and the occupied index is slow.
- pymolresponse.utils.get_reference_value_from_file(filename: Path | str, hamiltonian: str, spin: str, frequency: str, label_1: str, label_2: str) float[source]
Find a reference value for the linear response of a system to two operators.
- pymolresponse.utils.matsym(amat: ndarray[tuple[int, int], dtype[number]], thrzer: float = 1e-14) int[source]
Determine matrix symmetry.
Copied from
DALTON/gp/gphjj.F/MATSYM.thrzer taken from
DALTON/include/thrzer.h.
- Parameters:
- amatnp.ndarray
- thrzerfloat
Threshold below which a (floating point) number is considered zero.
- Returns:
- int
1 if the matrix is symmetric to threshold thrzer
2 if the matrix is antisymmetric to threshold thrzer
3 if all elements are below thrzer
0 otherwise (the matrix is unsymmetric about the diagonal)
- pymolresponse.utils.np_load(filename: str | Path) ndarray[tuple[int, ...], dtype[number]][source]
Read a file using NumPy.
- pymolresponse.utils.np_load_2(filename: str | Path) ndarray[tuple[int, int], dtype[floating]][source]
Read a file with a floating-point matrix using NumPy.
- pymolresponse.utils.occupations_from_sirifc(ifc: sirifc) Occupations[source]
Read orbital occupations from a parsed DALTON SIRIFC object.
- pymolresponse.utils.parse_int_file_2(filename: str | Path, dim: int) ndarray[tuple[int, int], dtype[floating]][source]
Read a 2-D array from a formatted text file.
The first two columns are the one-based indices and the third column is the array element.
- pymolresponse.utils.read_file_1(filename: Path | str) ndarray[tuple[int], dtype[floating]][source]
Read a libaview-formatted 1-D array.
- pymolresponse.utils.read_file_2(filename: Path | str) ndarray[tuple[int, int], dtype[floating]][source]
Read a libaview-formatted 2-D array.
- pymolresponse.utils.read_file_3(filename: Path | str) ndarray[tuple[int, int, int], dtype[floating]][source]
Read a libaview-formatted 3-D array.
- pymolresponse.utils.read_file_4(filename: Path | str) ndarray[tuple[int, int, int, int], dtype[floating]][source]
Read a libaview-formatted 4-D array.
- pymolresponse.utils.read_file_occupations(filename: Path | str) Occupations[source]
Read molecular orbital occupations from a file.
The file should contain a single line of four integers - number of occupied alpha orbitals - number of unoccupied (virtual) alpha orbitals - number of occupied beta orbitals - number of unoccupied (virtual) beta orbitals which are parsed and returned in an array in the same order.
The file makes no distinction about whether or not they come from a restricted calculation, in which case the alpha and beta values will be identical.
- pymolresponse.utils.repack_matrix_to_vector(mat: ndarray) ndarray[source]
Convert a matrix to a vector for compound indexing.
- pymolresponse.utils.repack_vector_to_matrix(vec: ndarray, shape: tuple[int, ...]) ndarray[source]
Convert a vector with an assumed compound index into a dense matrix.
- pymolresponse.utils.screen(mat: ndarray[tuple[int, ...], dtype[number]], thresh: float = 1e-16) ndarray[tuple[int, ...], dtype[number]][source]
Set all values smaller than the threshold to zero.
This function makes a copy of mat and does not modify it in-place.
- Parameters:
- matnp.ndarray
- threshfloat
Threshold below which all elements of mat smaller than thresh are set to zero.
- Returns:
- np.ndarray
Module contents
Molecular frequency-dependent response properties for arbitrary operators.