10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-12-21 11:53:30 +01:00

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

This commit is contained in:
Anthony Scemama 2022-01-12 12:49:02 +01:00
commit bb64e47ac9
7 changed files with 35 additions and 20 deletions

2
EZFIO

@ -1 +1 @@
Subproject commit ed1df9f3c1f51752656ca98da5693a4119add05c
Subproject commit d5805497fa0ef30e70e055cde1ecec2963303e93

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3 -u
#!/usr/bin/env python3
import scipy as sp
import scipy.optimize
@ -9,6 +9,8 @@ import time
import subprocess
from math import sqrt
QMCCHEM_PATH=os.environ["QMCCHEM_PATH"]
sys.path.insert(0,QMCCHEM_PATH+"/EZFIO/Python/")
@ -54,6 +56,7 @@ def main():
for m in atom_map:
print(m[0])
print (d[m[0]])
sys.stdout.flush()
return np.array([d[m[0]] for m in atom_map])
@ -118,6 +121,7 @@ def main():
memo_energy = {'fmin': 100000000.}
def f(x):
print ("x = %s"%str(x))
sys.stdout.flush()
h = str(x)
if h in memo_energy:
return memo_energy[h]
@ -144,6 +148,7 @@ def main():
energy = e #+ variance
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))
sys.stdout.flush()
if (energy-2.*err) > memo_energy['fmin']+thresh:
local_thresh = 10.*thresh
elif (energy+2.*err) < memo_energy['fmin']-thresh:
@ -154,6 +159,7 @@ def main():
os.kill(pid,0)
except OSError:
print("---")
sys.stdout.flush()
break
stop_qmc()
os.wait()
@ -170,6 +176,7 @@ def main():
opt = sp.optimize.minimize(f,x,method="Powell",
options= {'disp':True, 'ftol':thresh,'xtol':0.02})
print("x = "+str(opt))
sys.stdout.flush()
set_params_b(opt['x'][0])
set_params_pen(opt['x'][1:])

View File

@ -2,7 +2,7 @@ default_target: all
Downloads/irpf90.tar.gz:
wget --no-check-certificate \
"https://gitlab.com/scemama/irpf90/-/archive/v2.0.0/irpf90-v2.0.0.tar.gz" \
"https://gitlab.com/scemama/irpf90/-/archive/v2.0.5/irpf90-v2.0.5.tar.gz" \
-O $@.tmp -o /dev/null && mv $@.tmp $@
Downloads/ezfio.tar.gz:
@ -31,7 +31,7 @@ _build/irpf90.ok ../bin/irpman ../bin/irpf90: Downloads/irpf90.tar.gz
touch _build/$${target}.ok || cat _build/$${target}.log
_build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.5 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h: Downloads/zmq.tar.gz
_build/zmq.ok: Downloads/zmq.tar.gz
export target=zmq ; \
./scripts/install_$${target}.sh > _build/$${target}.log 2>&1 &&\
touch _build/$${target}.ok || cat _build/$${target}.log
@ -41,31 +41,31 @@ _build/ezfio.ok: Downloads/ezfio.tar.gz
./scripts/install_$${target}.sh > _build/$${target}.log 2>&1 &&\
touch _build/$${target}.ok || cat _build/$${target}.log
_build/f77_zmq.ok ../src/ZMQ/f77_zmq.h ../lib/libf77zmq.a ../lib/libf77zmq.so: Downloads/f77_zmq.tar.gz _build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.5 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h
_build/f77_zmq.ok: Downloads/f77_zmq.tar.gz _build/zmq.ok
export target=f77_zmq ; \
./scripts/install_$${target}.sh > _build/$${target}.log 2>&1 &&\
touch _build/$${target}.ok || cat _build/$${target}.log
_build/qmcchemrc.ok ../qmcchemrc: _build/irpf90.ok ../bin/irpman ../bin/irpf90 _build/ezfio.ok
_build/qmcchemrc.ok: _build/irpf90.ok _build/ezfio.ok
export target=qmcchemrc; \
./scripts/install_$${target}.sh > _build/$${target}.log 2>&1 &&\
touch _build/$${target}.ok || cat _build/$${target}.log
_build/ocaml.ok ../bin/opam: Downloads/opam_installer.sh _build/qmcchemrc.ok ../qmcchemrc
which opam && touch _build/$${target}.ok ../bin/opam || \
_build/ocaml.ok: Downloads/opam_installer.sh _build/qmcchemrc.ok ../qmcchemrc
which opam && touch _build/$${target}.ok || \
( export target=ocaml; \
./scripts/install_$${target}.sh > _build/$${target}.log 2>&1 &&\
touch _build/$${target}.ok || cat _build/$${target}.log ;\
)
_build/ocaml_zmq.ok: ../bin/opam ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h _build/ocaml.ok _build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.5 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h
_build/ocaml_zmq.ok: _build/ocaml.ok
export target=ocaml_zmq; \
./scripts/install_$${target}.sh > _build/$${target}.log 2>&1 &&\
touch _build/$${target}.ok || cat _build/$${target}.log
all: _build/ocaml_zmq.ok _build/ocaml.ok ../bin/opam _build/qmcchemrc.ok ../qmcchemrc _build/f77_zmq.ok ../src/ZMQ/f77_zmq.h ../lib/libf77zmq.a ../lib/libf77zmq.so _build/ezfio.ok _build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.5 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h _build/irpf90.ok ../bin/irpman ../bin/irpf90
all: _build/ocaml_zmq.ok _build/ocaml.ok _build/qmcchemrc.ok _build/f77_zmq.ok _build/ezfio.ok _build/zmq.ok _build/irpf90.ok
@echo "Now, source again the qmcchemrc file"
@echo "source $$QMCCHEM_PATH/qmcchemrc"

View File

@ -139,9 +139,8 @@ let display_summary ~range =
and print_property property =
let p = Random_variable.of_raw_data ~range property
in
Printf.printf "%20s : %s\n%!"
(Property.to_string property)
(Random_variable.to_string p)
Printf.printf "%20s : %!" (Property.to_string property);
Printf.printf "%s\n%!" (Random_variable.to_string p)
in
List.iter print_property properties ;

View File

@ -209,7 +209,7 @@ let ave_error { property ; data } =
else
( Average.of_float (sum /. ansum), None)
end
| (x,w) :: tail ->
| (x, w) :: tail ->
begin
let avcu0 = avsum /. ansum in
let xw = x *. w in
@ -633,6 +633,7 @@ let to_string p =
in
Printf.sprintf "%16.10f" ave
else
begin
match ave_error p with
| (ave, Some error) ->
let idxmax =
@ -645,16 +646,18 @@ let to_string p =
Error.to_float ~idx error
in
let s =
Printf.sprintf "%8d : %16.10f +/- %16.10f ;\n" (idx+1) ave error
Printf.sprintf "%8d : %16.10f +/- %16.10f ;" (idx+1) ave error
in
f (accu ^ s) (idx+1)
(f [@tailcall]) (s :: accu) (idx+1)
else
accu
List.rev (" ]" :: accu)
in
(f "[ \n" 0) ^ " ]"
f ["[ \n"] 0
|> String.concat "\n"
| (ave, None) ->
Average.to_float ave
|> Printf.sprintf "%16.10f"
|> Printf.sprintf "%16.10f%!"
end
end

View File

@ -58,7 +58,10 @@ let of_bytes b =
| 8 -> let x = Qptypes.float_of_bytes b in
One_dimensional x
| l -> let len = l/8 in
let result =
Multidimensional ( Array.init len (fun i ->
Bytes.get_int64_ne b (i*8)
|> Int64.float_of_bits ),
len )
in
result

View File

@ -10,7 +10,10 @@ source make.config
source qmcchemrc
FCFLAGS="${FCFLAGS} -fPIC"
export IRPF90 FC FCFLAGS AR RANLIB
cd EZFIO
cd EZFIO/config
[[ -f properties.config ]] || ln -s ../../ezfio_config/properties.config .
[[ -f qmc.config ]] || ln -s ../../ezfio_config/qmc.config .
cd ..
source ../make.config
make || exit -1
cp lib/libezfio{,_irp}.a ${QMCCHEM_PATH}/lib/ || exit 1