Merge branch 'master' of gitlab.com:scemama/qmcchem

This commit is contained in:
Anthony Scemama 2021-08-31 11:39:53 +02:00
commit 4cbb4f6a2d
2 changed files with 16 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3 -u
import scipy as sp import scipy as sp
import scipy.optimize import scipy.optimize
@ -17,7 +17,7 @@ from ezfio import ezfio
# PARAMETERS # PARAMETERS
thresh = 1.e-2 thresh = 1.e-2
block_time = 20 block_time = 6
def main(): def main():
if len(sys.argv) != 2: if len(sys.argv) != 2:
@ -45,6 +45,9 @@ def main():
atom_map = make_atom_map() atom_map = make_atom_map()
def get_params_b():
return ezfio.jastrow_jast_b_up_dn
def get_params_pen(): def get_params_pen():
d = ezfio.jastrow_jast_pen d = ezfio.jastrow_jast_pen
print(atom_map) print(atom_map)
@ -76,6 +79,11 @@ def main():
return None, None return None, None
def set_params_b(x):
x = np.abs(x)
ezfio.set_jastrow_jast_b_up_up(x)
ezfio.set_jastrow_jast_b_up_dn(x)
def set_params_pen(x): def set_params_pen(x):
x = np.abs(x) x = np.abs(x)
y=list(ezfio.jastrow_jast_pen) y=list(ezfio.jastrow_jast_pen)
@ -113,7 +121,8 @@ def main():
h = str(x) h = str(x)
if h in memo_energy: if h in memo_energy:
return memo_energy[h] return memo_energy[h]
set_params_pen(x) set_params_b(x[0])
set_params_pen(x[1:])
set_vmc_params() set_vmc_params()
pid = os.fork() pid = os.fork()
if pid == 0: if pid == 0:
@ -154,14 +163,15 @@ def main():
def run(): def run():
x = get_params_pen() x = np.array([ get_params_b() ] + list(get_params_pen()))
if sum(x) == 0.: if sum(x) == 0.:
jast_a_up_dn = ezfio.jastrow_jast_a_up_dn jast_a_up_dn = ezfio.jastrow_jast_a_up_dn
x += jast_a_up_dn x += jast_a_up_dn
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))
set_params_pen(opt['x']) set_params_b(opt['x'][0])
set_params_pen(opt['x'][1:])
run() run()

View File

@ -1588,7 +1588,7 @@ END_PROVIDER
BEGIN_PROVIDER [ double precision, det_beta_value, (det_beta_num_8) ] BEGIN_PROVIDER [ double precision, det_beta_value, (det_beta_num_8) ]
&BEGIN_PROVIDER [ double precision, det_beta_grad_lapl, (4,elec_beta_num,det_beta_num) ] &BEGIN_PROVIDER [ double precision, det_beta_grad_lapl, (4,elec_beta_num,det_beta_num) ]
&BEGIN_PROVIDER [ double precision, det_beta_pseudo, (det_beta_num_8,det_beta_num_pseudo) ] &BEGIN_PROVIDER [ double precision, det_beta_pseudo, (elec_beta_num_8,det_beta_num_pseudo) ]
implicit none implicit none