mirror of
https://github.com/LCPQ/quantum_package
synced 2024-06-16 10:15:27 +02:00
Some modif for the interface with qmcpack
This commit is contained in:
parent
d8fa797cf8
commit
1969a463fe
2
ocaml/.gitignore
vendored
2
ocaml/.gitignore
vendored
|
@ -16,6 +16,8 @@ qp_edit
|
||||||
qp_edit.ml
|
qp_edit.ml
|
||||||
qp_edit.native
|
qp_edit.native
|
||||||
qp_print
|
qp_print
|
||||||
|
qp_print_basis
|
||||||
|
qp_print_basis.native
|
||||||
qp_print.native
|
qp_print.native
|
||||||
qp_run
|
qp_run
|
||||||
qp_run.native
|
qp_run.native
|
||||||
|
|
|
@ -133,10 +133,6 @@ let run ?o b c d m p xyz_file =
|
||||||
|
|
||||||
let fetch_channel basis =
|
let fetch_channel basis =
|
||||||
let command =
|
let command =
|
||||||
if (p) then
|
|
||||||
Qpackage.root ^ "/scripts/get_basis.sh \"" ^ temp_filename
|
|
||||||
^ "." ^ basis ^ "\" \"" ^ basis ^"\" pseudo"
|
|
||||||
else
|
|
||||||
Qpackage.root ^ "/scripts/get_basis.sh \"" ^ temp_filename
|
Qpackage.root ^ "/scripts/get_basis.sh \"" ^ temp_filename
|
||||||
^ "." ^ basis ^ "\" \"" ^ basis ^"\""
|
^ "." ^ basis ^ "\" \"" ^ basis ^"\""
|
||||||
in
|
in
|
||||||
|
@ -344,7 +340,7 @@ let run ?o b c d m p xyz_file =
|
||||||
(* Doesn't work... *)
|
(* Doesn't work... *)
|
||||||
if (p) then
|
if (p) then
|
||||||
begin
|
begin
|
||||||
Qpackage.root ^ "/scripts/pseudo/put_pseudo_in_ezfio.py " ^ ezfio_file
|
Qpackage.root ^ "/scripts/pseudo/put_pseudo_in_ezfio.py " ^ ezfio_file ^ " " ^ " BFD-Pseudo"
|
||||||
|> Sys.command_exn
|
|> Sys.command_exn
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
open Core.Std
|
open Core.Std
|
||||||
open Qptypes
|
open Qptypes
|
||||||
|
|
||||||
let () =
|
let basis ()=
|
||||||
let ezfio_filename =
|
let ezfio_filename =
|
||||||
Sys.argv.(1)
|
Sys.argv.(1)
|
||||||
in
|
in
|
||||||
|
@ -16,4 +16,24 @@ let () =
|
||||||
Input.Ao_basis.to_rst basis
|
Input.Ao_basis.to_rst basis
|
||||||
|> Rst_string.to_string
|
|> Rst_string.to_string
|
||||||
|> print_endline
|
|> print_endline
|
||||||
|
;;
|
||||||
|
|
||||||
|
let mo ()=
|
||||||
|
let ezfio_filename =
|
||||||
|
Sys.argv.(1)
|
||||||
|
in
|
||||||
|
if (not (Sys.file_exists_exn ezfio_filename)) then
|
||||||
|
failwith "Error reading EZFIO file";
|
||||||
|
Ezfio.set_file ezfio_filename;
|
||||||
|
let mo_coef =
|
||||||
|
match Input.Mo_basis.read () with
|
||||||
|
| Some mo_coef -> mo_coef
|
||||||
|
| _ -> failwith "Error reading the mo set"
|
||||||
|
in
|
||||||
|
Input.Mo_basis.to_rst mo_coef
|
||||||
|
|> Rst_string.to_string
|
||||||
|
|> print_endline
|
||||||
|
;;
|
||||||
|
|
||||||
|
basis ();;
|
||||||
|
mo ();;
|
|
@ -46,15 +46,4 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pseudo="$1"
|
${EMSL_API_ROOT}/EMSL_api.py get_basis_data --treat_l --save --path="${tmpfile}" --basis="${basis}"
|
||||||
shift
|
|
||||||
|
|
||||||
if [[ -z $pseudo ]]
|
|
||||||
then
|
|
||||||
${EMSL_API_ROOT}/EMSL_api.py get_basis_data --treat_l --save --path="${tmpfile}" --basis="${basis}"
|
|
||||||
else
|
|
||||||
${EMSL_API_ROOT}/EMSL_api.py get_basis_data --save --path="${tmpfile}" --basis="${basis}" --db_path="${EMSL_API_ROOT}/db/Pseudo.db"
|
|
||||||
# echo ${EMSL_API_ROOT}/EMSL_api.py get_basis_data --save --path="${tmpfile}" --basis="${basis}" --db_path="${EMSL_API_ROOT}/db/Pseudo.db" 1>&2
|
|
||||||
# echo $PWD/BASIS
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Create the pseudo potential for a given atom
|
Create the pseudo potential for a given atom
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
put_pseudo_in_ezfio.py <ezfio_path>
|
put_pseudo_in_ezfio.py <ezfio_path> <pseudo_name> [<db_path>]
|
||||||
|
|
||||||
Help:
|
Help:
|
||||||
atom is the Abreviation of the atom
|
atom is the Abreviation of the atom
|
||||||
|
@ -28,7 +28,7 @@ import re
|
||||||
p = re.compile(ur'\|(\d+)><\d+\|')
|
p = re.compile(ur'\|(\d+)><\d+\|')
|
||||||
|
|
||||||
|
|
||||||
def get_pseudo_str(l_atom):
|
def get_pseudo_str(db_path,pseudo_name,l_atom):
|
||||||
"""
|
"""
|
||||||
Run EMSL_local for getting the str of the pseudo potential
|
Run EMSL_local for getting the str of the pseudo potential
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ def get_pseudo_str(l_atom):
|
||||||
|
|
||||||
EMSL_root = "{0}/install/emsl/".format(qpackage_root)
|
EMSL_root = "{0}/install/emsl/".format(qpackage_root)
|
||||||
EMSL_path = "{0}/EMSL_api.py".format(EMSL_root)
|
EMSL_path = "{0}/EMSL_api.py".format(EMSL_root)
|
||||||
db_path = "{0}/db/Pseudo.db".format(EMSL_root)
|
|
||||||
|
|
||||||
str_ = ""
|
str_ = ""
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ def get_pseudo_str(l_atom):
|
||||||
|
|
||||||
l_cmd_head = [EMSL_path, "get_basis_data",
|
l_cmd_head = [EMSL_path, "get_basis_data",
|
||||||
"--db_path", db_path,
|
"--db_path", db_path,
|
||||||
"--basis", "BFD-Pseudo"]
|
"--basis", pseudo_name]
|
||||||
|
|
||||||
process = Popen(l_cmd_head + l_cmd_atom, stdout=PIPE, stderr=PIPE)
|
process = Popen(l_cmd_head + l_cmd_atom, stdout=PIPE, stderr=PIPE)
|
||||||
|
|
||||||
|
@ -180,19 +179,22 @@ def get_zeff_alpha_beta(str_ele):
|
||||||
#
|
#
|
||||||
|
|
||||||
from elts_num_ele import name_to_elec
|
from elts_num_ele import name_to_elec
|
||||||
|
from math import ceil, floor
|
||||||
z = name_to_elec[name]
|
z = name_to_elec[name]
|
||||||
|
|
||||||
z_eff = z - z_remove
|
z_eff = z - z_remove
|
||||||
|
|
||||||
alpha = (z_remove / 2)
|
alpha = int(ceil(z_remove / 2.))
|
||||||
beta = (z_remove / 2)
|
beta = int(floor(z_remove / 2.))
|
||||||
|
|
||||||
|
# Remove more alpha, than beta
|
||||||
|
|
||||||
# _
|
# _
|
||||||
# |_) _ _|_ ._ ._
|
# |_) _ _|_ ._ ._
|
||||||
# | \ (/_ |_ |_| | | |
|
# | \ (/_ |_ |_| | | |
|
||||||
#
|
#
|
||||||
|
|
||||||
return [z_eff, alpha, beta]
|
return [z_remove, z_eff, alpha, beta]
|
||||||
|
|
||||||
|
|
||||||
def add_zero(array, size, type):
|
def add_zero(array, size, type):
|
||||||
|
@ -224,6 +226,12 @@ def make_it_square(matrix, dim, type=float):
|
||||||
|
|
||||||
return matrix
|
return matrix
|
||||||
|
|
||||||
|
def full_path(path):
|
||||||
|
path = os.path.expanduser(path)
|
||||||
|
path = os.path.expandvars(path)
|
||||||
|
path = os.path.abspath(path)
|
||||||
|
return path
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
arguments = docopt(__doc__)
|
arguments = docopt(__doc__)
|
||||||
# ___
|
# ___
|
||||||
|
@ -235,19 +243,22 @@ if __name__ == "__main__":
|
||||||
# E Z F I O #
|
# E Z F I O #
|
||||||
# ~#~#~#~#~ #
|
# ~#~#~#~#~ #
|
||||||
|
|
||||||
ezfio_path = arguments["<ezfio_path>"]
|
ezfio_path = full_path(arguments["<ezfio_path>"])
|
||||||
ezfio_path = os.path.expanduser(ezfio_path)
|
|
||||||
ezfio_path = os.path.expandvars(ezfio_path)
|
|
||||||
ezfio_path = os.path.abspath(ezfio_path)
|
|
||||||
|
|
||||||
ezfio.set_file("{0}".format(ezfio_path))
|
ezfio.set_file("{0}".format(ezfio_path))
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~ #
|
# ~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
# P s e u d o _ d a t a #
|
# P s e u d o _ d a t a #
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~ #
|
# ~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
|
if arguments["<db_path>"]:
|
||||||
|
db_path = full_path(arguments["<db_path>"])
|
||||||
|
else:
|
||||||
|
db_path= full_path("{0}/data/BFD-Pseudo.db".format(qpackage_root))
|
||||||
|
|
||||||
|
pseudo_name = arguments["<pseudo_name>"]
|
||||||
l_ele = ezfio.get_nuclei_nucl_label()
|
l_ele = ezfio.get_nuclei_nucl_label()
|
||||||
str_ = get_pseudo_str(l_ele)
|
|
||||||
|
str_ = get_pseudo_str(db_path,pseudo_name,l_ele)
|
||||||
|
|
||||||
# _
|
# _
|
||||||
# |_) _. ._ _ _
|
# |_) _. ._ _ _
|
||||||
|
@ -257,7 +268,7 @@ if __name__ == "__main__":
|
||||||
l_str_ele = [str_ele for str_ele in str_.split("Element Symbol: ")
|
l_str_ele = [str_ele for str_ele in str_.split("Element Symbol: ")
|
||||||
if str_ele]
|
if str_ele]
|
||||||
|
|
||||||
for i in "l_zeff v_k n_k dz_k v_kl n_kl dz_kl".split():
|
for i in "l_zeff l_remove v_k n_k dz_k v_kl n_kl dz_kl".split():
|
||||||
exec("{0} = []".format(i))
|
exec("{0} = []".format(i))
|
||||||
|
|
||||||
alpha_tot = 0
|
alpha_tot = 0
|
||||||
|
@ -296,11 +307,13 @@ if __name__ == "__main__":
|
||||||
# Z _ e f f , a l p h a / b e t a _ e l e c #
|
# Z _ e f f , a l p h a / b e t a _ e l e c #
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
zeff, alpha, beta = get_zeff_alpha_beta(str_ele)
|
zremove, zeff, alpha, beta = get_zeff_alpha_beta(str_ele)
|
||||||
|
|
||||||
alpha_tot += alpha
|
alpha_tot += alpha
|
||||||
beta_tot += beta
|
beta_tot += beta
|
||||||
l_zeff.append(zeff)
|
l_zeff.append(zeff)
|
||||||
|
l_remove.append(zremove)
|
||||||
|
|
||||||
# _
|
# _
|
||||||
# /\ _| _| _|_ _ _ _ _|_ o _
|
# /\ _| _| _|_ _ _ _ _|_ o _
|
||||||
# /--\ (_| (_| |_ (_) (/_ /_ | | (_)
|
# /--\ (_| (_| |_ (_) (/_ /_ | | (_)
|
||||||
|
@ -311,6 +324,7 @@ if __name__ == "__main__":
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
ezfio.nuclei_nucl_charge = l_zeff
|
ezfio.nuclei_nucl_charge = l_zeff
|
||||||
|
ezfio.pseudo_nucl_charge_remove = l_remove
|
||||||
|
|
||||||
alpha_tot = ezfio.get_electrons_elec_alpha_num() - alpha_tot
|
alpha_tot = ezfio.get_electrons_elec_alpha_num() - alpha_tot
|
||||||
beta_tot = ezfio.get_electrons_elec_beta_num() - beta_tot
|
beta_tot = ezfio.get_electrons_elec_beta_num() - beta_tot
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
[nucl_charge_remove]
|
||||||
|
doc: Nuclear charges removed
|
||||||
|
type:double precision
|
||||||
|
size: (nuclei.nucl_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
|
||||||
[pseudo_klocmax]
|
[pseudo_klocmax]
|
||||||
doc: test
|
doc: test
|
||||||
type:integer
|
type:integer
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
# So we strip the "-", is the abs value of the poor
|
# So we strip the "-", is the abs value of the poor
|
||||||
function eq() {
|
function eq() {
|
||||||
awk -v n1=${1#-} -v n2=${2#-} -v p=$3 'BEGIN{ if ((n1-n2)^2 < p^2) exit 0; exit 1}'
|
awk -v n1=${1#-} -v n2=${2#-} -v p=$3 'BEGIN{ if ((n1-n2)^2 < p^2) exit 0; exit 1}'
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo $1 $2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#: "${QP_ROOT?Pls set your quantum_package.rc}"
|
#: "${QP_ROOT?Pls set your quantum_package.rc}"
|
||||||
|
@ -44,8 +47,10 @@ cd ${TEST_DIR}
|
||||||
qp_run full_ci HBO.ezfio
|
qp_run full_ci HBO.ezfio
|
||||||
energy="$(ezfio get full_ci energy)"
|
energy="$(ezfio get full_ci energy)"
|
||||||
eq $energy -98.9649618899175 1E-2
|
eq $energy -98.9649618899175 1E-2
|
||||||
|
# -98.964541775171284
|
||||||
energy_pt2="$(ezfio get full_ci energy_pt2)"
|
energy_pt2="$(ezfio get full_ci energy_pt2)"
|
||||||
eq $energy_pt2 -98.966228232164 1E-5
|
eq $energy_pt2 -98.966228232164 1E-5
|
||||||
|
# -98.966209348290292
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "cas_sd_selected HBO STO-3G" {
|
@test "cas_sd_selected HBO STO-3G" {
|
||||||
|
@ -58,6 +63,7 @@ cd ${TEST_DIR}
|
||||||
# Check energy
|
# Check energy
|
||||||
energy="$(ezfio get cas_sd energy)"
|
energy="$(ezfio get cas_sd energy)"
|
||||||
eq $energy -98.9646946027433 1E-5
|
eq $energy -98.9646946027433 1E-5
|
||||||
|
# -98.964352450115271
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "mrcc_cassd HBO STO-3G" {
|
@test "mrcc_cassd HBO STO-3G" {
|
||||||
|
@ -69,6 +75,7 @@ cd ${TEST_DIR}
|
||||||
# Check energy
|
# Check energy
|
||||||
energy="$(ezfio get mrcc_cassd energy)"
|
energy="$(ezfio get mrcc_cassd energy)"
|
||||||
eq $energy -98.9653606184686 1E-5
|
eq $energy -98.9653606184686 1E-5
|
||||||
|
# -98.96509060765523
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "script conversion HBO.out" {
|
@test "script conversion HBO.out" {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user