qmctorch.wavefunction.slater_jastrow_base module

class qmctorch.wavefunction.slater_jastrow_base.SlaterJastrowBase(mol, configs='ground_state', kinetic='jacobi', cuda=False, include_all_mo=True)[source]

Bases: qmctorch.wavefunction.wf_base.WaveFunction

Implementation of the QMC Network.

Parameters:
  • mol (Molecule) – a QMCTorch molecule object
  • configs (str, optional) – defines the CI configurations to be used. Defaults to ‘ground_state’. - ground_state : only the ground state determinant in the wave function - single(n,m) : only single excitation with n electrons and m orbitals - single_double(n,m) : single and double excitation with n electrons and m orbitals - cas(n, m) : all possible configuration using n eletrons and m orbitals
  • kinetic (str, optional) – method to compute the kinetic energy. Defaults to ‘jacobi’. - jacobi : use the Jacobi formula to compute the kinetic energy - auto : use automatic differentiation to compute the kinetic energy
  • cuda (bool, optional) – turns GPU ON/OFF Defaults to False.
  • include_all_mo (bool, optional) – include either all molecular orbitals or only the ones that are popualted in the configs. Defaults to False
log_data()[source]

Print information abut the wave function.

get_mo_coeffs()[source]
update_mo_coeffs()[source]
geometry(pos)[source]

Returns the gemoetry of the system in xyz format

Parameters:pos (torch.tensor) – sampling points (Nbatch, 3*Nelec)
Returns:list where each element is one line of the xyz file
Return type:list
gto2sto(plot=False)[source]

Fits the AO GTO to AO STO. The SZ sto that have only one basis function per ao

forward(x, ao=None)[source]

computes the value of the wave function for the sampling points

\[\Psi(R) = \sum_{n} c_n D^{u}_n(r^u) \times D^{d}_n(r^d)\]
Parameters:
  • x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
  • ao (torch.tensor, optional) – values of the atomic orbitals (Nbatch, Nelec, Nao)
Returns:

values of the wave functions at each sampling point (Nbatch, 1)

Return type:

torch.tensor

Examples::
>>> mol = Molecule('h2.xyz', calculator='adf', basis = 'dzp')
>>> wf = SlaterJastrow(mol, configs='cas(2,2)')
>>> pos = torch.rand(500,6)
>>> vals = wf(pos)
ao2mo(ao)[source]

Get the values of the MO from the values of AO.

pos2mo(x, derivative=0)[source]

Get the values of MOs from the positions

Parameters:{torch.tensor} -- positions of the electrons [nbatch, nelec*ndim] (x) –
Keyword Arguments:
 {int} -- order of the derivative (default (derivative) – {0})
Returns:torch.tensor – MO matrix [nbatch, nelec, nmo]
kinetic_energy_jacobi(x, **kwargs)[source]

Compute the value of the kinetic enery using the Jacobi Formula. C. Filippi, Simple Formalism for Efficient Derivatives .

\[\frac{K(R)}{\Psi(R)} = Tr(A^{-1} B_{kin})\]
Parameters:x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
Returns:values of the kinetic energy at each sampling points
Return type:torch.tensor
gradients_jacobi(x, pdf=False)[source]

Compute the gradients of the wave function (or density) using the Jacobi Formula C. Filippi, Simple Formalism for Efficient Derivatives.

\[\frac{K(R)}{\Psi(R)} = Tr(A^{-1} B_{grad})\]
Parameters:
  • x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
  • pdf (bool, optional) – if true compute the grads of the density
Returns:

values of the gradients wrt the walker pos at each sampling points

Return type:

torch.tensor

get_gradient_operator(x, ao, grad_ao, mo)[source]

Compute the gradient operator

Parameters:
  • x ([type]) – [description]
  • ao ([type]) – [description]
  • dao ([type]) – [description]
get_hessian_operator(x, ao, dao, d2ao, mo)[source]

Compute the Bkin matrix

Parameters:
  • x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
  • mo (torch.tensor, optional) – precomputed values of the MOs
Returns:

matrix of the kinetic operator

Return type:

torch.tensor