fcdmft.rpa.pbc.kurpa module#

Periodic k-point spin-unrestricted random phase approximation (direct RPA/dRPA in chemistry) with N^4 scaling

Method:

Main routines are based on GW-AC method described in: T. Zhu and G.K.-L. Chan, J. Chem. Theory. Comput. 17, 727-741 (2021) X. Ren et al., New J. Phys. 14, 053020 (2012)

class fcdmft.rpa.pbc.kurpa.KURPA(mf, frozen=None)[source]#

Bases: KRPA

Attributes:
nmo
nocc

Methods

__call__(*args, **kwargs)

Update the attributes of the current object.

apply(fn, *args, **kwargs)

Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

check_sanity()

Check input of class/object attributes, check whether a class method is overwritten.

copy()

Returns a shallow copy

get_frozen_mask()

Boolean mask for orbitals in k-point post-HF method.

get_grids([alg, nw, mo_energy])

Generate grids for integration.

get_nmo([per_kpoint])

Number of orbitals for k-point calculations.

get_nocc([per_kpoint])

Number of occupied orbitals for k-point calculations.

get_q_mesh(mo_energy, mo_coeff)

Get q-mesh for finite size correction.

kernel([mo_energy, mo_coeff, nw])

RPA correlation and total energy

post_kernel(envs)

A hook to be run after the main body of the kernel function.

pre_kernel(envs)

A hook to be run before the main body of kernel function is executed.

run(*args, **kwargs)

Call the kernel function of current object.

set(*args, **kwargs)

Update the attributes of the current object.

view(cls)

New view of object with the same attributes.

dump_flags

dump_flags(verbose=None)[source]#
get_frozen_mask()#

Boolean mask for orbitals in k-point post-HF method.

Creates a boolean mask to remove frozen orbitals and keep other orbitals for post-HF calculations.

Args:

mp (MP2): An instantiation of an SCF or post-Hartree-Fock object.

Returns:

moidx (list of ndarray of bool): Boolean mask of orbitals to include.

get_grids(alg=None, nw=None, mo_energy=None)[source]#

Generate grids for integration.

Parameters:
algstr, optional

algorithm for generating grids, by default None

nwint, optional

number of grids, by default None

mo_energydouble 3d array, optional

orbital energy, used for minimax grids, by default None

Returns:
freqsdouble 1d array

frequency grid

wtsdouble 1d array

weight of grids

get_nmo(per_kpoint=False)#

Number of orbitals for k-point calculations.

Number of orbitals for use in a calculation with k-points, taking into account frozen orbitals.

Note:

If per_kpoint is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where each max is done over all k-points. Otherwise the number of orbitals is returned as a list of number of orbitals at each k-point.

Args:

mp (MP2): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of orbitals at each k-point.

For a description of False, see Note.

Returns:
nmo (int, list of int): Number of orbitals. For return type, see description of arg

per_kpoint.

get_nocc(per_kpoint=False)#

Number of occupied orbitals for k-point calculations.

Number of occupied orbitals for use in a calculation with k-points, taking into account frozen orbitals.

Args:

mp (MP2): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of occupied

orbitals at each k-point. False gives the max of this list.

Returns:
nocc (int, list of int): Number of occupied orbitals. For return type, see description of arg

per_kpoint.

Notes:

For specifying frozen orbitals inside mp, the following options are accepted:

+=========================+========================================+===============================+ | Argument (Example) | Argument Meaning | Example Meaning | +=========================+========================================+===============================+ | int (1) | Freeze the same number of orbitals | Freeze one (lowest) orbital | | | regardless of spin and/or kpt | for all kpts and spin cases | +————————-+—————————————-+——————————-+ | 2-tuple of list of int | inner list: List of orbitals indices | Freeze the orbitals [0,4] for | | ([0, 4], [0, 5, 6]) | to freeze at all kpts | spin0, and orbitals [0,5,6] | | | outer list: Spin index | for spin1 at all kpts | +————————-+—————————————-+——————————-+ | list(2) of list of list | inner list: list of orbital indices to | Freeze orbital 0 for spin0 at | | ([[0,],[]], | freeze at each kpt for given spin | kpt0, and freeze orbital 0,1 | | [[0,1],[4]]) | outer list: spin index | for spin1 at kpt0 and orbital | | | | 4 at kpt1 | +————————-+—————————————-+——————————-+

get_q_mesh(mo_energy, mo_coeff)[source]#

Get q-mesh for finite size correction. Equation 39-42 in doi.org/10.1021/acs.jctc.0c00704

Parameters:
mo_energydouble 3d array

orbital energy

mo_coeffdouble 4d array

coefficient from AO to MO

Returns:
qijdouble 1d array

q-mesh grids

q_absdouble 1d array

absolute positions of q-mesh grids

nq_ptsinit

number of q-mesh grids

kernel(mo_energy=None, mo_coeff=None, nw=None)[source]#

RPA correlation and total energy

Calculated total energy, HF energy and RPA correlation energy are stored in self.e_tot, self.e_hf, self.e_corr

Parameters:
mo_energydouble array

molecular orbital energies

mo_coeffdouble ndarray

molecular orbital coefficients

nwint, optional

number of frequency point on imaginary axis, by default None

Returns:
e_totfloat

RPA total energy

e_hffloat

HF energy (exact exchange for given mo_coeff)

e_corrfloat

RPA correlation energy

property nmo#
property nocc#
fcdmft.rpa.pbc.kurpa.get_rpa_ecorr(rpa, freqs, wts)[source]#

Compute RPA correlation energy.

Parameters:
rpaKURPA

rpa object

freqsdouble 1d array

frequency grid

wtsdouble 1d array

weight of grids

Returns:
e_corrdouble

correlation energy

fcdmft.rpa.pbc.kurpa.get_rpa_ecorr_outcore(rpa, freqs, wts)[source]#

Low-memory routine to compute RPA correlation energy.

Parameters:
rpaKURPA

rpa object

freqsdouble 1d array

frequency grid

wtsdouble 1d array

weight of grids

Returns:
e_corrdouble

correlation energy

fcdmft.rpa.pbc.kurpa.get_rpa_ecorr_outcore_metal(rpa, freqs, wts)[source]#

Low-memory routine to compute RPA correlation energy for metals.

Parameters:
rpaKURPA

rpa object

freqsdouble 1d array

frequency grid

wtsdouble 1d array

weight of grids

Returns:
e_corrdouble

correlation energy

fcdmft.rpa.pbc.kurpa.kernel(rpa, mo_energy, mo_coeff, nw=None)[source]#

RPA correlation and total energy

Parameters:
rpaKURPA

rpa object

mo_energydouble array

molecular orbital energies

mo_coeffdouble ndarray

molecular orbital coefficients

nwint, optional

number of frequency point on imaginary axis, by default None

Returns:
e_totfloat

RPA total energy

e_hffloat

HF energy (exact exchange for given mo_coeff)

e_corrfloat

RPA correlation energy