-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix format and lint errors and relax requirements (#309)
* Allow python > 3.11 * Allow numpy >= 1.26 * Bump CI python versions (min version is 3.10) * Fix lint / format errors introduced in #296 I split the AFQMC driver into a base class and then implementations for FT / ZT afqmc which allows for more customization of the factory methods.
- Loading branch information
Showing
67 changed files
with
2,487 additions
and
1,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,4 +108,6 @@ ipie/qmc/tests/reference_data/**/*.h5 | |
*.txt | ||
*wheels* | ||
*FCIDUMP* | ||
*out* | ||
*out* | ||
|
||
*.code-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/usr/bin/env python3 | ||
import argparse | ||
import glob | ||
import os | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
# Author: Fionn Malone <[email protected]> | ||
# | ||
|
||
from typing import Dict | ||
|
||
import numpy as np | ||
from pyscf import gto, scf | ||
|
||
|
@@ -86,11 +88,11 @@ def __init__(self, ham): | |
# Must specify that we're dealing with array valued estimator | ||
self.scalar_estimator = False | ||
|
||
def compute_estimator(self, system, walker_batch, hamiltonian, trial_wavefunction): | ||
trial_wavefunction.calc_greens_function(walker_batch, build_full=True) | ||
numer = np.einsum("w,wii->i", walker_batch.weight, walker_batch.Ga + walker_batch.Gb) | ||
def compute_estimator(self, system=None, walkers=None, hamiltonian=None, trial=None): | ||
trial.calc_greens_function(walkers, build_full=True) | ||
numer = np.einsum("w,wii->i", walkers.weight, walkers.Ga + walkers.Gb) | ||
self["DiagGNumer"] = numer | ||
self["DiagGDenom"] = sum(walker_batch.weight) | ||
self["DiagGDenom"] = sum(walkers.weight) | ||
|
||
|
||
afqmc = build_afqmc_driver(comm, nelec=mol.nelec) | ||
|
@@ -127,25 +129,28 @@ def __init__(self, ham): | |
# Must specify that we're dealing with array valued estimator | ||
self.scalar_estimator = False | ||
|
||
def compute_estimator(self, system, walker_batch, hamiltonian, trial_wavefunction): | ||
trial_wavefunction.calc_greens_function(walker_batch, build_full=True) | ||
def compute_estimator(self, system=None, walkers=None, hamiltonian=None, trial=None): | ||
trial.calc_greens_function(walkers, build_full=True) | ||
numer = np.array( | ||
[ | ||
np.einsum("w,wij->ij", walker_batch.weight, walker_batch.Ga), | ||
np.einsum("w,wij->ij", walker_batch.weight, walker_batch.Gb), | ||
np.einsum("w,wij->ij", walkers.weight, walkers.Ga), | ||
np.einsum("w,wij->ij", walkers.weight, walkers.Gb), | ||
] | ||
) | ||
|
||
# For multidimensional arrays we must flatten the data | ||
self["GNumer"] = numer.ravel() | ||
self["GDenom"] = sum(walker_batch.weight) | ||
self["GDenom"] = sum(walkers.weight) | ||
|
||
|
||
afqmc = build_afqmc_driver(comm, nelec=mol.nelec) | ||
# Let us override the number of blocks to keep it short | ||
afqmc.params.num_blocks = 20 | ||
# We can now add this to the estimator handler object in the afqmc driver | ||
add_est = {"diagG": Diagonal1RDM(ham=afqmc.hamiltonian), "1RDM": Mixed1RDM(ham=afqmc.hamiltonian)} | ||
add_est: Dict[str, EstimatorBase] = { | ||
"diagG": Diagonal1RDM(ham=afqmc.hamiltonian), | ||
"1RDM": Mixed1RDM(ham=afqmc.hamiltonian), | ||
} | ||
afqmc.run(additional_estimators=add_est) | ||
# We can extract the qmc data as as a pandas data frame like so | ||
from ipie.analysis.extraction import extract_observable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.