Skip to content

Commit

Permalink
Merge pull request #247 from willwheelera/recipes
Browse files Browse the repository at this point in the history
Add optimize_orthogonal to OPTIMIZE recipe
  • Loading branch information
lkwagner committed Feb 6, 2021
2 parents 37132a4 + 673e986 commit ddbb729
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions pyqmc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,4 @@ def read_wf(wf, wf_file):
wf.parameters[k] = new_parms
else:
raise Exception("Did not find wf in hdf file")
return wf
37 changes: 27 additions & 10 deletions pyqmc/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import pyqmc.reblock
import scipy.stats
import pandas as pd
import copy



def OPTIMIZE(
dft_checkfile,
output,
anchors=None,
nconfig=1000,
ci_checkfile=None,
start_from=None,
Expand Down Expand Up @@ -42,16 +45,30 @@ def OPTIMIZE(

configs = pyqmc.initial_guess(mol, nconfig)
acc = pyqmc.gradient_generator(mol, wf, to_opt)
pyqmc.line_minimization(
wf,
configs,
acc,
verbose=True,
hdf_file=output,
client=client,
npartitions=npartitions,
**linemin_kws
)
if anchors is None:
pyqmc.line_minimization(
wf,
configs,
acc,
verbose=True,
hdf_file=output,
client=client,
npartitions=npartitions,
**linemin_kws
)
else:
wfs = [pyqmc.read_wf(copy.deepcopy(wf), a) for a in anchors]
wfs.append(wf)
pyqmc.optimize_orthogonal(
wfs,
configs,
acc,
# verbose=True,
hdf_file=output,
client=client,
npartitions=npartitions,
**linemin_kws
)


def generate_accumulators(mol, mf, energy=True, rdm1=False, extra_accumulators=None):
Expand Down

0 comments on commit ddbb729

Please sign in to comment.