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: object

Class 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.QMCOpts object.) – 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.
nmax

Max number of measurements.

Type:int
header

Output header.

Type:int
rdm

True if output BP RDM to file.

Type:bool
nreg

Number of regular estimates (exluding iteration).

Type:int
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:
  • comm – MPI communicator.
  • nprocs (int) – Number of processors.
  • step (int) – Current iteration number.
  • nmeasure (int) – Number of steps between measurements.
setup_output(filename)[source]
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.QMCOpts object.) – Container for qmc input options.
  • trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
  • psi (pauxy.walkers.Walkers object) – 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.QMCOpts object.) – Container for qmc input options.
  • trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
  • psi (pauxy.walkers.Walkers object) – CPMC wavefunction.
  • step (int) – Current simulation step
  • free_projection (bool) – True if doing free projection.
zero()[source]

Zero (in the appropriate sense) various estimator arrays.

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: object

Container 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.QMCOpts object.) – 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
estimates

Dictionary of estimator objects.

Type:dict
back_propagation

True if doing back propagation, specified in estimates dict.

Type:bool
nbp

Number of back propagation steps.

Type:int
nprop_tot

Total number of auxiliary field configurations we store / use for back propagation and itcf calculation.

Type:int
calc_itcf

True if calculating imaginary time correlation functions (ITCFs).

Type:bool
dump_metadata()[source]
increment_file_number()[source]
print_step(comm, nprocs, step, nsteps=None, free_projection=False)[source]

Print QMC estimates.

Parameters:
  • comm – MPI communicator.
  • nprocs (int) – Number of processors.
  • step (int) – Current iteration number.
  • nmeasure (int) – Number of steps between measurements.
reset(root)[source]
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.QMCOpts object.) – Container for qmc input options.
  • trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
  • psi (pauxy.walkers.Walkers object) – 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: object

Class 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.QMCOpts object.) – 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.
nmax

Number of back propagation steps to perform.

Type:int
header

Header sfor back propagated estimators.

Type:list
key

Explanation of spgf data structure.

Type:dict
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:
accumulate_uhf(idx, weight, Ggr, Gls, nbasis)[source]

Accumulate ITCF for UHF wavefunction.

Parameters:
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.Walkers object) – 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.Walkers object) – 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:
Returns:

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:
Returns:

increment_tau_uhf_stable(Ggr, Gls, B, Gnn_gr, Gnn_ls)[source]

Update ITCF to next time slice. Stable algorithm, UHF format.

Parameters:
Returns:

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:
Returns:

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:

numpy.ndarray

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:

numpy.ndarray

print_step(comm, nprocs, step, nmeasure=1, free_projection=False)[source]

Print ITCF to file.

Parameters:
  • comm – MPI communicator.
  • nprocs (int) – Number of processors.
  • step (int) – Current iteration number.
  • nmeasure (int) – Number of steps between measurements.
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.QMCOpts object.) – Container for qmc input options.
  • trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
  • psi (pauxy.walkers.Walkers object) – CPMC wavefunction.
  • step (int) – Current simulation step
  • free_projection (bool) – True if doing free projection.
zero()[source]

Zero (in the appropriate sense) various estimator arrays.

pauxy.estimators.mixed module

class pauxy.estimators.mixed.Mixed(mixed, system, root, filename, qmc, trial, dtype)[source]

Bases: object

Class for computing mixed estimates.

Parameters:
  • mixed (dict) – Input options for mixed estimates.
  • root (bool) – True if on root/master processor.
  • qmc (pauxy.state.QMCOpts object.) – Container for qmc input options.
  • trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
  • dtype (complex or float) – Output type.
nmeasure

Max number of measurements.

Type:int
nreg

Number of regular estimates (exluding iteration).

Type:int
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
header

Output header.

Type:int
key

Explanation of output.

Type:dict
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:

None

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:
  • comm – MPI communicator.
  • nprocs (int) – Number of processors.
  • step (int) – Current iteration number.
  • nmeasure (int) – Number of steps between measurements.
projected_energy()[source]

Computes projected energy from estimator array.

Returns:eproj – Mixed estimate for projected energy.
Return type:float
setup_output(filename)[source]
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.QMCOpts object.) – Container for qmc input options.
  • trial (:class:`pauxy.trial_wavefunction.X’ object) – Trial wavefunction class.
  • psi (pauxy.walkers.Walkers object) – CPMC wavefunction.
  • step (int) – Current simulation step
  • free_projection (bool) – True if doing free projection.
zero()[source]

Zero (in the appropriate sense) various estimator arrays.

pauxy.estimators.mixed.eproj(estimates, enum)[source]

Real projected energy.

Parameters:
  • estimates (numpy.array) – Array containing estimates averaged over all processors.
  • enum (pauxy.estimators.EstimatorEnum object) – Enumerator class outlining indices of estimates array elements.
Returns:

eproj – Projected energy from current estimates array.

Return type:

float

pauxy.estimators.mixed.get_estimator_enum(thermal=False)[source]
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.local_energy_multi_det(system, Gi, weights, two_rdm=None)[source]
pauxy.estimators.mixed.variational_energy(system, psi, coeffs, G=None, GH=None)[source]
pauxy.estimators.mixed.variational_energy_multi_det(system, psi, coeffs, H=None, S=None)[source]
pauxy.estimators.mixed.variational_energy_ortho_det(system, occs, coeffs)[source]

Compute variational energy for CI-like multi-determinant expansion.

Parameters:
  • system (pauxy.system object) – 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

pauxy.estimators.mixed.variational_energy_single_det(system, psi, G=None, GH=None)[source]

pauxy.estimators.utils module

class pauxy.estimators.utils.H5EstimatorHelper(filename, base, nav=1)[source]

Bases: object

Helper 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
index

Counter for incrementing data.

Type:int
increment()[source]
push(data, name)[source]

Push data to dataset.

Parameters:data (numpy.ndarray) – Data to push.
reset()[source]
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

Module contents