Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THC TDA #12

Merged
merged 65 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ec84641
THC testing using CDERI esq tensors
mkakcl Jul 19, 2023
0cd345a
Linear in t scaling method for moment construction.
mkakcl Jul 28, 2023
7466529
Initial attempted implementation of THC se moments in main GW code
mkakcl Jul 31, 2023
ac7436f
Alignment between eta and zeta
mkakcl Aug 2, 2023
12c906d
Cleanup branch
mkakcl Aug 2, 2023
f9882b1
Changes to align more closely with original TDA
mkakcl Aug 2, 2023
402a3a1
Working THC method
mkakcl Aug 3, 2023
77286a5
THC testing using CDERI esq tensors
mkakcl Jul 19, 2023
d6ec4f0
Linear in t scaling method for moment construction.
mkakcl Jul 28, 2023
088032c
Initial attempted implementation of THC se moments in main GW code
mkakcl Jul 31, 2023
6add9a1
Alignment between eta and zeta
mkakcl Aug 2, 2023
bf28799
Cleanup branch
mkakcl Aug 2, 2023
e8c59ed
Changes to align more closely with original TDA
mkakcl Aug 2, 2023
732aa7f
Working THC method
mkakcl Aug 3, 2023
fdb53cc
Merge branch 'dTDA_THC' of github.com:BoothGroup/momentGW into dTDA_THC
mkakcl Aug 3, 2023
219d494
Attempted rebasing
mkakcl Aug 3, 2023
1356906
Cleanup
mkakcl Aug 3, 2023
5c1e861
Complete rebase
mkakcl Aug 3, 2023
b582a58
Testing still works with new code structure
mkakcl Aug 3, 2023
f565fb2
Functioning THC in new ints form
mkakcl Aug 3, 2023
46c8da7
Adding docstrings
mkakcl Aug 3, 2023
2ac9f30
Further updates
mkakcl Aug 3, 2023
d4319c5
Removing THC files
mkakcl Aug 3, 2023
79459b3
reformatted to discussed style and linted.
mkakcl Aug 7, 2023
19b8efc
Working in new structure
mkakcl Aug 7, 2023
8e80d11
reformatted to discussed style and linted.
mkakcl Aug 7, 2023
98c1b8a
Updates imports
mkakcl Aug 7, 2023
dc89895
Merge branch 'main' into dTDA_THC
mkakcl Aug 7, 2023
a2ba19a
Removed benchmarking file
mkakcl Aug 7, 2023
1ab6dd5
Remove junk files
mkakcl Aug 7, 2023
c065178
Removed all junk files
mkakcl Aug 7, 2023
a68642f
Update post review
mkakcl Aug 7, 2023
d5c6511
Update for linting
mkakcl Aug 7, 2023
f5bdfaa
Additional linting update
mkakcl Aug 7, 2023
1353677
Improves inheritance for moment convolution step
obackhouse Aug 7, 2023
f141e74
Remove total_nmom
obackhouse Aug 7, 2023
6b86a1f
Converts thc_opts into keyword arguments to Integrals
obackhouse Aug 7, 2023
5d2d1e1
More simplifications
obackhouse Aug 7, 2023
2373e50
Some refactoring
obackhouse Aug 7, 2023
30a6580
Can inherit the __init__ now
obackhouse Aug 7, 2023
795b358
Can inherit the __init__ now
obackhouse Aug 7, 2023
f0ec94d
Fix function name
obackhouse Aug 7, 2023
149220d
Inheritance for THC Integrals
obackhouse Aug 7, 2023
02b6ff4
Lower case for example name
obackhouse Aug 7, 2023
3844bc5
Fix bug
obackhouse Aug 7, 2023
3132155
Fix
obackhouse Aug 8, 2023
88740e1
Implements N^3 fock build functionality for THC
obackhouse Aug 9, 2023
b4d06d0
Add clarifying comment in THC example
obackhouse Aug 9, 2023
4a9a1fe
More adjustments
obackhouse Aug 9, 2023
0e52e14
Linting
obackhouse Aug 9, 2023
9d7645d
THC_TDA test added and faster example 07
mkakcl Aug 10, 2023
813474e
Updated an np.einsum
mkakcl Aug 10, 2023
8fac749
Testing MPI implementation
mkakcl Aug 14, 2023
c7e4964
Updated attempt at parallelisation
mkakcl Aug 14, 2023
073fe37
Revert "Updated attempt at parallelisation"
mkakcl Aug 17, 2023
5674b93
Revert "Testing MPI implementation"
mkakcl Aug 17, 2023
a820035
Update in line with review
mkakcl Aug 17, 2023
74551fb
Update import methods for integrals and initial attempt at scGW imple…
mkakcl Aug 21, 2023
e2587a4
Linting
mkakcl Aug 21, 2023
2502deb
Fix import issue between MO and AO orbitals in get_j and k
mkakcl Aug 21, 2023
5059dcf
Linting
mkakcl Aug 21, 2023
fd3c61e
Docstring for THC-scGW
mkakcl Aug 21, 2023
96408d9
Docstring in the form of numpy
mkakcl Aug 22, 2023
dad868e
Merge conflicts
obackhouse Aug 22, 2023
c10ed10
Linting
obackhouse Aug 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# pycharm
.idea/
42 changes: 42 additions & 0 deletions examples/07-thc_tda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Example of using THC integrals instead of using Cholesky decomposition.
In this example, the THC integrals are imported from thc_eri_8.h5.
"""


from os.path import abspath, dirname, join

import numpy as np
from pyscf.pbc import df, dft, gto

from momentGW.gw import GW

cell = gto.Cell()
cell.atom = """He 0 0 0; He 1 1 1"""
cell.a = np.eye(3) * 3
cell.basis = "6-31g"
cell.verbose = 3
cell.max_memory = 1e10
cell.precision = 1e-6
cell.build()

kpts = cell.make_kpts([1, 1, 1])

# To compare to the Cholesky decomposition code, we need to use
# Gaussian density fitting and not FFT. The THC integrals are
# based of the FFT representation, and so there will be some
# additional error between these calculations.

mf = dft.RKS(cell, xc="pbe")
mf = mf.density_fit()
mf.exxdiv = None
mf.kernel()

print("THC-TDA:")
gw = GW(mf)
gw.thc_opts = dict(file_path=abspath(join(dirname(__file__), "..", "examples/thc.h5")))
gw.polarizability = "thc-dtda"
gw.kernel(nmom_max=7)

print("TDA:")
gw = GW(mf)
gw.kernel(nmom_max=7)
Binary file added examples/thc.h5
Binary file not shown.
9 changes: 8 additions & 1 deletion momentGW/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BaseGW(lib.StreamObject):
Default value is `False`.
polarizability : str, optional
Type of polarizability to use, can be one of `("drpa",
"drpa-exact", "dtda"). Default value is `"drpa"`.
"drpa-exact", "dtda", "thc-dtda"). Default value is `"drpa"`.
npoints : int, optional
Number of numerical integration points. Default value is `48`.
optimise_chempot : bool, optional
Expand All @@ -46,6 +46,9 @@ class BaseGW(lib.StreamObject):
self-consistent scheme. Default value is `"ia"`.
compression_tol : float, optional
Tolerance for the compression. Default value is `1e-10`.
thc_opts : dict, optional
Dictionary of options to be used for THC calculations. Current
implementation requires a filepath to import the THC integrals.
{extra_parameters}
"""

Expand All @@ -66,6 +69,9 @@ class BaseGW(lib.StreamObject):
)
compression = "ia"
compression_tol = 1e-10
thc_opts = dict(
file_path=None,
)

_opts = [
"diagonal_se",
Expand All @@ -76,6 +82,7 @@ class BaseGW(lib.StreamObject):
"fock_opts",
"compression",
"compression_tol",
"thc_opts",
]

def __init__(self, mf, **kwargs):
Expand Down
23 changes: 18 additions & 5 deletions momentGW/gw.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pyscf.ao2mo import _ao2mo
from pyscf.lib import logger

from momentGW import energy, util
from momentGW import energy, thc, util
from momentGW.base import BaseGW
from momentGW.fock import fock_loop
from momentGW.ints import Integrals
Expand Down Expand Up @@ -182,19 +182,32 @@ def build_se_moments(self, nmom_max, integrals, **kwargs):
tda = TDA(self, nmom_max, integrals, **kwargs)
return tda.kernel()

elif self.polarizability == "thc-dtda":
tda = thc.TDA(self, nmom_max, integrals, **kwargs)
return tda.kernel()

else:
raise NotImplementedError

def ao2mo(self, transform=True):
"""Get the integrals."""

integrals = Integrals(
if self.polarizability.startswith("thc"):
cls = thc.Integrals
kwargs = self.thc_opts
else:
cls = Integrals
kwargs = dict(
compression=self.compression,
compression_tol=self.compression_tol,
store_full=self.fock_loop,
)

integrals = cls(
self.with_df,
self.mo_coeff,
self.mo_occ,
compression=self.compression,
compression_tol=self.compression_tol,
store_full=self.has_fock_loop,
**kwargs,
)
if transform:
integrals.transform()
Expand Down
Loading
Loading