Wave function objects¶
-
__init__()¶ Initialize the wave function parameters. This can be just about anything, but do not allocate walker-specific memory here.
-
recompute(configs)¶
Initialize any walker-based storage and compute the value of the wave function.
-
updateinternals(e, epos, mask=None)¶
Update any internals given that electron e moved to epos. mask is a Boolean array which allows us to update only certain walkers
-
value()¶
Return logarithm of the wave function as noted in recompute()
-
testvalue(e, epos)¶
Return the ratio between the current wave function and the wave function if electron e’s position is replaced by epos
-
gradient(e, epos)¶
Return the gradient of the log wave function. Note that this can be called even if the internals have not been updated for electron e, if epos differs from the current position of electron e.
-
laplacian(e, epos)¶
Return the laplacian Psi/ Psi. Conditions similar to gradient()
-
pgradient()¶
Return the parameter gradient of Psi. Returns d_p Psi/Psi as a dictionary of numpy arrays, which correspond to the parameter dictionary.
Slater determinant¶
-
class
pyqmc.slater.JoinParameters(dicts)[source]¶ This class provides a dict-like interface that actually references other dictionaries in the background. If keys collide, then the first dictionary that matches the key will be returned. However, some bad things may happen if you have colliding keys.
-
class
pyqmc.slater.Slater(mol, mf, mc=None, tol=None, twist=None, determinants=None)[source]¶ A multi-determinant wave function object initialized via an SCF calculation.
How to use with hci
cisolver = pyscf.hci.SCI(mol) cisolver.select_cutoff=0.1 nmo = mf.mo_coeff.shape[1] nelec = mol.nelec h1 = mf.mo_coeff.T.dot(mf.get_hcore()).dot(mf.mo_coeff) h2 = pyscf.ao2mo.full(mol, mf.mo_coeff) e, civec = cisolver.kernel(h1, h2, nmo, nelec, verbose=4) cisolver.ci = civec[0] wf = pyqmc.multislater.MultiSlater(mol, mf, cisolver, tol=0.1)
-
gradient(e, epos)[source]¶ Compute the gradient of the log wave function Note that this can be called even if the internals have not been updated for electron e, if epos differs from the current position of electron e.
-
gradient_value(e, epos)[source]¶ Compute the gradient of the log wave function Note that this can be called even if the internals have not been updated for electron e, if epos differs from the current position of electron e.
-
pgradient()[source]¶ Compute the parameter gradient of Psi. Returns \(\partial_p \Psi/\Psi\) as a dictionary of numpy arrays, which correspond to the parameter dictionary.
The wave function is given by ci Di, with an implicit sum
We have two sets of parameters:
Determinant coefficients: di psi/psi = Dui Ddi/psi
Orbital coefficients: dj psi/psi = ci dj (Dui Ddi)/psi
Let’s suppose that j corresponds to an up orbital coefficient. Then dj (Dui Ddi) = (dj Dui)/Dui Dui Ddi/psi = (dj Dui)/Dui di psi/psi where di psi/psi is the derivative defined above.
-
recompute(configs)[source]¶ This computes the value from scratch. Returns the logarithm of the wave function as (phase,logdet). If the wf is real, phase will be +/- 1.
-
testvalue(e, epos, mask=None)[source]¶ return the ratio between the current wave function and the wave function if electron e’s position is replaced by epos
-
testvalue_many(e, epos, mask=None)[source]¶ return the ratio between the current wave function and the wave function if electron e’s position is replaced by epos for each electron
-
Jastrow factor¶
-
class
pyqmc.jastrowspin.JastrowSpin(mol, a_basis, b_basis)[source]¶ 1 body and 2 body jastrow factor
The Jastrow form is \(e^{U(R)}\), where\[U(R) = \sum_{I, i, k} c^{a}_{Ik\sigma(i)} a_{k}(r_{Ii}) + \sum_{i,j,k} c^{b}_{k\sigma(i)\sigma(j)} b^{l}(r_{ij})\]-
gradient(e, epos)[source]¶ We compute the gradient for electron e as \(\nabla_e \ln \Psi_J = \sum_k c_k \left(\sum_{j > e} \nabla_e b_k(r_{ej}) + \sum_{i < e} \nabla_e b_k(r_{ie})\right)\) So we need to compute the gradient of the b’s for these indices. Note that we need to compute distances between electron position given and the current electron distances. We will need this for laplacian() as well
-
pgradient()[source]¶ Given the b sums, this is pretty trivial for the coefficient derivatives. For the derivatives of basis functions, we will have to compute the derivative of all the b’s and redo the sums, similar to recompute()
-
recompute(configs)[source]¶ _avalues is the array for current configurations \(A_{Iks} = \sum_s a_{k}(r_{Is})\) where \(s\) indexes over \(\uparrow\) (\(\alpha\)) and \(\downarrow\) (\(\beta\)) sums. _bvalues is the array for current configurations \(B_{ls} = \sum_s b_{l}(r_{s})\) where \(s\) indexes over \(\uparrow\uparrow\) (\(\alpha_1 < \alpha_2\)), \(\uparrow\downarrow\) (\(\alpha, \beta\)), and \(\downarrow\downarrow\) (\(\beta_1 < \beta_2\)) sums.
the partial sums store values before summing over electrons _a_partial is the array \(A^p_{eIk} = a_k(r_{Ie}\), where \(e\) is any electron _b_partial is the array \(B^p_{els} = \sum_s b_l(r_{es}\), where \(e\) is any electron, \(s\) indexes over \(\uparrow\) (\(\alpha\)) and \(\downarrow\) (\(\beta\)) sums, not including \(e\).
-
testvalue(e, epos, mask=None)[source]¶ Compute the ratio \(\Psi_{\rm new}/\Psi_{\rm old}\) for moving electron e to epos. _avalues is the array for current configurations \(A_{Iks} = \sum_s a_{k}(r_{Is})\) where \(s\) indexes over \(\uparrow\) (\(\alpha\)) and \(\downarrow\) (\(\beta\)) sums. _bvalues is the array for current configurations \(B_{ls} = \sum_s b_{l}(r_{s})\) where \(s\) indexes over \(\uparrow\uparrow\) (\(\alpha_1 < \alpha_2\)), \(\uparrow\downarrow\) (\(\alpha, \beta\)), and \(\downarrow\downarrow\) (\(\beta_1 < \beta_2\)) sums. The update for _avalues and _b_values from moving one electron only requires computing the new sum for that electron. The sums for the electron in the current configuration are stored in _a_partial and _b_partial. deltaa = \(a_{k}(r_{Ie})\), indexing (atom, a_basis) deltab = \(\sum_s b_{l}(r_{se})\), indexing (b_basis, spin s)
-
testvalue_many(e, epos, mask=None)[source]¶ Compute the ratio \(\Psi_{\rm new}/\Psi_{\rm old}\) for moving electrons in e to epos.
_avalues is the array for current configurations \(A_{Iks} = \sum_s a_{k}(r_{Is})\) where \(s\) indexes over \(\uparrow\) (\(\alpha\)) and \(\downarrow\) (\(\beta\)) sums. _bvalues is the array for current configurations \(B_{ls} = \sum_s b_{l}(r_{s})\) where \(s\) indexes over \(\uparrow\uparrow\) (\(\alpha_1 < \alpha_2\)), \(\uparrow\downarrow\) (\(\alpha, \beta\)), and \(\downarrow\downarrow\) (\(\beta_1 < \beta_2\)) sums. The update for _avalues and _b_values from moving one electron only requires computing the new sum for that electron. The sums for the electron in the current configuration are stored in _a_partial and _b_partial. deltaa = \(a_{k}(r_{Ie})\), indexing (atom, a_basis) deltab = \(\sum_s b_{l}(r_{se})\), indexing (b_basis, spin s)
-
u_components(rvec, r)[source]¶ Given positions rvec and their magnitudes r, returns dictionaries of the one-body and two-body Jastrow components. Dictionaries are the spin components of U summed across the basis; one-body also returns U for different atoms.
-
updateinternals(e, epos, wrap=None, mask=None)[source]¶ Update a and b sums. _avalues is the array for current configurations \(A_{Iks} = \sum_s a_{k}(r_{Is})\) where \(s\) indexes over \(\uparrow\) (\(\alpha\)) and \(\downarrow\) (\(\beta\)) sums. _bvalues is the array for current configurations \(B_{ls} = \sum_s b_{l}(r_{s})\) where \(s\) indexes over \(\uparrow\uparrow\) (\(\alpha_1 < \alpha_2\)), \(\uparrow\downarrow\) (\(\alpha, \beta\)), and \(\downarrow\downarrow\) (\(\beta_1 < \beta_2\)) sums. The update for _avalues and _b_values from moving one electron only requires computing the new sum for that electron. The sums for the electron in the current configuration are stored in _a_partial and _b_partial
-