Skip to content

Commit

Permalink
revert msd init walker, input walker specifically in example
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtong1000 committed Dec 5, 2024
1 parent 5723138 commit a24ff20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
16 changes: 16 additions & 0 deletions examples/02-multi_determinant/run_afqmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions ipie/walkers/walkers_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a24ff20

Please sign in to comment.