gext: Grassmann Extrapolation Library
This library define an Extrapolator
class to be used for providing guesses in QM simulations. It is designed in such a way that requires minimum modifications on the QM code side.
Installation
The library can be installed using pip
:
- Navigate to the root folder of the library
- Run
pip install .
Usage
The usage requires only four lines of code:
-
Add an import statement
import gext
. -
Initialize a new extrapolator by inserting the line:
extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms)
.Note: the extrapolator can be finely controlled by passing additional keyword arguments. This is explained in the next section.
-
When a new SCF calculation has been performed, load the resulting data in the extrapolator by running:
extrapolator.load_data(coordinates, coefficients, overlap)
.Here,
coordinates
are the molecule coordinates of size(natoms, 3)
,coefficients
is the full coefficients matrix of size(nbasis, nbasis)
andoverlap
is the overlap matrix of size(nbasis, nbasis)
. -
When a new guess density is needed, run:
guess_density = extrapolator.guess(current_coordinates, current_overlap)
,if
current_overlap
is not available, run this alternative:guess_density = extrapolator.guess(current_coordinates)
.
Further options
The behavior can be finely controlled by passing additional keyword arguments to the
gext.Extrapolator()
constructor. Note: many options are not yet implemented.
This is an up to date list of available keyword options:
-
nsteps
: integer parameter, number of steps to be used in the extrapolation. Note: Callingguess
before loadingnsteps
data points will cause aValueError
.
Acknowledgments
This work is based on these papers:
- F. Pes, È. Polack, P. Mazzeo, G. Dusson, B. Stamm, and F. Lipparini, “A Quasi Time-Reversible scheme based on density matrix extrapolation on the Grassmann manifold for Born-Oppenheimer Molecular Dynamics.” arXiv, 2023. doi: 10.48550/ARXIV.2307.05653.
- É. Polack, G. Dusson, B. Stamm, and F. Lipparini, “Grassmann Extrapolation of Density Matrices for Born–Oppenheimer Molecular Dynamics,” Journal of Chemical Theory and Computation, vol. 17, no. 11. American Chemical Society (ACS), pp. 6965–6973, Oct. 08, 2021. doi: 10.1021/acs.jctc.1c00751.
- É. Polack, A. Mikhalev, G. Dusson, B. Stamm, and F. Lipparini, “An approximation strategy to compute accurate initial density matrices for repeated self-consistent field calculations at different geometries,” Molecular Physics, vol. 118, no. 19–20. Informa UK Limited, p. e1779834, Jun. 22, 2020. doi: 10.1080/00268976.2020.1779834.