Skip to content

Commit

Permalink
Add IVO test wit KAPPA information (Ar atom)
Browse files Browse the repository at this point in the history
  • Loading branch information
kohei-noda-qcrg committed Dec 11, 2023
1 parent 4d3ea46 commit b7555a0
Show file tree
Hide file tree
Showing 10 changed files with 565 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/dev/ivo_c32h_ar_dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*DFPCMONEW*
ivo_c32h_ar_dev.ivo.out
latest_passed.*
!reference.*
211 changes: 211 additions & 0 deletions test/dev/ivo_c32h_ar_dev/DFPCMO

Large diffs are not rendered by default.

Binary file added test/dev/ivo_c32h_ar_dev/MDCINT
Binary file not shown.
Binary file added test/dev/ivo_c32h_ar_dev/MRCONEE
Binary file not shown.
25 changes: 25 additions & 0 deletions test/dev/ivo_c32h_ar_dev/active.ivo.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ninact
0
nact
14
nelec
14
nsec
24
noccg
3
noccu
6
nvcutg
10
nvcutu
15
nroot
1
selectroot
1
totsym
33
diracver
22
end
3 changes: 3 additions & 0 deletions test/dev/ivo_c32h_ar_dev/dirac_data/Ar.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1

Ar 0 0 0
17 changes: 17 additions & 0 deletions test/dev/ivo_c32h_ar_dev/dirac_data/sh_ivo
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

DCASPT2=/home/noda/develop/dirac_caspt2/bin/dcaspt2 # REPLACE THIS PATH TO YOUR DCASPT2 EXECUTABLE
MOL=Ar

rm M* DFPCMO*
INPFILE=x2c.inp
MOLFILE=$MOL.mol
LOGFILE=$MOL.log

# DIRAC HF calculation
module load DIRAC/22.0
pam --get="MRCONEE MDCIN* DFPCMO" --mol=${MOLFILE} --inp=${INPFILE} >& ${LOGFILE}
module unload DIRAC/22.0

# IVO calculation
$DCASPT2 -i active.ivo.inp --ivo --get "DFPCMONEW"
42 changes: 42 additions & 0 deletions test/dev/ivo_c32h_ar_dev/dirac_data/x2c.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
**DIRAC
.TITLE
UO2
.WAVE FUNCTION
.4INDEX
.ANALYZE
**GENERAL
.PCMOUT
**HAMILTONIAN
.X2C
**INTEGRALS
*READIN
.UNCONTRACT
**WAVE FUNCTIONS
.SCF
!.RELCCSD
*SCF
.MAXITR
200
!.EVCCNV
!1.0E-8
.ERGCNV
1.0E-10
**RELCCSD
*CCENER
.MAXIT
200
.NTOL
7
.NOSD
.NOSDT
**ANALYZE
.PRIVEC
*PRIVEC
.VECPRI
all
all
**MOLECULE
*BASIS
.DEFAULT
6-31G
*END OF
211 changes: 211 additions & 0 deletions test/dev/ivo_c32h_ar_dev/reference.DFPCMONEW

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions test/dev/ivo_c32h_ar_dev/test_ivo_c32h_ar_dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
import shutil

import pytest
from module_testing import (
run_test_dcaspt2,
)


@pytest.mark.dev
def test_ivo_c32h_ar_dev(env_setup_ivo) -> None:
(test_path, DFPCMONEW_path, ref_DFPCMONEW_path, latest_passed_DFPCMONEW_path, output_path, latest_passed_output_path, test_command) = env_setup_ivo
os.chdir(test_path) # Change directory to the path of this file
run_test_dcaspt2(test_command)

# DFPCMONEW format
# INFO (DIRAC version >= 21)
# N2 Thu Apr 6 11:00:00 2023
# 2 15 15 54 15 15 54
# -0.1075307794799569E+03
# COEFS (DIRAC version >= 21)
# 0.0783846162631894 -0.0932522358717089 0.2444662687107759 -0.2100050908725506 0.0207980763363816 -0.0061525045832165
# -0.0001106259309856 -0.0000860939270339 0.0001830653248163 0.0000000555844586 -0.0000000349239622 0.0000000146384444
# -0.0000000555844586 0.0000000349239622 -0.0000000146384444 -0.4656826540533246 0.2259566676583494 -0.3303017764820634
# ...
# EVALS (DIRAC version >= 21)
# -0.378466132952E+05 -0.376317160433E+05 -0.375871872904E+05 -0.375847489191E+05 -0.375740444395E+05 -0.375738772125E+05
# -0.375678183830E+05 -0.375638423228E+05 -0.375612685737E+05 -0.375611284085E+05 -0.375605808599E+05 -0.375591793895E+05
# -0.375586003412E+05 -0.375585970263E+05 -0.375581434458E+05 -0.155806087301E+02 -0.122487085753E+01 -0.527584459237E+00
# ...
# SUPERSYM
# 1 1 1 1 -3 1 1 1 -3 1 1 1 -3 1 1 1 1 1 1 -3 1 1 -3 1 1 1 -3 1 1 1 1 1 1 1 1 -3 1 1 1 -3 1 1 1 -3 1 1 1 1 -3 1 1 -3 1 1 1 -3 1 1 1 1
# 1 2 3 2

# Open DFPCMONEW and reference.DFPCMONEW and compare the values (if the values are float, compare the values to 10th decimal places)
with open(DFPCMONEW_path, "r") as DFPCMONEW_file, open(ref_DFPCMONEW_path, "r") as ref_file:
for DFPCMONEW_line, ref_line in zip(DFPCMONEW_file, ref_file):
# if the first value cannot be converted to float, compare the values as strings
DFPCMONEW_values = DFPCMONEW_line.split()
ref_values = ref_line.split()
try:
DFPCMONEW_float_values = [float(value) for value in DFPCMONEW_values]
ref_float_values = [float(value) for value in ref_values]
for DFPCMONEW_float_value, ref_float_value in zip(DFPCMONEW_float_values, ref_float_values):
assert ref_float_value == pytest.approx(DFPCMONEW_float_value, abs=1e-13)
except ValueError:
assert DFPCMONEW_values == ref_values

# If it reaches this point, the result of assert is true.
# The latest passed output file is overwritten by the current output file if assert is True.
shutil.copy(output_path, latest_passed_output_path)
shutil.copy(DFPCMONEW_path, latest_passed_DFPCMONEW_path)

0 comments on commit b7555a0

Please sign in to comment.