1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-07-17 00:20:53 +02:00
qmc-lttc/qmc_uniform.py

20 lines
453 B
Python

from hydrogen import *
from qmc_stats import *
def MonteCarlo(a, nmax):
energy = 0.
normalization = 0.
for istep in range(nmax):
r = np.random.uniform(-5., 5., (3))
w = psi(a,r)
w = w*w
normalization += w
energy += w * e_loc(a,r)
return energy/normalization
a = 0.9
nmax = 100000
X = [MonteCarlo(a,nmax) for i in range(30)]
E, deltaE = ave_error(X)
print(f"E = {E} +/- {deltaE}")