10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 23:22:18 +02:00
quantum_package/test/bats/qp.bats

83 lines
2.1 KiB
Plaintext
Raw Normal View History

2015-10-28 13:51:11 +01:00
#!/usr/bin/env bats
# float number comparison
# Compare two number ($1, $2) with a given precision ($3)
# If the number are not equal, the exit is 1 else is 0
# So we strip the "-", is the abs value of the poor
function eq() {
awk -v n1=${1#-} -v n2=${2#-} -v p=$3 'BEGIN{ if ((n1-n2)^2 < p^2) exit 0; exit 1}'
}
2015-10-28 14:46:19 +01:00
#: "${QP_ROOT?Pls set your quantum_package.rc}"
2015-10-28 13:51:11 +01:00
2015-10-28 14:46:19 +01:00
source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh
2015-10-28 13:51:11 +01:00
TEST_DIR=${QP_ROOT}/test/work/
2015-10-28 14:46:19 +01:00
mkdir -p ${TEST_DIR}
2015-10-28 13:51:11 +01:00
cd ${TEST_DIR}
@test "init HBO STO-3G" {
cp ${QP_ROOT}/test/input/HBO.xyz .
qp_create_ezfio_from_xyz -b "STO-3G" HBO.xyz
qp_edit -c HBO.ezfio
}
@test "hartree fock HBO STO-3G" {
run init HBO STO-3G
2015-10-28 15:11:56 +01:00
ezfio set_file HBO.ezfio
2015-12-15 16:26:47 +01:00
ezfio hartree_fock thresh_scf 1E-5
2015-10-28 15:11:56 +01:00
2015-10-28 13:51:11 +01:00
qp_run SCF HBO.ezfio
# Check energy
2015-10-28 15:11:56 +01:00
2015-10-28 13:51:11 +01:00
energy="$(ezfio get hartree_fock energy)"
2015-12-15 16:26:47 +01:00
eq $energy -98.8251985622549 1E-5
2015-10-28 13:51:11 +01:00
}
@test "full ci HBO STO-3G" {
run init HBO STO-3G
ezfio set_file HBO.ezfio
ezfio set perturbation do_pt2_end 1
2015-10-28 14:58:08 +01:00
ezfio set determinants n_det_max 1000
2015-10-28 13:51:11 +01:00
qp_run full_ci HBO.ezfio
energy="$(ezfio get full_ci energy)"
2015-12-15 16:26:47 +01:00
eq $energy -98.9649618899175 1E-2
2015-10-28 13:51:11 +01:00
energy_pt2="$(ezfio get full_ci energy_pt2)"
2015-12-15 16:26:47 +01:00
eq $energy_pt2 -98.966228232164 1E-5
2015-10-28 13:51:11 +01:00
}
@test "cas_sd_selected HBO STO-3G" {
run hartree fock HBO STO-3G
ezfio set_file HBO.ezfio
ezfio set perturbation do_pt2_end 0
ezfio set determinants n_det_max 1000
qp_set_mo_class HBO.ezfio -core "[1-2]" -inact "[3-5]" -act "[6-9]" -virt "[10-11]"
qp_run cas_sd_selected HBO.ezfio
# Check energy
energy="$(ezfio get cas_sd energy)"
2015-12-15 16:26:47 +01:00
eq $energy -98.9646946027433 1E-5
2015-10-28 13:51:11 +01:00
}
@test "mrcc_cassd HBO STO-3G" {
run cas_sd_selected fock HBO STO-3G
ezfio set_file HBO.ezfio
ezfio set determinants threshold_generators 1
ezfio set determinants read_wf 1
qp_run mrcc_cassd HBO.ezfio
# Check energy
energy="$(ezfio get mrcc_cassd energy)"
2015-12-15 16:26:47 +01:00
eq $energy -98.9653606184686 1E-5
2015-10-28 13:51:11 +01:00
}
@test "script conversion HBO.out" {
cp ${QP_ROOT}/test/input/HBO.out .
qp_convert_output_to_ezfio.py HBO.out
qp_edit -c HBO.out.ezfio
qp_run SCF HBO.out.ezfio
ezfio set_file HBO.out.ezfio
energy="$(ezfio get hartree_fock energy)"
2015-12-15 16:26:47 +01:00
eq $energy -100.01858225534 1E-5
2015-10-28 13:51:11 +01:00
}