diff --git a/examples/02-multi_determinant/run_afqmc.py b/examples/02-multi_determinant/run_afqmc.py index c4572012..ac7d774c 100644 --- a/examples/02-multi_determinant/run_afqmc.py +++ b/examples/02-multi_determinant/run_afqmc.py @@ -11,6 +11,8 @@ from ipie.systems.generic import Generic from ipie.trial_wavefunction.particle_hole import ParticleHole from ipie.utils.from_pyscf import gen_ipie_input_from_pyscf_chk +from ipie.walkers.uhf_walkers import UHFWalkersParticleHole +from ipie.utils.mpi import MPIHandler try: from mpi4py import MPI @@ -90,11 +92,25 @@ trial.build() trial.half_rotate(ham) +initial_walker = numpy.hstack([trial.psi0a, trial.psi0b]) +random_perturbation = numpy.random.random(initial_walker.shape) +initial_walker = initial_walker + random_perturbation +initial_walker, _ = numpy.linalg.qr(initial_walker) +walkers = UHFWalkersParticleHole( + initial_walker, + mol_nelec[0], + mol_nelec[1], + num_basis, + num_walkers, + MPIHandler(), +) +walkers.build(trial) afqmc_msd = AFQMC.build( mol_nelec, ham, trial, + walkers=walkers, num_walkers=num_walkers, num_steps_per_block=25, num_blocks=10, diff --git a/ipie/walkers/walkers_dispatch.py b/ipie/walkers/walkers_dispatch.py index 6a8a85b0..606d63d9 100644 --- a/ipie/walkers/walkers_dispatch.py +++ b/ipie/walkers/walkers_dispatch.py @@ -45,15 +45,15 @@ def get_initial_walker(trial: TrialWavefunctionBase) -> numpy.ndarray: num_dets = 1 elif isinstance(trial, ParticleHole): initial_walker = numpy.hstack([trial.psi0a, trial.psi0b]) - random_walker = numpy.random.random(initial_walker.shape) - initial_walker = initial_walker + random_walker - initial_walker, _ = numpy.linalg.qr(initial_walker) + # random_walker = numpy.random.random(initial_walker.shape) + # initial_walker = initial_walker + random_walker + # initial_walker, _ = numpy.linalg.qr(initial_walker) num_dets = trial.num_dets elif isinstance(trial, ParticleHoleNonChunked): initial_walker = numpy.hstack([trial.psi0a, trial.psi0b]) - random_walker = numpy.random.random(initial_walker.shape) - initial_walker = initial_walker + random_walker - initial_walker, _ = numpy.linalg.qr(initial_walker) + # random_walker = numpy.random.random(initial_walker.shape) + # initial_walker = initial_walker + random_walker + # initial_walker, _ = numpy.linalg.qr(initial_walker) num_dets = trial.num_dets elif isinstance(trial, NOCI): initial_walker = trial.psi[0].copy()