-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
on GPU, when I set walker.rhf = True (for computational cost saving purpose), the result is different from what I get using walker.rhf = False
To Reproduce
Here is a minimal example for reproducing the bug:
import numpy as np
from pyscf import gto, scf
from ipie.utils.from_pyscf import generate_hamiltonian
from ipie.trial_wavefunction.single_det import SingleDet
from ipie.walkers.uhf_walkers import UHFWalkers
from ipie.utils.mpi import MPIHandler
from ipie.systems.generic import Generic
from ipie.qmc.afqmc import AFQMC
import os
handler = MPIHandler()
nsteps = 25
nblocks = 10
timestep = 0.005
rng_seed = 0
atomstring = '''
H 0. 0. 0.
H 0. 0. 0.74
'''
mol = gto.M(atom=atomstring, basis='cc-pvdz', verbose=3, symmetry=0)
mf = scf.RHF(mol)
mf.kernel()
nelec = mol.nelec
neleca, nelecb = nelec
system = Generic(nelec=nelec)
hcore = mf.get_hcore()
ham = generate_hamiltonian(mol, mf.mo_coeff, hcore, mf.mo_coeff, chol_cut=1e-6)
num_basis = ham.nbasis
psi_a = np.eye(num_basis, neleca)
psi_b = np.eye(num_basis, nelecb)
trial = SingleDet(np.hstack([psi_a, psi_b]), nelec, num_basis, handler=handler)
trial.build()
trial.half_rotate(ham)
num_walkers = 1000
walkers = UHFWalkers(np.hstack([psi_a, psi_b]), system.nup, system.ndown, ham.nbasis, num_walkers, mpi_handler=handler)
walkers.build(trial)
walkers.rhf = True
afqmc = AFQMC.build(
(neleca, nelecb),
ham,
trial,
walkers,
num_walkers,
rng_seed,
nsteps,
nblocks,
timestep,
stabilize_freq=5,
pop_control_freq=5,
mpi_handler=handler,
verbose=True)
afqmc.run(verbose=True)
afqmc.finalise(verbose=True)
Expected behavior
RHF and UHF should give the same result.
True behavior
RHF:
Block Weight WeightFactor HybridEnergy ENumer EDenom ETotal E1Body E2Body
0 1.0000000000000000e+03 1.0000000000000000e+03 0.0000000000000000e+00 -1.1287001328879180e+03 1.0000000000000000e+03 -1.1287001328879180e+00 -1.7876825538047363e+00 6.5898242091681836e-01
1 1.0051004437340034e+03 1.0108638462230341e+03 -5.2904358478681923e-01 -1.1287001328573720e+03 1.0000000000000002e+03 -1.1287001328573718e+00 -1.7877552008200857e+00 6.5905506796271363e-01
2 1.0000718478963389e+03 1.0023500927362777e+03 -5.3938995449068527e-01 -1.1287001328371289e+03 1.0000000000000000e+03 -1.1287001328371289e+00 -1.7878654727312355e+00 6.5916533989410697e-01
3 1.0000115770516917e+03 1.0000463372231701e+03 -5.4117960041716850e-01 -1.1287001328028175e+03 1.0000000000000001e+03 -1.1287001328028172e+00 -1.7879651313033260e+00 6.5926499850050868e-01
4 1.0000549403673514e+03 1.0001609738793918e+03 -5.5149062001800164e-01 -1.1287001328055737e+03 1.0000000000000002e+03 -1.1287001328055735e+00 -1.7877281670242433e+00 6.5902803421866984e-01
5 9.9996874829092371e+02 9.9993441378711873e+02 -5.5070653947513126e-01 -1.1287001327561768e+03 1.0000000000000002e+03 -1.1287001327561765e+00 -1.7879568160390706e+00 6.5925668328289444e-01
6 9.9997009135056817e+02 9.9993578727016518e+02 -5.5088788260525745e-01 -1.1287001327539806e+03 1.0000000000000001e+03 -1.1287001327539803e+00 -1.7879453219551318e+00 6.5924518920115127e-01
7 9.9999356374174727e+02 9.9985263687025395e+02 -5.5469357907383632e-01 -1.1287001326691798e+03 1.0000000000000001e+03 -1.1287001326691795e+00 -1.7882542121401492e+00 6.5955407947096967e-01
8 9.9998013530148125e+02 9.9996939262306830e+02 -5.5659290854245758e-01 -1.1287001326350753e+03 1.0000000000000001e+03 -1.1287001326350752e+00 -1.7884484902139044e+00 6.5974835757882910e-01
9 9.9995712268771217e+02 9.9984558315262927e+02 -5.5842364764637809e-01 -1.1287001326578641e+03 1.0000000000000000e+03 -1.1287001326578641e+00 -1.7882354007069403e+00 6.5953526804907603e-01
10 9.9989431282100179e+02 9.9984735391943650e+02 -5.5684606191317321e-01 -1.1287001327435407e+03 1.0000000000000000e+03 -1.1287001327435409e+00 -1.7878590632117006e+00 6.5915893046816010e-01
UHF:
Block Weight WeightFactor HybridEnergy ENumer EDenom ETotal E1Body E2Body
0 1.0000000000000000e+03 1.0000000000000000e+03 0.0000000000000000e+00 -1.1287001328879180e+03 1.0000000000000000e+03 -1.1287001328879180e+00 -1.7876825538047363e+00 6.5898242091681836e-01
1 1.0051004437340034e+03 1.0108638462230341e+03 -5.2904358478681923e-01 -1.1377930125303735e+03 1.0000000000000002e+03 -1.1377930125303732e+00 -1.7878278478354344e+00 6.5003483530506112e-01
2 1.0000718478963389e+03 1.0023500927362777e+03 -5.3938995449068527e-01 -1.1440028747499925e+03 1.0000000000000000e+03 -1.1440028747499926e+00 -1.7880483916577352e+00 6.4404551690774237e-01
3 1.0000115770516917e+03 1.0000463372231701e+03 -5.4117960041716850e-01 -1.1485091339860103e+03 1.0000000000000001e+03 -1.1485091339860101e+00 -1.7882477088019155e+00 6.3973857481590546e-01
4 1.0000549403673514e+03 1.0001609738793918e+03 -5.5149062001800164e-01 -1.1517828952055277e+03 1.0000000000000002e+03 -1.1517828952055273e+00 -1.7877737802437506e+00 6.3599088503822265e-01
5 9.9996874829092371e+02 9.9993441378711873e+02 -5.5070653947513126e-01 -1.1543269477581075e+03 1.0000000000000002e+03 -1.1543269477581073e+00 -1.7882310782734050e+00 6.3390413051529781e-01
6 9.9997009135056817e+02 9.9993578727016518e+02 -5.5088788260525745e-01 -1.1568823221715868e+03 1.0000000000000001e+03 -1.1568823221715865e+00 -1.7882080901055271e+00 6.3132576793394046e-01
7 9.9999356374174727e+02 9.9985263687025395e+02 -5.5469357907383632e-01 -1.1571073630656399e+03 1.0000000000000001e+03 -1.1571073630656397e+00 -1.7888258704755622e+00 6.3171850740992264e-01
8 9.9998013530148125e+02 9.9996939262306830e+02 -5.5659290854245758e-01 -1.1593016176583408e+03 1.0000000000000001e+03 -1.1593016176583406e+00 -1.7892144266230725e+00 6.2991280896473190e-01
9 9.9995712268771217e+02 9.9984558315262927e+02 -5.5842364764637809e-01 -1.1590574023647384e+03 1.0000000000000000e+03 -1.1590574023647384e+00 -1.7887882476091441e+00 6.2973084524440537e-01
10 9.9989431282100179e+02 9.9984735391943650e+02 -5.5684606191317321e-01 -1.1603559442338171e+03 1.0000000000000000e+03 -1.1603559442338172e+00 -1.7880355726186650e+00 6.2767962838484781e-01
Other information:
- Git branch hash a7235c4
- OS: Linux
- Version 0.7.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working