mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-12-21 11:53:30 +01:00
Jastrow opt
This commit is contained in:
parent
8471cb050a
commit
2e5256bc63
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3 -u
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import scipy as sp
|
import scipy as sp
|
||||||
import scipy.optimize
|
import scipy.optimize
|
||||||
@ -9,6 +9,8 @@ import time
|
|||||||
import subprocess
|
import subprocess
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QMCCHEM_PATH=os.environ["QMCCHEM_PATH"]
|
QMCCHEM_PATH=os.environ["QMCCHEM_PATH"]
|
||||||
|
|
||||||
sys.path.insert(0,QMCCHEM_PATH+"/EZFIO/Python/")
|
sys.path.insert(0,QMCCHEM_PATH+"/EZFIO/Python/")
|
||||||
@ -54,6 +56,7 @@ def main():
|
|||||||
for m in atom_map:
|
for m in atom_map:
|
||||||
print(m[0])
|
print(m[0])
|
||||||
print (d[m[0]])
|
print (d[m[0]])
|
||||||
|
sys.stdout.flush()
|
||||||
return np.array([d[m[0]] for m in atom_map])
|
return np.array([d[m[0]] for m in atom_map])
|
||||||
|
|
||||||
|
|
||||||
@ -118,6 +121,7 @@ def main():
|
|||||||
memo_energy = {'fmin': 100000000.}
|
memo_energy = {'fmin': 100000000.}
|
||||||
def f(x):
|
def f(x):
|
||||||
print ("x = %s"%str(x))
|
print ("x = %s"%str(x))
|
||||||
|
sys.stdout.flush()
|
||||||
h = str(x)
|
h = str(x)
|
||||||
if h in memo_energy:
|
if h in memo_energy:
|
||||||
return memo_energy[h]
|
return memo_energy[h]
|
||||||
@ -144,6 +148,7 @@ def main():
|
|||||||
energy = e #+ variance
|
energy = e #+ variance
|
||||||
err = e_err #sqrt(e_err*e_err+v_err*v_err)
|
err = e_err #sqrt(e_err*e_err+v_err*v_err)
|
||||||
print(" %f %f %f %f %f %f"%(e, e_err, variance, v_err, energy, err))
|
print(" %f %f %f %f %f %f"%(e, e_err, variance, v_err, energy, err))
|
||||||
|
sys.stdout.flush()
|
||||||
if (energy-2.*err) > memo_energy['fmin']+thresh:
|
if (energy-2.*err) > memo_energy['fmin']+thresh:
|
||||||
local_thresh = 10.*thresh
|
local_thresh = 10.*thresh
|
||||||
elif (energy+2.*err) < memo_energy['fmin']-thresh:
|
elif (energy+2.*err) < memo_energy['fmin']-thresh:
|
||||||
@ -154,6 +159,7 @@ def main():
|
|||||||
os.kill(pid,0)
|
os.kill(pid,0)
|
||||||
except OSError:
|
except OSError:
|
||||||
print("---")
|
print("---")
|
||||||
|
sys.stdout.flush()
|
||||||
break
|
break
|
||||||
stop_qmc()
|
stop_qmc()
|
||||||
os.wait()
|
os.wait()
|
||||||
@ -170,6 +176,7 @@ def main():
|
|||||||
opt = sp.optimize.minimize(f,x,method="Powell",
|
opt = sp.optimize.minimize(f,x,method="Powell",
|
||||||
options= {'disp':True, 'ftol':thresh,'xtol':0.02})
|
options= {'disp':True, 'ftol':thresh,'xtol':0.02})
|
||||||
print("x = "+str(opt))
|
print("x = "+str(opt))
|
||||||
|
sys.stdout.flush()
|
||||||
set_params_b(opt['x'][0])
|
set_params_b(opt['x'][0])
|
||||||
set_params_pen(opt['x'][1:])
|
set_params_pen(opt['x'][1:])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user