Skip to content

Commit

Permalink
laspdft rdm2 cache: close file between build calls
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewRHermes committed Aug 8, 2024
1 parent eced7e7 commit de3ed1f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions my_pyscf/mcpdft/laspdft.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ def _store_rdms(self):
else:
nblk = max (1, int ((self.max_memory - current_mem) / mem_per_state)-1)
rdmstmpfile = self.rdmstmpfile
with h5py.File(rdmstmpfile, 'w') as f:
for i in range (0, len (self.e_states), nblk):
j = min (i+nblk, len (self.e_states))
rdm1s, rdm2s = lassi.root_make_rdm12s(self, self.ci, self.si,
state=list(range(i,j)))
for i in range (0, len (self.e_states), nblk):
j = min (i+nblk, len (self.e_states))
rdm1s, rdm2s = lassi.root_make_rdm12s(self, self.ci, self.si,
state=list(range(i,j)))
with h5py.File(rdmstmpfile, 'w') as f:
for k in range (i, j):
rdm1s_dname = f'rdm1s_{k}'
f.create_dataset(rdm1s_dname, data=rdm1s[k])
rdm2s_dname = f'rdm2s_{k}'
f.create_dataset(rdm2s_dname, data=rdm2s[k])
rdm1s = rdm2s = None
rdm1s = rdm2s = None

# # This code doesn't seem efficent, have to calculate the casdm1 and casdm2 in different functions.
# def make_one_casdm1s(self, ci=None, state=0, **kwargs):
Expand Down

0 comments on commit de3ed1f

Please sign in to comment.