Skip to content

Commit

Permalink
relax_params pairwise assignment and example
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewRHermes committed Jul 18, 2024
1 parent ba9f221 commit c3f9baf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion examples/lasscf_async/c2h6n4_lasscf88_sto3g.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from mrh.tests.lasscf.c2h6n4_struct import structure as struct
from mrh.my_pyscf.mcscf import lasscf_sync_o0 as syn
from mrh.my_pyscf.mcscf import lasscf_async as asyn
from mrh.my_pyscf.mcscf.lasscf_async import old_aa_sync_kernel

mol = struct (1.0, 1.0, 'sto-3g', symmetry=False)
mol.verbose = 5
Expand All @@ -22,7 +23,17 @@
las_asyn.max_cycle_macro = 50 # by default, all subproblems use this
las_asyn.impurity_params['max_cycle_macro'] = 51 # all fragments
las_asyn.impurity_params[1]['max_cycle_macro'] = 52 # second fragment only (has priority)
las_asyn.relax_params['max_cycle_macro'] = 53
las_asyn.relax_params['max_cycle_macro'] = 53 # "flas", the "LASCI step"
# If you have more than two fragments, you can apply specific parameters to orbital relaxations
# between specific pairs of fragments. Addressing specific fragment pairs has priority over
# the global settings above.
las_asyn.relax_params['max_cycle_micro'] = 6 # loses
las_asyn.relax_params[(0,1)]['max_cycle_micro'] = 7 # wins
# However, the old_aa_sync_kernel doesn't relax the active orbitals in a pairwise way, so stuff like
# "relax_params[(0,1)]" is ignored if we patch in the old kernel:
#
# las_asyn = old_aa_sync_kernel.patch_kernel (las_asyn) # uncomment me to make 6 win

mo = las_asyn.set_fragments_((list (range (3)), list (range (9,12))), mf.mo_coeff)
las_asyn.state_average_(weights=[1,0,0,0,0],
spins=[[0,0],[2,0],[-2,0],[0,2],[0,-2]],
Expand Down
2 changes: 2 additions & 0 deletions my_pyscf/mcscf/lasscf_async/lasscf_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def __init__(self, mf, ncas, nelecas, ncore=None, spin_sub=None, **kwargs):
for i in range (self.nfrags):
self.impurity_params[i] = {}
self.relax_params = {}
for i, j in itertools.combinations (range (self.nfrags), 2):
self.relax_params[(i,j)] = {}
keys = set (('frags_orbs','impurity_params','relax_params'))
self._keys = self._keys.union (keys)

Expand Down

0 comments on commit c3f9baf

Please sign in to comment.