Metadata-Version: 2.1
Name: AKCK_LFF
Version: 1.0.1
Summary: Analytic models for the local field factors of the interacting uniform electron gas
Author-email: Aaron Kaplan <aaron.kaplan.physics@gmail.com>, Carl Kukkonen <kukkonen@viaspace.com>
License: Creative Commons Legal Code
        
        CC0 1.0 Universal
        
            CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
            LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
            ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
            INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
            REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
            PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
            THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
            HEREUNDER.
        
        Statement of Purpose
        
        The laws of most jurisdictions throughout the world automatically confer
        exclusive Copyright and Related Rights (defined below) upon the creator
        and subsequent owner(s) (each and all, an "owner") of an original work of
        authorship and/or a database (each, a "Work").
        
        Certain owners wish to permanently relinquish those rights to a Work for
        the purpose of contributing to a commons of creative, cultural and
        scientific works ("Commons") that the public can reliably and without fear
        of later claims of infringement build upon, modify, incorporate in other
        works, reuse and redistribute as freely as possible in any form whatsoever
        and for any purposes, including without limitation commercial purposes.
        These owners may contribute to the Commons to promote the ideal of a free
        culture and the further production of creative, cultural and scientific
        works, or to gain reputation or greater distribution for their Work in
        part through the use and efforts of others.
        
        For these and/or other purposes and motivations, and without any
        expectation of additional consideration or compensation, the person
        associating CC0 with a Work (the "Affirmer"), to the extent that he or she
        is an owner of Copyright and Related Rights in the Work, voluntarily
        elects to apply CC0 to the Work and publicly distribute the Work under its
        terms, with knowledge of his or her Copyright and Related Rights in the
        Work and the meaning and intended legal effect of CC0 on those rights.
        
        1. Copyright and Related Rights. A Work made available under CC0 may be
        protected by copyright and related or neighboring rights ("Copyright and
        Related Rights"). Copyright and Related Rights include, but are not
        limited to, the following:
        
          i. the right to reproduce, adapt, distribute, perform, display,
             communicate, and translate a Work;
         ii. moral rights retained by the original author(s) and/or performer(s);
        iii. publicity and privacy rights pertaining to a person's image or
             likeness depicted in a Work;
         iv. rights protecting against unfair competition in regards to a Work,
             subject to the limitations in paragraph 4(a), below;
          v. rights protecting the extraction, dissemination, use and reuse of data
             in a Work;
         vi. database rights (such as those arising under Directive 96/9/EC of the
             European Parliament and of the Council of 11 March 1996 on the legal
             protection of databases, and under any national implementation
             thereof, including any amended or successor version of such
             directive); and
        vii. other similar, equivalent or corresponding rights throughout the
             world based on applicable law or treaty, and any national
             implementations thereof.
        
        2. Waiver. To the greatest extent permitted by, but not in contravention
        of, applicable law, Affirmer hereby overtly, fully, permanently,
        irrevocably and unconditionally waives, abandons, and surrenders all of
        Affirmer's Copyright and Related Rights and associated claims and causes
        of action, whether now known or unknown (including existing as well as
        future claims and causes of action), in the Work (i) in all territories
        worldwide, (ii) for the maximum duration provided by applicable law or
        treaty (including future time extensions), (iii) in any current or future
        medium and for any number of copies, and (iv) for any purpose whatsoever,
        including without limitation commercial, advertising or promotional
        purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
        member of the public at large and to the detriment of Affirmer's heirs and
        successors, fully intending that such Waiver shall not be subject to
        revocation, rescission, cancellation, termination, or any other legal or
        equitable action to disrupt the quiet enjoyment of the Work by the public
        as contemplated by Affirmer's express Statement of Purpose.
        
        3. Public License Fallback. Should any part of the Waiver for any reason
        be judged legally invalid or ineffective under applicable law, then the
        Waiver shall be preserved to the maximum extent permitted taking into
        account Affirmer's express Statement of Purpose. In addition, to the
        extent the Waiver is so judged Affirmer hereby grants to each affected
        person a royalty-free, non transferable, non sublicensable, non exclusive,
        irrevocable and unconditional license to exercise Affirmer's Copyright and
        Related Rights in the Work (i) in all territories worldwide, (ii) for the
        maximum duration provided by applicable law or treaty (including future
        time extensions), (iii) in any current or future medium and for any number
        of copies, and (iv) for any purpose whatsoever, including without
        limitation commercial, advertising or promotional purposes (the
        "License"). The License shall be deemed effective as of the date CC0 was
        applied by Affirmer to the Work. Should any part of the License for any
        reason be judged legally invalid or ineffective under applicable law, such
        partial invalidity or ineffectiveness shall not invalidate the remainder
        of the License, and in such case Affirmer hereby affirms that he or she
        will not (i) exercise any of his or her remaining Copyright and Related
        Rights in the Work or (ii) assert any associated claims and causes of
        action with respect to the Work, in either case contrary to Affirmer's
        express Statement of Purpose.
        
        4. Limitations and Disclaimers.
        
         a. No trademark or patent rights held by Affirmer are waived, abandoned,
            surrendered, licensed or otherwise affected by this document.
         b. Affirmer offers the Work as-is and makes no representations or
            warranties of any kind concerning the Work, express, implied,
            statutory or otherwise, including without limitation warranties of
            title, merchantability, fitness for a particular purpose, non
            infringement, or the absence of latent or other defects, accuracy, or
            the present or absence of errors, whether or not discoverable, all to
            the greatest extent permissible under applicable law.
         c. Affirmer disclaims responsibility for clearing rights of other persons
            that may apply to the Work or any use thereof, including without
            limitation any person's Copyright and Related Rights in the Work.
            Further, Affirmer disclaims responsibility for obtaining any necessary
            consents, permissions or other rights required for any use of the
            Work.
         d. Affirmer understands and acknowledges that Creative Commons is not a
            party to this document and has no duty or obligation with respect to
            this CC0 or use of the Work.
        
Project-URL: Homepage, https://github.com/esoteric-ephemera/UEG_LFF
Project-URL: Bug Tracker, https://github.com/esoteric-ephemera/UEG_LFF/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# Analytic parameterizations of the UEG local field factors

## Maintainer: Aaron Kaplan
***

This CC0-licensed repo contains Python3 libraries for computing the uniform electron gas (UEG) local field factors (LFFs) developed by Aaron Kaplan and Carl Kukkonen in:

A.D. Kaplan and C.A. Kukkonen, "QMC-consistent static spin and density local field factors for the uniform electron gas", arXiv:2303.08626 (2023). *In review at Phys. Rev. B*.

Please cite the previously listed paper when using this code or the results of our paper.

## Basic use of the fitted LFFs

To use the fitted LFFs in Python code, type
*from AKCK_LFF.fitted_LFF import g_plus_new, g_minus_new*
The arguments of both *g_plus_new* and *g_minus_new* are, in order, the wavevector (units: inverse bohr), and the Wigner-Seitz (WS) radius / *r*<sub>s</sub> (units: bohr).

Both *g_plus_new* and *g_minus_new* are wrappers around the parent structure *simple_LFF*.
This function takes, in order, the wavevector (units: inverse bohr), WS radius (units: bohr), coefficients (dimensionless), and variant (string, either *G<sub>+* by setting *var == "+""*, or *G<sub>-* by setting *var == "-"*).
*var* controls which set of asymptotic coefficients are used.

To use the improved fit of the correlation spin stiffness in *G<sub>-*, use the optional keyword argument *acpars = 'AKCK'*.
By default, *acpars = 'PW92'*, which uses the Perdew-Wang expression.

## Detailed breakdown of the repo contents

These are listed in order of their appearance on the Github repo.
Unless specified otherwise, the units used in the following are hartree atomic units: lengths are measured in bohr radii, and energies in hartree (1 hartree = 2 Ry).

# Directories

* **data_files**
  * Files of the form *CK_G\*\_rs\_\*.csv* contain Quantum Monte Carlo (QMC) data on *G<sub>+* and *G<sub>-* as a function of the wavevector (units: Fermi wavevector) from Ref. 1 (see **References** section below).
  Individual files are for a fixed value of the WS radius (units: bohr).
  When *plus* appears before *\_rs\_* in the file name, data for *G<sub>+* is tabulated.
  Identically, when *minus* appears before *\_rs\_* in the file name, data for *G<sub>-* is tabulated.
  The value of the WS radius appears after *\_rs\_* and before *.csv*.

  * Files of the form *MCS_Gplus_rs_\*.csv* present QMC data for *G<sub>+* at a fixed value of the WS radius (same naming convention as before), but from Ref. 2.

* **ec_data**

  * Files of the form *eps_c_\*.csv* tabulate computed correlation energies (units: hartree, from the adiabatic connection fluctuation dissipation theorem) as a function of the WS radius.
  Some keywords are:
      * *COR*: the wavevector-dependent exchange-correlation (xc) kernel of Corradini *et al.* [3]
      * *NEW*: the present wavevector-dependent density LFF, or xc kernel
      * *RAD*: the wavevector- and frequency-dependent Richardson-Ashcroft xc kernel [4]
      * *RAS*: the static limit of the Richardson-Ashcroft kernel [4], which is still wavevector-dependent
      * *RPA*: the random phase approximation, whereby the xc kernel is set to zero
      * *rMCP07*: the wavevector- and frequency-dependent revised MCP07 kernel of Kaplan *et al.* [5]
      * The suffix *_GKQ* indicates a result from globally-adaptive Gauss-Kronrod quadrature, whereas no suffix indicates a result using the RPA cutoffs

  * *RPA_cutoffs.csv* contain the numeric RPA cutoffs described in the work
  * *eps_c_err.pdf* is Fig. 2 of the main text
  * *RPA_sanity.tex* is Table S2

* **figs** contains the figures of the main text and supplemental material

* **figs_from_fit** contains plots similar to those of the manuscript, but generated immediately after the fitting procedure.
These plots may use parameters in the LFFs that are not truncated at a fixed number of digits.

* **fitted_LFF_pars** contain the fitted parameters in the LFFs as both CSV- and LaTeX-formatted tables.
Initial guesses for the parameters are contained in *optpars_g\*.csv*.

* **quad_grids** is generated by *gauss_quad.py*, and contains grid points and weights for Gaussian quadrature
  * *GKQ* indicates Gauss-Kronrod quadrature
  * *GLQ* indicates Gauss-Legendre quadrature

* **stiffness_refit** contains the revised pars in the correlation spin stiffness (*alphac_pars_rev.tex*), and the susceptibility enhancement in tabular (*chi_enhance.tex*) and pictoral (*suscep_enhance.pdf*) form

# Python files

* *PW92.py* contains both the Perdew-Wang parameterization of the UEG correlation energy [6] in *ec_pw92*, and the Pade approximant of the UEG on-top pair distribution function [7] in *g0_unp_pw92_pade*

* *PZ81.py* contains the Perdew-Zunger parameterization of the UEG correlation energy [8] in *ec_pz81* and of the correlation spin-stiffness in *alpha_c_pz81*

* *QMC_data.py* contains QMC-computed UEG correlation energies from previous works.
Citations are given throughout the file.
This file is used in *stiffness_refit.py*.

* *alda.py* provides the adiabatic local density approximation to the xc kernel, which depends only on the WS radius.
This file is modified from a previous repo maintained by the author, https://github.com/esoteric-ephemera/tc21/tree/master/dft
Note that function *alda* thus requires a dictionary entry *dv* which takes the density *n*, Fermi wavevector *kF*, WS radius *rs*, and square-root of the WS radius *rsh* as keys.
Possible optional keywords are *x_only* for exchange only (default: False), and parameterization of the kernel (default: PZ81, PW92 is another possible option).

* *alpha_c_c1.py* recomputes the value of the next-to-leading order term in the high-density expansion of the correlation spin-stiffness, as in Eq. (19).
To call its functionality, use *from AKCK_LFF.alpha_c_c1 import integrate_funs*, and simply run *integrate_funs()*.

* *asymptotics.py* provides the asymptotic expansion coefficients of *G<sub>+* in *get_g_plus_pars*, which takes only the WS radius as input, and of *G<sub>-* in *get_g_minus_pars*, which takes the WS radius and relative spin polarization as input.

* *corr.py* computes the correlation energies of various density LFFs, as plotted in Fig. 2.
To generate Fig. 2, run *corr_plots()*.
*corr_plots* takes an optional keyword argument, *gpl* (list).
To modify which kernels/LFFs are used, use the same keywords as in the **ec_data/eps_c_\*.csv** files, described above.

* *fit_LFF.py* is the main fitting routine used here.
Its usage syntax is *from AKCK_LFF.fit_LFF import fitparser*, *fitparser(routine,manip,rs=None)*.
Running this file requires secondary options
  * *routine* (string):
    * *init*: generates initial parameters for select values of the WS radius
    * *manip*: allows the user to manually manipulate the parameters in the LFF
    * *main*: main fitting routine which provides the parameters in the text
  * *var* (string) is the variant of the LFF, either *+* for *G<sub>+* or *-* for *G<sub>-*.
  * optional keyword argument *rs* (float/int)
  * optional keyword argument *acpars* (string), defaults to 'PW92' to use the Perdew-Wang parameterization of the correlation spin stiffness.
  Use *acpars = 'AKCK'* to use the improved fit of the correlation spin stiffness.

* *fit_RPA_cutoffs.py* fits the numeric RPA cutoffs for the correlation energy, as described in the supplemental material.
Run *gen_RPA_cutoffs()* (no arguments).

* *fitted_LFF.py* is described in the **Basic use of the fitted LFFs** section.

* *g_corradini.py* contains the density LFF *G<sub>+* of Corradini *et al.* [3] in *g_corradini*.
This function requires the wavevector (unit: inverse bohr) and a density dictionary similar to *alda* as input.

* *gauss_quad.py*, modified from https://github.com/esoteric-ephemera/tc21/tree/master/, is an all-purpose numeric integrator using adaptive mesh refinement.

* *mcp07_static.py* contains the static limit of the modified CP07 kernel of Ruzsinszky *et al.* [9], in *mcp07_static*.
This function takes the wavevector and density dictionary as inputs.
An optional keyword, *param* (default PZ81) can use either the Perdew-Zunger [8] (PZ81) or Perdew-Wang [6] (PW92) parameterization of the UEG correlation energy as input.

* *plot_LFFs.py* generates plots of *G<sub>+* (*gplus_plots*) and *G<sub>-* (*gminus_plots*) shown in the manuscript.
Neither function takes arguments.

* *rMCP07.py* contains the wavevector- and frequency-dependent density LFF of Kaplan *et al.* [5] in *g_rMCP07*.
Note that this function ***assumes*** that the frequency is purely imaginary.
This function takes the wavevector, imaginary part of the frequency (entered as a real number), and density dictionary as input.

* *ra_lff.py* contains the various LFFs of Richardson and Ashcroft [4].
To use their density LFF *G<sub>+*, call *g_plus_ra*; to use their spin LFF *G<sub>-*, call *g_minus_ra*.
Both take the wavevector (units: bohr) and imaginary part of the frequency (units: inverse hartree energy), and WS radius (units: bohr) as inputs.
***Both assume that the frequency is purely imaginary.***

* *stiffness_refit.py* refits the correlation spin stiffness using the PW92 framework.
To call its functionality, use *fit_alpha_c_new()* (takes no arguments)

* *surf_plots.py* produces the surface plots in the supplemental material.
Call *surf_plots()* (takes no arguments).

## References

1. C.A. Kukkonen and K. Chen, Phys. Rev. B **104**, 195142 (2021).
DOI: 10.1103/PhysRevB.104.195142

2. S. Moroni, D. M. Ceperley, and G. Senatore, Phys. Rev. Lett. **75**, 689 (1995).
DOI: 10.1103/PhysRevLett.75.689

3. M. Corradini, R. Del Sole, G. Onida, and M. Palummo, Phys. Rev. B **57**, 14569 (1998).
DOI: 10.1103/PhysRevB.57.14569

4. C. F. Richardson and N. W. Ashcroft, Phys. Rev. B **50**, 8170 (1994).
DOI: 10.1103/PhysRevB.50.8170

5. A. D. Kaplan, N. K. Nepal, A. Ruzsinszky, P. Ballone, and J. P. Perdew, Phys. Rev. B **105**, 035123 (2022).
DOI: 10.1103/PhysRevB.105.035123

6. J.P. Perdew and Y. Wang, Phys. Rev. B **45**, 13244 (1992).
DOI: 10.1103/PhysRevB.45.13244

7. J. P. Perdew and Y. Wang, Phys. Rev. B **46**, 12947 (1992).
DOI: 10.1103/PhysRevB.46.12947,
and erratum Phys. Rev. B 56, 7018 (1997).
DOI: 10.1103/PhysRevB.56.7018

8. J. P. Perdew and A. Zunger, Phys. Rev. B **23**, 5048 (1981).
DOI: 10.1103/PhysRevB.23.5048

9. A. Ruzsinszky, N. K. Nepal, J. M. Pitarke, and J. P. Perdew, Phys. Rev. B **101**, 245135 (2020).
DOI: 10.1103/PhysRevB.101.245135
