diff --git a/examples/lasscf_async/c2h6n4_lasscf88_sto3g.py b/examples/lasscf_async/c2h6n4_lasscf88_sto3g.py index da3fc09c..290072f2 100644 --- a/examples/lasscf_async/c2h6n4_lasscf88_sto3g.py +++ b/examples/lasscf_async/c2h6n4_lasscf88_sto3g.py @@ -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 @@ -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]], diff --git a/my_pyscf/mcscf/lasscf_async/lasscf_async.py b/my_pyscf/mcscf/lasscf_async/lasscf_async.py index 9cceded6..3c47455b 100644 --- a/my_pyscf/mcscf/lasscf_async/lasscf_async.py +++ b/my_pyscf/mcscf/lasscf_async/lasscf_async.py @@ -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)