qmctorch.wavefunction.orbitals.atomic_orbitals module
- class qmctorch.wavefunction.orbitals.atomic_orbitals.AtomicOrbitals(*args: Any, **kwargs: Any)[source]
Bases:
Module
Computes the value of atomic orbitals
- Parameters:
- forward(pos, derivative=[0], sum_grad=True, sum_hess=True, one_elec=False)[source]
Computes the values of the atomic orbitals.
\[\phi_i(r_j) = \sum_n c_n \text{Rad}^{i}_n(r_j) \text{Y}^{i}_n(r_j)\]where Rad is the radial part and Y the spherical harmonics part. It is also possible to compute the first and second derivatives
\[ \begin{align}\begin{aligned}\nabla \phi_i(r_j) = \frac{d}{dx_j} \phi_i(r_j) + \frac{d}{dy_j} \phi_i(r_j) + \frac{d}{dz_j} \phi_i(r_j)\\\text{grad} \phi_i(r_j) = (\frac{d}{dx_j} \phi_i(r_j), \frac{d}{dy_j} \phi_i(r_j), \frac{d}{dz_j} \phi_i(r_j))\\\Delta \phi_i(r_j) = \frac{d^2}{dx^2_j} \phi_i(r_j) + \frac{d^2}{dy^2_j} \phi_i(r_j) + \frac{d^2}{dz^2_j} \phi_i(r_j)\end{aligned}\end{align} \]- Parameters:
pos (torch.tensor) – Positions of the electrons Size : Nbatch, Nelec x Ndim
derivative (int, optional) – order of the derivative (0,1,2,). Defaults to 0.
sum_grad (bool, optional) – Return the sum_grad (i.e. the sum of the derivatives) or the individual terms. Defaults to True. False only for derivative=1
sum_hess (bool, optional) – Return the sum_hess (i.e. the sum of 2nd the derivatives) or the individual terms. Defaults to True. False only for derivative=1
one_elec (bool, optional) – if only one electron is in input
- Returns:
Value of the AO (or their derivatives)
size : Nbatch, Nelec, Norb (sum_grad = True)
size : Nbatch, Nelec, Norb, Ndim (sum_grad = False)
- Return type:
torch.tensor
- Examples::
>>> mol = Molecule('h2.xyz') >>> ao = AtomicOrbitals(mol) >>> pos = torch.rand(100,6) >>> aovals = ao(pos) >>> daovals = ao(pos,derivative=1)
- update(ao, pos, idelec)[source]
Update an AO matrix with the new positions of one electron
- Parameters:
ao (torch.tensor) – initial AO matrix
pos (torch.tensor) – new positions of some electrons
idelec (int) – index of the electron that has moved
- Returns:
new AO matrix
- Return type:
torch.tensor
- Examples::
>>> mol = Molecule('h2.xyz') >>> ao = AtomicOrbitals(mol) >>> pos = torch.rand(100,6) >>> aovals = ao(pos) >>> id = 0 >>> pos[:,:3] = torch.rand(100,3) >>> ao.update(aovals, pos, 0)