Skip to content

Commit 4e44caa

Browse files
authored
Add test of out_alllog (#6482)
1 parent 5b37f29 commit 4e44caa

File tree

7 files changed

+99
-1
lines changed

7 files changed

+99
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
INPUT_PARAMETERS
2+
#Parameters (1.General)
3+
suffix autotest
4+
calculation md
5+
esolver_type ksdft
6+
md_type nve
7+
md_nstep 3
8+
symmetry -1
9+
10+
#Parameters (2.Iteration)
11+
ecutwfc 50
12+
scf_thr 1e-5
13+
scf_nmax 100
14+
#Parameters (3.Basis)
15+
basis_type lcao
16+
17+
#Parameters (4.Smearing)
18+
smearing_method gauss
19+
smearing_sigma 0.002
20+
21+
out_alllog 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
3 2 2 0 0 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test if the log filenames are set correctly when out_alllog=1
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ATOMIC_SPECIES
2+
Si 14.000 ../../PP_ORB/Si_ONCV_PBE_FR-1.1.upf
3+
4+
NUMERICAL_ORBITAL
5+
../../PP_ORB/Si_gga_6au_100Ry_2s2p1d.orb
6+
7+
LATTICE_CONSTANT
8+
10.2
9+
10+
LATTICE_VECTORS
11+
0.0 0.5 0.5 #Lattice vector 1
12+
0.5 0.0 0.5 #Lattice vector 2
13+
0.5 0.5 0.0 #Lattice vector 3
14+
15+
ATOMIC_POSITIONS
16+
Cartesian #Cartesian(Unit is LATTICE_CONSTANT)
17+
Si #Name of element
18+
0.0 #Magnetic for this element.
19+
2 #Number of atoms
20+
0.00 0.00 0.00 0 0 0 #x,y,z, move_x, move_y, move_z
21+
0.25 0.25 0.25 1 1 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
etotref -211.1186500606459
2+
etotperatomref -105.5593250303
3+
log_filename_validation 1
4+
totaltimeref 1.55

tests/10_others/CASES_CPU.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
01_NP_KP_sp
22
02_NP_KP_spd
33
04_RDMFT_Si2
4+
05_Alllog_filename

tests/integrate/tools/catch_properties.sh

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ file=$1
3939
# the command will ignore lines starting with #
4040
calculation=`grep calculation INPUT | grep -v '^#' | awk '{print $2}' | sed s/[[:space:]]//g`
4141

42-
running_path=`echo "OUT.autotest/running_$calculation"".log"`
42+
# running_path=`echo "OUT.autotest/running_$calculation"".log"`
43+
running_path=$(ls OUT.autotest/running_${calculation}*.log 2>/dev/null | head -1)
44+
if [ -z "$running_path" ]; then
45+
echo "Error: No running log file found for calculation=$calculation in OUT.autotest/"
46+
exit 1
47+
fi
4348
#echo $running_path
4449

4550
natom=`grep -En '(^|[[:space:]])TOTAL ATOM NUMBER($|[[:space:]])' $running_path | tail -1 | awk '{print $6}'`
@@ -625,6 +630,47 @@ if ! test -z "$rdmft" && [[ $rdmft == 1 ]]; then
625630
echo "" >>$1
626631
fi
627632

633+
#--------------------------------------------
634+
# Check if out_alllog is set to 1
635+
# and verify running*.log filenames
636+
#--------------------------------------------
637+
out_alllog=$(get_input_key_value "out_alllog" "INPUT")
638+
if ! test -z "$out_alllog" && [ $out_alllog -eq 1 ]; then
639+
calculation=$(get_input_key_value "calculation" "INPUT")
640+
641+
if [ -z "$calculation" ]; then
642+
echo "Error: calculation parameter not found in INPUT"
643+
exit 1
644+
fi
645+
646+
# Find all running*.log files in OUT.autotest directory
647+
log_files=$(ls OUT.autotest/running*.log 2>/dev/null)
648+
649+
if [ -z "$log_files" ]; then
650+
echo "Error: No running*.log files found in OUT.autotest/"
651+
exit 1
652+
fi
653+
654+
# Check each log file name contains the calculation parameter
655+
all_valid=true
656+
for log_file in $log_files; do
657+
filename=$(basename "$log_file")
658+
if [[ ! "$filename" =~ running_${calculation}_ ]]; then
659+
echo "Error: Invalid log filename $filename - should contain 'running_${calculation}_'"
660+
all_valid=false
661+
fi
662+
done
663+
664+
if $all_valid; then
665+
echo "All log filenames contain 'running_${calculation}_' - validation passed"
666+
echo "log_filename_validation 1" >>$1
667+
else
668+
echo "Error: Some log filenames do not contain 'running_${calculation}_'"
669+
echo "log_filename_validation 0" >>$1
670+
exit 1
671+
fi
672+
fi
673+
628674
#--------------------------------------------
629675
# Check time information
630676
#--------------------------------------------

0 commit comments

Comments
 (0)