pauxy.estimators package¶
Submodules¶
pauxy.estimators.back_propagation module¶
-
class
pauxy.estimators.back_propagation.BackPropagation(bp, root, filename, qmc, system, trial, dtype, BT2)[source]¶ Bases:
objectClass for computing back propagated estimates.
Parameters: - bp (dict) – Input options for BP estimates.
- root (bool) – True if on root/master processor.
- h5f (
h5py.File) – Output file object. - qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - system (system object) – System object.
- trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- dtype (complex or float) – Output type.
- BT2 (
numpy.ndarray) – One-body propagator for back propagation.
-
G¶ One-particle RDM.
Type: numpy.ndarray
-
estimates¶ Store for mixed estimates per processor.
Type: numpy.ndarray
-
global_estimates¶ Store for mixed estimates accross all processors.
Type: numpy.ndarray
-
output¶ Class for outputting data to HDF5 group.
Type: pauxy.estimators.H5EstimatorHelper
-
rdm_output¶ Class for outputting rdm data to HDF5 group.
Type: pauxy.estimators.H5EstimatorHelper
-
print_step(comm, nprocs, step, nsteps=1, free_projection=False)[source]¶ Print back-propagated estimates to file.
Parameters:
-
update_ghf(system, qmc, trial, psi, step, free_projection=False)[source]¶ Calculate back-propagated estimates for GHF walkers.
Parameters: - system (system object in general.) – Container for model input options.
- qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - step (int) – Current simulation step
- free_projection (bool) – True if doing free projection.
-
update_uhf(system, qmc, trial, psi, step, free_projection=False)[source]¶ Calculate back-propagated estimates for RHF/UHF walkers.
Parameters: - system (system object in general.) – Container for model input options.
- qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - step (int) – Current simulation step
- free_projection (bool) – True if doing free projection.
pauxy.estimators.handler module¶
Routines and classes for estimation of observables.
-
class
pauxy.estimators.handler.Estimators(estimates, root, qmc, system, trial, BT2, verbose=False)[source]¶ Bases:
objectContainer for qmc estimates of observables.
Parameters: - estimates (dict) – input options detailing which estimators to calculate. By default only mixed estimates will be calculated.
- root (bool) – True if on root/master processor.
- qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - system (
pauxy.hubbard.Hubbard/ system object in general.) – Container for model input options. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- BT2 (
numpy.ndarray) – One body propagator. - verbose (bool) – If true we print out additional setup information.
-
h5f¶ Output file object.
Type: h5py.File
-
nprop_tot¶ Total number of auxiliary field configurations we store / use for back propagation and itcf calculation.
Type: int
-
print_step(comm, nprocs, step, nsteps=None, free_projection=False)[source]¶ Print QMC estimates.
Parameters:
-
update(system, qmc, trial, psi, step, free_projection=False)[source]¶ Update estimators
Parameters: - system (system object in general.) – Container for model input options.
- qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - step (int) – Current simulation step
- free_projection (bool) – True if doing free projection.
pauxy.estimators.itcf module¶
-
class
pauxy.estimators.itcf.ITCF(itcf, qmc, trial, root, h5f, system, dtype, BT2)[source]¶ Bases:
objectClass for computing ITCF estimates.
Parameters: - itcf (dict) –
Input options for ITCF estimates :
- tmax : float
- Maximum value of imaginary time to calculate ITCF to.
- stable : bool
- If True use the stabalised algorithm of Feldbacher and Assad.
- mode : string / list
- How much of the ITCF to save to file:
- ’full’ : print full ITCF. ‘diagonal’ : print diagonal elements of ITCF. elements : list : print select elements defined from list.
- kspace : bool
- If True evaluate correlation functions in momentum space.
- root (bool) – True if on root/master processor.
- h5f (
h5py.File) – Output file object. - qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - system (system object) – System object.
- trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- dtype (complex or float) – Output type.
- BT2 (
numpy.ndarray) – One-body propagator for back propagation.
-
header¶ Header sfor back propagated estimators.
Type: list
-
spgf¶ Storage for single-particle greens function (SPGF).
Type: numpy.ndarray
-
spgf_global¶ Store for ITCF accross all processors.
Type: numpy.ndarray
-
rspace_unit¶ Output dataset for real space itcfs.
Type: pauxy.estimators.H5EstimatorHelper
-
kspace_unit¶ Output dataset for real space itcfs.
Type: pauxy.estimators.H5EstimatorHelper
-
accumulate_ghf(idx, weight, Ggr, Gls, nbasis)[source]¶ Accumulate ITCF for GHF wavefunction.
Parameters: - idx (int) – Time index.
- weight (float) – Walker weight.
- Ggr (
numpy.ndarray) – Greater ITCF. - Gls (
numpy.ndarray) – Lesser ITCF. - nbasis (int) – Number of basis functions.
-
accumulate_uhf(idx, weight, Ggr, Gls, nbasis)[source]¶ Accumulate ITCF for UHF wavefunction.
Parameters: - idx (int) – Time index.
- weight (float) – Walker weight.
- Ggr (
numpy.ndarray) – Greater ITCF. - Gls (
numpy.ndarray) – Lesser ITCF. - nbasis (int) – Number of basis functions.
-
calculate_spgf_stable(system, psi, trial)[source]¶ Calculate imaginary time single-particle green’s function.
This uses the stable algorithm as outlined in: Feldbacher and Assad, Phys. Rev. B 63, 073105.
On return the spgf estimator array will have been updated.
Parameters: - system (system object in general.) – Container for model input options.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
-
calculate_spgf_unstable(system, psi, trial)[source]¶ Calculate imaginary time single-particle green’s function.
This uses the naive unstable algorithm.
On return the spgf estimator array will have been updated.
Parameters: - system (system object in general.) – Container for model input options.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
-
increment_tau_ghf_stable(Ggr, Gls, B, Gnn_gr, Gnn_ls)[source]¶ Update ITCF to next time slice. Stable algorithm, GHF format.
Parameters: - Ggr (
numpy.ndarray) – Greater ITCF. - Ggr – Lesser ITCF.
- Gls (
numpy.ndarray) – Propagator matrix. - G_nn_gr (
numpy.ndarray) – Greater equal-time green’s function. - G_nn_ls (
numpy.ndarray) – Lesser equal-time green’s function.
Returns: - Ggr (
numpy.ndarray) – Updated greater ITCF. - Ggr (
numpy.ndarray) – Updated lesser ITCF.
- Ggr (
-
increment_tau_ghf_unstable(Ggr, Gls, B, Gnn_gr=None, Gnn_ls=None)[source]¶ Update ITCF to next time slice. Unstable algorithm, GHF format.
Parameters: - Ggr (
numpy.ndarray) – Greater ITCF. - Ggr – Lesser ITCF.
- Gls (
numpy.ndarray) – Propagator matrix. - G_nn_gr (
numpy.ndarray, not used) – Greater equal-time green’s function. - G_nn_ls (
numpy.ndarray, not used) – Lesser equal-time green’s function.
Returns: - Ggr (
numpy.ndarray) – Updated greater ITCF. - Ggr (
numpy.ndarray) – Updated lesser ITCF.
- Ggr (
-
increment_tau_uhf_stable(Ggr, Gls, B, Gnn_gr, Gnn_ls)[source]¶ Update ITCF to next time slice. Stable algorithm, UHF format.
Parameters: - Ggr (
numpy.ndarray) – Greater ITCF. - Ggr – Lesser ITCF.
- Gls (
numpy.ndarray) – Propagator matrix. - G_nn_gr (
numpy.ndarray) – Greater equal-time green’s function. - G_nn_ls (
numpy.ndarray) – Lesser equal-time green’s function.
Returns: - Ggr (
numpy.ndarray) – Updated greater ITCF. - Ggr (
numpy.ndarray) – Updated lesser ITCF.
- Ggr (
-
increment_tau_uhf_unstable(Ggr, Gls, B, Gnn_gr=None, Gnn_ls=None)[source]¶ Update ITCF to next time slice. Unstable algorithm, UHF format.
Parameters: - Ggr (
numpy.ndarray) – Greater ITCF. - Ggr – Lesser ITCF.
- Gls (
numpy.ndarray) – Propagator matrix. - G_nn_gr (
numpy.ndarray, not used) – Greater equal-time green’s function. - G_nn_ls (
numpy.ndarray, not used) – Lesser equal-time green’s function.
Returns: - Ggr (
numpy.ndarray) – Updated greater ITCF. - Ggr (
numpy.ndarray) – Updated lesser ITCF.
- Ggr (
-
initial_greens_function_ghf(A, B, trial, nup, weights)[source]¶ Compute initial green’s function at timestep n for GHF wavefunction.
Here we actually compute the equal-time green’s function:
\[G_{ij} = \langle c_i c_j^{\dagger} \rangle\]Parameters: - A (
numpy.ndarray) – Left hand wavefunction for green’s function. - B (
numpy.ndarray) – Left hand wavefunction for green’s function. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- nup (int) – Number of up electrons.
- weight (
numpy.ndarray) – Any GS orthogonalisation factors which need to be included.
Returns: G_nn – Green’s function.
Return type: - A (
-
initial_greens_function_uhf(A, B, trial, nup, weights)[source]¶ Compute initial green’s function at timestep n for UHF wavefunction.
Here we actually compute the equal-time green’s function:
\[G_{ij} = \langle c_i c_j^{\dagger} \rangle\]Parameters: - A (
numpy.ndarray) – Left hand wavefunction for green’s function. - B (
numpy.ndarray) – Left hand wavefunction for green’s function. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- nup (int) – Number of up electrons.
- weight (
numpy.ndarray) – Any GS orthogonalisation factors which need to be included.
Returns: G_nn – Green’s function.
Return type: - A (
-
print_step(comm, nprocs, step, nmeasure=1, free_projection=False)[source]¶ Print ITCF to file.
Parameters:
-
to_file(group, spgf)[source]¶ Push ITCF to hdf5 group.
Parameters: - group (string) – HDF5 group name.
- spgf (
numpy.ndarray) – Single-particle Green’s function (SPGF).
-
update(system, qmc, trial, psi, step, free_projection=False)[source]¶ Update estimators
Parameters: - system (system object in general.) – Container for model input options.
- qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - step (int) – Current simulation step
- free_projection (bool) – True if doing free projection.
- itcf (dict) –
pauxy.estimators.mixed module¶
-
class
pauxy.estimators.mixed.Mixed(mixed, system, root, filename, qmc, trial, dtype)[source]¶ Bases:
objectClass for computing mixed estimates.
Parameters: -
G¶ One-particle RDM.
Type: numpy.ndarray
-
estimates¶ Store for mixed estimates per processor.
Type: numpy.ndarray
-
global_estimates¶ Store for mixed estimates accross all processors.
Type: numpy.ndarray
-
names¶ Enum for locating estimates in estimates array.
Type: pauxy.estimators.EstimEnum
-
output¶ Class for outputting data to HDF5 group.
Type: pauxy.estimators.H5EstimatorHelper
-
output Class for outputting rdm data to HDF5 group.
Type: pauxy.estimators.H5EstimatorHelper
-
get_shift()[source]¶ Get hybrid shift.
Returns: eshift – Walker averaged hybrid energy. Return type: float
-
print_header(eol='', encode=False)[source]¶ Print out header for estimators
Parameters: - eol (string, optional) – String to append to output, Default : ‘’.
- encode (bool) – In True encode output to be utf-8.
Returns: Return type:
-
print_key(eol='', encode=False)[source]¶ Print out information about what the estimates are.
Parameters: - eol (string, optional) – String to append to output, e.g., Default : ‘’.
- encode (bool) – In True encode output to be utf-8.
-
print_step(comm, nprocs, step, nsteps=None, free_projection=False)[source]¶ Print mixed estimates to file.
This reduces estimates arrays over processors. On return estimates arrays are zerod.
Parameters:
-
projected_energy()[source]¶ Computes projected energy from estimator array.
Returns: eproj – Mixed estimate for projected energy. Return type: float
-
update(system, qmc, trial, psi, step, free_projection=False)[source]¶ Update mixed estimates for walkers.
Parameters: - system (system object.) – Container for model input options.
- qmc (
pauxy.state.QMCOptsobject.) – Container for qmc input options. - trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
- psi (
pauxy.walkers.Walkersobject) – CPMC wavefunction. - step (int) – Current simulation step
- free_projection (bool) – True if doing free projection.
-
-
pauxy.estimators.mixed.eproj(estimates, enum)[source]¶ Real projected energy.
Parameters: - estimates (numpy.array) – Array containing estimates averaged over all processors.
- enum (
pauxy.estimators.EstimatorEnumobject) – Enumerator class outlining indices of estimates array elements.
Returns: eproj – Projected energy from current estimates array.
Return type:
-
pauxy.estimators.mixed.local_energy(system, G, Ghalf=None, opt=True, two_rdm=None, rchol=None)[source]¶ Helper routine to compute local energy.
Parameters: - system (system object) – system object.
- G (
numpy.ndarray) – 1RDM.
Returns: (E,T,V) – Total, one-body and two-body energy.
Return type: tuple
-
pauxy.estimators.mixed.variational_energy_ortho_det(system, occs, coeffs)[source]¶ Compute variational energy for CI-like multi-determinant expansion.
Parameters: - system (
pauxy.systemobject) – System object. - occs (list of lists) – list of determinants.
- coeffs (
numpy.ndarray) – Expansion coefficients.
Returns: energy – Total energies: (etot,e1b,e2b).
Return type: tuple of float / complex
- system (
pauxy.estimators.utils module¶
-
class
pauxy.estimators.utils.H5EstimatorHelper(filename, base, nav=1)[source]¶ Bases:
objectHelper class for pushing data to hdf5 dataset of fixed length.
Parameters: - h5f (
h5py.File) – Output file object. - name (string) – Dataset name.
- shape (tuple) – Shape of output data.
- dtype (type) – Output data type.
-
store¶ Dataset object.
Type: h5py.File.DataSet
-
push(data, name)[source]¶ Push data to dataset.
Parameters: data ( numpy.ndarray) – Data to push.
- h5f (
-
pauxy.estimators.utils.convolve(f, g, mesh, backend=<module 'numpy.fft' from '/home/docs/.pyenv/versions/3.7.3/lib/python3.7/site-packages/numpy/fft/__init__.py'>)[source]¶
-
pauxy.estimators.utils.scipy_fftconvolve(in1, in2, mesh1=None, mesh2=None, mode='full', axes=None)[source]¶ Convolve two N-dimensional arrays using FFT. Convolve in1 and in2 using the fast Fourier transform method, with the output size determined by the mode argument. This is generally much faster than convolve for large arrays (n > ~500), but can be slower when only a few output values are needed, and can only output float arrays (int or object array inputs will be cast to float). As of v0.19, convolve automatically chooses this method or the direct method based on an estimation of which is faster. :param in1: First input. :type in1: array_like :param in2: Second input. Should have the same number of dimensions as in1. :type in2: array_like :param mode: A string indicating the size of the output:
full- The output is the full discrete linear convolution of the inputs. (Default)
valid- The output consists only of those elements that do not rely on the zero-padding. In ‘valid’ mode, either in1 or in2 must be at least as large as the other in every dimension.
same- The output is the same size as in1, centered with respect to the ‘full’ output. axis : tuple, optional
Parameters: axes (int or array_like of ints or None, optional) – Axes over which to compute the convolution. The default is over all axes. Returns: out – An N-dimensional array containing a subset of the discrete linear convolution of in1 with in2. Return type: array