From ba665f9958a7550a9e62e64b4e081eed348c827d Mon Sep 17 00:00:00 2001 From: SY Wang Date: Mon, 2 Nov 2026 21:19:14 +0800 Subject: [PATCH] Precommit: Format other bash scripts (Part I) --- examples/01_bravais_lattice/01_fcc_Si/run.sh | 17 +- .../01_bravais_lattice/02_hex_MoS2/run.sh | 17 +- examples/01_bravais_lattice/03_so_SnTe/run.sh | 17 +- examples/01_bravais_lattice/runall.sh | 15 +- examples/02_scf/01_pw_Si2/run.sh | 17 +- examples/02_scf/02_lcao_Si2/run.sh | 17 +- examples/02_scf/03_lcao_Cu/run.sh | 17 +- examples/02_scf/04_lcao_ZnO/run.sh | 17 +- examples/02_scf/runall.sh | 15 +- examples/03_spin_polarized/01_H_atom/run.sh | 17 +- examples/03_spin_polarized/02_Fe_FM/run.sh | 17 +- examples/03_spin_polarized/03_Fe_AFM/run.sh | 17 +- examples/03_spin_polarized/runall.sh | 15 +- .../04_noncollinear/01_Fe_noncollinear/run.sh | 17 +- examples/04_noncollinear/runall.sh | 15 +- examples/05_soc/01_pw_GaAs/run.sh | 21 +- examples/05_soc/runall.sh | 15 +- examples/06_smearing/01_lcao_Fe/run.sh | 22 +- examples/06_smearing/runall.sh | 15 +- examples/07_charge_mixing/01_pw_Al/run.sh | 35 +- examples/07_charge_mixing/runall.sh | 15 +- .../08_charge_density/01_pw_Al_nspin1/run.sh | 17 +- .../02_lcao_Si2_nspin1/run.sh | 17 +- .../08_charge_density/03_pw_Fe_nspin2/run.sh | 19 +- examples/08_charge_density/runall.sh | 15 +- .../01_lcao_Si2_nspin1/run.sh | 19 +- examples/09_density_matrix/runall.sh | 15 +- .../10_hs_matrix/01_out_hsr_multik/run.sh | 49 ++- .../10_hs_matrix/02_out_hsr_multik/run.sh | 21 +- examples/10_hs_matrix/03_out_hsk_gamma/run.sh | 21 +- .../10_hs_matrix/04_out_hsk_multik/run.sh | 17 +- examples/10_hs_matrix/05_gets/run.sh | 15 +- examples/10_hs_matrix/runall.sh | 15 +- examples/11_wfc/01_pw_scf_Al/run.sh | 15 +- examples/11_wfc/02_lcao_scf_Si2/run.sh | 17 +- examples/11_wfc/03_lcao_getwf/run.sh | 23 +- examples/11_wfc/runall.sh | 15 +- examples/12_band/01_pw_Al/run.sh | 25 +- examples/12_band/02_lcao_Si2/run.sh | 25 +- examples/12_band/runall.sh | 15 +- examples/13_dos/01_pw_Al/run.sh | 27 +- examples/13_dos/02_lcao_Si2/run.sh | 27 +- examples/13_dos/runall.sh | 15 +- examples/14_mulliken/01_lcao_Si2/run.sh | 19 +- examples/14_mulliken/runall.sh | 15 +- examples/16_uspp/01_pw_Fe/run.sh | 15 +- examples/16_uspp/runall.sh | 15 +- .../17_relax/01_pw_cell_relax_BFGS_Al/run.sh | 17 +- examples/17_relax/02_lcao_relax_CG_Si2/run.sh | 17 +- examples/17_relax/runall.sh | 15 +- examples/18_md/01_LCAO_NVE_Si8/run.sh | 43 ++- examples/18_md/runall.sh | 15 +- examples/19_dftu/01_lcao_NiO/run.sh | 17 +- examples/19_dftu/runall.sh | 15 +- examples/20_hybrid/02_lcao_Si2/run.sh | 17 +- examples/20_hybrid/runall.sh | 15 +- examples/21_deepks/01_pw_H2O/run.sh | 17 +- examples/21_deepks/02_lcao_H2O/run.sh | 17 +- examples/21_deepks/03_lcao_CsPbI3/run.sh | 17 +- examples/21_deepks/runall.sh | 15 +- .../22_rt-tddft/01_H2_length_gauge/run.sh | 17 +- .../22_rt-tddft/02_H2_velocity_gauge/run.sh | 17 +- examples/23_sdft/01_pw_Si2/run.sh | 15 +- examples/23_sdft/02_pw_md_Al/run.sh | 15 +- examples/23_sdft/runall.sh | 15 +- examples/25_vdw/01_vdw_D2_Si2/run.sh | 19 +- examples/25_vdw/02_vdw_D3_Si2/run.sh | 25 +- examples/25_vdw/runall.sh | 15 +- examples/26_berryphase/01_pw_PbTiO3/run.sh | 23 +- examples/26_berryphase/02_lcao_PbTiO3/run.sh | 21 +- examples/26_berryphase/runall.sh | 15 +- examples/27_imp_sol/01_pw_Pt_slab/run.sh | 17 +- examples/27_imp_sol/runall.sh | 15 +- examples/28_efield/01_Pt_slab/run.sh | 17 +- examples/28_efield/runall.sh | 15 +- examples/29_dipole_corr/01_Pt_slab/run.sh | 21 +- examples/29_dipole_corr/runall.sh | 15 +- examples/30_elec_pot/01_lcao_Si/run.sh | 17 +- examples/30_elec_pot/runall.sh | 15 +- examples/31_comp_charge/01_Pt_slab/run.sh | 17 +- examples/31_comp_charge/runall.sh | 15 +- examples/32_bsse/01_water/run.sh | 49 ++- examples/32_bsse/runall.sh | 15 +- .../35_tdofdft/01_Al_proton_ESP/01_gs/run.sh | 13 +- .../35_tdofdft/01_Al_proton_ESP/02_td/run.sh | 13 +- generate_build_info.sh | 350 +++++++++--------- interfaces/ASE_interface/abacuslite/xtest.sh | 1 - .../ShengBTE_interface/01_pw/3rd/run_stru.sh | 27 +- .../02_lcao/3rd/run_stru.sh | 29 +- .../pyabacus/tests/test_cell/lcao_ZnO/run.sh | 17 +- .../test/para_collection_mpi_test.sh | 26 +- .../test/para_mpi_func_mpi_test.sh | 26 +- .../test/para_setup_mpi_test.sh | 26 +- .../test/para_world_mpi_test.sh | 26 +- .../test_parallel/blacs_connector_test.sh | 28 +- .../test_parallel/parallel_2d_test.sh | 22 +- .../test_parallel/parallel_common_test.sh | 26 +- .../test_parallel/parallel_global_test.sh | 26 +- .../test_parallel/parallel_reduce_test.sh | 26 +- .../module_ao/test/parallel_orbitals_test.sh | 22 +- .../source_basis/module_pw/test/test_gnu.sh | 63 ++-- .../source_basis/module_pw/test/test_intel.sh | 65 ++-- .../test/bcast_atom_pseudo_test.sh | 26 +- .../source_cell/test/bcast_atom_spec_test.sh | 26 +- .../source_cell/test/bcast_read_sep_test.sh | 22 +- .../source_cell/test/bcast_sep_cell_test.sh | 22 +- source/source_cell/test/klist_test_para.sh | 26 +- .../source_cell/test/parallel_kpoints_test.sh | 23 +- .../test/unitcell_test_parallel.sh | 26 +- .../test_pw/unitcell_test_pw_para.sh | 26 +- .../test/parallel_hcontainer_tests.sh | 22 +- .../unittests/diago_cg_parallel_test.sh | 32 +- .../unittests/diago_david_parallel_test.sh | 34 +- .../unittests/diago_lcao_parallel_test.sh | 30 +- .../unittests/diago_pexsi_parallel_test.sh | 26 +- .../unittests/parallel_k2d_test.sh | 26 +- .../source_io/unittests/write_wfc_nao_para.sh | 28 +- .../test/parallel_operator_tests.sh | 40 +- 118 files changed, 1362 insertions(+), 1445 deletions(-) diff --git a/examples/01_bravais_lattice/01_fcc_Si/run.sh b/examples/01_bravais_lattice/01_fcc_Si/run.sh index 4b536d7af5a..744c25b9c9a 100644 --- a/examples/01_bravais_lattice/01_fcc_Si/run.sh +++ b/examples/01_bravais_lattice/01_fcc_Si/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/01_bravais_lattice/02_hex_MoS2/run.sh b/examples/01_bravais_lattice/02_hex_MoS2/run.sh index 4b536d7af5a..744c25b9c9a 100644 --- a/examples/01_bravais_lattice/02_hex_MoS2/run.sh +++ b/examples/01_bravais_lattice/02_hex_MoS2/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/01_bravais_lattice/03_so_SnTe/run.sh b/examples/01_bravais_lattice/03_so_SnTe/run.sh index 4b536d7af5a..744c25b9c9a 100644 --- a/examples/01_bravais_lattice/03_so_SnTe/run.sh +++ b/examples/01_bravais_lattice/03_so_SnTe/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/01_bravais_lattice/runall.sh b/examples/01_bravais_lattice/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/01_bravais_lattice/runall.sh +++ b/examples/01_bravais_lattice/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/02_scf/01_pw_Si2/run.sh b/examples/02_scf/01_pw_Si2/run.sh index dc55bc2a3d2..815c873b533 100644 --- a/examples/02_scf/01_pw_Si2/run.sh +++ b/examples/02_scf/01_pw_Si2/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/02_scf/02_lcao_Si2/run.sh b/examples/02_scf/02_lcao_Si2/run.sh index dc55bc2a3d2..815c873b533 100644 --- a/examples/02_scf/02_lcao_Si2/run.sh +++ b/examples/02_scf/02_lcao_Si2/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/02_scf/03_lcao_Cu/run.sh b/examples/02_scf/03_lcao_Cu/run.sh index dc55bc2a3d2..815c873b533 100644 --- a/examples/02_scf/03_lcao_Cu/run.sh +++ b/examples/02_scf/03_lcao_Cu/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/02_scf/04_lcao_ZnO/run.sh b/examples/02_scf/04_lcao_ZnO/run.sh index dc55bc2a3d2..815c873b533 100644 --- a/examples/02_scf/04_lcao_ZnO/run.sh +++ b/examples/02_scf/04_lcao_ZnO/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/02_scf/runall.sh b/examples/02_scf/runall.sh index 014c2cd5b29..92d4f0d2c75 100755 --- a/examples/02_scf/runall.sh +++ b/examples/02_scf/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/03_spin_polarized/01_H_atom/run.sh b/examples/03_spin_polarized/01_H_atom/run.sh index 20f9489547e..560423dd88b 100644 --- a/examples/03_spin_polarized/01_H_atom/run.sh +++ b/examples/03_spin_polarized/01_H_atom/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np 1 ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/03_spin_polarized/02_Fe_FM/run.sh b/examples/03_spin_polarized/02_Fe_FM/run.sh index 1d56a80632c..01c2ffed4eb 100644 --- a/examples/03_spin_polarized/02_Fe_FM/run.sh +++ b/examples/03_spin_polarized/02_Fe_FM/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/mulliken.txt ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/mulliken.txt ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/03_spin_polarized/03_Fe_AFM/run.sh b/examples/03_spin_polarized/03_Fe_AFM/run.sh index 1d56a80632c..01c2ffed4eb 100644 --- a/examples/03_spin_polarized/03_Fe_AFM/run.sh +++ b/examples/03_spin_polarized/03_Fe_AFM/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/mulliken.txt ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/mulliken.txt ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/03_spin_polarized/runall.sh b/examples/03_spin_polarized/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/03_spin_polarized/runall.sh +++ b/examples/03_spin_polarized/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/04_noncollinear/01_Fe_noncollinear/run.sh b/examples/04_noncollinear/01_Fe_noncollinear/run.sh index 1d56a80632c..01c2ffed4eb 100644 --- a/examples/04_noncollinear/01_Fe_noncollinear/run.sh +++ b/examples/04_noncollinear/01_Fe_noncollinear/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/mulliken.txt ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/mulliken.txt ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/04_noncollinear/runall.sh b/examples/04_noncollinear/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/04_noncollinear/runall.sh +++ b/examples/04_noncollinear/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/05_soc/01_pw_GaAs/run.sh b/examples/05_soc/01_pw_GaAs/run.sh index 1a3e377fa21..1bad4565371 100644 --- a/examples/05_soc/01_pw_GaAs/run.sh +++ b/examples/05_soc/01_pw_GaAs/run.sh @@ -14,16 +14,15 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT KPT -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/05_soc/runall.sh b/examples/05_soc/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/05_soc/runall.sh +++ b/examples/05_soc/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/06_smearing/01_lcao_Fe/run.sh b/examples/06_smearing/01_lcao_Fe/run.sh index eafa219e5c0..9d4af31807a 100644 --- a/examples/06_smearing/01_lcao_Fe/run.sh +++ b/examples/06_smearing/01_lcao_Fe/run.sh @@ -14,16 +14,14 @@ mv OUT.autotest/running_scf.log OUT.autotest/running_scf2.log rm INPUT if [[ ! -f scf1.output ]] || - [[ ! -f scf2.output ]] || - [[ ! -f OUT.autotest/running_scf1.log ]] || - [[ ! -f OUT.autotest/running_scf2.log ]] || - [[ ! ( "$(tail -1 OUT.autotest/running_scf1.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.autotest/running_scf2.log)" == " Total Time :"* ) ]] - -then - echo "job failed!" - exit 1 + [[ ! -f scf2.output ]] || + [[ ! -f OUT.autotest/running_scf1.log ]] || + [[ ! -f OUT.autotest/running_scf2.log ]] || + [[ ! ("$(tail -1 OUT.autotest/running_scf1.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.autotest/running_scf2.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/06_smearing/runall.sh b/examples/06_smearing/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/06_smearing/runall.sh +++ b/examples/06_smearing/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/07_charge_mixing/01_pw_Al/run.sh b/examples/07_charge_mixing/01_pw_Al/run.sh index b2480c79f64..ec7b7184355 100644 --- a/examples/07_charge_mixing/01_pw_Al/run.sh +++ b/examples/07_charge_mixing/01_pw_Al/run.sh @@ -19,22 +19,21 @@ mv OUT.ABACUS/running_scf.log OUT.ABACUS/running_scf4.log rm INPUT -if [[ ! -f scf1.output ]] || - [[ ! -f scf2.output ]] || - [[ ! -f scf3.output ]] || - [[ ! -f scf4.output ]] || - [[ ! -f OUT.ABACUS/running_scf1.log ]] || - [[ ! -f OUT.ABACUS/running_scf2.log ]] || - [[ ! -f OUT.ABACUS/running_scf3.log ]] || - [[ ! -f OUT.ABACUS/running_scf4.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf3.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf4.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf1.output ]] || + [[ ! -f scf2.output ]] || + [[ ! -f scf3.output ]] || + [[ ! -f scf4.output ]] || + [[ ! -f OUT.ABACUS/running_scf1.log ]] || + [[ ! -f OUT.ABACUS/running_scf2.log ]] || + [[ ! -f OUT.ABACUS/running_scf3.log ]] || + [[ ! -f OUT.ABACUS/running_scf4.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf3.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf4.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/07_charge_mixing/runall.sh b/examples/07_charge_mixing/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/07_charge_mixing/runall.sh +++ b/examples/07_charge_mixing/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/08_charge_density/01_pw_Al_nspin1/run.sh b/examples/08_charge_density/01_pw_Al_nspin1/run.sh index 0117ef8c3df..c7e0a4286d8 100644 --- a/examples/08_charge_density/01_pw_Al_nspin1/run.sh +++ b/examples/08_charge_density/01_pw_Al_nspin1/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/chgs1.cube ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/chgs1.cube ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/08_charge_density/02_lcao_Si2_nspin1/run.sh b/examples/08_charge_density/02_lcao_Si2_nspin1/run.sh index 0117ef8c3df..c7e0a4286d8 100644 --- a/examples/08_charge_density/02_lcao_Si2_nspin1/run.sh +++ b/examples/08_charge_density/02_lcao_Si2_nspin1/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/chgs1.cube ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/chgs1.cube ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/08_charge_density/03_pw_Fe_nspin2/run.sh b/examples/08_charge_density/03_pw_Fe_nspin2/run.sh index 87cc3842a6d..fb213366ad4 100644 --- a/examples/08_charge_density/03_pw_Fe_nspin2/run.sh +++ b/examples/08_charge_density/03_pw_Fe_nspin2/run.sh @@ -6,15 +6,14 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/chgs1.cube ]] || - [[ ! -f OUT.ABACUS/chgs2.cube ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/chgs1.cube ]] || + [[ ! -f OUT.ABACUS/chgs2.cube ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/08_charge_density/runall.sh b/examples/08_charge_density/runall.sh index 014c2cd5b29..92d4f0d2c75 100755 --- a/examples/08_charge_density/runall.sh +++ b/examples/08_charge_density/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/09_density_matrix/01_lcao_Si2_nspin1/run.sh b/examples/09_density_matrix/01_lcao_Si2_nspin1/run.sh index cf2d6c6f390..9c86773499d 100644 --- a/examples/09_density_matrix/01_lcao_Si2_nspin1/run.sh +++ b/examples/09_density_matrix/01_lcao_Si2_nspin1/run.sh @@ -8,14 +8,13 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm KPT -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/SPIN1_DM ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/SPIN1_DM ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/09_density_matrix/runall.sh b/examples/09_density_matrix/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/09_density_matrix/runall.sh +++ b/examples/09_density_matrix/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/10_hs_matrix/01_out_hsr_multik/run.sh b/examples/10_hs_matrix/01_out_hsr_multik/run.sh index e2f3ba7945b..fd17223f6c2 100644 --- a/examples/10_hs_matrix/01_out_hsr_multik/run.sh +++ b/examples/10_hs_matrix/01_out_hsr_multik/run.sh @@ -6,29 +6,28 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.autotest/running_scf.log ]] || - [[ ! -f OUT.autotest/data-0-H ]] || - [[ ! -f OUT.autotest/data-0-S ]] || - [[ ! -f OUT.autotest/data-1-H ]] || - [[ ! -f OUT.autotest/data-1-S ]] || - [[ ! -f OUT.autotest/data-2-H ]] || - [[ ! -f OUT.autotest/data-2-S ]] || - [[ ! -f OUT.autotest/data-3-H ]] || - [[ ! -f OUT.autotest/data-3-S ]] || - [[ ! -f OUT.autotest/data-4-H ]] || - [[ ! -f OUT.autotest/data-4-S ]] || - [[ ! -f OUT.autotest/data-5-H ]] || - [[ ! -f OUT.autotest/data-5-S ]] || - [[ ! -f OUT.autotest/data-6-H ]] || - [[ ! -f OUT.autotest/data-6-S ]] || - [[ ! -f OUT.autotest/data-7-H ]] || - [[ ! -f OUT.autotest/data-7-S ]] || - [[ ! ( "$(tail -1 OUT.autotest/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.autotest/running_scf.log ]] || + [[ ! -f OUT.autotest/data-0-H ]] || + [[ ! -f OUT.autotest/data-0-S ]] || + [[ ! -f OUT.autotest/data-1-H ]] || + [[ ! -f OUT.autotest/data-1-S ]] || + [[ ! -f OUT.autotest/data-2-H ]] || + [[ ! -f OUT.autotest/data-2-S ]] || + [[ ! -f OUT.autotest/data-3-H ]] || + [[ ! -f OUT.autotest/data-3-S ]] || + [[ ! -f OUT.autotest/data-4-H ]] || + [[ ! -f OUT.autotest/data-4-S ]] || + [[ ! -f OUT.autotest/data-5-H ]] || + [[ ! -f OUT.autotest/data-5-S ]] || + [[ ! -f OUT.autotest/data-6-H ]] || + [[ ! -f OUT.autotest/data-6-S ]] || + [[ ! -f OUT.autotest/data-7-H ]] || + [[ ! -f OUT.autotest/data-7-S ]] || + [[ ! ("$(tail -1 OUT.autotest/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/10_hs_matrix/02_out_hsr_multik/run.sh b/examples/10_hs_matrix/02_out_hsr_multik/run.sh index ba71de8f8e4..73d37da1839 100644 --- a/examples/10_hs_matrix/02_out_hsr_multik/run.sh +++ b/examples/10_hs_matrix/02_out_hsr_multik/run.sh @@ -6,15 +6,14 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.autotest/running_scf.log ]] || - [[ ! -f OUT.autotest/data-HR-sparse_SPIN0.csr ]] || - [[ ! -f OUT.autotest/data-SR-sparse_SPIN0.csr ]] || - [[ ! ( "$(tail -1 OUT.autotest/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.autotest/running_scf.log ]] || + [[ ! -f OUT.autotest/data-HR-sparse_SPIN0.csr ]] || + [[ ! -f OUT.autotest/data-SR-sparse_SPIN0.csr ]] || + [[ ! ("$(tail -1 OUT.autotest/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/10_hs_matrix/03_out_hsk_gamma/run.sh b/examples/10_hs_matrix/03_out_hsk_gamma/run.sh index 9823be542d4..bd2c99fc156 100644 --- a/examples/10_hs_matrix/03_out_hsk_gamma/run.sh +++ b/examples/10_hs_matrix/03_out_hsk_gamma/run.sh @@ -6,15 +6,14 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.autotest/running_scf.log ]] || - [[ ! -f OUT.autotest/data-0-H ]] || - [[ ! -f OUT.autotest/data-0-S ]] || - [[ ! ( "$(tail -1 OUT.autotest/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.autotest/running_scf.log ]] || + [[ ! -f OUT.autotest/data-0-H ]] || + [[ ! -f OUT.autotest/data-0-S ]] || + [[ ! ("$(tail -1 OUT.autotest/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/10_hs_matrix/04_out_hsk_multik/run.sh b/examples/10_hs_matrix/04_out_hsk_multik/run.sh index 28cca0be2af..4b4ed12745e 100644 --- a/examples/10_hs_matrix/04_out_hsk_multik/run.sh +++ b/examples/10_hs_matrix/04_out_hsk_multik/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.autotest/running_scf.log ]] || - [[ ! -f OUT.autotest/hk1_nao.txt ]] || - [[ ! -f OUT.autotest/sk1_nao.txt ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.autotest/running_scf.log ]] || + [[ ! -f OUT.autotest/hk1_nao.txt ]] || + [[ ! -f OUT.autotest/sk1_nao.txt ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/10_hs_matrix/05_gets/run.sh b/examples/10_hs_matrix/05_gets/run.sh index f5beb0fc579..cf7f7bdf97c 100644 --- a/examples/10_hs_matrix/05_gets/run.sh +++ b/examples/10_hs_matrix/05_gets/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.autotest/running_get_S.log ]] || - [[ ! -f OUT.autotest/sr_nao.csr ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.autotest/running_get_S.log ]] || + [[ ! -f OUT.autotest/sr_nao.csr ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/10_hs_matrix/runall.sh b/examples/10_hs_matrix/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/10_hs_matrix/runall.sh +++ b/examples/10_hs_matrix/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/11_wfc/01_pw_scf_Al/run.sh b/examples/11_wfc/01_pw_scf_Al/run.sh index 3787fd86346..744c25b9c9a 100644 --- a/examples/11_wfc/01_pw_scf_Al/run.sh +++ b/examples/11_wfc/01_pw_scf_Al/run.sh @@ -7,12 +7,11 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/11_wfc/02_lcao_scf_Si2/run.sh b/examples/11_wfc/02_lcao_scf_Si2/run.sh index 016f9df82fd..32ed3e1da9c 100644 --- a/examples/11_wfc/02_lcao_scf_Si2/run.sh +++ b/examples/11_wfc/02_lcao_scf_Si2/run.sh @@ -7,14 +7,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/wfs1k1_nao.txt ]] || - [[ ! -f OUT.ABACUS/wfs1k36_nao.txt ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/wfs1k1_nao.txt ]] || + [[ ! -f OUT.ABACUS/wfs1k36_nao.txt ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/11_wfc/03_lcao_getwf/run.sh b/examples/11_wfc/03_lcao_getwf/run.sh index bccfe4d409c..2759116ab9b 100644 --- a/examples/11_wfc/03_lcao_getwf/run.sh +++ b/examples/11_wfc/03_lcao_getwf/run.sh @@ -12,17 +12,16 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT if [[ ! -f scf.output ]] || - [[ ! -f get_wf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_get_wf.log ]] || - [[ ! -f OUT.ABACUS/wfs1k1_nao.txt ]] || - [[ ! -f OUT.ABACUS/wfs1k36_nao.txt ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_get_wf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f get_wf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_get_wf.log ]] || + [[ ! -f OUT.ABACUS/wfs1k1_nao.txt ]] || + [[ ! -f OUT.ABACUS/wfs1k36_nao.txt ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_get_wf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/11_wfc/runall.sh b/examples/11_wfc/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/11_wfc/runall.sh +++ b/examples/11_wfc/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/12_band/01_pw_Al/run.sh b/examples/12_band/01_pw_Al/run.sh index 3d3e8c3b25a..4d9d5de05d9 100755 --- a/examples/12_band/01_pw_Al/run.sh +++ b/examples/12_band/01_pw_Al/run.sh @@ -11,17 +11,16 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! -f OUT.ABACUS/BANDS_1.dat ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! -f OUT.ABACUS/BANDS_1.dat ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/12_band/02_lcao_Si2/run.sh b/examples/12_band/02_lcao_Si2/run.sh index 0310662e3fb..4d9d5de05d9 100755 --- a/examples/12_band/02_lcao_Si2/run.sh +++ b/examples/12_band/02_lcao_Si2/run.sh @@ -11,19 +11,16 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! -f OUT.ABACUS/BANDS_1.dat ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! -f OUT.ABACUS/BANDS_1.dat ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi - - diff --git a/examples/12_band/runall.sh b/examples/12_band/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/12_band/runall.sh +++ b/examples/12_band/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/13_dos/01_pw_Al/run.sh b/examples/13_dos/01_pw_Al/run.sh index 626f7008c37..b06c6969c37 100755 --- a/examples/13_dos/01_pw_Al/run.sh +++ b/examples/13_dos/01_pw_Al/run.sh @@ -14,18 +14,17 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT KPT -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! -f OUT.ABACUS/doss1g1.txt ]] || - [[ ! -f OUT.ABACUS/chg.cube ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! -f OUT.ABACUS/doss1g1.txt ]] || + [[ ! -f OUT.ABACUS/chg.cube ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/13_dos/02_lcao_Si2/run.sh b/examples/13_dos/02_lcao_Si2/run.sh index 626f7008c37..b06c6969c37 100755 --- a/examples/13_dos/02_lcao_Si2/run.sh +++ b/examples/13_dos/02_lcao_Si2/run.sh @@ -14,18 +14,17 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT KPT -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! -f OUT.ABACUS/doss1g1.txt ]] || - [[ ! -f OUT.ABACUS/chg.cube ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! -f OUT.ABACUS/doss1g1.txt ]] || + [[ ! -f OUT.ABACUS/chg.cube ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/13_dos/runall.sh b/examples/13_dos/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/13_dos/runall.sh +++ b/examples/13_dos/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/14_mulliken/01_lcao_Si2/run.sh b/examples/14_mulliken/01_lcao_Si2/run.sh index eaa2c59d07f..bf29959b901 100644 --- a/examples/14_mulliken/01_lcao_Si2/run.sh +++ b/examples/14_mulliken/01_lcao_Si2/run.sh @@ -6,14 +6,13 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/mulliken.txt ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/mulliken.txt ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/14_mulliken/runall.sh b/examples/14_mulliken/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/14_mulliken/runall.sh +++ b/examples/14_mulliken/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/16_uspp/01_pw_Fe/run.sh b/examples/16_uspp/01_pw_Fe/run.sh index bc94ea35da2..815c873b533 100644 --- a/examples/16_uspp/01_pw_Fe/run.sh +++ b/examples/16_uspp/01_pw_Fe/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/16_uspp/runall.sh b/examples/16_uspp/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/16_uspp/runall.sh +++ b/examples/16_uspp/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/17_relax/01_pw_cell_relax_BFGS_Al/run.sh b/examples/17_relax/01_pw_cell_relax_BFGS_Al/run.sh index b5f9ca490da..eb1bed3179d 100644 --- a/examples/17_relax/01_pw_cell_relax_BFGS_Al/run.sh +++ b/examples/17_relax/01_pw_cell_relax_BFGS_Al/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee relax.output -if [[ ! -f relax.output ]] || - [[ ! -f OUT.ABACUS/running_cell-relax.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_cell-relax.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f relax.output ]] || + [[ ! -f OUT.ABACUS/running_cell-relax.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_cell-relax.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/17_relax/02_lcao_relax_CG_Si2/run.sh b/examples/17_relax/02_lcao_relax_CG_Si2/run.sh index 4d90d430781..2b4f88a36d5 100644 --- a/examples/17_relax/02_lcao_relax_CG_Si2/run.sh +++ b/examples/17_relax/02_lcao_relax_CG_Si2/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee relax.output -if [[ ! -f relax.output ]] || - [[ ! -f OUT.ABACUS/running_relax.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_relax.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f relax.output ]] || + [[ ! -f OUT.ABACUS/running_relax.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_relax.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/17_relax/runall.sh b/examples/17_relax/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/17_relax/runall.sh +++ b/examples/17_relax/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/18_md/01_LCAO_NVE_Si8/run.sh b/examples/18_md/01_LCAO_NVE_Si8/run.sh index 599a0e106ec..1c7b55d0d3e 100644 --- a/examples/18_md/01_LCAO_NVE_Si8/run.sh +++ b/examples/18_md/01_LCAO_NVE_Si8/run.sh @@ -4,10 +4,9 @@ ABACUS_PATH=$(awk -F "=" '$1=="ABACUS_PATH"{print $2}' ../../SETENV) ABACUS_NPROCS=$(awk -F "=" '$1=="ABACUS_NPROCS"{print $2}' ../../SETENV) ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) -for i in $( seq 0 7 ) -do - cp INPUT_$i INPUT - OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee md$i.output +for i in $(seq 0 7); do + cp INPUT_$i INPUT + OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee md$i.output done rm INPUT @@ -17,27 +16,27 @@ logs=(OUT.Si_nve/running_md.log OUT.Si_nhc_nvt/running_md.log OUT.Si_lgv/running allpass=1 -for i in "${outputs[@]}";do - if [ ! -f "$i" ];then - echo "No file: $i !" - allpass=0 - fi +for i in "${outputs[@]}"; do + if [ ! -f "$i" ]; then + echo "No file: $i !" + allpass=0 + fi done -for i in "${logs[@]}";do - if [ ! -f "$i" ];then - echo "No file: $i !" - allpass=0 - elif [[ ! ( "$(tail -1 $i)" == " Total Time :"* ) ]];then - echo "File is not normal end: $i !" - allpass=0 - fi +for i in "${logs[@]}"; do + if [ ! -f "$i" ]; then + echo "No file: $i !" + allpass=0 + elif [[ ! ("$(tail -1 $i)" == " Total Time :"*) ]]; then + echo "File is not normal end: $i !" + allpass=0 + fi done -if [ $allpass == 0 ];then - echo "job failed!" - exit 1 +if [ $allpass == 0 ]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/18_md/runall.sh b/examples/18_md/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/18_md/runall.sh +++ b/examples/18_md/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/19_dftu/01_lcao_NiO/run.sh b/examples/19_dftu/01_lcao_NiO/run.sh index b1bdbdd9ff8..15795345442 100644 --- a/examples/19_dftu/01_lcao_NiO/run.sh +++ b/examples/19_dftu/01_lcao_NiO/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.NiO/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.NiO/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.NiO/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.NiO/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/19_dftu/runall.sh b/examples/19_dftu/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/19_dftu/runall.sh +++ b/examples/19_dftu/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/20_hybrid/02_lcao_Si2/run.sh b/examples/20_hybrid/02_lcao_Si2/run.sh index 4943bee2db0..aa92b4e6dfc 100644 --- a/examples/20_hybrid/02_lcao_Si2/run.sh +++ b/examples/20_hybrid/02_lcao_Si2/run.sh @@ -8,13 +8,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) allprocess=$((${ABACUS_NPROCS} * ${ABACUS_THREADS})) OMP_NUM_THREADS=${allprocess} mpirun -np 1 ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/20_hybrid/runall.sh b/examples/20_hybrid/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/20_hybrid/runall.sh +++ b/examples/20_hybrid/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/21_deepks/01_pw_H2O/run.sh b/examples/21_deepks/01_pw_H2O/run.sh index 4aca65061b1..e55bfc1db87 100755 --- a/examples/21_deepks/01_pw_H2O/run.sh +++ b/examples/21_deepks/01_pw_H2O/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.abacus/running_gen_bessel.log ]] || - [[ ! ( "$(tail -1 OUT.abacus/running_gen_bessel.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.abacus/running_gen_bessel.log ]] || + [[ ! ("$(tail -1 OUT.abacus/running_gen_bessel.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/21_deepks/02_lcao_H2O/run.sh b/examples/21_deepks/02_lcao_H2O/run.sh index 8b0a373e6c7..c27fdd16caf 100755 --- a/examples/21_deepks/02_lcao_H2O/run.sh +++ b/examples/21_deepks/02_lcao_H2O/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.abacus/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.abacus/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.abacus/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.abacus/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/21_deepks/03_lcao_CsPbI3/run.sh b/examples/21_deepks/03_lcao_CsPbI3/run.sh index 8b0a373e6c7..c27fdd16caf 100755 --- a/examples/21_deepks/03_lcao_CsPbI3/run.sh +++ b/examples/21_deepks/03_lcao_CsPbI3/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.abacus/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.abacus/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.abacus/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.abacus/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/21_deepks/runall.sh b/examples/21_deepks/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/21_deepks/runall.sh +++ b/examples/21_deepks/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/22_rt-tddft/01_H2_length_gauge/run.sh b/examples/22_rt-tddft/01_H2_length_gauge/run.sh index 222f799fc24..9468b1ef095 100644 --- a/examples/22_rt-tddft/01_H2_length_gauge/run.sh +++ b/examples/22_rt-tddft/01_H2_length_gauge/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee relax.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/22_rt-tddft/02_H2_velocity_gauge/run.sh b/examples/22_rt-tddft/02_H2_velocity_gauge/run.sh index 222f799fc24..9468b1ef095 100644 --- a/examples/22_rt-tddft/02_H2_velocity_gauge/run.sh +++ b/examples/22_rt-tddft/02_H2_velocity_gauge/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee relax.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/23_sdft/01_pw_Si2/run.sh b/examples/23_sdft/01_pw_Si2/run.sh index bc94ea35da2..815c873b533 100644 --- a/examples/23_sdft/01_pw_Si2/run.sh +++ b/examples/23_sdft/01_pw_Si2/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/23_sdft/02_pw_md_Al/run.sh b/examples/23_sdft/02_pw_md_Al/run.sh index 87ace968fa3..3b8c7ece4d8 100644 --- a/examples/23_sdft/02_pw_md_Al/run.sh +++ b/examples/23_sdft/02_pw_md_Al/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_md.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_md.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_md.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_md.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/23_sdft/runall.sh b/examples/23_sdft/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/23_sdft/runall.sh +++ b/examples/23_sdft/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/25_vdw/01_vdw_D2_Si2/run.sh b/examples/25_vdw/01_vdw_D2_Si2/run.sh index cdf905ad550..937cd5c8ade 100644 --- a/examples/25_vdw/01_vdw_D2_Si2/run.sh +++ b/examples/25_vdw/01_vdw_D2_Si2/run.sh @@ -14,15 +14,14 @@ mv OUT.ABACUS/running_scf.log OUT.ABACUS/running_scf2.log rm INPUT if [[ ! -f scf1.output ]] || - [[ ! -f scf2.output ]] || - [[ ! -f OUT.ABACUS/running_scf1.log ]] || - [[ ! -f OUT.ABACUS/running_scf2.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f scf2.output ]] || + [[ ! -f OUT.ABACUS/running_scf1.log ]] || + [[ ! -f OUT.ABACUS/running_scf2.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/25_vdw/02_vdw_D3_Si2/run.sh b/examples/25_vdw/02_vdw_D3_Si2/run.sh index 40796505149..0375dab9596 100644 --- a/examples/25_vdw/02_vdw_D3_Si2/run.sh +++ b/examples/25_vdw/02_vdw_D3_Si2/run.sh @@ -16,18 +16,17 @@ mv OUT.ABACUS/running_scf.log OUT.ABACUS/running_scf3.log rm INPUT if [[ ! -f scf1.output ]] || - [[ ! -f scf2.output ]] || - [[ ! -f scf3.output ]] || - [[ ! -f OUT.ABACUS/running_scf1.log ]] || - [[ ! -f OUT.ABACUS/running_scf2.log ]] || - [[ ! -f OUT.ABACUS/running_scf3.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf3.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f scf2.output ]] || + [[ ! -f scf3.output ]] || + [[ ! -f OUT.ABACUS/running_scf1.log ]] || + [[ ! -f OUT.ABACUS/running_scf2.log ]] || + [[ ! -f OUT.ABACUS/running_scf3.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf3.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/25_vdw/runall.sh b/examples/25_vdw/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/25_vdw/runall.sh +++ b/examples/25_vdw/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/26_berryphase/01_pw_PbTiO3/run.sh b/examples/26_berryphase/01_pw_PbTiO3/run.sh index 411f68db273..87973f2d1c8 100644 --- a/examples/26_berryphase/01_pw_PbTiO3/run.sh +++ b/examples/26_berryphase/01_pw_PbTiO3/run.sh @@ -12,16 +12,15 @@ cp INPUT-nscf-c INPUT cp KPT-nscf-c KPT OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee nscf.output -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/26_berryphase/02_lcao_PbTiO3/run.sh b/examples/26_berryphase/02_lcao_PbTiO3/run.sh index 3d22b313929..6069b2f39aa 100644 --- a/examples/26_berryphase/02_lcao_PbTiO3/run.sh +++ b/examples/26_berryphase/02_lcao_PbTiO3/run.sh @@ -14,16 +14,15 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm INPUT KPT -if [[ ! -f scf.output ]] || - [[ ! -f nscf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/running_nscf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f nscf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! -f OUT.ABACUS/running_nscf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_nscf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/26_berryphase/runall.sh b/examples/26_berryphase/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/26_berryphase/runall.sh +++ b/examples/26_berryphase/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/27_imp_sol/01_pw_Pt_slab/run.sh b/examples/27_imp_sol/01_pw_Pt_slab/run.sh index dc55bc2a3d2..815c873b533 100644 --- a/examples/27_imp_sol/01_pw_Pt_slab/run.sh +++ b/examples/27_imp_sol/01_pw_Pt_slab/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/27_imp_sol/runall.sh b/examples/27_imp_sol/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/27_imp_sol/runall.sh +++ b/examples/27_imp_sol/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/28_efield/01_Pt_slab/run.sh b/examples/28_efield/01_Pt_slab/run.sh index 798eb78cb5c..badb180c9e6 100644 --- a/examples/28_efield/01_Pt_slab/run.sh +++ b/examples/28_efield/01_Pt_slab/run.sh @@ -8,13 +8,12 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm KPT -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/28_efield/runall.sh b/examples/28_efield/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/28_efield/runall.sh +++ b/examples/28_efield/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/29_dipole_corr/01_Pt_slab/run.sh b/examples/29_dipole_corr/01_Pt_slab/run.sh index 835b024c52c..661e5a3b408 100644 --- a/examples/29_dipole_corr/01_Pt_slab/run.sh +++ b/examples/29_dipole_corr/01_Pt_slab/run.sh @@ -13,16 +13,15 @@ mv OUT.ABACUS/running_scf.log OUT.ABACUS/running_scf2.log rm INPUT KPT -if [[ ! -f scf1.output ]] || - [[ ! -f scf2.output ]] || - [[ ! -f OUT.ABACUS/running_scf1.log ]] || - [[ ! -f OUT.ABACUS/running_scf2.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf1.output ]] || + [[ ! -f scf2.output ]] || + [[ ! -f OUT.ABACUS/running_scf1.log ]] || + [[ ! -f OUT.ABACUS/running_scf2.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf1.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf2.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/29_dipole_corr/runall.sh b/examples/29_dipole_corr/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/29_dipole_corr/runall.sh +++ b/examples/29_dipole_corr/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/30_elec_pot/01_lcao_Si/run.sh b/examples/30_elec_pot/01_lcao_Si/run.sh index e6efe6698c2..744c25b9c9a 100644 --- a/examples/30_elec_pot/01_lcao_Si/run.sh +++ b/examples/30_elec_pot/01_lcao_Si/run.sh @@ -6,13 +6,12 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee output -if [[ ! -f output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/30_elec_pot/runall.sh b/examples/30_elec_pot/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/30_elec_pot/runall.sh +++ b/examples/30_elec_pot/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/31_comp_charge/01_Pt_slab/run.sh b/examples/31_comp_charge/01_Pt_slab/run.sh index 798eb78cb5c..badb180c9e6 100644 --- a/examples/31_comp_charge/01_Pt_slab/run.sh +++ b/examples/31_comp_charge/01_Pt_slab/run.sh @@ -8,13 +8,12 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t rm KPT -if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 +if [[ ! -f scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 -fi \ No newline at end of file + echo "job succeeded!" + exit 0 +fi diff --git a/examples/31_comp_charge/runall.sh b/examples/31_comp_charge/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/31_comp_charge/runall.sh +++ b/examples/31_comp_charge/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/32_bsse/01_water/run.sh b/examples/32_bsse/01_water/run.sh index 3a16dfa9dcd..c0b25704b5b 100755 --- a/examples/32_bsse/01_water/run.sh +++ b/examples/32_bsse/01_water/run.sh @@ -4,8 +4,8 @@ ABACUS_PATH=$(awk -F "=" '$1=="ABACUS_PATH"{print $2}' ../../SETENV) ABACUS_NPROCS=$(awk -F "=" '$1=="ABACUS_NPROCS"{print $2}' ../../SETENV) ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV) -if [[ $ABACUS_NPROCS -gt 8 ]];then - ABACUS_NPROCS=8 +if [[ $ABACUS_NPROCS -gt 8 ]]; then + ABACUS_NPROCS=8 fi cp STRU_0 STRU @@ -28,32 +28,31 @@ E_O=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_O.log | awk '{printf $2}') E_H1=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H1.log | awk '{printf $2}') E_H2=$(grep FINAL_ETOT_IS OUT.ABACUS/running_scf_H2.log | awk '{printf $2}') result=$(echo "scale=12; ${E_H2O} - ${E_O} - ${E_H1} - ${E_H2}" | bc -l) -echo $result > result.out -echo "E_H2O: $E_H2O" >> result.out -echo "E_O: $E_O" >> result.out -echo "E_H1: $E_H1" >> result.out -echo "E_H2: $E_H2" >> result.out +echo $result >result.out +echo "E_H2O: $E_H2O" >>result.out +echo "E_O: $E_O" >>result.out +echo "E_H1: $E_H1" >>result.out +echo "E_H2: $E_H2" >>result.out result_ref=$(cat result.ref | head -1) difference=$(echo "scale=12; $result - $result_ref" | bc -l) abs_difference=$(echo "scale=12; if ($difference < 0) $difference * -1 else $difference" | bc) -if [[ ! -f H2O_scf.output ]] || - [[ ! -f O_scf.output ]] || - [[ ! -f H1_scf.output ]] || - [[ ! -f H2_scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf_H2O.log ]] || - [[ ! -f OUT.ABACUS/running_scf_O.log ]] || - [[ ! -f OUT.ABACUS/running_scf_H1.log ]] || - [[ ! -f OUT.ABACUS/running_scf_H2.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf_H2O.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf_O.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf_H1.log)" == " Total Time :"* ) ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf_H2.log)" == " Total Time :"* ) ]] || - [ $(echo "$abs_difference < 0.00001" | bc) -ne 1 ] -then - echo "job failed!" - exit 1 +if [[ ! -f H2O_scf.output ]] || + [[ ! -f O_scf.output ]] || + [[ ! -f H1_scf.output ]] || + [[ ! -f H2_scf.output ]] || + [[ ! -f OUT.ABACUS/running_scf_H2O.log ]] || + [[ ! -f OUT.ABACUS/running_scf_O.log ]] || + [[ ! -f OUT.ABACUS/running_scf_H1.log ]] || + [[ ! -f OUT.ABACUS/running_scf_H2.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf_H2O.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf_O.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf_H1.log)" == " Total Time :"*) ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf_H2.log)" == " Total Time :"*) ]] || + [ $(echo "$abs_difference < 0.00001" | bc) -ne 1 ]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/32_bsse/runall.sh b/examples/32_bsse/runall.sh index 014c2cd5b29..92d4f0d2c75 100644 --- a/examples/32_bsse/runall.sh +++ b/examples/32_bsse/runall.sh @@ -1,11 +1,10 @@ #!/bin/bash -for ii in * -do - if [ -d $ii ];then - cd ${ii} - echo "RUN: ${ii}" - bash run.sh - cd .. - fi +for ii in *; do + if [ -d $ii ]; then + cd ${ii} + echo "RUN: ${ii}" + bash run.sh + cd .. + fi done diff --git a/examples/35_tdofdft/01_Al_proton_ESP/01_gs/run.sh b/examples/35_tdofdft/01_Al_proton_ESP/01_gs/run.sh index 7623ec13913..1d65ab4d636 100644 --- a/examples/35_tdofdft/01_Al_proton_ESP/01_gs/run.sh +++ b/examples/35_tdofdft/01_Al_proton_ESP/01_gs/run.sh @@ -7,12 +7,11 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee relax.output if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/examples/35_tdofdft/01_Al_proton_ESP/02_td/run.sh b/examples/35_tdofdft/01_Al_proton_ESP/02_td/run.sh index 7623ec13913..1d65ab4d636 100644 --- a/examples/35_tdofdft/01_Al_proton_ESP/02_td/run.sh +++ b/examples/35_tdofdft/01_Al_proton_ESP/02_td/run.sh @@ -7,12 +7,11 @@ ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../../../SETENV) OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee relax.output if [[ ! -f scf.output ]] || - [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] -then - echo "job failed!" - exit 1 + [[ ! -f OUT.ABACUS/running_scf.log ]] || + [[ ! ("$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"*) ]]; then + echo "job failed!" + exit 1 else - echo "job succeeded!" - exit 0 + echo "job succeeded!" + exit 0 fi diff --git a/generate_build_info.sh b/generate_build_info.sh index f50f98ac727..6b87ce6fbbb 100755 --- a/generate_build_info.sh +++ b/generate_build_info.sh @@ -11,8 +11,8 @@ # set -e # Exit immediately if a command exits with a non-zero status. if [ -z "$1" ]; then - echo "Usage: $0 " - exit 1 + echo "Usage: $0 " + exit 1 fi OUTPUT_FILE=$1 @@ -21,31 +21,31 @@ OUTPUT_FILE=$1 # Function to get version from a command's output # Usage: get_version_from_command "" "" get_version_from_command() { - local cmd="$1" - local regex="$2" - if command -v "$cmd" > /dev/null; then - local output=$($cmd 2>&1) - if [[ $output =~ $regex ]]; then - echo "${BASH_REMATCH[1]}" - return 0 - fi + local cmd="$1" + local regex="$2" + if command -v "$cmd" >/dev/null; then + local output=$($cmd 2>&1) + if [[ $output =~ $regex ]]; then + echo "${BASH_REMATCH[1]}" + return 0 fi - return 1 + fi + return 1 } # Function to get version from a header file # Usage: get_version_from_header "" "" get_version_from_header() { - local header_path="$1" - local regex="$2" - if [ -f "$header_path" ]; then - local line=$(grep -E "$regex" "$header_path" | head -n 1) - if [[ $line =~ $regex ]]; then - echo "${BASH_REMATCH[1]}" - return 0 - fi + local header_path="$1" + local regex="$2" + if [ -f "$header_path" ]; then + local line=$(grep -E "$regex" "$header_path" | head -n 1) + if [[ $line =~ $regex ]]; then + echo "${BASH_REMATCH[1]}" + return 0 fi - return 1 + fi + return 1 } # --- Main Detection Logic --- @@ -69,191 +69,205 @@ if [ "${ENABLE_ELPA}" == "ON" ] && [ "${ENABLE_LCAO}" == "ON" ]; then PLATFORM_N MPI_IMPLEMENTATION="no" MPI_VERSION="no" if [ "${ENABLE_MPI}" == "ON" ]; then - MPI_IMPLEMENTATION="Unknown" - MPI_COMPILER="${MPI_CXX_COMPILER:-mpicxx}" - if command -v "$MPI_COMPILER" > /dev/null; then - # Intel MPI (oneAPI) - version=$(get_version_from_command "$MPI_COMPILER --version" "Intel\(R\) oneAPI DPC\+\+/C\+\+ Compiler ([0-9]+\.[0-9]+\.[0-9]+)") - if [ -n "$version" ]; then MPI_IMPLEMENTATION="Intel MPI"; MPI_VERSION="$version"; fi - # Intel MPI (classic) - if [ -z "$version" ]; then - version=$(get_version_from_command "$MPI_COMPILER --version" "icpc \(ICC\) ([0-9]+\.[0-9]+\.[0-9]+)") - if [ -n "$version" ]; then MPI_IMPLEMENTATION="Intel MPI"; MPI_VERSION="$version"; fi - fi - # OpenMPI - if [ -z "$version" ]; then - version=$(get_version_from_command "$MPI_COMPILER --version" "Open MPI ([0-9]+\.[0-9]+\.[0-9]+)") - if [ -n "$version" ]; then MPI_IMPLEMENTATION="OpenMPI"; MPI_VERSION="$version"; fi - fi - # MPICH - if [ -z "$version" ]; then - version=$(get_version_from_command "$MPI_COMPILER --version" "MPICH Version: ([0-9]+\.[0-9]+\.[0-9]+)") - if [ -n "$version" ]; then MPI_IMPLEMENTATION="MPICH"; MPI_VERSION="$version"; fi - fi - # Fallback via mpirun - if [ -z "$version" ] && command -v mpirun > /dev/null; then - mr_out=$(mpirun --version 2>&1) - if [[ $mr_out =~ Open\ MPI\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then - MPI_IMPLEMENTATION="OpenMPI"; MPI_VERSION="${BASH_REMATCH[1]}" - elif [[ $mr_out =~ MPICH\ Version:\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then - MPI_IMPLEMENTATION="MPICH"; MPI_VERSION="${BASH_REMATCH[1]}" - fi - fi + MPI_IMPLEMENTATION="Unknown" + MPI_COMPILER="${MPI_CXX_COMPILER:-mpicxx}" + if command -v "$MPI_COMPILER" >/dev/null; then + # Intel MPI (oneAPI) + version=$(get_version_from_command "$MPI_COMPILER --version" "Intel\(R\) oneAPI DPC\+\+/C\+\+ Compiler ([0-9]+\.[0-9]+\.[0-9]+)") + if [ -n "$version" ]; then + MPI_IMPLEMENTATION="Intel MPI" + MPI_VERSION="$version" + fi + # Intel MPI (classic) + if [ -z "$version" ]; then + version=$(get_version_from_command "$MPI_COMPILER --version" "icpc \(ICC\) ([0-9]+\.[0-9]+\.[0-9]+)") + if [ -n "$version" ]; then + MPI_IMPLEMENTATION="Intel MPI" + MPI_VERSION="$version" + fi + fi + # OpenMPI + if [ -z "$version" ]; then + version=$(get_version_from_command "$MPI_COMPILER --version" "Open MPI ([0-9]+\.[0-9]+\.[0-9]+)") + if [ -n "$version" ]; then + MPI_IMPLEMENTATION="OpenMPI" + MPI_VERSION="$version" + fi + fi + # MPICH + if [ -z "$version" ]; then + version=$(get_version_from_command "$MPI_COMPILER --version" "MPICH Version: ([0-9]+\.[0-9]+\.[0-9]+)") + if [ -n "$version" ]; then + MPI_IMPLEMENTATION="MPICH" + MPI_VERSION="$version" + fi + fi + # Fallback via mpirun + if [ -z "$version" ] && command -v mpirun >/dev/null; then + mr_out=$(mpirun --version 2>&1) + if [[ $mr_out =~ Open\ MPI\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then + MPI_IMPLEMENTATION="OpenMPI" + MPI_VERSION="${BASH_REMATCH[1]}" + elif [[ $mr_out =~ MPICH\ Version:\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then + MPI_IMPLEMENTATION="MPICH" + MPI_VERSION="${BASH_REMATCH[1]}" + fi fi - if [ "$MPI_VERSION" == "no" ]; then MPI_VERSION="yes (version unknown)"; else MPI_VERSION="yes (v$MPI_VERSION)"; fi + fi + if [ "$MPI_VERSION" == "no" ]; then MPI_VERSION="yes (version unknown)"; else MPI_VERSION="yes (v$MPI_VERSION)"; fi else - MPI_IMPLEMENTATION="no" - MPI_VERSION="no" + MPI_IMPLEMENTATION="no" + MPI_VERSION="no" fi # 3. OpenMP OPENMP_VERSION="no" if [[ "$CXX_FLAGS" == *"-fopenmp"* ]]; then - OPENMP_VERSION="yes (version unknown)" - # Try to get version from compiler - if command -v "$CXX_COMPILER_PATH" > /dev/null; then - version=$($CXX_COMPILER_PATH -dM -E - < /dev/null 2>&1 | grep '#define _OPENMP ' | awk '{print $3}') - if [ -n "$version" ]; then - # Convert YYYYMM to a more readable format if possible - year=$((version / 10000)) - month=$((version % 10000)) - OPENMP_VERSION="yes (v${year}.${month})" - fi + OPENMP_VERSION="yes (version unknown)" + # Try to get version from compiler + if command -v "$CXX_COMPILER_PATH" >/dev/null; then + version=$($CXX_COMPILER_PATH -dM -E - &1 | grep '#define _OPENMP ' | awk '{print $3}') + if [ -n "$version" ]; then + # Convert YYYYMM to a more readable format if possible + year=$((version / 10000)) + month=$((version % 10000)) + OPENMP_VERSION="yes (v${year}.${month})" fi + fi fi # 4. MKL MKL_SUPPORT="no" if [ -n "$MKLROOT" ]; then - MKL_SUPPORT="yes (version unknown)" - version=$(get_version_from_header "$MKLROOT/include/mkl_version.h" "INTEL_MKL_VERSION ([0-9]+)") - if [ -n "$version" ]; then - major=$((version / 10000)) - minor=$(( (version % 10000) / 100 )) - patch=$((version % 100)) - MKL_SUPPORT="yes (v${major}.${minor}.${patch})" - fi + MKL_SUPPORT="yes (version unknown)" + version=$(get_version_from_header "$MKLROOT/include/mkl_version.h" "INTEL_MKL_VERSION ([0-9]+)") + if [ -n "$version" ]; then + major=$((version / 10000)) + minor=$(((version % 10000) / 100)) + patch=$((version % 100)) + MKL_SUPPORT="yes (v${major}.${minor}.${patch})" + fi fi # 5. Libxc LIBXC_VERSION="no" if [ "${ENABLE_LIBXC}" == "ON" ]; then - LIBXC_VERSION="yes (version unknown)" - # Try pkg-config first - if command -v pkg-config > /dev/null; then - version=$(pkg-config --modversion libxc 2>/dev/null) - if [ -n "$version" ]; then LIBXC_VERSION="yes (v$version)"; fi - fi - # Fallback to header - if [[ "$LIBXC_VERSION" == *"unknown"* ]]; then - # Assuming standard include paths - version=$(get_version_from_header "/usr/include/libxc/libxc.h" "LIBXC_VERSION_ \"([0-9]+\.[0-9]+\.[0-9]+)\"") - if [ -n "$version" ]; then LIBXC_VERSION="yes (v$version)"; fi - fi + LIBXC_VERSION="yes (version unknown)" + # Try pkg-config first + if command -v pkg-config >/dev/null; then + version=$(pkg-config --modversion libxc 2>/dev/null) + if [ -n "$version" ]; then LIBXC_VERSION="yes (v$version)"; fi + fi + # Fallback to header + if [[ "$LIBXC_VERSION" == *"unknown"* ]]; then + # Assuming standard include paths + version=$(get_version_from_header "/usr/include/libxc/libxc.h" "LIBXC_VERSION_ \"([0-9]+\.[0-9]+\.[0-9]+)\"") + if [ -n "$version" ]; then LIBXC_VERSION="yes (v$version)"; fi + fi fi # 6. CUDA CUDA_VERSION="no" if [ "${USE_CUDA}" == "ON" ]; then - CUDA_VERSION="yes (version unknown)" - if [ -n "$CUDA_HOME" ]; then - version=$(get_version_from_command "$CUDA_HOME/bin/nvcc --version" "release ([0-9]+\.[0-9]+)") - if [ -n "$version" ]; then CUDA_VERSION="yes (v$version)"; fi - elif command -v nvcc > /dev/null; then - version=$(get_version_from_command "nvcc --version" "release ([0-9]+\.[0-9]+)") - if [ -n "$version" ]; then CUDA_VERSION="yes (v$version)"; fi - fi + CUDA_VERSION="yes (version unknown)" + if [ -n "$CUDA_HOME" ]; then + version=$(get_version_from_command "$CUDA_HOME/bin/nvcc --version" "release ([0-9]+\.[0-9]+)") + if [ -n "$version" ]; then CUDA_VERSION="yes (v$version)"; fi + elif command -v nvcc >/dev/null; then + version=$(get_version_from_command "nvcc --version" "release ([0-9]+\.[0-9]+)") + if [ -n "$version" ]; then CUDA_VERSION="yes (v$version)"; fi + fi fi # 7. ROCm/HIP ROCM_VERSION="no" if [ "${USE_ROCM}" == "ON" ]; then - ROCM_VERSION="yes (version unknown)" - if [ -n "$ROCM_PATH" ]; then - version=$(get_version_from_command "$ROCM_PATH/bin/hipcc --version" "HIP version: ([0-9]+\.[0-9]+\.[0-9]+)") - if [ -n "$version" ]; then ROCM_VERSION="yes (v$version)"; fi - elif command -v hipcc > /dev/null; then - version=$(get_version_from_command "hipcc --version" "HIP version: ([0-9]+\.[0-9]+\.[0-9]+)") - if [ -n "$version" ]; then ROCM_VERSION="yes (v$version)"; fi - fi + ROCM_VERSION="yes (version unknown)" + if [ -n "$ROCM_PATH" ]; then + version=$(get_version_from_command "$ROCM_PATH/bin/hipcc --version" "HIP version: ([0-9]+\.[0-9]+\.[0-9]+)") + if [ -n "$version" ]; then ROCM_VERSION="yes (v$version)"; fi + elif command -v hipcc >/dev/null; then + version=$(get_version_from_command "hipcc --version" "HIP version: ([0-9]+\.[0-9]+\.[0-9]+)") + if [ -n "$version" ]; then ROCM_VERSION="yes (v$version)"; fi + fi fi # 8. DeePMD-kit DEEPMD_VERSION="no" if [ -n "$DeePMD_DIR" ]; then - DEEPMD_VERSION="yes (version unknown)" - version=$(get_version_from_header "$DeePMD_DIR/include/deepmd/version.h" "global_install_prefix=\".*deepmd-kit-([0-9]+\.[0-9]+\.[0-9]+)\"") - if [ -n "$version" ]; then DEEPMD_VERSION="yes (v$version)"; else DEEPMD_VERSION="yes (path: $DeePMD_DIR)"; fi + DEEPMD_VERSION="yes (version unknown)" + version=$(get_version_from_header "$DeePMD_DIR/include/deepmd/version.h" "global_install_prefix=\".*deepmd-kit-([0-9]+\.[0-9]+\.[0-9]+)\"") + if [ -n "$version" ]; then DEEPMD_VERSION="yes (v$version)"; else DEEPMD_VERSION="yes (path: $DeePMD_DIR)"; fi fi # 9. ELPA ELPA_VERSION="no" if [ "${ENABLE_ELPA}" == "ON" ] && [ -n "$ELPA_DIR" ]; then - ELPA_VERSION="yes (version unknown)" - if [ -f "$ELPA_DIR/bin/elpa2_print_version" ]; then - version=$("$ELPA_DIR/bin/elpa2_print_version" 2>/dev/null) - if [ -n "$version" ]; then ELPA_VERSION="yes ($version)"; fi - else - ELPA_VERSION="yes (path: $ELPA_DIR)" - fi + ELPA_VERSION="yes (version unknown)" + if [ -f "$ELPA_DIR/bin/elpa2_print_version" ]; then + version=$("$ELPA_DIR/bin/elpa2_print_version" 2>/dev/null) + if [ -n "$version" ]; then ELPA_VERSION="yes ($version)"; fi + else + ELPA_VERSION="yes (path: $ELPA_DIR)" + fi fi # 10. Cereal CEREAL_VERSION="no" if [ -n "$CEREAL_DIR" ]; then - CEREAL_VERSION="yes (version unknown)" - major=$(get_version_from_header "$CEREAL_DIR/include/cereal/version.hpp" "__CEREAL_VERSION_MAJOR[[:space:]]+([0-9]+)") - minor=$(get_version_from_header "$CEREAL_DIR/include/cereal/version.hpp" "__CEREAL_VERSION_MINOR[[:space:]]+([0-9]+)") - patch=$(get_version_from_header "$CEREAL_DIR/include/cereal/version.hpp" "__CEREAL_VERSION_PATCH[[:space:]]+([0-9]+)") - if [ -n "$major" ] && [ -n "$minor" ] && [ -n "$patch" ]; then - CEREAL_VERSION="yes (v${major}.${minor}.${patch})" - else - CEREAL_VERSION="yes (path: $CEREAL_DIR)" - fi + CEREAL_VERSION="yes (version unknown)" + major=$(get_version_from_header "$CEREAL_DIR/include/cereal/version.hpp" "__CEREAL_VERSION_MAJOR[[:space:]]+([0-9]+)") + minor=$(get_version_from_header "$CEREAL_DIR/include/cereal/version.hpp" "__CEREAL_VERSION_MINOR[[:space:]]+([0-9]+)") + patch=$(get_version_from_header "$CEREAL_DIR/include/cereal/version.hpp" "__CEREAL_VERSION_PATCH[[:space:]]+([0-9]+)") + if [ -n "$major" ] && [ -n "$minor" ] && [ -n "$patch" ]; then + CEREAL_VERSION="yes (v${major}.${minor}.${patch})" + else + CEREAL_VERSION="yes (path: $CEREAL_DIR)" + fi fi # 11. LibRI LIBRI_VERSION="no" if [ -n "$LIBRI_DIR" ]; then - LIBRI_VERSION="yes (version unknown)" - major=$(get_version_from_header "$LIBRI_DIR/include/RI/version.h" "__LIBRI_VERSION_MAJOR[[:space:]]+([0-9]+)") - minor=$(get_version_from_header "$LIBRI_DIR/include/RI/version.h" "__LIBRI_VERSION_MINOR[[:space:]]+([0-9]+)") - patch=$(get_version_from_header "$LIBRI_DIR/include/RI/version.h" "__LIBRI_VERSION_PATCH[[:space:]]+([0-9]+)") - if [ -n "$major" ] && [ -n "$minor" ] && [ -n "$patch" ]; then - LIBRI_VERSION="yes (v${major}.${minor}.${patch})" - else - LIBRI_VERSION="yes (path: $LIBRI_DIR)" - fi + LIBRI_VERSION="yes (version unknown)" + major=$(get_version_from_header "$LIBRI_DIR/include/RI/version.h" "__LIBRI_VERSION_MAJOR[[:space:]]+([0-9]+)") + minor=$(get_version_from_header "$LIBRI_DIR/include/RI/version.h" "__LIBRI_VERSION_MINOR[[:space:]]+([0-9]+)") + patch=$(get_version_from_header "$LIBRI_DIR/include/RI/version.h" "__LIBRI_VERSION_PATCH[[:space:]]+([0-9]+)") + if [ -n "$major" ] && [ -n "$minor" ] && [ -n "$patch" ]; then + LIBRI_VERSION="yes (v${major}.${minor}.${patch})" + else + LIBRI_VERSION="yes (path: $LIBRI_DIR)" + fi fi # 12. LibComm LIBCOMM_VERSION="no" if [ -n "$LIBCOMM_DIR" ]; then - LIBCOMM_VERSION="yes (path: $LIBCOMM_DIR)" + LIBCOMM_VERSION="yes (path: $LIBCOMM_DIR)" fi # 13. FFTW (non-MKL) FFTW3_VERSION="no" if [ -z "$MKLROOT" ] && [ -n "$FFTW3_INCLUDE_DIR" ]; then - FFTW3_VERSION="yes (version unknown)" - hdr="$FFTW3_INCLUDE_DIR/fftw3.h" - version=$(get_version_from_header "$hdr" "FFTW_VERSION\s+\"([^\"]+)\"") - if [ -n "$version" ]; then FFTW3_VERSION="yes (v$version)"; fi + FFTW3_VERSION="yes (version unknown)" + hdr="$FFTW3_INCLUDE_DIR/fftw3.h" + version=$(get_version_from_header "$hdr" "FFTW_VERSION\s+\"([^\"]+)\"") + if [ -n "$version" ]; then FFTW3_VERSION="yes (v$version)"; fi fi # CUDA-aware MPI CUDA_AWARE_MPI="no" if [ "${USE_CUDA}" == "ON" ]; then - if command -v ompi_info > /dev/null; then - out=$(ompi_info --parsable --all 2>/dev/null) - if echo "$out" | grep -q "mpi_built_with_cuda_support:value:true"; then - CUDA_AWARE_MPI="yes" - else - CUDA_AWARE_MPI="no (or undetectable)" - fi + if command -v ompi_info >/dev/null; then + out=$(ompi_info --parsable --all 2>/dev/null) + if echo "$out" | grep -q "mpi_built_with_cuda_support:value:true"; then + CUDA_AWARE_MPI="yes" else - CUDA_AWARE_MPI="no (or undetectable)" + CUDA_AWARE_MPI="no (or undetectable)" fi + else + CUDA_AWARE_MPI="no (or undetectable)" + fi fi # --- Final File Generation --- @@ -263,33 +277,33 @@ INPUT_FILE="${SCRIPT_DIR}/source/source_io/build_info.h.in" # Use sed to replace all placeholders with detected values # Note the use of different delimiters (#) for paths to avoid conflicts with / sed \ - -e "s#@ABACUS_PLATFORM_NAME@#$PLATFORM_NAME#g" \ - -e "s#@ABACUS_BUILD_TYPE@#${BUILD_TYPE:-Release}#g" \ - -e "s#@ABACUS_BUILD_USER@#$BUILD_USER#g" \ - -e "s#@ABACUS_BUILD_HOST@#$BUILD_HOST#g" \ - -e "s#@ABACUS_CXX_COMPILER_ID@#${CXX_COMPILER_ID:-Unknown}#g" \ - -e "s#@ABACUS_CXX_COMPILER_PATH@#$CXX_COMPILER_PATH#g" \ - -e "s#@ABACUS_CXX_COMPILER_VERSION@#$CXX_COMPILER_VERSION#g" \ - -e "s#@ABACUS_CXX_FLAGS@#$CXX_FLAGS#g" \ - -e "s#@ABACUS_LINKER_FLAGS@#$LINKER_FLAGS#g" \ - -e "s#@ABACUS_CUDA_FLAGS@#$CUDA_FLAGS#g" \ - -e "s#@ABACUS_MPI_IMPLEMENTATION@#$MPI_IMPLEMENTATION#g" \ - -e "s#@ABACUS_MPI_VERSION@#$MPI_VERSION#g" \ - -e "s#@ABACUS_CUDA_AWARE_MPI@#$CUDA_AWARE_MPI#g" \ - -e "s#@ABACUS_OPENMP_VERSION@#$OPENMP_VERSION#g" \ - -e "s#@ABACUS_MKL_SUPPORT@#$MKL_SUPPORT#g" \ - -e "s#@ABACUS_LIBXC_VERSION@#$LIBXC_VERSION#g" \ - -e "s#@ABACUS_FFTW_VERSION@#$FFTW3_VERSION#g" \ - -e "s#@ABACUS_CUDA_VERSION@#$CUDA_VERSION#g" \ - -e "s#@ABACUS_ROCM_VERSION@#$ROCM_VERSION#g" \ - -e "s#@ABACUS_DEEPMD_VERSION@#$DEEPMD_VERSION#g" \ - -e "s#@ABACUS_ELPA_VERSION@#$ELPA_VERSION#g" \ - -e "s#@ABACUS_CEREAL_VERSION@#$CEREAL_VERSION#g" \ - -e "s#@ABACUS_LIBRI_VERSION@#$LIBRI_VERSION#g" \ - -e "s#@ABACUS_LIBCOMM_VERSION@#$LIBCOMM_VERSION#g" \ - -e "s#@ABACUS_ASAN_STATUS@#${ENABLE_ASAN:-no}#g" \ - -e "s#@ABACUS_CMAKE_OPTIONS@#Not available with Makefile#g" \ - -e "s#@ABACUS_CMAKE_FIND_PACKAGES@#Not available with Makefile#g" \ - "$INPUT_FILE" > "$OUTPUT_FILE" + -e "s#@ABACUS_PLATFORM_NAME@#$PLATFORM_NAME#g" \ + -e "s#@ABACUS_BUILD_TYPE@#${BUILD_TYPE:-Release}#g" \ + -e "s#@ABACUS_BUILD_USER@#$BUILD_USER#g" \ + -e "s#@ABACUS_BUILD_HOST@#$BUILD_HOST#g" \ + -e "s#@ABACUS_CXX_COMPILER_ID@#${CXX_COMPILER_ID:-Unknown}#g" \ + -e "s#@ABACUS_CXX_COMPILER_PATH@#$CXX_COMPILER_PATH#g" \ + -e "s#@ABACUS_CXX_COMPILER_VERSION@#$CXX_COMPILER_VERSION#g" \ + -e "s#@ABACUS_CXX_FLAGS@#$CXX_FLAGS#g" \ + -e "s#@ABACUS_LINKER_FLAGS@#$LINKER_FLAGS#g" \ + -e "s#@ABACUS_CUDA_FLAGS@#$CUDA_FLAGS#g" \ + -e "s#@ABACUS_MPI_IMPLEMENTATION@#$MPI_IMPLEMENTATION#g" \ + -e "s#@ABACUS_MPI_VERSION@#$MPI_VERSION#g" \ + -e "s#@ABACUS_CUDA_AWARE_MPI@#$CUDA_AWARE_MPI#g" \ + -e "s#@ABACUS_OPENMP_VERSION@#$OPENMP_VERSION#g" \ + -e "s#@ABACUS_MKL_SUPPORT@#$MKL_SUPPORT#g" \ + -e "s#@ABACUS_LIBXC_VERSION@#$LIBXC_VERSION#g" \ + -e "s#@ABACUS_FFTW_VERSION@#$FFTW3_VERSION#g" \ + -e "s#@ABACUS_CUDA_VERSION@#$CUDA_VERSION#g" \ + -e "s#@ABACUS_ROCM_VERSION@#$ROCM_VERSION#g" \ + -e "s#@ABACUS_DEEPMD_VERSION@#$DEEPMD_VERSION#g" \ + -e "s#@ABACUS_ELPA_VERSION@#$ELPA_VERSION#g" \ + -e "s#@ABACUS_CEREAL_VERSION@#$CEREAL_VERSION#g" \ + -e "s#@ABACUS_LIBRI_VERSION@#$LIBRI_VERSION#g" \ + -e "s#@ABACUS_LIBCOMM_VERSION@#$LIBCOMM_VERSION#g" \ + -e "s#@ABACUS_ASAN_STATUS@#${ENABLE_ASAN:-no}#g" \ + -e "s#@ABACUS_CMAKE_OPTIONS@#Not available with Makefile#g" \ + -e "s#@ABACUS_CMAKE_FIND_PACKAGES@#Not available with Makefile#g" \ + "$INPUT_FILE" >"$OUTPUT_FILE" echo "Generated $OUTPUT_FILE successfully." diff --git a/interfaces/ASE_interface/abacuslite/xtest.sh b/interfaces/ASE_interface/abacuslite/xtest.sh index 47640cfc28b..5e22366a600 100755 --- a/interfaces/ASE_interface/abacuslite/xtest.sh +++ b/interfaces/ASE_interface/abacuslite/xtest.sh @@ -7,4 +7,3 @@ python3 ./io/generalio.py -v python3 ./io/legacyio.py -v python3 ./io/latestio.py -v python3 ./utils/ksampling.py -v - diff --git a/interfaces/ShengBTE_interface/01_pw/3rd/run_stru.sh b/interfaces/ShengBTE_interface/01_pw/3rd/run_stru.sh index 111430e6f98..56f82ff2918 100644 --- a/interfaces/ShengBTE_interface/01_pw/3rd/run_stru.sh +++ b/interfaces/ShengBTE_interface/01_pw/3rd/run_stru.sh @@ -1,13 +1,12 @@ #!/bin/bash -for i in STRU_* -do -stru=$(echo $i|cut -d"_" -f2) -echo $stru -echo "stru=$stru" -mkdir SCF-$stru -cd SCF-$stru -pwd -cat > INPUT <INPUT < KPT <KPT < INPUT <INPUT < KPT <KPT < /dev/null 2>&1 - -for ((i=0;i<4;++i)) -do - -if ((i==0)) ;then -make -j12 --silent CXX=g++ DEBUG=ON -echo "Test for Serial Version:" -./pw_test.exe - -elif ((i==1)) ;then -make -j12 --silent CXX=g++ FLOAT=ON DEBUG=ON -echo "Test for Serial Version with single precision:" -./pw_test.exe - -elif ((i==2)) ;then -make -j12 --silent CXX=mpicxx DEBUG=ON -echo "Test for MPI Version:" - -elif ((i==3)) ;then -make -j12 --silent CXX=mpicxx FLOAT=ON DEBUG=ON -echo "Test for MPI Version with single precision:" -fi -if ((i>=2)) ; then +make clean >/dev/null 2>&1 + +for ((i = 0; i < 4; ++i)); do + + if ((i == 0)); then + make -j12 --silent CXX=g++ DEBUG=ON + echo "Test for Serial Version:" + ./pw_test.exe + + elif ((i == 1)); then + make -j12 --silent CXX=g++ FLOAT=ON DEBUG=ON + echo "Test for Serial Version with single precision:" + ./pw_test.exe + + elif ((i == 2)); then + make -j12 --silent CXX=mpicxx DEBUG=ON + echo "Test for MPI Version:" + + elif ((i == 3)); then + make -j12 --silent CXX=mpicxx FLOAT=ON DEBUG=ON + echo "Test for MPI Version with single precision:" + fi + if ((i >= 2)); then echo "1 processor:" ./pw_test.exe sleep 1 echo "3 processors:" mpirun -np 3 ./pw_test.exe >_tmp.txt - cat _tmp.txt|grep PASSED - cat _tmp.txt|grep FAILED + cat _tmp.txt | grep PASSED + cat _tmp.txt | grep FAILED sleep 1 echo "5 processors:" mpirun -np 5 ./pw_test.exe >_tmp.txt - cat _tmp.txt|grep PASSED - cat _tmp.txt|grep FAILED + cat _tmp.txt | grep PASSED + cat _tmp.txt | grep FAILED sleep 1 echo "8 processors:" mpirun -np 8 ./pw_test.exe >_tmp.txt - cat _tmp.txt|grep PASSED - cat _tmp.txt|grep FAILED -fi + cat _tmp.txt | grep PASSED + cat _tmp.txt | grep FAILED + fi -make --silent clean + make --silent clean done diff --git a/source/source_basis/module_pw/test/test_intel.sh b/source/source_basis/module_pw/test/test_intel.sh index a4742455e53..babb2ebaa34 100644 --- a/source/source_basis/module_pw/test/test_intel.sh +++ b/source/source_basis/module_pw/test/test_intel.sh @@ -1,52 +1,51 @@ #!/bin/bash -make clean > /dev/null 2>&1 - -for ((i=0;i<4;++i)) -do - -if ((i==0)) ;then -make -j12 CXX=icpc > /dev/null -echo "Test for Serial Version:" -./pw_test.exe - -elif ((i==1)) ;then -make -j12 CXX=icpc FLOAT=ON > /dev/null -echo "Test for Serial Version with single precision:" -./pw_test.exe - -elif ((i==2)) ;then -make -j12 CXX=mpiicpc > /dev/null -echo "Test for MPI Version:" - -elif ((i==3)) ;then -make -j12 CXX=mpiicpc FLOAT=ON > /dev/null -echo "Test for MPI Version with single precision:" -fi -if ((i>=2)) ; then +make clean >/dev/null 2>&1 + +for ((i = 0; i < 4; ++i)); do + + if ((i == 0)); then + make -j12 CXX=icpc >/dev/null + echo "Test for Serial Version:" + ./pw_test.exe + + elif ((i == 1)); then + make -j12 CXX=icpc FLOAT=ON >/dev/null + echo "Test for Serial Version with single precision:" + ./pw_test.exe + + elif ((i == 2)); then + make -j12 CXX=mpiicpc >/dev/null + echo "Test for MPI Version:" + + elif ((i == 3)); then + make -j12 CXX=mpiicpc FLOAT=ON >/dev/null + echo "Test for MPI Version with single precision:" + fi + if ((i >= 2)); then echo "1 processor:" ./pw_test.exe sleep 1 echo "3 processors:" mpirun -np 3 ./pw_test.exe >_tmp.txt - cat _tmp.txt|grep PASSED - cat _tmp.txt|grep FAILED + cat _tmp.txt | grep PASSED + cat _tmp.txt | grep FAILED sleep 1 echo "5 processors:" mpirun -np 5 ./pw_test.exe >_tmp.txt - cat _tmp.txt|grep PASSED - cat _tmp.txt|grep FAILED + cat _tmp.txt | grep PASSED + cat _tmp.txt | grep FAILED sleep 1 echo "8 processors:" mpirun -np 8 ./pw_test.exe >_tmp.txt - cat _tmp.txt|grep PASSED - cat _tmp.txt|grep FAILED -fi + cat _tmp.txt | grep PASSED + cat _tmp.txt | grep FAILED + fi -make clean > /dev/null 2>&1 + make clean >/dev/null 2>&1 done test -e _tmp.txt && rm -f _tmp.txt -exit 0 \ No newline at end of file +exit 0 diff --git a/source/source_cell/test/bcast_atom_pseudo_test.sh b/source/source_cell/test/bcast_atom_pseudo_test.sh index c156351f6d6..665e57f19af 100644 --- a/source/source_cell/test/bcast_atom_pseudo_test.sh +++ b/source/source_cell/test/bcast_atom_pseudo_test.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 4;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_atom_pseudo}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 4; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_atom_pseudo}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_cell/test/bcast_atom_spec_test.sh b/source/source_cell/test/bcast_atom_spec_test.sh index 321a4ef2a3a..e7c27dd47ca 100644 --- a/source/source_cell/test/bcast_atom_spec_test.sh +++ b/source/source_cell/test/bcast_atom_spec_test.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 4;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_atom_spec}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 4; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_atom_spec}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_cell/test/bcast_read_sep_test.sh b/source/source_cell/test/bcast_read_sep_test.sh index 6a2c826a708..25279250c4e 100644 --- a/source/source_cell/test/bcast_read_sep_test.sh +++ b/source/source_cell/test/bcast_read_sep_test.sh @@ -4,15 +4,15 @@ np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" for i in 4; do - if [[ $i -gt $np ]]; then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_SEP_TEST}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m" \ - "execute UT with $i cores error." - exit 1 - fi - break + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_SEP_TEST}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_cell/test/bcast_sep_cell_test.sh b/source/source_cell/test/bcast_sep_cell_test.sh index c4b84bd18d5..762bf9dfa84 100644 --- a/source/source_cell/test/bcast_sep_cell_test.sh +++ b/source/source_cell/test/bcast_sep_cell_test.sh @@ -4,15 +4,15 @@ np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" for i in 4; do - if [[ $i -gt $np ]]; then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_SEP_CELL_TEST}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m" \ - "execute UT with $i cores error." - exit 1 - fi - break + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_SEP_CELL_TEST}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_cell/test/klist_test_para.sh b/source/source_cell/test/klist_test_para.sh index 1dd54e29dee..8c6e81f7b4f 100644 --- a/source/source_cell/test/klist_test_para.sh +++ b/source/source_cell/test/klist_test_para.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 4;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_klist_test_para1}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 4; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_klist_test_para1}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_cell/test/parallel_kpoints_test.sh b/source/source_cell/test/parallel_kpoints_test.sh index 4f39cd462d7..892f2053eb8 100644 --- a/source/source_cell/test/parallel_kpoints_test.sh +++ b/source/source_cell/test/parallel_kpoints_test.sh @@ -1,17 +1,16 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for ((i=3;i<=4;i++)); -do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_ParaKpoints}" - if [ $? -ne 0 ]; then - echo "TEST in parallel, nprocs=$i failed" - exit 1 - fi +for ((i = 3; i <= 4; i++)); do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_ParaKpoints}" + if [ $? -ne 0 ]; then + echo "TEST in parallel, nprocs=$i failed" + exit 1 + fi done diff --git a/source/source_cell/test/unitcell_test_parallel.sh b/source/source_cell/test/unitcell_test_parallel.sh index 854d901d953..69119d8f8b2 100644 --- a/source/source_cell/test/unitcell_test_parallel.sh +++ b/source/source_cell/test/unitcell_test_parallel.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 4;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_unitcell_test_para}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 4; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_unitcell_test_para}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_cell/test_pw/unitcell_test_pw_para.sh b/source/source_cell/test_pw/unitcell_test_pw_para.sh index 722b15e6312..ef41b295d27 100644 --- a/source/source_cell/test_pw/unitcell_test_pw_para.sh +++ b/source/source_cell/test_pw/unitcell_test_pw_para.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 4;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_CELL_unitcell_test_pw}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 4; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_CELL_unitcell_test_pw}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_hamilt/module_hcontainer/test/parallel_hcontainer_tests.sh b/source/source_hamilt/module_hcontainer/test/parallel_hcontainer_tests.sh index aae35024ba3..6f44b30e3b3 100644 --- a/source/source_hamilt/module_hcontainer/test/parallel_hcontainer_tests.sh +++ b/source/source_hamilt/module_hcontainer/test/parallel_hcontainer_tests.sh @@ -1,17 +1,17 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" for i in 2 3 4; do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_LCAO_hcontainer_transfer_test}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_LCAO_hcontainer_transfer_test}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi done diff --git a/source/source_hsolver/unittests/diago_cg_parallel_test.sh b/source/source_hsolver/unittests/diago_cg_parallel_test.sh index 6f8b2ce91e1..63e4d8e4fe7 100644 --- a/source/source_hsolver/unittests/diago_cg_parallel_test.sh +++ b/source/source_hsolver/unittests/diago_cg_parallel_test.sh @@ -1,21 +1,21 @@ #!/bin/bash -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 6 3 2;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST DIAGO CG in parallel, nprocs=$i" - OMP_NUM_THREADS=1 mpirun -np $i "${1:-./MODULE_HSOLVER_cg}" - e1=$? - OMP_NUM_THREADS=1 mpirun -np $i "${2:-./MODULE_HSOLVER_cg_float}" - e2=$? - if [[ e1 -ne 0 || e2 -ne 0 ]];then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 6 3 2; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST DIAGO CG in parallel, nprocs=$i" + OMP_NUM_THREADS=1 mpirun -np $i "${1:-./MODULE_HSOLVER_cg}" + e1=$? + OMP_NUM_THREADS=1 mpirun -np $i "${2:-./MODULE_HSOLVER_cg_float}" + e2=$? + if [[ e1 -ne 0 || e2 -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_hsolver/unittests/diago_david_parallel_test.sh b/source/source_hsolver/unittests/diago_david_parallel_test.sh index a57507e18a6..ae454c03186 100644 --- a/source/source_hsolver/unittests/diago_david_parallel_test.sh +++ b/source/source_hsolver/unittests/diago_david_parallel_test.sh @@ -1,21 +1,21 @@ #!/bin/bash -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 6 3 2;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST DIAGO davidson in parallel, nprocs=$i" - OMP_NUM_THREADS=1 mpirun -np $i "${1:-./MODULE_HSOLVER_dav}" - e1=$? - OMP_NUM_THREADS=1 mpirun -np $i "${2:-./MODULE_HSOLVER_dav_float}" - e2=$? - if [[ e1 -ne 0 || e2 -ne 0 ]];then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break -done \ No newline at end of file +for i in 6 3 2; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST DIAGO davidson in parallel, nprocs=$i" + OMP_NUM_THREADS=1 mpirun -np $i "${1:-./MODULE_HSOLVER_dav}" + e1=$? + OMP_NUM_THREADS=1 mpirun -np $i "${2:-./MODULE_HSOLVER_dav_float}" + e2=$? + if [[ e1 -ne 0 || e2 -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break +done diff --git a/source/source_hsolver/unittests/diago_lcao_parallel_test.sh b/source/source_hsolver/unittests/diago_lcao_parallel_test.sh index e7e296ec480..82488e7c107 100644 --- a/source/source_hsolver/unittests/diago_lcao_parallel_test.sh +++ b/source/source_hsolver/unittests/diago_lcao_parallel_test.sh @@ -1,20 +1,20 @@ #!/bin/bash -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 6 3 2;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST DIAGO davidson in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_HSOLVER_LCAO}" - mpirun -np $i "${2:-./MODULE_HSOLVER_dav_real}" - mpirun -np $i "${3:-./MODULE_HSOLVER_cg_real}" - if [[ $? != 0 ]];then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 6 3 2; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST DIAGO davidson in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_HSOLVER_LCAO}" + mpirun -np $i "${2:-./MODULE_HSOLVER_dav_real}" + mpirun -np $i "${3:-./MODULE_HSOLVER_cg_real}" + if [[ $? != 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_hsolver/unittests/diago_pexsi_parallel_test.sh b/source/source_hsolver/unittests/diago_pexsi_parallel_test.sh index 43e1c277107..32d93f86d71 100644 --- a/source/source_hsolver/unittests/diago_pexsi_parallel_test.sh +++ b/source/source_hsolver/unittests/diago_pexsi_parallel_test.sh @@ -1,18 +1,18 @@ #!/bin/bash -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 6 3 2;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST DIAGO PEXSI in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_HSOLVER_LCAO_PEXSI}" - if [[ $? != 0 ]];then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 6 3 2; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST DIAGO PEXSI in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_HSOLVER_LCAO_PEXSI}" + if [[ $? != 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_hsolver/unittests/parallel_k2d_test.sh b/source/source_hsolver/unittests/parallel_k2d_test.sh index f7ee917ce80..5e86e7d0940 100644 --- a/source/source_hsolver/unittests/parallel_k2d_test.sh +++ b/source/source_hsolver/unittests/parallel_k2d_test.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 8;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_HSOLVER_parak2d_test}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break +for i in 8; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_HSOLVER_parak2d_test}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break done diff --git a/source/source_io/unittests/write_wfc_nao_para.sh b/source/source_io/unittests/write_wfc_nao_para.sh index ddc0e8ae70e..c25f21ee112 100644 --- a/source/source_io/unittests/write_wfc_nao_para.sh +++ b/source/source_io/unittests/write_wfc_nao_para.sh @@ -1,18 +1,18 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" -for i in 4;do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_IO_write_wfc_nao}" - if [[ $? -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi - break -done \ No newline at end of file +for i in 4; do + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_IO_write_wfc_nao}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi + break +done diff --git a/source/source_lcao/module_operator_lcao/test/parallel_operator_tests.sh b/source/source_lcao/module_operator_lcao/test/parallel_operator_tests.sh index 2636680e9fb..926c0a4a3f4 100644 --- a/source/source_lcao/module_operator_lcao/test/parallel_operator_tests.sh +++ b/source/source_lcao/module_operator_lcao/test/parallel_operator_tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -np=`cat /proc/cpuinfo | grep "cpu cores" | uniq| awk '{print $NF}'` +np=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') echo "nprocs in this machine is $np" # Allow OpenMPI run as root @@ -8,23 +8,23 @@ export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 for i in 2 3 4; do - if [[ $i -gt $np ]];then - continue - fi - echo "TEST in parallel, nprocs=$i" - mpirun -np $i "${1:-./MODULE_LCAO_operator_overlap_cd_test}" - e1=$? - mpirun -np $i "${2:-./MODULE_LCAO_operator_overlap_test}" - e2=$? - mpirun -np $i "${3:-./MODULE_LCAO_operator_ekinetic_test}" - e3=$? - mpirun -np $i "${4:-./MODULE_LCAO_operator_nonlocal_test}" - e4=$? - mpirun -np $i "${5:-./MODULE_LCAO_operator_T_NL_cd_test}" - e5=$? - if [[ $e1 -ne 0 || $e2 -ne 0 || $e3 -ne 0 || $e4 -ne 0 || $e5 -ne 0 ]]; then - echo -e "\e[1;33m [ FAILED ] \e[0m"\ - "execute UT with $i cores error." - exit 1 - fi + if [[ $i -gt $np ]]; then + continue + fi + echo "TEST in parallel, nprocs=$i" + mpirun -np $i "${1:-./MODULE_LCAO_operator_overlap_cd_test}" + e1=$? + mpirun -np $i "${2:-./MODULE_LCAO_operator_overlap_test}" + e2=$? + mpirun -np $i "${3:-./MODULE_LCAO_operator_ekinetic_test}" + e3=$? + mpirun -np $i "${4:-./MODULE_LCAO_operator_nonlocal_test}" + e4=$? + mpirun -np $i "${5:-./MODULE_LCAO_operator_T_NL_cd_test}" + e5=$? + if [[ $e1 -ne 0 || $e2 -ne 0 || $e3 -ne 0 || $e4 -ne 0 || $e5 -ne 0 ]]; then + echo -e "\e[1;33m [ FAILED ] \e[0m" \ + "execute UT with $i cores error." + exit 1 + fi done