diff --git a/tests/10_others/05_Alllog_filename/INPUT b/tests/10_others/05_Alllog_filename/INPUT new file mode 100644 index 0000000000..44c80a4996 --- /dev/null +++ b/tests/10_others/05_Alllog_filename/INPUT @@ -0,0 +1,21 @@ +INPUT_PARAMETERS +#Parameters (1.General) +suffix autotest +calculation md +esolver_type ksdft +md_type nve +md_nstep 3 +symmetry -1 + +#Parameters (2.Iteration) +ecutwfc 50 +scf_thr 1e-5 +scf_nmax 100 +#Parameters (3.Basis) +basis_type lcao + +#Parameters (4.Smearing) +smearing_method gauss +smearing_sigma 0.002 + +out_alllog 1 \ No newline at end of file diff --git a/tests/10_others/05_Alllog_filename/KPT b/tests/10_others/05_Alllog_filename/KPT new file mode 100644 index 0000000000..76cd36e5a4 --- /dev/null +++ b/tests/10_others/05_Alllog_filename/KPT @@ -0,0 +1,4 @@ +K_POINTS +0 +Gamma +3 2 2 0 0 0 diff --git a/tests/10_others/05_Alllog_filename/README b/tests/10_others/05_Alllog_filename/README new file mode 100644 index 0000000000..915635324a --- /dev/null +++ b/tests/10_others/05_Alllog_filename/README @@ -0,0 +1 @@ +Test if the log filenames are set correctly when out_alllog=1 \ No newline at end of file diff --git a/tests/10_others/05_Alllog_filename/STRU b/tests/10_others/05_Alllog_filename/STRU new file mode 100644 index 0000000000..e35b5a9c15 --- /dev/null +++ b/tests/10_others/05_Alllog_filename/STRU @@ -0,0 +1,21 @@ +ATOMIC_SPECIES +Si 14.000 ../../PP_ORB/Si_ONCV_PBE_FR-1.1.upf + +NUMERICAL_ORBITAL +../../PP_ORB/Si_gga_6au_100Ry_2s2p1d.orb + +LATTICE_CONSTANT +10.2 + +LATTICE_VECTORS +0.0 0.5 0.5 #Lattice vector 1 +0.5 0.0 0.5 #Lattice vector 2 +0.5 0.5 0.0 #Lattice vector 3 + +ATOMIC_POSITIONS +Cartesian #Cartesian(Unit is LATTICE_CONSTANT) +Si #Name of element +0.0 #Magnetic for this element. +2 #Number of atoms +0.00 0.00 0.00 0 0 0 #x,y,z, move_x, move_y, move_z +0.25 0.25 0.25 1 1 1 \ No newline at end of file diff --git a/tests/10_others/05_Alllog_filename/result.ref b/tests/10_others/05_Alllog_filename/result.ref new file mode 100644 index 0000000000..33428b89dd --- /dev/null +++ b/tests/10_others/05_Alllog_filename/result.ref @@ -0,0 +1,4 @@ +etotref -211.1186500606459 +etotperatomref -105.5593250303 +log_filename_validation 1 +totaltimeref 1.55 diff --git a/tests/10_others/CASES_CPU.txt b/tests/10_others/CASES_CPU.txt index 45304cf0b0..7c585b7c69 100644 --- a/tests/10_others/CASES_CPU.txt +++ b/tests/10_others/CASES_CPU.txt @@ -1,3 +1,4 @@ 01_NP_KP_sp 02_NP_KP_spd 04_RDMFT_Si2 +05_Alllog_filename \ No newline at end of file diff --git a/tests/integrate/tools/catch_properties.sh b/tests/integrate/tools/catch_properties.sh index a5b1d9eb17..768feba045 100755 --- a/tests/integrate/tools/catch_properties.sh +++ b/tests/integrate/tools/catch_properties.sh @@ -39,7 +39,12 @@ file=$1 # the command will ignore lines starting with # calculation=`grep calculation INPUT | grep -v '^#' | awk '{print $2}' | sed s/[[:space:]]//g` -running_path=`echo "OUT.autotest/running_$calculation"".log"` +# running_path=`echo "OUT.autotest/running_$calculation"".log"` +running_path=$(ls OUT.autotest/running_${calculation}*.log 2>/dev/null | head -1) +if [ -z "$running_path" ]; then + echo "Error: No running log file found for calculation=$calculation in OUT.autotest/" + exit 1 +fi #echo $running_path 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 echo "" >>$1 fi +#-------------------------------------------- +# Check if out_alllog is set to 1 +# and verify running*.log filenames +#-------------------------------------------- +out_alllog=$(get_input_key_value "out_alllog" "INPUT") +if ! test -z "$out_alllog" && [ $out_alllog -eq 1 ]; then + calculation=$(get_input_key_value "calculation" "INPUT") + + if [ -z "$calculation" ]; then + echo "Error: calculation parameter not found in INPUT" + exit 1 + fi + + # Find all running*.log files in OUT.autotest directory + log_files=$(ls OUT.autotest/running*.log 2>/dev/null) + + if [ -z "$log_files" ]; then + echo "Error: No running*.log files found in OUT.autotest/" + exit 1 + fi + + # Check each log file name contains the calculation parameter + all_valid=true + for log_file in $log_files; do + filename=$(basename "$log_file") + if [[ ! "$filename" =~ running_${calculation}_ ]]; then + echo "Error: Invalid log filename $filename - should contain 'running_${calculation}_'" + all_valid=false + fi + done + + if $all_valid; then + echo "All log filenames contain 'running_${calculation}_' - validation passed" + echo "log_filename_validation 1" >>$1 + else + echo "Error: Some log filenames do not contain 'running_${calculation}_'" + echo "log_filename_validation 0" >>$1 + exit 1 + fi +fi + #-------------------------------------------- # Check time information #--------------------------------------------