qmctorch.wavefunction.wf_base module

class qmctorch.wavefunction.wf_base.WaveFunction(nelec, ndim, kinetic='auto', cuda=False)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

forward(x)[source]

Compute the value of the wave function. for a multiple conformation of the electrons

Parameters:
  • parameters – variational param of the wf
  • pos – position of the electrons

Returns: values of psi

electronic_potential(pos)[source]

Computes the electron-electron term

Parameters:x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
Returns:values of the electon-electron energy at each sampling points
Return type:torch.tensor
nuclear_potential(pos)[source]

Computes the electron-nuclear term

Parameters:x (torch.tensor) – sampling points (Nbatch, 3*Nelec)
Returns:values of the electon-nuclear energy at each sampling points
Return type:torch.tensor
nuclear_repulsion()[source]

Computes the nuclear-nuclear repulsion term

Returns:values of the nuclear-nuclear energy at each sampling points
Return type:torch.tensor
gradients_autograd(pos, pdf=False)[source]

Computes the gradients of the wavefunction (or density) w.r.t the values of the pos.

Parameters:
  • pos (torch.tensor) – positions of the walkers
  • pdf (bool, optional) – if true compute the grads of the density
Returns:

values of the gradients

Return type:

torch.tensor

kinetic_energy_autograd(pos)[source]

Compute the kinetic energy through the 2nd derivative w.r.t the value of the pos.

Parameters:pos (torch.tensor) – positions of the walkers
Returns:values of nabla^2 * Psi
local_energy(pos)[source]

Computes the local energy

\[E = K(R) + V_{ee}(R) + V_{en}(R) + V_{nn}\]
Parameters:pos (torch.tensor) – sampling points (Nbatch, 3*Nelec)
Returns:values of the local enrgies at each sampling points
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.local_energy(pos)

Note

by default kinetic_energy refers to kinetic_energy_autograd users can overwrite it to poit to any other methods see kinetic_energy_jacobi in wf_orbital

energy(pos)[source]

Total energy for the sampling points.

variance(pos)[source]

Variance of the energy at the sampling points.

sampling_error(eloc)[source]

Compute the statistical uncertainty. Assuming the samples are uncorrelated.

pdf(pos, return_grad=False)[source]

density of the wave function.

get_number_parameters()[source]

Computes the total number of parameters.

load(filename, group='wf_opt', model='best')[source]

Load trained parameters

Parameters:
  • filename (str) – hdf5 filename
  • group (str, optional) – group in the hdf5 file where the model is stored. Defaults to ‘wf_opt’.
  • model (str, optional) – ‘best’ or ‘ last’. Defaults to ‘best’.