pyscivr.potentials module
Potential energy calculators.
All calculators take positions in Angstrom and return energies in eV, forces in eV/Angs and Hessians in eV/Angs^2.
- Notation:
N: number of atoms.
- class pyscivr.potentials.Calculator[source]
Bases:
ABCBase class for potential energy calculators.
Subclasses implement
_energy_forces_batch()and optionally_hessian_batch()for a batch of geometries. The public methods accept either a single geometry(N, 3)or a batch of geometries(n_batch, N, 3), and return the results without the batch axis for a single geometry.- energy_forces(positions)[source]
Compute the energy and forces for a single geometry or a batch of geometries.
- Parameters:
positions (ArrayLike) –
(N, 3)or(n_batch, N, 3)positions [Angs].- Returns:
(energy, forces)[eV, eV/Angs], with shapes()and(N, 3)for a single geometry, or(n_batch,)and(n_batch, N, 3)for a batch.- Return type:
tuple[NDArray[np.float64], NDArray[np.float64]]
- energy(positions)[source]
Compute the energy [eV] (see
energy_forces()).- Parameters:
positions (ArrayLike)
- Return type:
NDArray[np.float64]
- forces(positions)[source]
Compute the forces [eV/Angs] (see
energy_forces()).- Parameters:
positions (ArrayLike)
- Return type:
NDArray[np.float64]
- hessian(positions)[source]
Compute the analytical Hessian.
- Parameters:
positions (ArrayLike) –
(N, 3)or(n_batch, N, 3)positions [Angs].- Returns:
(3N, 3N)Hessian [eV/Angs^2] for a single geometry, or(n_batch, 3N, 3N)for a batch.- Raises:
NotImplementedError – If the subclass does not implement an analytic Hessian. Use
pyscivr.hessian.eval_hess_active()instead.- Return type:
NDArray[np.float64]
- class pyscivr.potentials.ZeroPotential[source]
Bases:
CalculatorZero potential. The energies, forces and Hessians are all zero.
- class pyscivr.potentials.H2SplinePotential[source]
Bases:
CalculatorH2 potential by cubic spline interpolation of CCSD(T)/aug-cc-pV5Z scan computed with Gaussian 16.
The potential \(V(r)\) depends only on the bond length \(r\) between the two atoms. The forces and Hessians are the exact derivatives of the spline, with the Hessian blocks
H_ii = H_jj = H_BBandH_ij = H_ji = -H_BB, where\[H_{BB} = V''(r) \hat{u}\hat{u}^T + \frac{V'(r)}{r} (I - \hat{u}\hat{u}^T), \quad \hat{u} = \frac{q_j - q_i}{r}\]Warning
The scan covers only 0.4 to 1.5 Angs (0.02 Angs spacing). The spline is not reliable outside this range.
- class pyscivr.potentials.ASEPotential(symbols, calc)[source]
Bases:
CalculatorWrapper for ASE calculators.
Geometries in a batch are evaluated sequentially. The analytical Hessian is not available.
- Parameters:
symbols (Sequence[str]) –
(N,)atomic symbols.calc (ASECalculator) – ASE calculator.
- pyscivr.potentials.mace_anicc_potential(symbols, *, device=None, num_threads=1)[source]
Make a calculator with the pre-trained MACE-ANICC model.
- Parameters:
- Returns:
Calculator wrapping the MACE-ANICC model.
- Return type:
Note
Requires the
torch,maceandasepackages. On the CPU,torch.jit.loadis patched to load the model onto the CPU.
- class pyscivr.potentials.DFTPotential(symbols, *, basis='def2-svp', xc='b3lyp', charge=0, spin=0, conv_tol=1e-10)[source]
Bases:
CalculatorPotential by DFT calculations with PySCF.
Geometries in a batch are evaluated sequentially. The analytical Hessian is not available.
- Parameters:
symbols (Sequence[str]) –
(N,)atomic symbols.basis (str) – Basis set.
xc (str) – Exchange-correlation functional.
charge (int) – Total charge.
spin (int) – Number of unpaired electrons (
2S). Restricted Kohn-Sham is used ifspin == 0, otherwise unrestricted Kohn-Sham.conv_tol (float) – Convergence threshold of the SCF energy [Hartree].
- class pyscivr.potentials.ArgonPotential(calc, root=None, fname_qc_base=None)[source]
Bases:
CalculatorWrapper for Argon (Unpublished) calculators.
Geometries in a batch are evaluated sequentially. The analytical Hessian is not available.
- Parameters:
calc – Argon calculator.
root – tuple that specifying the bra (and ket) state of the property will be returned.
fname_qc_base – File name (w/o extension) of QC input/output file.