diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 0000000000..2223589f03 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,14 @@ +SIAB: codes to generate numerical atomic orbitals. +molden: generate molden style file for Multiwfn analysis. + +plot-tools: band structure, dos and pdos, dipole and adsorption. +rt-tddft-tools: tools for real-time tddft. +average_pot: python script used to calculate and plot the average electrostatic potential. +stm: generate figures related to Scanning tunneling microscope technique. + +generate_orbital.sh: script used to generate numerical atomic orbitals (NAO). +opt_abfs_bash: related to generating NAO basis set. +opt_lcao_bash: related to generating NAO basis set. +opt_orb_pytorch: related to generating NAO basis set. +opt_orb_pytorch_dpsi: related to generating NAO basis set. +qo: generate quasiatomic orbital (qo). diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/ChangeLog b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/ChangeLog deleted file mode 100644 index 1854d9e768..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/ChangeLog +++ /dev/null @@ -1,345 +0,0 @@ -Minimize Spillage Program Update Note. -Author : Mohan Chen -Email : mohan@mail.ustc.edu.cn -Locate : LQCC - -Na-bcc 29 kpoints use 15 pools and 15 processors. ---------- CLASS NAME--------------- NAME ----- TIME(sec) -- CALLS ----- AVG ----- PER% -! total 1052.41 1 1.1e+03 1e+02% -! Metropolis move_various_t 1e+03 5 2.1e+02 98% -! Metropolis move_one_step 1e+03 2000 0.51 98% -! PW_Basis (*)pdate_psi1d 6.1e+02 176005 0.0034 57% -! PW_Basis calculateS 2.8e+02 352010 0.0008 27% -! PW_Basis update_psi3d 1e+02 352010 0.0003 9.9% -! PW_Basis (*)get_sk 25 398506 6.2e-05 2.3% -! Orthogonal start 11 4 2.7 1% -! PW_Basis calculate_Jlq 9.8 45056 0.00022 0.93% -! Spillage TableOne 7.7 1 7.7 0.73% -! PW_Basis calculate_psi3d 0.32 90 0.0036 0.03% -! PW_Basis calculate_psi1d 0.23 45 0.0051 0.022% -! ReadData OverlapQ 0.11 1 0.11 0.01% --------------------------------------------------------------------------------------- -Start Time : Sat Jun 19 00:00:06 2010 -Finish Time : Sat Jun 19 00:24:25 2010 -Problem: -1. Need to improve update_psi1d. -2. Sk,gk can be chosen to calculated once and stored. -which can be 'tested' -3. Calculate_Jlq can be improved. -4. Memory calculation should be available. -5. Output time after each level. -6. More detail output information for large system. -7. Efficient restart mode. -8. Chosen bands information should be output correctly. - -VERSION 046 -11-07-22 Output ORBITAL_PW_GK.dat in pw_basis.cpp. -11-07-22 Update some output information, the order of plane wave in MCSP -is the same as in ESP. - -VERSION 045 -11-02-21 Add new functions in read_INPUT.cpp, can read INPUTs now. -11-02-21 Add new variables in tools.cpp - -VERSION 044 -10-08-06 Mohan Fix bug in SpillageStep, mz.lmax_type[it] -> LMAXALL, -because when using l < LMAXALL, we hope the program can go on running. -10-09-27 Mohan Fix bug in ReadData.cpp, the CARPOSX,Y,Z is useless. -10-10-15 Add a new parameter: START_KIN_TEM -11-02-19 Fix a bug, the id of elements should be numbrs, and the number -must > 0. - -VERSION 043 -10-07-21 Fix a bug in SpillageStep, about calculation of iw00. -10-07-22 Fix another bug during set iw00 in SpillageStep, -LMAXALL -> mz.lmax_type[it]. - -VERSION 042 -10-07-12 Reorder tools.h -10-07-13 Fix a bug, the Mkb and Mkb_used must be zero at first. -10-07-13 Fix a bug in out_orbital. the spillage in it is consistent with -spillage value in get_spillage now. - -VERSION 041 -10-06-18 Add some function in memory calculation. -10-06-18 Fix a bug in get_sk. -10-06-27 Using openmpi instead of mpich-1.2.7. -10-06-27 Fix a bug in MPI_Recv, the MPI_Status *ierror -> MPI_Status ierror. -10-06-27 Fix a bug in main.cpp, the MPI_Finalize should be added. - -VERSION 040 -10-06-18 Update timer. -10-06-18 Speed up orthogonal in Sq1q2 largely. -10-06-18 Add Way2iw in PW. -10-06-18 Add calculate_Jlq in PW. -10-06-18 Add calculate_Jlq_phi in PW. -10-06-18 Orthogonal is avalible for PW in both versions. -10-06-18 A small update about 'update_psi1d'. -10-06-18 Add unstable in SpillageStep. -10-06-18 Add reduce_int_all in parallel_reduce. -10-06-18 Refix the bug in spillagestep, about Mk and upbound. -10-06-18 Fix a bug in Out_Orbtial, about output spillage information. -10-06-18 Fix a 'very' serious bug in SpillageStep. -origin : Mk > spillage0 is not promised by every k point, -this is correct. Because spillage0 is also an average value -by sum_{ik,ib}. So I changed it to fill > spillage0. -I hope this is the final correct form! -10-06-18 Add parallel in Out_Orbital. -10-06-18 Delete two parallel about 'bcast c4' and 'unstable'. - -VERSION 039 -10-06-17 Change ylm to ylm[NKS], optimize speed. -10-06-17 Fix a bug in ReadData about USEPW. -10-06-17 Fix two bug in pw_basis::get_GVectors. -10-06-17 Fix a bug in ReadData about bcast. -10-06-17 KPAR is not readable in series version. -10-06-17 Add calculation of ig1, ig2, ig3 in pw_basic. -10-06-17 Add NMAXUSED and CALSPI in tools. -10-06-17 Add LMAXUSED. -10-06-17 Fix a bug in series version, the CARKX,Y,Z. -10-06-17 Structure factor not needed to update unless -it or ia changed. -10-06-17 Add && istep==0 condition in Metropolis. -10-06-17 Fix a serious bug in init_QS_matrix, calculate_psi1d -and calculate_psi3d must consistent in it. - -VERSION 038 -10-06-14 Add cartesian k point coordiantes. -10-06-14 Add LAT0 and bcast it. -10-06-15 Add new pw_basis class. -10-06-15 Add new heapsort file. -10-06-15 Add ylm_real file. -10-06-15 Add inverse_matrix file. -10-06-16 Fix a bug, bcast CARPOSX,Y,Z. -10-06-16 Distribut plane wave using my own algorithm. -10-06-16 dekete ggpsi in pw_basis. -10-06-16 Add m in wayd in spillagestep. -10-06-16 Bcast C4 after each trial_C4. -10-06-16 Change psi3d to 3 dimension (ik,iw,ig) -10-06-16 Add make note operation. -10-06-17 Available for plwane wave calculation. -10-06-17 Orthogonal not avalable yet. -10-06-17 Speed not optimized yet. - -VERSION 037 -10-06-14 Bcast S data available. -10-06-14 Bcast parameters in Metropolis. -10-06-14 Bcast parameters in Coefficients. -10-06-14 Bcast parameters in MultiZeta. -10-06-14 Bcast weight. -10-06-14 K points parallel available! -10-06-14 If I delete Sq, use plane wave instead. - -VERSION 036 -10-06-14 Add mpi information in main.cpp -10-06-14 Fix a bug about KPAR bcast. -10-06-14 Bcast Q data available. - -VERSION 035 -10-06-12 Delete Damping.cpp. -10-06-12 Add common.h -10-06-12 Add parallel_kpoints class. -10-06-12 Add parallel_common namespace. -10-06-12 Add parallel_reduce namespace. -10-06-12 Add parallel_global namespace. -10-06-12 Add pw_complement. -10-06-12 Add make s and make p in Makefile. -10-06-12 Add parallel_kpoints as a global class. -10-06-12 Add QUIT in tools. -10-06-12 Parallel enviroment is available. -10-06-12 First part of read_INPUT is done. -10-06-12 Add DESTROY(). -10-06-12 Add LATVEC, NA, LABEL, .... -10-06-12 Add matrix3 and vector3. -10-06-12 Delete inputs class. -10-06-12 not available yet. - -VERSION 034 -10-05-02~10-06-12 Tests are good. -10-06-14 Fix a bug in SpillageStep, judge the upbound, the -condition should be weight * Mkb > upbound. - -VERSION 033 -10-05-02 Change the 'get_value' in SpillageValue to a more suitable name: -'cal_defined_value'. -10-05-02 Add BANDS_CONTROL, BANDS_START, BANDS_END 3 variables in tools. -and used in get_spillage in SpillageStep. -10-05-02 Add Mkb and Mk in Step_Data. -10-05-02 Add ilevel in Multizeta. -10-05-02 Add output Mkb information in Out_Orbital. -10-05-02 Add Mkb_used in Step_Data. -10-05-02 Record Mkb in Metropolis. - -VERSION 032 -10-04-29 A bug fixed in SpillageStep, the S inverse matrix value can reach as -large as 1.0*e14, an the effective number in double precision is only 15. So -this may artificially number in S inverse matrix which can cause the multiplication -between Q and S^{-1} incorrect. I ignore the incorrect value introduced by -some sets of coefficients. - -VERSION 031 -10-04-19 Add 'zero' point in ouput psi. -10-04-21 Small modification of output information. - -VERSION 030 -10-04-17 The efficience of 'norm_c4' be improved. -10-04-17 The recalculation should start from file "ORBITAL_RESUTSL.txt". -10-04-17 Delete file ORBITAL_SAVE, replace ORBITAL_RESULTS.txt instead of ORBITAL.out.restart. -10-04-18 Change back c4 to c4^2 to calculate kinetic energy. - -VERSION 029 -10-04-14 Speedup 'get_ecut' about 30%. (can still be imptoved if we divide Psi) -10-04-14 Add a parameter 'OPTIMIZE_METHOD'. -10-04-15 Fix a bug, about the output mesh don't include the r=0 point. -10-04-16 Add PI in tools.cpp. -10-04-16 The kinetic energy is updated in Rydberg unit. -10-04-16 The kinetic energy is now |C|q^2*PI/rcut. -10-04-17 The kinetic energy have two equal formuals. -10-04-17 Fix a bug in norm_c4, the g(r) must be multiplied. - -VERSION 028 -10-04-13 Add more ecut judgement in 'Plot_Psi'. -10-04-14 Add a new method to minimize kinetic energy, calculate the Ecut. - -VERSION 027 -10-04-12 Output logmesh oritals for plot and for used. -10-04-12 Seperate the dr to minimize kinetic energy and ploting, add KINETIC_DR in tools. -10-04-13 Fix a bug about the normalization of logmesh in Plot_Psi. -10-04-13 Add 'establish ecut' in 'Plot_Psi' to establish the cutoff of each orbital. - -VERSION 026 -10-04-08 Delete write_c4, read_c4, write_c4_init in Coefficients class. -10-04-08 Rearrange the files, add src_tools dir and src_spillage dir. -10-04-11 Output the average spillage value. -10-04-11 Output C4 after each step. - -VERSION 025 -09-12-27 Divide output ORBITAL.MCSP to different element part. - -VERSION 024 -09-11-06 Fix a bug in Metropolis, about recalculate kinetic energy temperature. - -VERSION 023 -09-10-10 Add two-step kinetical energy minimization. -09-10-15 Update Metropolis.cpp. -09-10-16 Add accept_rate in Metropolis.cpp -09-10-31 Add auto adjust the accept_rate. -09-10-31 Add KINETIC_MAX in tools.h, which control the energy of orbital. - -VERSION 022 -09-09-26 Output COEFFICIENTS, PSI, PSI2 file. -09-09-26 Output oscillation, kinetic energy. - -VERSION 021 -09-09-11 Add Psi_Second class. - -VERSION 020 -09-08-27 Move ORBITAL.out filename to ORBITAL.out.txt -09-08-27 Modify Metropolis, 'ne > BLOCK_NE ' to 'ne >= BLOCK_NE' -09-08-27 Add RESTART in tools.h -09-08-27 Add state(string) in SpillageStep::TypeInformation. -09-08-28 Fix a bug in Coefficients.cpp, output_c4_name must be initialized in constructor. -09-08-28 Remove restart_c4 in read_INPUT. -09-08-28 Add class Damping in file Damping.cpp. -09-08-28 Add in Metropolis. -09-08-28 Add in tools.h - -VERSION 019 -09-08-20 Update SpillageValue::get_value, providing 3 schemes now. -09-08-24 Fix a bug in input, if the file is not exit, warning and quit. -09-08-26 Add BLOCK_NE as global. -09-08-26 Add a parameter in SCAN_BEGIN function in tools.h - -VERSION 018 -09-07-23 Abandon input file: "INPUTs", instead we read in information from first "spillage.dat" file. -09-07-23 Add in INPUT::read_PW_QS, to read "INPUTs" information. -09-07-23 Delete "read_site" in read_INPUT.cpp -09-07-24 Change all energy units from "Hartree" to Rydberg. -09-07-24 Fix a bug in Calculate_C4, lmax<3 change to lmax<5 - -VERSION 017 -09-07-12 Add average input in -09-07-12 Delete nchi in Coefficients, no used. -09-07-12 Delete 'm' member variable in way2Data, no used, furthermore, hard to define whene use average orbital. -09-07-12 Add average parameter in way2Data. -09-07-12 Add new function in SpillageStep. -09-07-12 Available for average orbital. - -VERSION 016 -09-05-23 Add reset_temperature in Metropolis -09-05-23 Add l_nchi in MultiZeta -09-06-09 Add value_each_step in SpillageValue. -09-06-09 Add nstep in read_INPUT file. -09-06-09 Output spillage value of each step in the output file. -09-06-14 Output "ORBITAL.MCSP" in Plot_Psi.cpp -09-06-14 Fix a bug in SpillageStep.cpp, assert(iw==nwfc) - -VERSION 015*** -09-05-22 Reconstruction of all program. - -VERSION 014 -09-05-13 Add two 'na' member and 'get_na()' function in read_INPUTs, -09-05-13 Input 'na' in CalculateSpillage Constructor -09-05-13 Fix a bug in allocate_index in CalculateSpillage, the iw2iw dimension must equal nwfc2 -09-05-14 Add WARNING_QUIT function in tools.cpp -09-05-14 Change name read_plot_c4 and read_cal_c4 in read_stuff -09-05-14 Delete iw_index in CalculateSpilalge, no used. -09-05-14 The sinv readin function return! - -VERSION 013 -09-05-02 Add spillage0 in ReadData class -09-05-02 Can correctly do double_zeta operation. -0.159% for GaAs(optimize separate) not much improved use 33Jl - -VERSION 012 -09-05-01 Add iw2iw in CalculateSpillage -09-05-01 Control write_c4 in CalculateSpillage -09-05-01 Add multi_zeta parameter in ReadData -09-05-01 Add test in some class -09-05-01 Available for combine double-zeta calculation. -0.21% for GaAs SZ -0.12% for GaAs DZ(optimized together) - -VERSION 011 -09-04-29 Add orthogonal flag in INPUT file. -09-04-29 Add Class Multi_zeta. -09-04-29 Add Qreal_readin and Qimag_readin in ReadData. -09-04-29 Available for seperate double-zeta calculation. But find a problem: The new set of bloch wave functions are not orthogonal. - -VERSION 010 -09-04-27 Open the gate for multi_zeta programming. - -VERSION 009 -09-04-27 Add class 'read_stuff', reduce the main program. -09-04-27 Add class 'MultiZeta', reduce the main program. - -VERSION 008 -09-04-26 Use ibz_kpoint to calculate spillage. -36000 steps/hour -09-04-26 Use new Lapack routine to calculate Inverse_Matrix -57000 steps/hour - -VERSION 007 -09-04-26 Add calss Inverse_Matrix -09-04-26 Accelarate using_zheev -4000 steps/hour - -VERSION 006 -09-04-26 Use the hermit symmetry of S matrix -3400 steps/hour - -VERSION 005 -09-04-19 Unit, -09-04-19 Can available for more than one stucture. -09-04-19 Reduce goback time. -2400 steps/hour - -VERSION 004 -09-04-18 Can plot wave functions. -09-04-18 Speedup S update routine. - -VERSION 003 -09-04-17 Speedup Q update routine. - -VERSION 002 -09-04 Available for calculate spillage without plane wave basis. diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/Makefile b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/Makefile deleted file mode 100644 index be472a8b4a..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/Makefile +++ /dev/null @@ -1,110 +0,0 @@ -#=========================================================== -# AUTHOR : mohan -# DATE START FROM : 2009-04-14 -# FUNCTION : spillage makefile -#=========================================================== -#Dirac -#CPLUSPLUS =CXX -O3 -w -ffast-math -funroll-loops -CPLUSPLUS = icpc -#CPLUSPLUS_GPROF = g++ -gp -#CPLUSPLUS_MPI = /opt/openmpi/bin/mpicxx -O3 -w -CPLUSPLUS_MPI = mpiicpc -#Einstein -#CPLUSPLUS_MPI = /opt/openmpi-intel9/bin/mpicxx -O3 -w - -#LIBS=-L/opt/intel/cmkl/10.2.5.035/lib/em64t -i-dynamic -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread \ - -LIBS=-L/opt/intel/cmkl/10.2.5.035/lib/em64t -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group - -TOOLS_OBJS=src_tools/mathzone.o \ - src_tools/matrix.o \ - src_tools/matrix3.o \ - src_tools/realarray.o \ - src_tools/intarray.o \ - src_tools/complexmatrix.o \ - src_tools/complexarray.o\ - src_tools/timer.o \ - src_tools/inverse_matrix.o\ - -SPILLAGE_OBJS=src_spillage/main.o \ - src_spillage/read_INPUT.o\ - src_spillage/ReadData.o\ - src_spillage/Calculate_C4.o\ - src_spillage/Coefficients.o\ - src_spillage/MultiZeta.o\ - src_spillage/SpillageStep.o\ - src_spillage/SpillageValue.o\ - src_spillage/Step_Data.o\ - src_spillage/Orthogonal.o\ - src_spillage/Type_Information.o\ - src_spillage/Metropolis.o\ - src_spillage/Out_Orbital.o\ - src_spillage/Plot_Psi.o\ - src_spillage/Psi_Second.o\ - src_spillage/tools.o \ - src_spillage/common.o \ - -PARALLEL_OBJS=src_parallel/parallel_global.o\ - src_parallel/parallel_common.o\ - src_parallel/parallel_reduce.o\ - src_parallel/parallel_kpoints.o - -PW_OBJS=src_pw/pw_basis.o\ - src_pw/pw_complement.o\ - src_pw/heapsort.o\ - src_pw/numerical_basis.o\ - src_pw/bessel_basis.o\ - src_pw/ylm_real.o\ - src_pw/memory_calculation.o\ - -OBJS = ${TOOLS_OBJS} \ - ${SPILLAGE_OBJS} \ - ${PARALLEL_OBJS} \ - ${PW_OBJS}\ - -help : - @echo 'make target list: ' - @echo 's : Series version of Monte Carlo Spillage Program.' - @echo 'p : Parallel Version of Monte Carlo Spillage Program.' - @echo 'note : some notes.' - -s : ${OBJS} - ${CPLUSPLUS} -o SIA_s.exe ${OBJS} ${LIBS} - -p : ${OBJS} - $(CPLUSPLUS_MPI) -D__MPI -o SIA_p.exe $(OBJS) $(LIBS) - -note : - @echo 'atom type label : it ' - @echo 'atom label for each type : ia ' - @echo 'The angular momentum : l ' - @echo 'The multiplicity : n ' - @echo 'The magnetic quantum num : m ' - @echo 'The k point index : ik ' - @echo 'The band index : ib ' - @echo 'The eigenvalue of Jlq : ie ' - @echo 'The radius cutoff (a.u.) : rcut ' - @echo 'The state is : psi(ib,ik) ' - @echo 'The local orbitals is : phi(it,ia,l,n,m) ' - @echo 'The index of local basis : nwfc(it,l,n)' - @echo 'The index of local basis : nwfc2(it,ia,l,n,m) ' - @echo 'The Spherical Bessel func : Jl(ie,rcut) ' - @echo 'The SB transform : \int Jl(ie,rcut) * Jl' - @echo 'The index of Jlq coef : Coef(it,l,n,ie)' - @echo 'The local orbitals formu : phi=\sum_{ie} Coef(it,l,n,ie) * Jl(ie,rcut)' - @echo 'The spillage formula is : S = ' - @echo 'The projector P is : P = \sum_{mu,nu} |phi_mu> S^{-1} = (1-P1) |psi1>' - @echo 'So we can fonud that : P1|psi2> = 0 ' - @echo 'the Q matrix is : Q = ' - @echo 'the S matrix is : S = ' - @echo 'start index of band : BANDS_START(count from 1, not 0) ' - @echo 'end index of band : BANDS_END ' - -.cpp.o: - ${CPLUSPLUS} -c $< -o $@ -# $(CPLUSPLUS_MPI) -c -D__MPI $< -o $@ - -.PHONY:clean -clean: - ${RM} *.o *.exe core* src_tools/*.o src_spillage/*.o tests_s/ORBITAL* tests_s/ORBITAL* src_parallel/*.o src_pw/*.o diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/Makefiles/Makefile.Einstein b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/Makefiles/Makefile.Einstein deleted file mode 100644 index c0bd26a3e9..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/Makefiles/Makefile.Einstein +++ /dev/null @@ -1,115 +0,0 @@ -#=========================================================== -# AUTHOR : mohan -# DATE START FROM : 2009-04-14 -# FUNCTION : spillage makefile -#=========================================================== -#Dirac -CPLUSPLUS =/usr/mpi/intel/openmpi-1.4.1/bin/mpicxx -O3 -#CPLUSPLUS_GPROF = g++ -gp -#CPLUSPLUS_MPI = /opt/openmpi/bin/mpicxx -O3 -w -CPLUSPLUS_MPI=/usr/mpi/intel/openmpi-1.4.1/bin/mpicxx -#Einstein -#CPLUSPLUS_MPI = /opt/openmpi-intel9/bin/mpicxx -O3 -w - -#EINSTEIN -#LIBS=-L/home/common/lib -llapack -lblas -lf2c - -#DIRAC -#LIBS = -L/share/apps/lib/ -llapack -lblas -L/share/data1/lib/ -lf2c\ - #-L/opt/intel/fce/9.1.052/lib/ -lifcore \ -#Einstein -#LIBS = -L/share/apps/lib -llapack -lblas -L/opt/intel/fce/9.1.052/lib/ -lifcore -LIBS = -L/opt/intel/cmkl/10.2.5.035/lib/em64t -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread - -TOOLS_OBJS=src_tools/mathzone.o \ - src_tools/matrix.o \ - src_tools/matrix3.o \ - src_tools/realarray.o \ - src_tools/intarray.o \ - src_tools/complexmatrix.o \ - src_tools/complexarray.o\ - src_tools/timer.o \ - src_tools/inverse_matrix.o\ - -SPILLAGE_OBJS=src_spillage/main.o \ - src_spillage/read_INPUT.o\ - src_spillage/ReadData.o\ - src_spillage/Calculate_C4.o\ - src_spillage/Coefficients.o\ - src_spillage/MultiZeta.o\ - src_spillage/SpillageStep.o\ - src_spillage/SpillageValue.o\ - src_spillage/Step_Data.o\ - src_spillage/Orthogonal.o\ - src_spillage/Type_Information.o\ - src_spillage/Metropolis.o\ - src_spillage/Out_Orbital.o\ - src_spillage/Plot_Psi.o\ - src_spillage/Psi_Second.o\ - src_spillage/tools.o \ - src_spillage/common.o \ - -PARALLEL_OBJS=src_parallel/parallel_global.o\ - src_parallel/parallel_common.o\ - src_parallel/parallel_reduce.o\ - src_parallel/parallel_kpoints.o - -PW_OBJS=src_pw/pw_basis.o\ - src_pw/pw_complement.o\ - src_pw/heapsort.o\ - src_pw/numerical_basis.o\ - src_pw/bessel_basis.o\ - src_pw/ylm_real.o\ - src_pw/memory_calculation.o\ - -OBJS = ${TOOLS_OBJS} \ - ${SPILLAGE_OBJS} \ - ${PARALLEL_OBJS} \ - ${PW_OBJS}\ - -help : - @echo 'make target list: ' - @echo 's : Series version of Monte Carlo Spillage Program.' - @echo 'p : Parallel Version of Monte Carlo Spillage Program.' - @echo 'note : some notes.' - -s : ${OBJS} - ${CPLUSPLUS} -o 045.MCSP_s.exe ${OBJS} ${LIBS} - -p : ${OBJS} - $(CPLUSPLUS_MPI) -D__MPI -o 045.MCSP_p.exe $(OBJS) $(LIBS) - -note : - @echo 'atom type label : it ' - @echo 'atom label for each type : ia ' - @echo 'The angular momentum : l ' - @echo 'The multiplicity : n ' - @echo 'The magnetic quantum num : m ' - @echo 'The k point index : ik ' - @echo 'The band index : ib ' - @echo 'The eigenvalue of Jlq : ie ' - @echo 'The radius cutoff (a.u.) : rcut ' - @echo 'The state is : psi(ib,ik) ' - @echo 'The local orbitals is : phi(it,ia,l,n,m) ' - @echo 'The index of local basis : nwfc(it,l,n)' - @echo 'The index of local basis : nwfc2(it,ia,l,n,m) ' - @echo 'The Spherical Bessel func : Jl(ie,rcut) ' - @echo 'The SB transform : \int Jl(ie,rcut) * Jl' - @echo 'The index of Jlq coef : Coef(it,l,n,ie)' - @echo 'The local orbitals formu : phi=\sum_{ie} Coef(it,l,n,ie) * Jl(ie,rcut)' - @echo 'The spillage formula is : S = ' - @echo 'The projector P is : P = \sum_{mu,nu} |phi_mu> S^{-1} = (1-P1) |psi1>' - @echo 'So we can fonud that : P1|psi2> = 0 ' - @echo 'the Q matrix is : Q = ' - @echo 'the S matrix is : S = ' - @echo 'start index of band : BANDS_START(count from 1, not 0) ' - @echo 'end index of band : BANDS_END ' - -.cpp.o: - ${CPLUSPLUS} -c $< -o $@ -# $(CPLUSPLUS_MPI) -c -D__MPI $< -o $@ - -.PHONY:clean -clean: - ${RM} *.o *.exe core* src_tools/*.o src_spillage/*.o tests_s/ORBITAL* tests_s/ORBITAL* src_parallel/*.o src_pw/*.o diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/README b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/README deleted file mode 100644 index 0099ea35cd..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/README +++ /dev/null @@ -1,6 +0,0 @@ -Systematically -Improvable -Atomic Orbitals -Generator -Based on -Spillage formula diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_common.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_common.cpp deleted file mode 100644 index bc86f2c2fd..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_common.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "parallel_common.h" -#include //this is needed because strcpy - -#ifdef __MPI -void Parallel_Common::bcast_string(string &object) -{ - char swap[100]; - if(MY_RANK == 0) strcpy(swap, object.c_str() ); - MPI_Bcast(swap, 100, MPI_CHAR, 0, MPI_COMM_WORLD); - if(MY_RANK != 0) object = static_cast( swap ); -// cout<<"\n"<( swap ); - } - return; -} - -void Parallel_Common::bcast_complex_double(complex &object) -{ - double a = object.real(); - double b = object.imag(); - Parallel_Common::bcast_double(a); - Parallel_Common::bcast_double(b); - object = std::complex( a, b); - return; -} - -void Parallel_Common::bcast_complex_double(complex *object, const int n) -{ - double *a = new double[n]; - double *b = new double[n]; - - for(int i=0; i( a[i], b[i]); - } - delete[] a; - delete[] b; -} - -void Parallel_Common::bcast_double(double &object) -{ - MPI_Bcast(&object, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); -// cout<<"\n"<( swap ); -// cout<<"\n"< -#endif -#include "../src_spillage/tools.h" - -namespace Parallel_Common -{ - //(1) bcast array - void bcast_complex_double( std::complex *object, const int n); - void bcast_string(string *object,const int n); - void bcast_double(double *object,const int n); - void bcast_int(int *object,const int n); - void bcast_char(char *object,const int n); - - //(2) bcast single - void bcast_complex_double( std::complex &object); - void bcast_string(string &object); - void bcast_double(double &object); - void bcast_int(int &object); - void bcast_bool(bool &object); - -} - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_global.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_global.cpp deleted file mode 100644 index 791bfe1650..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_global.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//========================================================== -// AUTHOR : fangwei, mohan -// DATE : 2009-11-08 -//========================================================== -#include "parallel_global.h" -#include "parallel_common.h" -#include "parallel_reduce.h" -#include "../src_spillage/tools.h" - -using namespace std; - -#if defined __MPI -MPI_Datatype mpicomplex; -MPI_Op myOp; -MPI_Comm POOL_WORLD; - -void Parallel_Global::myProd(complex *in, std::complex *inout,int *len,MPI_Datatype *dptr) -{ - for(int i=0;i<*len;i++) - { - (*inout).real()=(*inout).real()+(*in).real(); - (*inout).imag()=(*inout).imag()+(*in).imag(); - in++; - inout++; - } - return; -} -#endif - -void Parallel_Global::read_pal_param(int argc,char **argv) -{ -#if defined __MPI -//for test -/* - cout << "\n Hello! Test MPI NOW : argc = "< -extern MPI_Datatype mpicomplex; -extern MPI_Op myOp; -extern MPI_Comm POOL_WORLD; -#endif - -//void myProd(complex *in, std::complex *inout,int *len,MPI_Datatype *dptr); - -namespace Parallel_Global -{ - void read_pal_param(int argc, char **argv); - -#ifdef __MPI - void myProd(complex *in, std::complex *inout,int *len,MPI_Datatype *dptr); -#endif -} - - -#endif // GMPI diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_kpoints.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_kpoints.cpp deleted file mode 100644 index ef0b281f82..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_parallel/parallel_kpoints.cpp +++ /dev/null @@ -1,303 +0,0 @@ -#include "parallel_kpoints.h" -#include "parallel_global.h" -#include "parallel_common.h" - -Parallel_Kpoints::Parallel_Kpoints() -{ - nks_pool = new int[1]; - startk_pool = new int[1]; - whichpool = new int[1]; -} - -Parallel_Kpoints::~Parallel_Kpoints() -{ - delete[] nks_pool; - delete[] startk_pool; - delete[] whichpool; -} - -void Parallel_Kpoints::init(void) -{ - //TITLE("Parallel_Kpoints","init"); -#ifdef __MPI -//---------------------------------------------------------- -// CALL Function : divide_pools -//---------------------------------------------------------- - this->divide_pools(); - -// for test - - if(MY_RANK==0) - { - cout << "\n " << setw(8) << "MY_RANK" - << setw(8) << "MY_POOL" - << setw(13) << "RANK_IN_POOL" - << setw(6) << "NPROC" - << setw(6) << "KPAR" - << setw(14) << "NPROC_IN_POOL" << endl; - } - - ofs_running << "\n " << setw(8) << "MY_RANK" - << setw(8) << "MY_POOL" - << setw(13) << "RANK_IN_POOL" - << setw(6) << "NPROC" - << setw(6) << "KPAR" - << setw(14) << "NPROC_IN_POOL" << endl; - - for(int i=0;i mpi_split()"<= startpro_pool[i]) - { - MY_POOL=i; - } - } - - int key = 1; - RANK_IN_POOL = MY_RANK-startpro_pool[MY_POOL]; - - //======================================================== - // MPI_Comm_Split: Creates new communicators based on - // colors(2nd parameter) and keys(3rd parameter) - // Note: The color must be non-negative or MPI_UNDEFINED. - //======================================================== - MPI_Comm_split(MPI_COMM_WORLD,MY_POOL,key,&POOL_WORLD); -#endif - - return; -} - - -// the kpoints here are reduced after symmetry applied. -void Parallel_Kpoints::kinfo(int &nkstot) -{ -#ifdef __MPI - Parallel_Common::bcast_int(nkstot); - this->get_nks_pool(nkstot); - this->get_startk_pool(nkstot); - this->get_whichpool(nkstot); -#endif - return; -} - -void Parallel_Kpoints::get_whichpool(const int &nkstot) -{ - delete[] whichpool; - this->whichpool = new int[nkstot]; - ZEROS(whichpool, nkstot); - - for(int i=0; inks_pool[i]; ik++) - { - const int k_now = ik + startk_pool[i]; - this->whichpool[k_now] = i; - //ofs_running << "\n whichpool[" << k_now <<"] = " << whichpool[k_now]; - } - } - - return; -} - -void Parallel_Kpoints::get_nks_pool(const int &nkstot) -{ - delete[] nks_pool; - this->nks_pool = new int[KPAR]; - ZEROS(nks_pool, KPAR); - - const int nks_ave = nkstot/KPAR; - const int remain = nkstot%KPAR; - - //ofs_running << "\n nkstot = " << nkstot; - //ofs_running << "\n KPAR = " << KPAR; - //ofs_running << "\n nks_ave = " << nks_ave; - - for(int i=0; inks_pool[i] = nks_ave; - if(i &object) -{ -#ifdef __MPI - complex swap = object; - MPI_Allreduce(&swap, &object, 1, mpicomplex, myOp, MPI_COMM_WORLD); -#endif - return; -} - -void Parallel_Reduce::reduce_complex_double_pool(complex &object) -{ -#ifdef __MPI - complex swap = object; - MPI_Allreduce(&swap, &object, 1, mpicomplex, myOp, POOL_WORLD); -#endif - return; -} - -void Parallel_Reduce::reduce_complex_double_pool(complex *object, const int n) -{ -#ifdef __MPI - complex *swap = new std::complex[n]; - for(int i=0;iall[i]) - { - v = all[i]; - } - } - delete[] all; -#endif -} - -void Parallel_Reduce::gather_max_double_all(double &v) -{ -#ifdef __MPI - double *value=new double[NPROC]; - ZEROS(value, NPROC); - MPI_Allgather(&v, 1, MPI_DOUBLE, value, 1, MPI_DOUBLE, MPI_COMM_WORLD); - for(int i=0; ivalue[i]) - { - v = value[i]; - } - } - delete[] value; -#endif -} - -void Parallel_Reduce::gather_min_double_all(double &v) -{ -#ifdef __MPI - double *value=new double[NPROC]; - ZEROS(value, NPROC); - MPI_Allgather(&v, 1, MPI_DOUBLE, value, 1, MPI_DOUBLE, MPI_COMM_WORLD); - for(int i=0; ivalue[i]) - { - v = value[i]; - } - } - delete[] value; -#endif -} - -bool Parallel_Reduce::check_if_equal(double &v) -{ -#ifdef __MPI - double *all=new double[NPROC]; - MPI_Allgather(&v, 1, MPI_DOUBLE, all, 1, MPI_DOUBLE, MPI_COMM_WORLD); - for(int i=0; i 1.0e-9 ) - { - for(int j=0; jDk = dk; - - // to make a table - this->init_TableOne( SMOOTH, SIGMA, ECUT, RCUT, dr, Dk, LMAXALL, NE, TOLERENCE); - - return; -} - -double Bessel_Basis::Polynomial_Interpolation2 - (const int &l, const int &ie, const double &gnorm)const -{ - const double position = gnorm / this->Dk; - const int iq = static_cast(position); -// if(iq 0.0); - assert(dr > 0.0); - assert(dk > 0.0); - - // init kmesh - this->kmesh = static_cast(sqrt(ecutwfc) / dk) +1 + 4; - if (kmesh % 2 == 0)++kmesh; - cout << "\n kmesh = " << kmesh; - - // init Table One - this->TableOne.create(lmax+1, ecut_number, kmesh); - - // init rmesh - int rmesh = static_cast( rcut / dr ) + 4; - if (rmesh % 2 == 0) ++rmesh; - cout << "\n rmesh = " << rmesh; - - // allocate rmesh and Jlk and eigenvalue of Jlq - double *r = new double[rmesh]; - double *rab = new double[rmesh]; - double *jle = new double[rmesh]; - double *jlk = new double[rmesh]; - double *g = new double[rmesh]; // smooth function - double *function = new double[rmesh]; - double *en = new double[ecut_number]; - - for(int ir=0; ir(ir) * dr; - rab[ir] = dr; - if(smooth_in) - { - g[ir] = 1.0 - std::exp(-( (r[ir]-rcut)*(r[ir]-rcut)/2.0/sigma_in/sigma_in ) ); - } - } - - // init eigenvalue of Jl - for(int l=0; lTableOne(l, ie, ik) ); - } - - }// end ie - }// end ; - - delete[] en; - delete[] jle; - delete[] jlk; - delete[] rab; - delete[] g; - delete[] r; - delete[] function; - timer::tick("Spillage","TableOne"); - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/bessel_basis.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/bessel_basis.h deleted file mode 100644 index 0857edffa5..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/bessel_basis.h +++ /dev/null @@ -1,47 +0,0 @@ -//========================================================== -// AUTHOR : mohan -// DATE : 2009-3-29 -// Last Modify : 2009-08-28 -//========================================================== -#ifndef BESSEL_BASIS_H -#define BESSEL_BASIS_H -#include "../src_spillage/common.h" - -//========================================================== -// CLASS : -// NAME : Bessel_Basis -//========================================================== -class Bessel_Basis -{ -public: - Bessel_Basis(); - ~Bessel_Basis(); - - // used for a specific group of C4 coefficients. - void init( - const double &dk = 0.01, - const double &dr = 0.01); - - // get value from interpolation - double Polynomial_Interpolation2(const int &l, const int &ie, const double &gnorm)const; - - realArray TableOne; - -private: - int kmesh; - double Dk; - - // init table, used for output overlap Q. - void init_TableOne( - const bool smooth_in, - const double &sigma_in, - const double &ecut, - const double &rcut, - const double &dr, - const double &dk, - const int &lmax, - const int &ecut_number, - const double &tolerence); -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/heapsort.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/heapsort.cpp deleted file mode 100644 index 67ecac6489..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/heapsort.cpp +++ /dev/null @@ -1,171 +0,0 @@ -#include "../src_spillage/common.h" -#include "heapsort.h" - -void heapAjust(double *r, int *ind, int s, int m) -{ - int j, ic; - double rc; - rc = r[s]; - ic = ind[s]; - - for (j = 2 * s;j <= m;j *= 2) - { - if (j < m && (r[j] < r[j+1])) j++; - - if (!(rc < r[j])) break; - - r[s] = r[j]; - - ind[s] = ind[j]; - - s = j; - } - - r[s] = rc; - - ind[s] = ic; - return; -} - -void heapsort(const int n, double *r, int *ind) -{ - timer::tick("mymath","heapsort"); - int i, ic; - double rc; - - if (ind[0] == 0) - { - for (i = 0;i < n;i++) - { - ind[i] = i; - } - } - - for (i = n / 2;i >= 0;i--) - { - heapAjust(r, ind, i, n - 1); - } - - for (i= n - 1;i > 0;i--) - { - rc = r[0]; - r[0] = r[i]; - r[i] = rc; - ic = ind[0]; - ind[0] = ind[i]; - ind[i] = ic; - heapAjust(r, ind, 0, i - 1); - } - timer::tick("mymath","heapsort"); - return; -} - -/*-------------------------------------------------------------------- - subroutine hpsort(n,ra,ind) -c--------------------------------------------------------------------- -c sort an array ra(1:n) into ascending order using heapsort algorithm. -c n is input, ra is replaced on output by its sorted rearrangement. -c create an index table (ind) by making an exchange in the index array -c whenever an exchange is made on the sorted data array (ra). -c in case of equal values in the data array (ra) the values in the -c index array (ind) are used to order the entries. -c if on input ind(1) = 0 then indices are initialized in the routine, -c if on input ind(1) != 0 then indices are assumed to have been -c initialized before entering the routine and these -c indices are carried around during the sorting process -c -c no work space needed ! -c free us from machine-dependent sorting-routines ! -c -c adapted from Numerical Recipes pg. 329 (new edition) -*********************************************************************/ - -// from hpsort.f90 -void hpsort(int n, double *ra, int *ind) -{ - int i, ir, j, k, iind; - double rra; - - if (ind[1] == 0) - { - for (i = 1;i <= n;i++) - ind[i] = i; - } - - if (n < 2) return; // nothing to order - - k = n / 2 + 1; - - ir = n; - - while (true) - { - if (k > 1) // still in hiring phase - { - k = k - 1; - rra = ra[k]; - iind = ind[k]; - } - else // in retirement-promotion phase. - { - rra = ra[ir]; // clear a space at the end of the array - iind = ind[ir]; // - ra[ir] = ra[1]; // retire the top of the heap into it - ind[ir] = ind[1]; // - ir = ir - 1; // decrease the size of the corporation - - if (ir == 1) // done with the last promotion - { - ra[1] = rra; // the least competent worker at all // - ind[1] = iind; // - return; - } - } - - i = k; // wheter in hiring or promotion phase, we - - j = k + k; // set up to place rra in its proper level - - while (j <= ir) - { - if (j < ir) - { - if (ra[j] < ra[j+1]) // compare to better underling - { - j = j + 1; - } - else if (ra[j] == ra[j+1]) - { - if (ind[j] < ind[j+1]) - j = j + 1; - } - } - - if (rra < ra[j]) // demote rra - { - ra[i] = ra[j]; - ind[i] = ind[j]; - i = j; - j = j + j; - } - else if (rra == ra[j]) - { - if (iind < ind[j]) // demote rra - { - ra[i] = ra[j]; - ind[i] = ind[j]; - i = j; - j = j + j; - } - else - j = ir + 1; // set j to terminate do-while loop - } - else // this is the right place for rra - j = ir + 1; // set j to terminate do-while loop - } - - ra[i] = rra; - - ind[i] = iind; - } -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/heapsort.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/heapsort.h deleted file mode 100644 index ae40098c5a..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/heapsort.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef HEAPSORT_H -#define HEAPSROT_H -#include "../src_spillage/common.h" - -void heapsort(int n, double *r, int *ind); -void heapAjust(double r[], int ind[], int s, int m); -void hpsort(int n, double *ra, int *ind); - -#endif // HEAPSORT_H - - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/memory_calculation.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/memory_calculation.cpp deleted file mode 100644 index 1df8f7503d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/memory_calculation.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "memory_calculation.h" - -Memory::Memory() -{} - -Memory::~Memory() -{} - -void Memory::calculation(void) -{ - TITLE("Memory","calculation"); - - const double dk = 0.01; - int kmesh = static_cast(sqrt(ECUT) / dk) +1 + 4; - if (kmesh % 2 == 0)++kmesh; - - const int n1 = NTYPE; - const int n2 = LMAXUSED + 1; - const int n3 = NMAXUSED; - const int n4 = kmesh; - const int n1234 = n1 * n2 * n3 * n4; - - cout << "\n psi1d dimension(NTYPE, LMAXUSED+1, NMAXUSED, kmesh) : " << n1234 - << " = " << n1 << " * " << n2 << " * " - << n3 << " * " << n4 << " = " << n1234 * 8 / (double)1024 / (double)1024 << " MB"; - - for(int i=0; i[1]; - gcar_global = new Vector3[1]; - -#ifdef __MPI - gg = new double[1]; - gdirect = new Vector3[1]; - gcar = new Vector3[1]; -#endif - - ig1 = new int[1]; - ig2 = new int[1]; - ig3 = new int[1]; - - psi3d = new ComplexMatrix[1]; - ylm = new matrix[1]; - Jlq = new std::complex[1]; - - save = new std::complex[1]; - posmu = new int[1]; - posnu = new int[1]; -} - -PW_Basis::~PW_Basis() -{ - delete [] gcar_global; - delete [] gdirect_global; - delete [] gg_global; - -#ifdef __MPI - delete [] gcar; - delete [] gdirect; - delete [] gg; -#endif - - delete [] ig1; - delete [] ig2; - delete [] ig3; - - delete[] psi3d; - delete[] ylm; - delete[] Jlq; - - delete[] save; - delete[] posmu; - delete[] posnu; -} - -void PW_Basis::init(void) -{ - TITLE("PW_Basis","init"); - timer::tick("PW_Basis","init"); - - // (1) setup the energy cutoff, which is different in each pool, - // because the number of k points is differnt. - this->setup_gg(); - - // (2) setup the FFT dimension according to energy cutoff. - this->setup_FFT_dimension(); - - OUT(ofs_running,"ggwfc2(Ry)",ggwfc2); - - // (3) get the number of plane waves for wave functions. - this->ngmc_g = PW_complement::get_total_pw_number(0.0, ggchg, nx, ny, nz, GGT); - this->ngmw_g = PW_complement::get_total_pw_number(0.0, ggwfc2, nx, ny, nz, GGT); - - OUT(ofs_running,"ngmc_g",ngmc_g); - OUT(ofs_running,"ngmw_g",ngmw_g); - - // (4) get the local number of plane waves. - assert(NPROC_IN_POOL>0); - const int remain = ngmw_g % NPROC_IN_POOL; - this->ngmw = this->ngmw_g / NPROC_IN_POOL; - if (RANK_IN_POOL < remain) - { - this->ngmw++; - } - - if (RANK_IN_POOL < remain) - { - ngmw_start = ngmw * RANK_IN_POOL; - } - else - { - ngmw_start = (ngmw+1) * remain + ngmw * (RANK_IN_POOL-remain); - } - - OUT(ofs_running,"ngmw",ngmw); - //ofs_running << "\n ngmw_start = " << ngmw_start; - - // (5) init |g|, g_direct, g_cartesian - delete[] gdirect_global; - delete[] gcar_global; - delete[] gg_global; - - gdirect_global = new Vector3[ngmc_g];// indices of G vectors - gcar_global = new Vector3[ngmc_g]; - gg_global = new double[ngmc_g];// store the |G|^2 of the 1d array - - PW_complement::get_total_pw(gg_global, gdirect_global, 0.0, ggchg, nx, ny, nz, this->GGT, ngmc_g); - //PW_complement::get_total_pw(gg_global, gdirect_global, 0.0, ggwfc2, nx, ny, nz, this->GGT, ngmw_g); - PW_complement::setup_GVectors(this->G, ngmc_g, gg_global, gdirect_global, gcar_global); - - // (6) get ig1, ig2, ig3 -#ifdef __MPI - this->get_MPI_GVectors(); -#else - this->get_GVectors(); -#endif - // mohan add on 2011-07-23 - stringstream ss; - ss << "ORBITAL_PW_GK" << MY_RANK+1 << ".dat"; - ofstream ofs(ss.str().c_str()); - ofs << ggwfc2 << " (ggwfc2, Ry)" << endl; - ofs << ngmw << " (Number of plane wave basis for wave functions)" << endl; - for(int ig=0; igset_igk(); - - this->setup_structure_factor(); - timer::tick("PW_Basis","init"); - return; -} - -void PW_Basis::setup_gg(void) -{ - TITLE("PW_Basis","setup_gg"); - - //(1.1) lattice parameters - this->GT = LATVEC.Inverse(); - this->G = GT.Transpose(); - this->GGT = G * GT; - - // (1.2) tpiba and ecut - assert(LAT0 > 0.0); - this->tpiba = TWO_PI/LAT0; - this->tpiba2 = tpiba * tpiba; - this->ggpsi = ECUT / tpiba2; - - double wfac = 4.0; - this->ggchg = wfac * this->ggpsi; - - // (1.3) get ggwfc2 - assert( NKS > 0); - assert( CARKX != NULL ); - assert( CARKY != NULL ); - assert( CARKZ != NULL ); - - for (int ik=0; ikggpsi) + k_mod; - const double tmp2 = tmp * tmp ; - if (this->ggwfc2 < tmp2) this->ggwfc2 = tmp2; - } - - OUT(ofs_running,"NKS",NKS); - OUT(ofs_running,"ggpsi(Ry)",ggpsi*tpiba2); - OUT(ofs_running,"ggwfc2(Ry)",ggwfc2*tpiba2); - - // (1.4) initialize itia2iat - this->itia2iat = new int*[NTYPE]; - int iat=0; - for (int it=0; itnpwx = 0; - this->ngk = new int[NKS]; - ZEROS(this->ngk, NKS); - - assert(this->ngmw>0); - -// ofs_running << "\n\n ngmw = " << ngmw; -// ofs_running << "\n gg[ngmw-1]=" << gg[ngmw-1]; - for (int ik=0; ik kcar(CARKX[ik], CARKY[ik], CARKZ[ik]); - const double k2 = kcar * kcar; - int ng=0; - for (int ig=0; ig f = this->gcar[ig] + kcar; - const double gk2 = f * f; - if (sqrt(this->gg[ig]) > sqrt(this->ggpsi) + sqrt(k2)) - { - break; - } - if (gk2 <= this->ggpsi) - { - ++ng; - } - } - this->ngk[ik] = ng; - //ofs_running << "\n ngk[" << ik << "]=" << ngk[ik]; - if ( npwx < ng) - { - npwx = ng; - } - } - - OUT(ofs_running,"npwx",npwx); - - // set igk - this->igk = new int*[NKS]; - for (int ik=0; ikngk[ik]]; - ZEROS(igk[ik], ngk[ik]); - } - - for (int ik=0; ik kcar(CARKX[ik], CARKY[ik], CARKZ[ik]); - int ng=0; - const double k2 = kcar * kcar; - for (int ig=0; ig f = this->gcar[ig] + kcar; - const double gk2 = f * f; - if (sqrt(this->gg[ig]) > sqrt(this->ggpsi) + sqrt(k2)) - { - break; - } - if (gk2 <= this->ggpsi) - { - this->igk[ik][ng] = ig; - ++ng; - } - } - } - - return; -} - -// First stage Basis initialization. -// Set up crystal structure parameters. -void PW_Basis::setup_FFT_dimension() -{ - TITLE("PW_Basis","setup_FFT_dimension"); - - PW_complement::get_FFT_dimension(LATVEC, this->ggchg, nx, ny, nz); - this->nxyz = nx * ny * nz; - - OUT(ofs_running,"FFT wavefunctions",nx,ny,nz); - - return; -} - - - -#ifdef __MPI -void PW_Basis::get_MPI_GVectors(void) -{ - TITLE("PW_Basis","get_MPI_GVectors"); - - assert(ngmw>0); - - // (1) first part - delete[] gdirect; - delete[] gcar; - delete[] gg; - this->gdirect = new Vector3[ngmw]; - this->gcar = new Vector3[ngmw]; - this->gg = new double[ngmw]; - - for (int ig=0; igig1 = new int[ngmw]; - this->ig2 = new int[ngmw]; - this->ig3 = new int[ngmw]; - -// cout << "\n dim of ig1,2,3 = " << ngmw; - - for (int i = 0; i < ngmw; i++) - { - this->ig1[i] = int(this->gdirect[i].x) + nx; - this->ig2[i] = int(this->gdirect[i].y) + ny; - this->ig3[i] = int(this->gdirect[i].z) + nz; - } - - return; -}//end setup_mpi_GVectors -#else -void PW_Basis::get_GVectors(void) -{ - TITLE("PW_Basis","get_GVectors"); - timer::tick("PW_Basis","get_GVectors"); - - //************************************************************ - // g : Store the G vectors in 1d array (Cartian coordinate) - // ig : Store the G vectors in 1d array (Direct coordinate) - // gg : store the |G|^2 of the 1d array - //************************************************************ - - //---------------------------------------------------------- - // EXPLAIN : if not parallel case, we use pointer - // g and g_global are pointers to the same array - //---------------------------------------------------------- - this->gcar = this->gcar_global; - this->gdirect = this->gdirect_global; - this->gg = this->gg_global; - - // (2) calculate ig1, ig2, ig3 - assert(ngmw>0); - delete[] ig1; - delete[] ig2; - delete[] ig3; - this->ig1 = new int[ngmw]; - this->ig2 = new int[ngmw]; - this->ig3 = new int[ngmw]; - - for (int i = 0; i < ngmw; i++) - { - this->ig1[i] = int(this->gdirect[i].x) + nx; - this->ig2[i] = int(this->gdirect[i].y) + ny; - this->ig3[i] = int(this->gdirect[i].z) + nz; - } - - timer::tick("PW_Basis","get_GVectors"); - return; -}//end get_GVectors; -#endif - - -// Calculate structure factor -void PW_Basis::setup_structure_factor(void) -{ - TITLE("PW_Basis","setup_structure_factor"); - timer::tick("PW_Basis","setup_struc_factor"); - std::complex ci_tpi = NEG_IMAG_UNIT * TWO_PI; - std::complex x; - - this->strucFac = new std::complex*[NTYPE]; - for (int it=0; itstrucFac[it] = new std::complex[ngmw]; - ZEROS( strucFac[it], ngmw); - } - - for (int it=0; it< NTYPE; it++) - { - for (int ig=0; igstrucFac[it][ig] = std::complex( sum_cos, -sum_sin ); - - double tmpx = strucFac[it][ig].real() ; - double tmpy = strucFac[it][ig].imag() ; - } - } - - int nat = 0; - for (int it=0; iteigts1.create(nat, 2*this->nx + 1); - this->eigts2.create(nat, 2*this->ny + 1); - this->eigts3.create(nat, 2*this->nz + 1); - - Vector3 gtau; - Vector3 tau; - int iat = 0; - for (int it = 0; it < NTYPE; it++) - { - for (int ia = 0; ia < NA[it]; ia++) - { - tau.x = CARPOSX[it][ia]; - tau.y = CARPOSY[it][ia]; - tau.z = CARPOSZ[it][ia]; - - gtau = this->G * tau; //HLX: fixed on 10/13/2006 - - for (int n1 = -nx; n1 <= nx; n1++) - { - double arg = n1 * gtau.x; - this->eigts1(iat, n1 + nx) = exp( ci_tpi*arg ); - } - for (int n2 = -ny; n2 <= ny; n2++) - { - double arg = n2 * gtau.y; - this->eigts2(iat, n2 + ny) = exp( ci_tpi*arg ); - } - for (int n3 = -nz; n3 <= nz; n3++) - { - double arg = n3 * gtau.z; - this->eigts3(iat, n3 + nz) = exp( ci_tpi*arg ); - } - iat++; - } - } - timer::tick("PW_Basis","setup_struc_factor"); - return; -} - -complex* PW_Basis::get_sk(const int ik, const int it, const int ia)const -{ - timer::tick("PW_Basis","get_sk"); - const double arg = (CARKX[ik] * CARPOSX[it][ia] - + CARKY[ik] * CARPOSY[it][ia] - + CARKZ[ik] * CARPOSZ[it][ia] ) * TWO_PI; - const std::complex kphase = complex ( cos(arg), -sin(arg) ); - std::complex *sk = new std::complex[ this->ngk[ik] ]; - const int iat = this->itia2iat[it][ia]; - - for (int ig=0; ig< this->ngk[ik]; ig++) - { -// cout << "\n ig=" << ig << endl; - const int iig = this->igk[ik][ig]; - assert( iig < ngmw ); - - if (!(ig1[iig] >= 0 && ig1[iig] < 2*nx + 1) ) - { - cout << "\n ig1[iig] = " << ig1[iig] << endl; - QUIT(); - } - - if (!(ig2[iig] >= 0 && ig2[iig] < 2*ny + 1) ) - { - cout << "\n ig2[iig] = " << ig2[iig] << endl; - QUIT(); - } - - if (!(ig3[iig] >= 0 && ig3[iig] < 2*nz + 1) ) - { - cout << "\n iig = " << iig << endl; - cout << "\n ig3[iig] = " << ig3[iig] << endl; - QUIT(); - } - - sk[ig] = kphase - * this->eigts1(iat, this->ig1[iig]) - * this->eigts2(iat, this->ig2[iig]) - * this->eigts3(iat, this->ig3[iig]); - } - timer::tick("PW_Basis","get_sk"); - return sk; -} - -Vector3 PW_Basis::get_1qvec_cartesian(const int ik,const int ig)const -{ - Vector3 kvec = Vector3(CARKX[ik], CARKY[ik], CARKZ[ik]); - Vector3 qvec = kvec + this->gcar[ this->igk[ik][ig] ]; - return qvec; -} - -void PW_Basis::table(void) -{ - TITLE("PW_Basis", "table"); - NBasis.init_table(); - - const int total_lm = ( LMAXUSED + 1) * ( LMAXUSED + 1); - - delete[] ylm; - this->ylm = new matrix[NKS]; - - for (int ik=0; ikylm[ik].create(total_lm, npw); - - // (1) get the vector k+G - Vector3 *gk = new Vector3 [npw]; - for (int ig=0; igget_1qvec_cartesian(ik, ig); - } - - // (2) generate ylm according to different k. - // (or we can save the ylm for only once but all k points. - Ylm_Real(total_lm, npw, gk, this->ylm[ik]); - - delete[] gk; - } - - - // init index of iw00 - assert(NWFCALL>0); - this->iwindex = new Way2iw[NWFCALL]; - - int iw=0; - for(int it=0; itnwfc2 = mz.Level[il].nwfc2; - - this->Dk = 0.01; - this->kmesh = static_cast(sqrt(ECUT) / Dk) + 1 + 4; - if (kmesh % 2 == 0) ++kmesh; - - this->psi1d.create(NTYPE, LMAXUSED+1, NMAXUSED, kmesh); - - delete[] save; - delete[] posmu; - delete[] posnu; - - const int dim = nwfc2 * nwfc2; - save = new std::complex[dim]; - posmu = new int[dim]; - posnu = new int[dim]; - ZEROS(save, dim); - ZEROS(posmu, dim); - ZEROS(posnu, dim); - return; -} - -void PW_Basis::calculate_psi1d(void) -{ - timer::tick("PW_Basis","calculate_psi1d"); - psi1d.zero_out(); - for (int it=0; itpsi1d(it,l,n,ikm) += input.Coef.C4(it, l, n ,ie) - * Numerical_Basis::bessel_basis.TableOne(l, ie, ikm); - } - } - } - } - } - timer::tick("PW_Basis","calculate_psi1d"); - return; -} - -void PW_Basis::allocate_psi3d(const int &level) -{ - - // allocate the number of wave functions. - // consider(it, ia, l, n, m) - delete[] psi3d; - psi3d = new ComplexMatrix[NKS]; - - for (int ik=0; ikpsi3d[ik].create(nwfc2, npwx); - } - return; -} - - -void PW_Basis::calculate_psi3d(const int &ilevel, const int &ik) -{ - //TITLE("PW_Basis", "calculate_psi3d"); - timer::tick("PW_Basis", "calculate_psi3d"); - // (1) get the vector k+G - - ofs_running << " calculate_psi3d" << endl; - ofs_running << " ilevel = " << ilevel << " ik = " << ik << endl; - - const int npw = ngk[ik]; - - Vector3 *gk = new Vector3 [npw]; - for (int ig=0; igget_1qvec_cartesian(ik, ig); - } - - double *flq = new double[npw]; - for (int iw=0; iwnwfc2; iw++) - { - // for each wave function in nwfc2(it, i, l, n) - const int it = mz.Level[ilevel].wayd[iw].type; - const int ia = mz.Level[ilevel].wayd[iw].i; - const int l = mz.Level[ilevel].wayd[iw].L; - const int n = mz.Level[ilevel].wayd[iw].N; - const int m = mz.Level[ilevel].wayd[iw].m; - std::complex lphase = pow(IMAG_UNIT, l); - - // get flq from psi1d for each k point - for (int ig=0; igPolynomial_Interpolation(it, l, n, gk[ig].norm() * this->tpiba ); - } - - // get the structure wave functions for each k point. - std::complex *sk = this->get_sk(ik, it, ia); - - const int lm = l*l+m; - for (int ig=0; ig PW_Basis::calculateS(const int &iw, const int &iw2, const int &ik) -{ - std::complex overlap = 0.0; - for (int ig=0; igpsi3d[ik](iw, ig)) * this->psi3d[ik](iw2, ig); - } -// move this outside to get_spillage -#ifdef __MPI -// Parallel_Reduce::reduce_complex_double_pool(overlap); -#endif - return overlap; -} - - -void PW_Basis::update_psi1d(const int &il, const int &ic, const int &ie, - const double &c4_now, const double &c4_old) -{ - timer::tick("PW_Basis","update_psi1d"); - - // a small trick - // ALGORITHM : when we change psi1d, we don't know - // this psi1d will be accepted or rejected. - // However, it has been changed. - // So, in the next time, we recalculate them - // using C4. - static int it_last = -1; - static int l_last = -1; - static int n_last = -1; - - const int it_now = mz.Level[il].wayc[ic].type; - const int l_now = mz.Level[il].wayc[ic].L; - const int n_now = mz.Level[il].wayc[ic].N; - - for (int it=0; itpsi1d(it,l,n,ikm) = sum; - } - } - else if(it==it_now || l==l_now || n==n_now) - { - for (int ikm=0; ikmpsi1d(it,l,n,ikm) += (c4_now-c4_old) * Numerical_Basis::bessel_basis.TableOne(l, ie, ikm); - } - } - } - } - } - - it_last = it_now; - l_last = l_now; - n_last = n_now; - - timer::tick("PW_Basis","update_psi1d"); - return; -} - -void PW_Basis::update_psi3d( const int &il, const int &ic, const int &ik) -{ -// TITLE("PW_Basis","update_psi1d3d"); - timer::tick("PW_Basis","update_psi3d"); - - const int npw = ngk[ik]; - static int it_old; - static int ia_old; - static int l_old; - static int n_old; - static bool allocate=false; - static int *ic_last; - if (!allocate) - { - ic_last = new int[NKS]; - for (int ik=0; ik *gk = new Vector3 [npw]; - for (int ig=0; igget_1qvec_cartesian(ik, ig); - } - double *flq = new double[npw]; - std::complex *sk = new std::complex[1]; - std::complex *samepart = new std::complex[npw]; - for (int iw=0; iwnwfc2; iw++) - { - const int ic1 = mz.Level[il].wayd[iw].ic; - if (ic1 == ic || ic1 == ic_last[ik]) - { - // for each wave function in nwfc2(it, i, l, n) - const int it = mz.Level[il].wayd[iw].type; - const int ia = mz.Level[il].wayd[iw].i; - const int l = mz.Level[il].wayd[iw].L; - const int n = mz.Level[il].wayd[iw].N; - const int m = mz.Level[il].wayd[iw].m; - std::complex lphase = pow(IMAG_UNIT, l); - - // a small trick: get the structure wave functions for each k point. - if (it==it_old && ia==ia_old) - { - // do nothing - } - else - { - delete[] sk; - sk = this->get_sk(ik, it, ia); - } - - // small trick (2) : get flq from psi1d for each k point - if (it==it_old && l==l_old && n==n_old) - { - // do nothing - } - else - { - for (int ig=0; igPolynomial_Interpolation(it, l, n, gk[ig].norm() * this->tpiba ); - } - } - - // small trick (3) - if (it==it_old && ia==ia_old && l==l_old && n==n_old) - { - //samepart is the same as the previous one. - } - else - { - for (int ig=0; igDk; - const int iq = static_cast(position); - assert(iq < kmesh-4); - const double x0 = position - static_cast(iq); - const double x1 = 1.0 - x0; - const double x2 = 2.0 - x0; - const double x3 = 3.0 - x0; - const double y= - this->psi1d(it, l, n, iq) * x1 * x2 * x3 / 6.0 + - this->psi1d(it, l, n, iq) * x0 * x2 * x3 / 2.0 - - this->psi1d(it, l, n, iq) * x1 * x0 * x3 / 2.0 + - this->psi1d(it, l, n, iq) * x1 * x2 * x0 / 6.0 ; - return y; -} - - -void PW_Basis::calculate_Jlq(const int &ik, const int &iw, const int &ie) -{ - //TITLE("PW_Basis", "calculate_Jlq"); - timer::tick("PW_Basis","calculate_Jlq"); - - const int npw = this->ngk[ik]; - const int it= iwindex[iw].type; - const int ia= iwindex[iw].i; - const int l = iwindex[iw].L; - const int m = iwindex[iw].m; - - // generate 1d Jlq. - Vector3 *gk = new Vector3 [npw]; - double* flq=new double[npw]; - for (int ig=0; igget_1qvec_cartesian(ik, ig); - } - for (int ig=0; igtpiba ); - } - - // generate 3d Jlq. - delete[] Jlq; - Jlq = new std::complex[npw]; - std::complex *sk = this->get_sk(ik, it, ia); - - const int lm = l*l+m; - std::complex lphase = pow(IMAG_UNIT, l); - for (int ig=0; ig PW_Basis::calculate_Jlq_Phi(const int &ik, const int &mu) -{ - const int npw = this->ngk[ik]; - complex overlap = std::complex(0,0); - for(int ig=0; ig** strucFac; // StrucFac [ntype,ngmax] - - int ngmw; //(= ngmax) / num. of G vectors within ggfft - int ngmw_g; - int ngmw_start; - - int ngmc; - int ngmc_g; - int ngmc_start; - - Vector3 *gdirect; //(= *G1d) ; // ig = new Vector igc[ngmc], - Vector3 *gdirect_global; //(= *G1d) ; // ig = new Vector igc[ngmc], - Vector3 *gcar; //G vectors in cartesian corrdinate - Vector3 *gcar_global; //G vectors in cartesian corrdinate - double *gg; // modulus (G^2) of G vectors - double *gg_global; // modulus (G^2) of G vectors - - ComplexMatrix eigts1; // - ComplexMatrix eigts2; //the phases e^{-iG*tau_s} - ComplexMatrix eigts3; // - int *ig1; // - int *ig2; // the indices of G components - int *ig3; // - - PW_Basis(); - ~PW_Basis(); - - void init(void); - void setup_structure_factor(void); // Calculate structur factors - void get_sk(void); - complex* get_sk(const int ik, const int it, const int ia)const; - Vector3 get_1qvec_cartesian(const int ik,const int ig)const; - - void table(void); - Numerical_Basis NBasis; - - void allocate_psi1d(const int &il); - void allocate_psi3d(const int &level); - realArray psi1d; - ComplexMatrix *psi3d; - matrix *ylm; - - void calculate_psi1d(void); - // FUNCTION: - // use psi1d to generate 3D wave functions. - // psi3d(it, ia, l, n, m) for each k point. - void calculate_psi3d(const int &ilevel, const int &ik); - - void update_psi1d(const int &il, const int &ic, const int &ie, - const double &c4_now, const double &c4_old); - - int nwfc2; - - void update_psi3d( const int &il, const int &ic, const int &ik); - - int kmesh; - double Dk; - - // FNCTION: - // calculate the overlap between psi(it, ia, l, n, m) - // be called in SpillageStep::init_QS_matrix - complex calculateS(const int &iw, const int &iw2, const int &ik); - - void calculate_Jlq(const int &ik, const int &iw, const int &ie); - complex *Jlq; - complex calculate_Jlq_Phi(const int &ik, const int &mu); - - complex *save; - int* posmu; - int* posnu; - -private: - void set_igk(void); - void setup_gg(void); - void setup_FFT_dimension(void); // set up FFT dimensions -#ifdef __MPI - void get_MPI_GVectors(void); -#else - void get_GVectors(void); -#endif - - // FUNCTION: - // use interpolation scheme to get the one dimension wave function for - // each k point - double Polynomial_Interpolation(const int &it, const int &l, const int &n, const double &gnorm)const; - - Way2iw* iwindex; - -}; -#endif //PlaneWave class diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/pw_complement.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/pw_complement.cpp deleted file mode 100644 index a2ab75cada..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/pw_complement.cpp +++ /dev/null @@ -1,267 +0,0 @@ -#include "pw_complement.h" -#include "heapsort.h" - -int PW_complement::get_total_pw_number( - const double& ggcut_start, - const double& ggcut_end, - const int& nx, - const int& ny, - const int& nz, - const Matrix3& GGT) -{ - TITLE("PW_complement","get_total_pw_number"); - if (ggcut_end<=0.0) - { - WARNING_QUIT("PW_complement::get_total_pw_number","ggcut <= 0.0"); - } - // First, figure out the number of G-vectors within the cutoff G2max. - int ibox[3]={0,0,0}; - - // mohan modify 2008-3-25 nx -> ncx ,ny-> ncy, nz->ncz - ibox[0] = int(nx / 2) + 1; - ibox[1] = int(ny / 2) + 1; - ibox[2] = int(nz / 2) + 1; - - // first create the auxiliary arrays for the 1D G vectors - Vector3 f; - int ngm = 0 ; - for (int i = -ibox[0]; i <= ibox[0]; i++) - { - for (int j = -ibox[1]; j <= ibox[1]; j++) - { - for (int k = -ibox[2]; k <= ibox[2]; k++) - { - f.x = i; - f.y = j; - f.z = k; - double g2 = f * (GGT * f); //G2= |f|^2 in the unit of (2Pi/lat0)^2 - - if (g2 < ggcut_end && g2 >= ggcut_start) - { - ngm++; - } - } - } - } - return ngm; -} - -void PW_complement::get_total_pw( - double* gg, - Vector3 *ig, - const double& ggcut_start, - const double& ggcut_end, - const int& nx, - const int& ny, - const int& nz, - const Matrix3& GGT, // GGT = G*GT. - int& ngm// number of total plane waves. -) -{ - TITLE("PW_complement","get_total_pw"); - timer::tick("PW_complement","get_total_pw"); - if (ggcut_end<=0.0) - { - WARNING_QUIT("PW_complement::get_total_pw","ggcut <= 0.0"); - } - // First, figure out the number of G-vectors within the cutoff G2max. - int ibox[3]={0,0,0}; - - // mohan modify 2008-3-25 nx -> ncx ,ny-> ncy, nz->ncz - ibox[0] = int(nx / 2) + 1; - ibox[1] = int(ny / 2) + 1; - ibox[2] = int(nz / 2) + 1; - - // first create the auxiliary arrays for the 1D G vectors - Vector3 f; - int ng = 0; - for (int i = -ibox[0]; i <= ibox[0]; i++) - { - for (int j = -ibox[1]; j <= ibox[1]; j++) - { - for (int k = -ibox[2]; k <= ibox[2]; k++) - { - f.x = i; - f.y = j; - f.z = k; - double g2 = f * (GGT * f); //G2= |f|^2 in the unit of (2Pi/lat0)^2 - if (g2 < ggcut_end && g2 >= ggcut_start) - { - /*** g vector indices f=(i,j,k) ***/ - ig[ng] = f ; - gg[ng] = g2; - //cout<0,use the input - // FFT grid, otherwise generate the FFT grid in the code. - - int i = 0; - Vector3 lat; - int ibox[3]={0,0,0}; - - // ibox[i] are the minimal FFT dimensions, - lat.x = latvec.e11; - lat.y = latvec.e12; - lat.z = latvec.e13; - ibox[0] = 2 * int(sqrt(ggcut) * sqrt(lat * lat)) + 1; - - lat.x = latvec.e21; - lat.y = latvec.e22; - lat.z = latvec.e23; - ibox[1] = 2 * int(sqrt(ggcut) * sqrt(lat * lat)) + 1; - - lat.x = latvec.e31; - lat.y = latvec.e32; - lat.z = latvec.e33; - ibox[2] = 2 * int(sqrt(ggcut) * sqrt(lat * lat)) + 1; - //lat*lat=lat.x*lat.x+lat.y*lat.y+lat.z+lat.z - - /* Find the minimal FFT box size the factors into the primes (2,3,5,7). */ - -// log << "\n ibox[0]= "<< ibox[0] << " ibox[1] = "< *igsort = new Vector3[ngmc_g_in]; - for (int i=0;i *igsort, - const double& ggcut_start, const double& ggcut_end, - const int& nx, const int& ny, const int& nz, const Matrix3& GGT, // GGT = G*GT - int& ngm); // number of total plane waves. - -// output nx, ny, nz according to input: latve and ggcut. -void get_FFT_dimension(const Matrix3& latvec, const double &ggcut, int &nx, int &ny, int &nz); - -//========================================================== -// MEMBER FUNCTION : -// NAME : PW_Basis::setup_GVectors -// Second part of the initialization : find out all G -// vectors that |G|^2<=G2max and map it into a one -// dimentional array G1d in the increase order of |G|^2. -// Next generate the indices between the 1D array and -// the 3D G-grid and the FFT grid. -// generate : gg_global, g_global, ig_global -//========================================================== -void setup_GVectors(const Matrix3& G, const int &ngmc_g, double* gg, - Vector3* ig, Vector3* g); -} - - -#endif - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/ylm_real.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/ylm_real.cpp deleted file mode 100644 index 5fcc7724f4..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/ylm_real.cpp +++ /dev/null @@ -1,295 +0,0 @@ -#include "ylm_real.h" -#include "../src_parallel/parallel_reduce.h" -#include "../src_spillage/tools.h" - -//========================================================== -// MEMBER FUNCTION : -// NAME : YLM_REAL(Real spherical harmonics ylm(G) up to l=lmax -// Use Numerical recursive algorithm as given in Numerical Recipes -//========================================================== -void Ylm_Real -( - const int lmax2, // lmax2 = (lmax+1)^2 - const int ng, // - const Vector3 *g, // g_cartesian_vec(x,y,z) - matrix &ylm // output -) -{ -// TITLE("Mathzone","Ylm_Real"); -// timer::tick("Mathzone","Ylm_Real"); - - if (ng<1 || lmax2<1) - { - cout << "\n YLM_REAL: ng < 1 or lmax2 < 1"; - QUIT(); - timer::tick("Mathzone","Ylm_Real"); - return; - } - -//---------------------------------------------------------- -// EXPLAIN : find out lmax -//---------------------------------------------------------- - bool out_of_range = true; - int lmax = 0; - for (int l= 0; l< 30; l++) - { - if ((l+1)*(l+1) == lmax2) - { - lmax = l; - out_of_range = false; - break; - } - } - if (out_of_range) - { - WARNING_QUIT("YLM_REAL","l>30 or l<0"); - } - -//---------------------------------------------------------- -// EXPLAIN : if lmax = 1,only use Y00 , output result. -//---------------------------------------------------------- - if (lmax == 0) - { - for (int i=0;i 1.0e-9) - { - phi[ig] = atan(g[ig].y / g[ig].x); - } - else if (g[ig].x < -1.e-9) - { - phi[ig] = atan(g[ig].y / g[ig].x) + PI; - } - else - { - phi[ig] = PI_HALF * ((g[ig].y >= 0.0) ? 1.0 : -1.0); //HLX: modified on 10/13/2006 - } // end if - } // enddo - -//========================================================== -// NAME : p(Legendre Polynomials) (0 <= m <= l) -//========================================================== - realArray p(lmax+1,lmax+1,ng); - int m; - int i; - double x1, x2; - int lm = -1; - for (int l=0; l<=lmax; l++) - { - const double c = sqrt((2*l+1) / FOUR_PI); - if (l == 0) - { - for (i=0;i(l) / 2.0) ;//mohan modify 2007-10-13 - if (l%2 == 1) - { - p(l, l, i) = -p(l, l, i); - } - } - } // end if - - // Y_lm, m = 0 - ++lm; - for (i=0;i 0 - const double same = c * sqrt - ( - static_cast(Fact(l - m)) / - static_cast(Fact(l + m)) - ) - *SQRT2; - - ++lm; - for (i=0;i1; i--) - { - f *= i; -// if(n>16) -// { -// cout<<"\n n="<16) QUIT(); - - return f; -} - -int Semi_Fact(const int n) -{ - int semif = 1; - for (int i=n; i>2; i -= 2) - { - semif *= i; - } - return semif; -} - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/ylm_real.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/ylm_real.h deleted file mode 100644 index 84a344392e..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/ylm_real.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef YLM_REAL_H -#define YLM_REAL_H -#include "../src_tools/vector3.h" -#include "../src_tools/realarray.h" -#include "../src_tools/matrix.h" -using namespace std; - -void Ylm_Real -( - const int lmax2, // lmax2 = (lmax+1)^2 - const int ng, // - const Vector3 *g, // g_cartesian_vec(x,y,z) - matrix &ylm // output -); - -long double Fact(const int n); -int Semi_Fact(const int n); - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Calculate_C4.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Calculate_C4.cpp deleted file mode 100644 index acb162d589..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Calculate_C4.cpp +++ /dev/null @@ -1,559 +0,0 @@ -//========================================================== -// AUTHOR : mohan -// DATE : 2009-03-18 ( version 1.0 ) -// 2009-04-14 ( version 1.1 ) -// 2009-05-19 change file name -//========================================================== -#include "Calculate_C4.h" -#include "tools.h" - -int Calculate_C4::test = 0; -Calculate_C4::Calculate_C4(){} -Calculate_C4::~Calculate_C4(){} - -//=================================================================== -// FUNCTION : Find_Eigenvalues -// DESCRIPTION : Find 'Enumber' number of eigenvalues of -// spherical bessel function from '0~lmax', and put the -// result eigenvalues in 'en' matrix. -// P.S: (1) The eigenvalues are calculated '< tolerence' -// accuracy. -// P.S: (2) The rcut is important for cacluating eigenvalues -// because it makes jl( rcut * eigenvalue ) = 0.00 -//==================================================================== -void Calculate_C4::Find_Eigenvalues(const int &Enumber, matrix &en, - const int &lmax, const double &rcut, const double &tolerence) -{ - double *e = new double[Enumber]; - for(int l=0; l( rcut / dr)+1; - if(mesh % 2 == 0) mesh++; - cout << "\n\n Mesh for test = " << mesh << " L = " << L; - - double *r = new double[mesh]; - double *rab = new double[mesh]; - double *e = new double[Enumber]; - double *jle = new double[mesh]; - double *jtest = new double[mesh]; - double *function = new double[mesh]; - - for(int i=0; i C4_firstly -// (5) ues int_{0}^{Rc} J1(q1*r)*Jl(q1*r)*r*r dr ==> norm -// (6) C4 = C4_firstly / norm -//=================================================================== -void Calculate_C4::key_solver(const string &name, const int &L, const matrix &en, const int &Enumber, double *C4) -{ - ifstream ifs(name.c_str()); - if(!ifs) - { - cout << "\n Can't find file : " << name; - } - else - { - cout << "\n Open file " << name; - } - - string title; - - int mesh; - ifs >> title >> mesh; - assert(mesh > 0); - cout << "\t mesh = "<> title >> title >> title; - - for(int i=0; i> r[i] >> psi[i] >> rab[i]; - } - - double norm = 0.0; - for(int i=0; i(rcut / dr)+1; //mohan update 2009-10-10 - if(mesh % 2 == 0) mesh++; - - if(test==1) - { - cout << "\n norm : mesh = " << mesh; - cout << "\n type = " << ntype; - cout << "\n lmax = " << lmax; - cout << "\n enumber = " << enumber; - } - - // init radial mesh - double *r = new double[mesh]; - for(int i=0; i") ) - { - string filedir; - READ_VALUE( ifs, filedir ); - READ_VALUE( ifs, l ); - READ_VALUE( ifs, ecut ); - READ_VALUE( ifs, rcut ); - READ_VALUE( ifs, enumber ); - READ_VALUE( ifs, tolerence ); - cout << "\n l = " << l; - cout << "\n ecut = " << ecut; - cout << "\n enumber = " << enumber; - SCAN_END(ifs, ""); - } - - // init c4 - c4 = new double[enumber]; - ZEROS(c4, enumber); - if( SCAN_BEGIN(ifs,"") ) - { - assert(enumber>0); - for(int i=0; i> id >> c4[i]; - // cout << "\n c4[" << i << "]=" << c4[i]; - } - SCAN_END(ifs, ""); - } - - // init mesh - int mesh = static_cast(rcut / dr)+1; - if(mesh % 2 == 0) mesh++; - cout << "\n mesh = " << mesh; - - // init r - r = new double[mesh]; - for(int i=0; i get_C4 Program Start." << endl; - - cout << "\n rcut = " << rcut << " (a.u.)"; - cout << "\n ecut = " << ecut << " (Ry)"; - cout << "\n tolerence = " << tolerence; - cout << "\n lmax = " << lmax; - - int nw;//number of orbitals(files) to calculate C4. - string *name;// file name, containing psi(r)*r, rab, radial - int *L;//angular momentum for each file( each orbital); - - READ_VALUE( ifs, nw ); - assert(nw>0); - cout << "\n Files = " << nw; - - name = new string[nw]; - L = new int[nw]; - //================================================ - // read in the file name and the corresponding L. - //================================================ - for(int i=0; i( sqrt( ecut * 2) * rcut / Mathzone::PI ); - cout << "\n Eigenvalue number(Jl) = " << Enumber; - - //================================================ - // Calculate eigenvalue of Jl - // CALL FUNCTION : Find_Eigenvalues - //================================================ - matrix en( lmax+1, Enumber); - Find_Eigenvalues(Enumber, en, lmax, rcut, tolerence); - - for(int i=0; ikey_solver(name[i], L[i], en, Enumber, C4); - stringstream ss; - ss << name[i] << ".C4"; - ofstream ofs( ss.str().c_str() ); - - ofs << "Calculate_C4_Program"; - ofs << "\n"; - ofs << "\n AUTHOR : Mohan Chen"; - ofs << "\n Date : 2009-4-1"; - ofs << "\n LOCATION : LQCC, Hefei, China"; - ofs << "\n EMAIL : mohan@mail.ustc.edu.cn"; - ofs << "\n Description : Calculate the coefficients C4 of f(r) in Spherical Bessel Basis J(qr)."; - ofs << "\n Formula : C4 = integral(r)[ f(r)*jl(qr)*r^{2} ]dr "; - ofs << "\n P.S. : We default consider f(r) read from file is in the form : ( f(r) * r )."; - ofs << "\n"; - - ofs << "\n\n"; - ofs << "\n" << name[i] << " ( f(r) read from this file)"; - ofs << "\n" << setw(8) << L[i] << " angular momentum for this orbital."; - ofs << "\n" << setw(8) << ecut << " Energy cutoff(Ry.)."; - ofs << "\n" << setw(8) << rcut << " rcut (a.u.)"; - ofs << "\n" << setw(8) << Enumber << " eigenvalue number( sqrt(ecut*2)*rcut/PI )."; - ofs << "\n" << setw(8) << tolerence << " tolerence to calculate eigenvalue."; - ofs << "\n"; - - ofs << "\n\n"; - for(int j=0; j"; - ofs.close(); - delete[] C4; - } - - delete[] name; - delete[] L; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Calculate_C4.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Calculate_C4.h deleted file mode 100644 index b817fc4fd7..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Calculate_C4.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef CALCULATE_C4_H -#define CALCULATE_C4_H - -#include "common.h" - -class Calculate_C4 -{ - public: - - Calculate_C4(); - ~Calculate_C4(); - - void init( ifstream &ifs, const double &ecut, const double &rcut, const double &tolerence, const int &lmax ); - void Test( ifstream &ifs, const double &ecut, const double &tolerence); - void plot( ifstream &ifs ); - - static void norm_ic( realArray &C4, const int &ntype, const int &lmax, - const int &nmax, const int &enumber, const double &tolerence, - const double &rcut, const double &dr); - - static void Find_Eigenvalues(const int &Enumber, matrix &en, - const int &lmax, const double &rcut, const double &tolerence); - - private: - - void Test_Orthogonal(const double &rcut, const double &dr, - const int &L, const matrix &en, const int &Enumber, const int &test_ei); - - void key_solver(const string &name, const int &L, - const matrix &en, const int &Enumber, double *C4); - - static int test; - - - -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Coefficients.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Coefficients.cpp deleted file mode 100644 index 5d7cf79c25..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Coefficients.cpp +++ /dev/null @@ -1,350 +0,0 @@ -#include "Coefficients.h" -#include "../src_parallel/parallel_common.h" - -bool Coefficients::write_c4_flag; - -Coefficients::Coefficients() -{ - test = 0; - output_c4_name = new string[1]; - accumulate_num = 0;//mohan add 2009-09-25 -} - -Coefficients::~Coefficients() -{ - if (TEST1) cout << "\n ~Coefficients()" << endl; - delete[] output_c4_name; -} - -void Coefficients::init( - const int &ntype_in, - const int &lmax_in, - const int &nmax_in, - const double &ecut_in, - const double &ecut_jlq_in, // mohan add 2009-07-23 - const double &rcut_in, - const double &tolerence_in) -{ - TITLE(ofs_running,"Coefficients", "Constructor"); - - ntype = ntype_in; - lmax = lmax_in; - nmax = nmax_in; - ecut = ecut_in; - ecut_jlq = ecut_jlq_in; // mohan add 2009-07-23 - rcut = rcut_in; -// in Rydberg Unit - enumber = static_cast( sqrt( ecut )* rcut/PI ); - enumber_jlq = static_cast ( sqrt( ecut_jlq) * rcut/PI ); // mohan add 2009-07-23 - tolerence = tolerence_in; - - OUT(ofs_running,"ntype",ntype); - OUT(ofs_running,"lmax",lmax); - OUT(ofs_running,"nmax",nmax); - OUT(ofs_running,"ecut(Ry)",ecut); - OUT(ofs_running,"ecut_jlq(Ry)",ecut_jlq); - OUT(ofs_running,"rcut(Bohr)",rcut); - OUT(ofs_running,"enumber",enumber); - OUT(ofs_running,"enumber_jlq",enumber_jlq); - OUT(ofs_running,"tolerence",tolerence); - - assert(ntype > 0); - assert(lmax >= 0); - assert(nmax > 0); - assert(enumber > 0); - assert(enumber_jlq > 0); - - assert(ecut > 0.0); - assert(ecut_jlq > 0.0); - assert(rcut > 0.0); - assert(tolerence > 0.0); - - this->allocate_C4(); - - delete[] output_c4_name; - this->output_c4_name = new string[1]; - - return; -} - -void Coefficients::allocate_C4(void) -{ - if (test==1)TITLE("Coefficients", "allocate_C4"); - - this->C4.create(ntype, lmax + 1, nmax, enumber); - this->C4_old.create(ntype, lmax + 1, nmax, enumber); - this->C4_accumulate.create(ntype, lmax + 1, nmax, enumber); // mohan add 2009-09-25 -// this->acc_count.create(ntype, lmax+1, nmax, enumber); - this->accept_number.create(ntype, lmax+1, nmax, enumber); // mohan add 2009-10-16 - this->accept_rate.create(ntype, lmax+1, nmax, enumber);// mohan add 2009-10-31 - - // init accept_rate - for (int i=0; iaccept_rate.ptr[i] = 1.0; - } - - for (int it = 0; it < ntype; it++) - { - for (int il = 0; il < lmax+1; il++) - { - for (int in = 0; in < nmax; in++) - { - ofs_running << "\n Init C4: T=" << it+1 << " L=" << il << " N=" << in; - for (int ie = 0; ie < enumber; ie++) - { - // mohan modify 2009-08-26 - int ne_cut; - int ne_cut_min = -1; // must initalized - if (BLOCK_NE_MIN>0) - { - ne_cut_min = BLOCK_NE_MIN; - } - - if (BLOCK_NE<0) - { - ne_cut = enumber_jlq; - } - else - { - ne_cut = BLOCK_NE; - } - - if (iene_cut_min) - { - this->C4(it, il, in, ie) = Random::between0and1(); - this->C4_old(it, il, in, ie) = this->C4(it, il, in, ie); - } - else - { - this->C4(it, il, in, ie) = 0.0; - this->C4_old(it, il, in, ie) = 0.0; - } - if (ie%4==0)ofs_running< BLOCK, - // how many C4 you want to read in! - // remain bug when ntype > 1. - if (RESTART) - { - if (MY_RANK==0) - { - ifstream ifs( "ORBITAL_RESULTS.txt" ); - if (!ifs) - { - WARNING_QUIT("Coefficients::allocate_C4()","can't find the restart file: ORBITAL_RESULTS.txt"); - } - else - { - cout << "\n Read in RESTART information from : ORBITAL_RESULTS.txt" << endl; - } - - double ecut_in; - double rcut_in; - int ne_in; - if ( SCAN_BEGIN(ifs,"") ) - { - READ_VALUE(ifs, ecut_in); - READ_VALUE(ifs, rcut_in); - READ_VALUE(ifs, ne_in); - if (ne_in != enumber) - { - cout << "\n ne_in = " << ne_in; - cout << "\n enumber = " << enumber; - WARNING_QUIT("Coefficients::Allocate_C4()","enumber != ne_in"); - } - } - - if ( SCAN_BEGIN(ifs,"") ) - { - int nchi_in; - READ_VALUE(ifs, nchi_in); - assert(nchi_in > 0); - - string no_use1, no_use2, no_use3; - int it2, il2, in2; - bool hold_on = false; - int count_nchi = 0; - for (int it = 0; it < ntype; it++) - { - for (int il = 0; il < lmax+1; il++) - { - for (int in = 0; in < nmax; in++) - { - if (!hold_on) - { - ifs >> no_use1 >> no_use2 >> no_use3; - assert(no_use1 == "Type"); - assert(no_use2 == "L"); - assert(no_use3 == "Zeta-Orbital"); - ifs >> it2>> il2>> in2; - it2 -= 1; - in2 -= 1; - } - if (it2!=it || il2!=il || in2!=in) - { - hold_on = true; - continue; - } - else - { - hold_on = false; - cout << "\n\n Read in T=" << it+1 << " L=" << il << " Zeta-Orbital=" << in; - for (int ie=0; ie> C4(it, il, in, ie); - C4_old(it, il, in, ie) = C4(it, il, in, ie); - if (ie%4==0) cout << endl; - cout - << setiosflags(ios::fixed) - << setprecision(20) - << setiosflags(ios::showpoint) - << setw(25) << C4_old(it, il, in, ie); - } - ++count_nchi; - // if count_nchi == nchi_in, all needed C4 have been read in! - if (count_nchi==nchi_in) return; - } - } - } - } - }// end SCAN_BEGIN - }// end MY_RAN==0 - } // end RESTART - -#ifdef __MPI - Parallel_Common::bcast_double(C4.ptr, C4.getSize()); - Parallel_Common::bcast_double(C4_old.ptr, C4_old.getSize()); - ofs_running << "\n bcast C4 and C4_old done." << endl; -#endif - - return; -} - -void Coefficients::copy_c4_to_old(void) -{ - for (int i=0; iC4.getSize(); i++) - { - this->C4_old.ptr[i] = this->C4.ptr[i]; - } - return; -} - - -void Coefficients::trial_c4( const int &t, const int &l, const int &n, const int &ie ) -{ - // (1) - this->C4_old(t, l, n, ie) = this->C4(t, l, n, ie); - // update between -0.1~0.1 - - // (2) - this->C4(t, l, n, ie) += Random::betweenMinus1and1()/10.0* this->accept_rate(t, l, n, ie); - -#ifdef __MPI - // don't need to bcast ! it's a random seed. -// ofs_running << "\n C4=" << this->C4(t, l, n, ie); -// Parallel_Common::bcast_double( this->C4(t, l, n, ie) ); -#endif - -// if( abs(this->C4(t, l, n, ie)) < 1.0e-3) //mohan modify 2009-10-10 -// { -// this->C4(t, l, n, ie) = 0.0; -// } -// this->C4(t, l, n, ie) += Random::betweenMinus1and1(); - - // this->C4(t, l, n, ie) *= Random::betweenMinus2and2(); - // cout << "\n ic = " << ic << " ie = " << ie << " C4 = " << C4(t, l, n, ie); - return; -} - -/* -void Coefficients::accumulate_num_zero(void) -{ - cout << "\n Accumulate_num = " << this->accumulate_num; - this->accumulate_num = 0; -} -*/ - -/* -void Coefficients::accumulating_C4( const int &t, const int &l, const int &n, const int &ie ) -{ - // mohan add 2009-09-25 - double mix = this->C4_accumulate(t, l, n, ie) * this->acc_count(t,l,n,ie) + this->C4_old(t, l, n, ie); - ++acc_count(t,l,n,ie); - ++accumulate_num; - this->C4_accumulate(t, l, n, ie) = mix / acc_count(t,l,n,ie); -// cout << "\n Accumulate_num = " << this->accumulate_num; - - return; -} -*/ - -void Coefficients::update_c4( const int &t, const int &l, const int &n, const int &ie ) -{ - //=============================================== - // store the new c4 parameters(random accepted!! - // then next c4 will replace by a new set. - //=============================================== - - this->C4_old(t, l, n, ie) = this->C4(t, l, n, ie); - ++accept_number(t,l,n,ie); - - return; -} - -void Coefficients::go_back_c4( const int &t, const int &l, const int &n, const int &ie ) -{ - //================================== - // give up the random added number; - //================================== - this->C4(t, l, n, ie) = this->C4_old(t, l, n, ie); - return; -} - -/* -void Coefficients::kinetic_energy( const int &t, const int &l, const int &n, const int &ie) -{ - if(!ke_flip_flag) - { - if(ke_up_flag) - { - // C4>0.0 and C4_old>0.0 - this->ke_total_up += ( C4(t, l, n, ie) - C4_old(t, l, n, ie) ) * ie * ie; - } - else - { - // C4<0.0 and C4_old>0.0 - this->ke_total_down += ( C4_old(t, l, n, ie) - C4(t, l, n, ie) ) * ie * ie; - } - } - else - { - // (1) C4>0.0 and C4_old<0.0, - // so ke_total_up energy increase - // ke_total_down energy decrease - // - // (2) C4<0.0 and C4_old>0.0, - // so ke_total_up energy decrease - // and ke_total_down energy increase - this->ke_total_up += C4(t, l, n, ie) * ie * ie; - this->ke_total_down += C4_old(t, l, n, ie) * ie * ie; - } - - this->ke_total_old = this->ke_total_new; - this->ke_total_new = abs(abs(ke_total_up) - abs(ke_total_down)); - -// cout << "\n ke_total_up = " << ke_total_up; -// cout << "\n ke_total_down = " << ke_total_down; -// cout << "\n ke_total_old = " << ke_total_old; -// cout << "\n ke_total_new = " << ke_total_new << endl; - - return; -} -*/ diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Coefficients.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Coefficients.h deleted file mode 100644 index 32c692e345..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Coefficients.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef COEFFICIENTS_H -#define COEFFICIENTS_H - -#include "common.h" -class Coefficients -{ - public: - //============================ - // C4(type, L, N, ie) - //============================ - realArray C4; - realArray C4_old; - realArray C4_accumulate; - //IntArray acc_count; - IntArray accept_number; - realArray accept_rate; - - // constructor, available for SZ, DZ, DZP... - Coefficients(); - ~Coefficients(); - - void init( const int &ntype, const int &lmax, const int &namx, - const double &ecut, const double &ecut_jlq, - const double &rcut, const double &tolerence); - void trial_c4( const int &t, const int &l, const int &n, const int &ie ); - - void update_c4( const int &t, const int &l, const int &n, const int &ie ); - void go_back_c4( const int &t, const int &l, const int &n, const int &ie ); - void copy_c4_to_old(void); // for normalize - void kinetic_energy( const int &t, const int &l, const int &n, const int &ie);// mohan add 2009-07-23 - void accumulate_num_zero(void); - void accumulating_C4( const int &t, const int &l, const int &n, const int &ie ); - - int ntype; - int lmax; - int nmax; - int enumber; - double rcut; - double tolerence; - int fix; - - string *output_c4_name; - static bool write_c4_flag; - - private: - void allocate_C4(); - double ecut; - double ecut_jlq; // mohan add 2009-07-23 - int enumber_jlq; // mohan add 2009-07-23 - int test; - int accumulate_num; -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Metropolis.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Metropolis.cpp deleted file mode 100644 index f82b93fc1d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Metropolis.cpp +++ /dev/null @@ -1,726 +0,0 @@ -#include "Metropolis.h" -#include "../src_parallel/parallel_common.h" -#include "Calculate_C4.h" - -Metropolis::Metropolis() -{ - prob_old = 0.0; - prob_new = 0.0; - temperature = 0.0; - random_c4number = 0; - output_each_istep = 0; - kin_last = new double[1]; - kin_temp = new double[1]; -} - - -Metropolis::~Metropolis() -{ - delete[] kin_last; - delete[] kin_temp; -} - -// read in Metropolis parameters. -void Metropolis::init(void) -{ - if(test==1) TITLE("Metropolis","init"); - - bool begin = false; - - if(MY_RANK==0) - { - if(SCAN_BEGIN(input.ifs, "")) - { - begin = true; - } - } - -#ifdef __MPI - Parallel_Common::bcast_bool(begin); -#endif - - ofs_running << "\n begin read in Metropolis parameter." << endl; - - if(begin) - { - if(MY_RANK==0) - { - READ_VALUE( input.ifs, this->spi_ini_temp); - READ_VALUE( input.ifs, this->spi_rate); - READ_VALUE( input.ifs, this->spi_ntemp); - READ_VALUE( input.ifs, this->spi_nsteps); - - READ_VALUE( input.ifs, this->kin_ini_temp); - READ_VALUE( input.ifs, this->kin_rate); - READ_VALUE( input.ifs, this->kin_ntemp); - READ_VALUE( input.ifs, this->kin_nsteps); - - READ_VALUE( input.ifs, this->delta_kappa); - READ_VALUE( input.ifs, this->output_each_istep); - - READ_VALUE( input.ifs, ACCEPTANCE_STEPS ); // mohan add 2009-10-31 - READ_VALUE( input.ifs, ACCEPTANCE_HIGH ); - READ_VALUE( input.ifs, ACCEPTANCE_LOW ); - - READ_VALUE( input.ifs, KINETIC_MAX ); // mohan add 2009-10-31 - READ_VALUE( input.ifs, KINETIC_DR); //mohan add 2010-04-12 - READ_VALUE( input.ifs, OPTIMIZE_METHOD); // mohan add 2010-04-14 - //SCAN_END(input.ifs, ""); - } - -#ifdef __MPI - MPI_Barrier(MPI_COMM_WORLD); - - Parallel_Common::bcast_double(this->spi_ini_temp); - Parallel_Common::bcast_double(this->spi_rate); - Parallel_Common::bcast_int(this->spi_ntemp); - Parallel_Common::bcast_int(this->spi_nsteps); - - Parallel_Common::bcast_double(this->kin_ini_temp); - Parallel_Common::bcast_double(this->kin_rate); - Parallel_Common::bcast_int(this->kin_ntemp); - Parallel_Common::bcast_int(this->kin_nsteps); - - Parallel_Common::bcast_double(this->delta_kappa); - Parallel_Common::bcast_int(this->output_each_istep); - - Parallel_Common::bcast_int(ACCEPTANCE_STEPS ); - Parallel_Common::bcast_double(ACCEPTANCE_HIGH ); - Parallel_Common::bcast_double(ACCEPTANCE_LOW ); - - Parallel_Common::bcast_double(KINETIC_MAX ); - Parallel_Common::bcast_double(KINETIC_DR ); - Parallel_Common::bcast_int(OPTIMIZE_METHOD); -#endif - - } - - this->temperature = this->spi_ini_temp; - - // check whether the parameters are in the range. - assert(spi_ini_temp >= 0.0); - assert(spi_rate >= 0.0); - assert(spi_ntemp >= 0); - assert(spi_nsteps >= 0); - - assert(kin_ini_temp >= 0.0); - assert(kin_rate >= 0.0); - assert(kin_ntemp >= 0); - assert(kin_nsteps >= 0); - - assert(delta_kappa >= 0.0); - assert(output_each_istep>0); - - return; -} - -// be called in MultiZeta::init(), reset the start temperature. -void Metropolis::reset_temperature(const int &istep) -{ - temperature = this->spi_ini_temp; - for(int i=0; ikappa = 1.0 + this->delta_kappa; - - assert( this->spi_ntemp>=0 ); - - this->nchi = Level.nchi; - - delete[] kin_last; - this->kin_last = new double[nchi]; - ZEROS(kin_last, nchi); - - delete[] kin_temp; - this->kin_temp = new double[nchi]; - ZEROS(kin_temp, nchi); - - // how many temperature we try. - // there are two parts of this algorithm, - // first part is about spillage, - // the second part is about kinetic energy. - for (int itemp = 0; itemp < this->spi_ntemp + this->kin_ntemp; itemp++) - { - // if the kinetic energy is not small enough, we try new kappa again. - //try_new_kappa_again: - - if(itemp < this->spi_ntemp) - { - ofs_running << "\n" << " ---> SpillageTemp " << setw(3) << itemp+1 << endl; - ofs_running << " Temperature " << setw(6) << temperature << endl; - this->states = "Spi"; - ofs_running << setw(5) << "STEPS" - << setw(20) << "SPILLAGE" - << setw(10) << "UPDATES" << endl; - - if(itemp==0) - { - cout << setw(5) << "STEP" << setw(10) << "TEMP" - << setw(20) << "SPILLAGE" << endl; - } - } - else - { - // Please DIY, mohan 2010-04-14 - if(OPTIMIZE_METHOD==1) - { - this->states="Kin"; - } - else if(OPTIMIZE_METHOD==2) - { - this->states = "Ecut"; - } - else - { - WARNING_QUIT("move_various_temperature","Check OPTIMIZE_METHOD"); - } - } - - this->Psi2.ofso << "spillage_ntemp = " << itemp << " kappa = " << kappa << endl; - - // set the initial temperature and kinetic energy value. - if(itemp== this->spi_ntemp) - { - this->min_spillage = input.SV.cal_defined_value(0); // save the spillage value. - ofs_running << "\n\n Spillage at final temperature " << min_spillage << endl; - - for(int ic=0; icnchi; ic++) - { - const int T = Level.wayc[ic].type; - const int L = Level.wayc[ic].L; - const int N = Level.wayc[ic].N; - - double *c4_last = new double[Level.ne]; - for(int ie2=0; ie2kin_last[ic] = 0.0; - - if(states=="Kin") - { - for(int ie2=0; ie2kin_last[ic] += pow( c4_last[ie2]*(ie2+1)*PI/RCUT,2 ) - *this->Psi2.jjnorm(L,ie2); - } - } - else if(states=="Ecut") - { - this->kin_last[ic] = this->Psi2.get_ecut( c4_last, L ); - } - - // set the start temperature of kinetic part of Metropolis algorithms. - this->kin_temp[ic] = this->kin_last[ic] * this->kin_ini_temp; - - ofs_running << " Orbital " << ic+1 << " Initial E_kin " << setw(15) << this->kin_last[ic] << endl; - - delete[] c4_last; - } - } - - - // mohan add 2009-09-11 - // how many steps moving in this temperature. - int nsteps_now = 0; - if( states == "Spi" ) nsteps_now = this->spi_nsteps; - else nsteps_now = this->kin_nsteps; - - - for (int istep = 0; istep < nsteps_now; istep++) - { - // P.S.: a method to quit this whole program. - // you only need to create a file name : FINISH - // another function: if there existep a file 'FINISH' - // in the current dir, the program quit at the first - // iteration. - // Here I choose a proper parameter: 500 steps, - // you can change on your own. - if(istep%500==0) - { - // mohan add 2009-08-28 - ifstream ifs("FINISH"); - if( ifs ) - { - return; - } - } - - // because the initia temperature may be too high - // which caused by the high kinetic energy, so - // we need to reset the temperature. - if(itemp == this->spi_ntemp && istep == 50) - { - double high = 0.0; - for(int ic=0; icnchi; ic++) - { - this->kin_temp[ic] = this->kin_last[ic] * this->kin_ini_temp; - high = std::max( kin_temp[ic], high ); - } - - for(int ic=0; icnchi; ic++) - { - this->kin_temp[ic] = high; - ofs_running << " Notice: Change temperature of orbital " << ic+1 << " to " << kin_temp[ic] << endl; - } - } - - // Here is the part about changing Metropolis algorithm's accept rate. - // we want to calculate the accept rate every 'ACCEPTANCE_STEPS' steps. - // but we don't want to calculate at istep=0; - if(istep%ACCEPTANCE_STEPS == 0) - { - if(istep>0) - { - for(int ic=0; icnchi; ic++) - { - const int T = Level.wayc[ic].type; - const int L = Level.wayc[ic].L; - const int N = Level.wayc[ic].N; - for(int ie2=0; ie2 ACCEPTANCE_HIGH) - { - input.Coef.accept_rate(T,L,N,ie2) *= 2.0; // You can DIY 0.5 - } - else if(rate < ACCEPTANCE_LOW) - { - input.Coef.accept_rate(T,L,N,ie2) *= 0.5; // You can DIY 2.0 - } - - // output information - //if(ie2%5==0) cout << "\n"; - //cout << setw(8) << rate*100 << "%"; - //cout << setw(8) << input.Coef.accept_rate(T,L,N,ie2); - } - } - } - input.Coef.accept_number.zero_out(); - } // end accept_rate - - - //======================================================== - // if we want to move step, we need the set of C4 from CS - // in single zeta, the C4 can be either read in or random, - // in double zeta, the C4 should start from random, in - // most cases. - //======================================================== - this->move_one_step(itemp, istep, Level, nsteps_now); - - }// end istep - - cout << setw(5) << itemp+1 - << setiosflags(ios::fixed) - << setprecision(3) - << setiosflags(ios::scientific) - << setiosflags(ios::showpoint) - << setw(10) - << temperature - << resetiosflags(ios::fixed) - << setiosflags(ios::fixed) - << setiosflags(ios::showpoint) - << setprecision(10) - << setw(19) - << input.SV.cal_defined_value(0)*100 << "%" << endl; - - - //------------------------------------------- - // it's about minimizing kinetic energy. - //------------------------------------------- - if( itemp >= this->spi_ntemp) - { - for(int ic=0; icnchi; ic++) - { - cout << setw(5) << Level.wayc[ic].spd; - cout << setiosflags(ios::scientific) - << setiosflags(ios::showpoint) - << setprecision(3) - << setw(10)<< this->kin_temp[ic]; - cout << setprecision(10) - << resetiosflags(ios::fixed) - << setiosflags(ios::fixed) - << setiosflags(ios::showpoint) - << setw(20)<< this->kin_last[ic] << endl; - } - - for(int ic=0; icnchi; ic++) - { - if(this->kin_last[ic] > KINETIC_MAX) - { - cout << "\n kin_last[" << ic << "]=" << kin_last[ic] << " KINETIC_MAX = " << KINETIC_MAX << endl; - cout << " There maybe 2 reasons, first: The starting temperature for kinetical energy is too small." << endl; - cout << " Second: The kappa is too small." << endl; - //WARNING_QUIT("Minimizing Kinetic Energy","Kinetical Energy Too Large!"); - cout << "Kinetical Energy Too Large!"<kappa += this->delta_kappa; - //goto try_new_kappa_again; - } - } - - // change temperature - this->update_t(); - }// end item - timer::tick("Metropolis","move_various_t"); - return; -} - - -void Metropolis::move_one_step( - const int &itemp, - const int &istep, - SpillageStep &Level, - const int &nsteps_now) -{ - timer::tick("Metropolis", "move_one_step"); - - //ofs_running << "\n move_one_step"; - - // each step we renew every Jlq one by one. - int update_number = 0; - - static int *min_os = new int[this->nchi]; - - // for each (atom_type,L,N), we need a set of C4 - // to describe the radial wave functions. - // after each radial wave function is update(ne parameters), - // we call it 'a step under a particular temperature is done' - for (int ic = 0; ic < this->nchi; ic++) - { - // get the type index of this radial wave function. - const int T = Level.wayc[ic].type; - - // mohan add 2009-01-27 - // if "skip", the C4 will not changed in this 'Big step' - if(Level.info[T].state=="skip") continue; - - const int L = Level.wayc[ic].L; - const int N = Level.wayc[ic].N; - - for (int ie = 0; ie < Level.ne; ie++) - { - //cout << "ic=" << ic << " ie=" << ie << endl; - // mohan add 2009-08-26 - // this judgement means, - // If users don't want to use Jlq(ie) - // which is too oscillation(large), they - // can use only small part of Jlq. - // mohan add BLOCK_NE_MIN 2009-08-27 - if( (ie=BLOCK_NE)) continue; - - // trial a new value of c4(T,L,N). - input.Coef.trial_c4( T, L, N, ie); - - // calculate the spillage according to the new c4. - for (int is = 0; is < STRNUM; is++) - { - input.SV.value[is] = Level.get_spillage(is, ic, ie); - } - - // flag1 is about spillage can be accepted. - // flag2 is about kinetic energy can be accepted. - static bool accept_flag1 = false; - static bool accept_flag2 = false; - - //================================================================ - // STEP 1 : - //================================================================ - if( states == "Spi" ) - { - // 0 means get old value, 1 means get new value. - accept_flag1 = this->accept( input.SV.cal_defined_value(0), input.SV.cal_defined_value(1), temperature ); - accept_flag2 = true; - } - //================================================================ - // STEP 2 - //================================================================ - else - { - // make sure the new spillage value is in the range. - // otherwise, we don't even calculate the kinetic energy. - if( input.SV.cal_defined_value(1) < this->min_spillage * this->kappa) - { - // spillage is in the range, condition one ok! - accept_flag1 = true; - - double *c4tmp = new double[Level.ne]; - for(int ie2=0; ie2Psi2.norm_c4( c4tmp, L ); - - // and then calculate the new set of kinetic energy. - for(int ie2=0; ie2Psi2.jjnorm(L,ie2);//In Rydberg Unit. - } - } - else if(states=="Ecut") - { - value2 = this->Psi2.get_ecut( c4tmp, L ); - } - - // judge here - accept_flag2 = this->accept( this->kin_last[ic], value2, this->kin_temp[ic] ); - if(accept_flag2) - { - kin_last[ic] = value2; - } - - delete[] c4tmp; - } - else - { - accept_flag1 = false; - } - } - - if (accept_flag1 && accept_flag2) - { - ++update_number; - for (int is = 0; is< STRNUM; is++) - { - Level.updateQS( is ); // (1) update Soverlap and Qoverlap for each structure, - // S matrix and Q matrix has changed due to the change - // of c4 - } - - input.SV.update_value();// (2) update spillage value - - for(int is=0; is " << states << "Temp " << setw(15) - //<< istep+1 << "\n" ; -// << " SpiVal" -// << setprecision(6) -// << setiosflags(ios::fixed) -// << setw(15) << input.SV.cal_defined_value(0); - for(int ic=0; ic< this->nchi; ic++) - { - ofs_running << setw(4) << istep+1 << Level.wayc[ic].spd; - - ofs_running << setprecision(3) - << setiosflags(ios::scientific) - << setw(10)<< this->kin_temp[ic]; - - ofs_running << setprecision(10) - << setiosflags(ios::fixed) - << setw(20)<< this->kin_last[ic] << endl; - } - } - } -// } - - // because we choose c4 randomly between -0.1~0.1 - // so we need to normalize the set of c4 after a few - // steps, here I choose a proper number: 50 - // you can change on you own, but please notice it can't - // be too small, because we need to update all Q and S - // matrix after this normalization, which may affect the - // speed of the program. You can't choose too large, - // because it makes the update not efficient. - if ( (istep % 50 == 0 && istep !=0 ) || istep == nsteps_now-1) - { - // use to describe the real space mesh. - // don't need to choose too accuray, because - // it may affect the speed of running. - // you can change on your own, too. - double dr = 0.01; // a.u. - - // norm ic for all radial wave functions. - // after this call, all c4 will change/update. - // but the spillage will not change. - // (because we just normalize the wavefunctions). - Calculate_C4::norm_ic( - input.Coef.C4, - input.Coef.ntype, - input.Coef.lmax, - input.Coef.nmax, - input.Coef.enumber, - input.Coef.tolerence, - input.Coef.rcut, - dr); - - // get new set of C4, so we copy the set of C4 - // to C4_old. This will also not affect the - // spillage value. - input.Coef.copy_c4_to_old(); - - // for each structure, we need to update their - // Q matrix and S matrix, which may be time - // consuming. - for (int is = 0; is < STRNUM; is++) - { - Level.init_QS_matrix(is); - } - } - timer::tick("Metropolis", "move_one_step"); - return; -} - -double Metropolis::Boltzmann_dist(const double &value, const double &t) -{ - static const double small = 1.0e-20; - assert(t > small); - assert(value > 0.0); -// cout << "\n value = " << value; -// cout << "\n Boltzmann_dist = " << exp( -value/t ); - return exp(-value / t); -} - -void Metropolis::update_t(void) -{ - if(this->states == "Spi") - { - this->temperature *= this->spi_rate; -// cout << " New Temperature for spillage = " << temperature << endl; - } - else if(this->states == "Kin"||states=="Ecut") - { - // mohan add high 2009-11-05 - double high = 0.0; - for(int ic=0; ic< this->nchi; ic++) - { - this->kin_temp[ic] *= this->kin_rate; - high = std::max( this->kin_temp[ic], high ); - } - - for(int ic=0; ic< this->nchi; ic++) - { - this->kin_temp[ic] = high; - ofs_running << setprecision(6) << setiosflags(ios::scientific) - << " Temperature for orbital " << ic+1 << " = " << kin_temp[ic] << endl; - } - - ofs_running << " new kappa=" << kappa << endl; - } - return; -} - -bool Metropolis::accept( const double &v_old, const double &v_new, const double &temperature_in) -{ - assert(temperature_in > 0.0); - this->prob_old = v_old; - this->prob_new = v_new; - -// cout << "\n v_new = " << v_new; -// cout << "\n v_old = " << v_old; -// cout << "\n t = " << temperature_in; - - const double deltav = v_new - v_old; - - if ( deltav < 0.0 ) - { - return 1; // accept - } - else if ( deltav > 0.0 ) - { - const double p = Metropolis::Boltzmann_dist(v_new - v_old, temperature_in); - const double r = Random::between0and1(); - - if (r < p) return 1; // accept - if (r >= p) return 0; // reject - } - - return 0; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Metropolis.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Metropolis.h deleted file mode 100644 index 5ae6558572..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Metropolis.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef METROPOLIS_H -#define METROPOLIS_H - -#include "SpillageStep.h" -#include "Psi_Second.h" // use to calculaet oscillation - -class Metropolis -{ - public: - Metropolis(); - ~Metropolis(); - - void init(void); - - void move_various_temperature(SpillageStep &SS); - - void move_one_step(const int &itemp, const int &istep, SpillageStep &Level, const int &nsteps_now); - - bool accept(const double &v_old, const double &v_new, const double &temperature_in); - - void update_t(void); - void reset_temperature(const int &istep); - - - // (1) start temperature - const double& get_spi_ini_temp(void) const {return spi_ini_temp;} - const double& get_kin_ini_temp(void) const {return kin_ini_temp;} - - // (2) cooling rate for each new temperature - const double& get_spi_rate(void) const { return spi_rate;} - const double& get_kin_rate(void) const { return kin_rate;} - - // (3) number of temperature - const int& get_spi_ntemp(void) const { return spi_ntemp;} - const int& get_kin_ntemp(void) const { return kin_ntemp;} - - // (4) number of steps in each temperature - const int& get_spi_nsteps(void) const { return spi_nsteps;} - const int& get_kin_nsteps(void) const { return kin_nsteps;} - - - Psi_Second Psi2; - - private: - - // (1) - double spi_ini_temp; // initial temperature for spillage. - double kin_ini_temp; // initial temperature for kinetic energy. - - // (2) - double spi_rate; // decrease rate for spillage value - double kin_rate; // decrease rate for kinetic energy - - // (3) - int spi_ntemp; // number of temperatures (for spillage) - int kin_ntemp; // number of temperatures (for kinetical energy) - - // (4) - int spi_nsteps; // number of steps per temperature for spillage - int kin_nsteps; // number of steps per temperature for kinetical energy - - - double temperature; - double kappa; // mohan add 2009-10-11 - double delta_kappa; // mohan add 2009-10-31 - int try_kappa; - - double min_spillage; // mohan add 2009-10-15 - double *kin_last; // mohan add 2009-10-15 - double *kin_temp; // mohan add 2009-10-15, temperature for each orbital. - string states; // mohan add 2009-10-15 - int nchi; // mohan add 2009-10-15 - int output_each_istep; // mohan add 2009-10-16 - - double prob_new; - double prob_old; - - static double Boltzmann_dist( const double &value, const double &t ); - int test; - int random_c4number; - - -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/MultiZeta.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/MultiZeta.cpp deleted file mode 100644 index 39f103e0b8..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/MultiZeta.cpp +++ /dev/null @@ -1,425 +0,0 @@ -#include "MultiZeta.h" -#include "SpillageStep.h" -#include "Out_Orbital.h" -#include "../src_parallel/parallel_common.h" -#include "tools.h" - -MultiZeta::MultiZeta() -{ - test = 0; // output function name - Level = new SpillageStep[1]; - lmax_type = new int[1]; -} - -MultiZeta::~MultiZeta() -{ - delete[] Level; - delete[] lmax_type; -} - -// be called in main.cpp program. -void MultiZeta::init(void) -{ - TITLE(ofs_running,"MultiZeta","init"); - //============================= - // nlevel : optimization levels - //============================= - for (int is=0; isilevel = is+1;// 0 means level 1. - - // mohan add 2009-09-25 - //input.Coef.accumulate_num_zero(); - - // if start temperature is different for each level - // ( I don't think this is a very good idea for high level orbitals!! - // mohan note:2009-8-20, it's better to make temperature from "high enough" to - // "low enough" for each level) - metro.reset_temperature( is ); - - this->Level[is].ilevel = is; - this->Level[is].set_nchi(); - this->Level[is].set_nwfc(); - this->Level[is].set_iw00();// to get Sq1q2 - this->Level[is].allocate_data( 0 ); // to get Qin - - - // if is=0, means it's the first time, spillage0 = 1.0; - if (is==0) - { - for (int istr=0; istrLevel[is].data[istr].spillage0 = 1.0; - } - } - else if (is>0) - { - for (int istr=0; istrLevel[is].data[istr].spillage0 = input.SV.value_old[istr]; - } - cout << "\n Orthogonal......." << endl; - ofs_running << "\n Orthogonal......." << endl; - //**************************************** - // (2): Orthogonal to get new Bloch space! - // This subroutine is very important. - //**************************************** - Orth.start( this->Level[is-1], this->Level[is] ); - } - - if(USEPW) - { - PW.allocate_psi1d(is); - PW.allocate_psi3d(is); - } - - for (int istr=0; istrLevel[is].data[istr].initQS(); - this->Level[is].init_QS_matrix(istr); - input.SV.value_old[istr] = this->Level[is].get_spillage(istr, 0, 0); - } - - cout << "\n Initial Spillage Value at this Level: " << endl; - // output spillage value - input.SV.out(); - cout << endl; - - //******************************************************************* - // main part: Use Metropolis algorithm, move different temperature, - //******************************************************************* - this->metro.move_various_temperature( this->Level[is]); - - // save spillage value for each level - input.SV.save_level(is); - - this->saveC(); - - } - - return;; -} - - - -// read in paramters from BLOCK , called by MultiZeta::init(); -void MultiZeta::set_levels(void) -{ - TITLE(ofs_running,"MultiZeta","set_levels"); - - bool begin = false; - - if(MY_RANK==0) - { - if ( SCAN_BEGIN(input.ifs, "") ) begin = true; - } - -#ifdef __MPI - Parallel_Common::bcast_bool(begin); -#endif - - // read in parameters in BLOCK : 'OPTIMIZE' - if ( begin ) - { - // (1) read in important parameter: nlevel. - // nlevel means the number of orbital shells we need. - - if(MY_RANK==0) - { - READ_VALUE(input.ifs, this->nlevel); - assert(nlevel>-1); - assert(nlevel<100); - } - -#ifdef __MPI - Parallel_Common::bcast_int(nlevel); -#endif - - input.nlevel = this->nlevel; // mohan add 2009-06-09 -// cout << " nlevel = " << nlevel << endl; - OUT(ofs_running,"nlevel",nlevel); - - // (2) init 'SpillageStep' class, each level has - // different parameters. - delete[] this->Level; - this->Level = new SpillageStep[nlevel]; - - string useless; - - if(MY_RANK==0) - { - READ_VALUE(input.ifs, useless); - } - -#ifdef __MPI - Parallel_Common::bcast_string(useless); -#endif - - // (3) read in information concerning each level. - for (int i=0; i>>>> Level=" << i+1 ; - - this->Level[i].set_info(NTYPE); - for (int it=0; it> Level[i].info[it].id //id for this type - >> Level[i].info[it].na //number of atoms. - >> Level[i].info[it].state// new or skip, mohan 2009-08-27 - >> Level[i].info[it].lmax;//lmax in this level - } - -#ifdef __MPI - Parallel_Common::bcast_int(Level[i].info[it].id); - Parallel_Common::bcast_int(Level[i].info[it].na); - Parallel_Common::bcast_string(Level[i].info[it].state); - Parallel_Common::bcast_int(Level[i].info[it].lmax); -#endif - - if (!RESTART && Level[i].info[it].state=="skip") - { - ofs_running << "\n Level = " << i; - ofs_running << "\n it = " << it; - WARNING_QUIT("MultiZeta::set_levels","skip is not available if RESTART = false."); - } - if ( Level[i].info[it].state!="new" && Level[i].info[it].state!="skip") - { - ofs_running << "\n Level = " << i; - ofs_running << "\n it = " << it; - ofs_running << "\n state = " << Level[i].info[it].state << endl; - WARNING_QUIT("MultiZeta::set_levels","new or skip?"); - } - - ofs_running << "\n id=" << Level[i].info[it].id; - ofs_running << " na=" << Level[i].info[it].na; - ofs_running << " lmax=" << Level[i].info[it].lmax; - - if(Level[i].info[it].id==0) - { - ofs_running << " The id of elements should be numbers!" << endl; - ofs_running << " check the id of elements." << endl; - WARNING_QUIT("MultiZeta::set_levels","id=0"); - } - - // lmax=0(s), 1(p), 2(d), 3(f), 4(g) - if (Level[i].info[it].lmax>=5 || Level[i].info[it].lmax<0) - { - ofs_running << "\n lmax=" << Level[i].info[it].lmax << endl; - WARNING_QUIT("MultiZeta::set_levels"," lmax out of range."); - } - - // 'info' stands for "Type_Information" - // init: n, nbase; - // allocate - Level[i].info[it].init(); - - for (int L=0; L>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - // read in nchi for each L and full/average orbital. - int nz; - string fain; - string combine; - - // read in characters such as : 1/a - input.ifs >> combine; - -#ifdef __MPI - Parallel_Common::bcast_string(combine); -#endif - - //ofs_running << "\n lenght = " << combine.length() << endl; - - // firstly, we need to find the position of the label: '/' - const int index1 = combine.find_first_of("/"); - //ofs_running << "\n index1 = " << index1 << endl; - - // if index1==-1, means the combine didn't contain - // '/' label - if (index1 == -1) - { - // f stands for 'full' - fain = "f"; - // this 'atoi' command change string to int type. - nz = std::atoi( combine.c_str() ); - } - else // mean containing "/" - { - nz = std::atoi( combine.substr(0,index1+1).c_str() ); - // substrate the front int and remain the character. - // the second parameter '1' means the position is 'index+2' - fain = combine.substr(index1+1, 1); - } - - ofs_running << "\n L=" << L; - ofs_running << " Zeta=" << nz; - ofs_running << " fain(FULL/AVERAGE)=" << fain; - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - - // assert number of zeta < 20, you can change on your own, - // typically, we only need nz=2 or 3. - assert( nz < 20 ); - Level[i].info[it].n[L] = nz; - Level[i].info[it].fa[L] = fain; - - // mohan added 2009-05-22 - // i stands for level - // nbase stands for the radial wave functions before - // this level for each L of each atom type. - // (hard to understand, right? Try to figure out!) - // this parameter is very useful. - // nbase provide a base to count radial wave functions. - if (i==0) - { - Level[i].info[it].nbase[L] = 0; - } - else if (i>0) - { - for (int j=0; jlmax_type = new int[NTYPE]; - for (int it=0; itlmax_type[it] = -1; - } - - // sum information from all levels. - NMAXUSED = 0; - for (int k=0; knlevel; k++) - { - for (int it=0; it< NTYPE; it++) - { - this->lmax_type[it] = std::max( this->lmax_type[it], this->Level[k].info[it].lmax ); - LMAXUSED = std::max( LMAXUSED, this->lmax_type[it] ); - NMAXUSED = std::max( NMAXUSED, this->Level[k].info[it].nmax ); - } - } - - // for test. - if (test==2) - { - for (int it=0; it *sum = new std::complex[nbands]; - for (int iw=0; iw first_part = std::complex(0,0); - if(USEPW) - { - const int Mmu = step1.wayd[mu].m; - const int Imu = step1.wayd[mu].i; - PW.calculate_Jlq(ik,iw,ie); - first_part = PW.calculate_Jlq_Phi(ik,mu); - - // if( norm(first_part) > 0.1 ) - // { - // cout << "\n iw=" << iw << " ie=" << ie << " mu=" << mu << " first_part=" << first_part; - // BLOCK_HERE("haha"); - // } - } - else - { - for (int iemu=0; iemu sum = std::complex(0,0); - for(int mu=0; mu first_part = std::complex(0,0); - - for(int iemu=0; iemuversion_information( ofs ); - this->INPUTs_information( ofs ); - this->spillage_information( ofs, mz.ilevel ); - this->metropolis_information( ofs); - this->c4_information( ofs ); - } - this->mkb_information( ofs); - - if(MY_RANK==0) - { - ofs.close(); - } - - return; -} - -void Out_Orbital::version_information( ofstream &ofs ) -{ - ofs << "\n "; - ofs << "\n AUTHOR : Mohan Chen"; - ofs << "\n StartDate : 2009-4-01"; - ofs << "\n LastModify: 2012-6-27"; - ofs << "\n LOCATION : LQCC, Hefei, China"; - ofs << "\n EMAIL : mohan@mail.ustc.edu.cn"; - ofs << "\n Description : Calculate the coefficients C4 of f(r) in Spherical Bessel Basis J(qr)."; - ofs << "\n Formula : C4 = integral(r)[ f(r)*jl(qr)*r^{2} ]dr "; - ofs << "\n P.S. : We default consider f(r) read from file is in the form : ( f(r) * r )."; - ofs << "\n"; -} - -void Out_Orbital::INPUTs_information( ofstream &ofs ) -{ - ofs << "\n\n"; - ofs << "\n" << setw(20) << ECUT << " Energy cutoff(Hartree.)."; - ofs << "\n" << setw(20) << RCUT << " rcut (a.u.)"; - ofs << "\n" << setw(20) << NE << " eigenvalue number( sqrt(ecut*2)*rcut/PI )."; - ofs << "\n" << setw(20) << TOLERENCE << " tolerence to calculate eigenvalue."; - ofs << "\n" << setw(20) << NTYPE << " Number of atom types."; - for(int it=0; it"; -} - -void Out_Orbital::spillage_information( ofstream &ofs, const int &ilevel) -{ - ofs << "\n\n"; - ofs << "\n" << setw(20) << STRNUM << " kinds of structures."; - - // (1) mohan add average information 2010-04-11 - ofs << "\nAverage Spillage Value"; - for(int k=0; k"; - ofs << resetiosflags(ios::scientific); - return; -} - -void Out_Orbital::metropolis_information( ofstream &ofs) -{ - ofs << "\n\n"; - ofs << "\n" << setw(20) << mz.metro.get_spi_ini_temp() << " Start temperature (Kelvin) for spillage minimization."; - ofs << "\n" << setw(20) << mz.metro.get_spi_rate() << " Decreasing rate of temperature."; - ofs << "\n" << setw(20) << mz.metro.get_spi_ntemp() << " Number of different temperature (for spillage)."; - ofs << "\n" << setw(20) << mz.metro.get_spi_nsteps() << " Number of steps for each temperature (for spillage)."; - - ofs << "\n" << setw(20) << mz.metro.get_kin_ini_temp() << " Start temperature (Kelvin) for kinetical energy minimization."; - ofs << "\n" << setw(20) << mz.metro.get_kin_rate() << " Decreasing rate of temperature."; - ofs << "\n" << setw(20) << mz.metro.get_kin_ntemp() << " Number of different temperature (for kinetical)."; - ofs << "\n" << setw(20) << mz.metro.get_kin_nsteps() << " Number of steps for each temperature (for kineitcal)."; - ofs << "\n"; -} - -void Out_Orbital::c4_information( ofstream &ofs) -{ - ofs << "\n\n"; - ofs << "\n" << setw(20) << NCHIUSED << " Total number of radial orbitals."; - - // use multize parameters: ntype, *lmax_type, l_nchi, ne; - for(int it=0; it"; - return; -} - -void Out_Orbital::mkb_information( ofstream &ofs) -{ - ofs_running << "\n mkb_information." << endl; - if(MY_RANK==0) - { - ofs << "\n\n"; - ofs << "\n" << setw(20) << mz.nlevel << " Total number of orbitals optimized levels." ; - } - - double sum0 = 0.0; - double *sum1 = new double[NBANDS]; - ZEROS(sum1, NBANDS); - - int bands_start; - int bands_end; - int bands_number; - - if (BANDS_CONTROL) - { - bands_start = BANDS_START; - bands_end = BANDS_END; - bands_number = bands_end - bands_start; - } - else - { - bands_start = 0; - bands_end = NBANDS; - bands_number = bands_end - bands_start; - } - - ofs << "\nBands start from " << bands_start; - ofs << "\nBands ended at " << bands_end; - ofs << "\nOptimized bands number " << bands_number; - ofs << "\nSpillage per band is " << 1.0/bands_number; - - //ofs << setioflags(ios::fixed); - for(int il=0; il"; - delete[] sum1; - - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Out_Orbital.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Out_Orbital.h deleted file mode 100644 index 228ed3857d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Out_Orbital.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef OUT_ORBITAL_H -#define OUT_ORBITAL_H - -#include "common.h" - -// output orbital information -class Out_Orbital -{ - public: - Out_Orbital(); - ~Out_Orbital(); - - void write(void); - - private: - void version_information( ofstream &ofs ); - void INPUTs_information( ofstream &ofs); - void spillage_information( ofstream &ofs, const int &ilevel); - void metropolis_information( ofstream &ofs); - void c4_information( ofstream &ofs); - void mkb_information( ofstream &ofs); - -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Plot_Psi.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Plot_Psi.cpp deleted file mode 100644 index 0c0c9ca19f..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Plot_Psi.cpp +++ /dev/null @@ -1,588 +0,0 @@ -#include "Plot_Psi.h" -#include "tools.h" - -Plot_Psi::Plot_Psi() -{ - test=0; - rcut = 0.0; - - dr = 0.01; - - meshU = 0; // uniform mesh. - meshL = 0; // Log mesh. - - rU = new double[1]; - rL = new double[1]; - - xmin = -6; - zed = 4;//charge on the atom - dx = 1.0e-2; - xmax = 10; -} - -Plot_Psi::~Plot_Psi() -{ - delete[] rU; - delete[] rL; -} - -void Plot_Psi::allocate(void) -{ - // (1) read in parameters. - if(SCAN_BEGIN(input.ifs, "")) - { - READ_VALUE(input.ifs, this->dr); - assert( this->dr > 0.0); - - // mohan add 2009-11-23 - READ_VALUE(input.ifs, this->xmin); - READ_VALUE(input.ifs, this->zed);//charge? - READ_VALUE(input.ifs, this->dx); - READ_VALUE(input.ifs, this->xmax); - assert(zed>0.0); - assert(dx>0.0); - assert(xmax>=0.0); - - SCAN_END(input.ifs, ""); - } - - this->ne = NE; - this->meshU = static_cast(RCUT/dr); - this->meshL = ( std::log( xmax * zed ) - xmin ) / dx; - // mesh should be odd. - if(meshU%2==0) meshU++; - if(meshL%2==0) meshL++; - - /* - cout << "\n dr = " << dr; - cout << "\n meshU = " << meshU; - cout << "\n meshL = " << meshL; - - cout << "\n xmin = " << xmin; - cout << "\n zed = " << zed; - cout << "\n dx = " << dx; - cout << "\n xmax = " << xmax; - */ - - // other parameters. - this->rcut = RCUT; - - delete[] rU; - delete[] rL; - rU = new double[meshU]; - rL = new double[meshL]; - - for(int ir=0; irlmax = LMAXUSED; - this->total_nchi = NCHIUSED; - this->psiU.create( this->total_nchi, this->meshU); - this->psiL.create( this->total_nchi, this->meshL); - - return; -} - -// be called in main.cpp -void Plot_Psi::radial_wave_function(void) -{ - TITLE("Plot_Psi","radial_wave_function"); - timer::tick("Plot_Psi","radial_wf"); - - this->allocate(); - - // calculate all psi - int ichi = 0; - for(int it=0; it>>>>>>>>> - //The two formula are exactly same. - //<< setw(15) << abs(c4[ie])*pow(eigen1[ie],2) - //<< setw(15) << abs(c4[ie])*pow((ie+1)*PI/input.inputs.get_rcut(),2); - //<<<<<<<<<< - } - mz.metro.Psi2.ofsk << "\n Total kinetic energy = " << kin_sum; - - double *psi1 = new double[meshU]; - double *psi2 = new double[meshL]; - this->get_psi( meshU, rU, L, psi1, c4, eigen1, 0 ); - this->get_psi( meshL, rL, L, psi2, c4, eigen1, 1 ); - - for(int ir=0; irprint_orbitalsU_used(); - this->print_orbitalsL_used(); - - // mohan add 2010-04-13 - // use uniform grid to establish the energy cutoff of each orbital - ofstream ofs("ORBITAL_ECUT.txt"); - ofs << setprecision(12); - this->dk = 0.01; - this->meshK = 1500;// (1500*0.01)^2 * 2 = 450 Rydberg. - if(meshK%2==0)meshK++; - this->psiUK.create(total_nchi,meshK); - double *psi = new double[meshU]; - ichi = 0; - for(int it=0; it " << setw(7) << mz.l_nchi(it,L) << endl; - } - f1 << "---------------------------------------------------------------------------"<psiU(ichi, ir); - } - ++ichi; - } - } - f1.close(); - } - return; -} - -void Plot_Psi::print_orbitalsL_used(void)const -{ - //==================================== - // (5) - //==================================== - // output orbital for standard use form - int ichi = 0; - // because we can't read in r = 0 term now. - for(int it=0; itpsiL(ichi, ir); - } - ++ichi; - } - } - f1.close(); - } - return; -} - - - -void Plot_Psi::get_psi( - const int &mesh, - const double *r, - const int &l, - double *psi, - double *c4, - const double *eigen1, bool logmesh)const -{ - // (1) get psi1 - double *jle = new double[mesh]; - double *g = new double[mesh]; // smooth function - - if(SMOOTH) - { - double sigma2 = SIGMA*SIGMA; - for(int ir=0; irrcut)*(r[ir]-this->rcut)/2.0/sigma2) ); - //if(ir==mesh-1) cout << "\n g[" << ir << "]=" << g[ir] << endl; - } - } - - ZEROS(psi,mesh); - for(int ie=0; ie and - // using smooth Jlq, here we output the - // smooth functions. - if(SMOOTH) - { - for(int ir=0; irdr; - } - } - - for(int ir=0; ir0.9900)=" << pow(dk*kmesh_used,2)*2 << endl; - - while(normk*fpi< 0.999 && kmesh_used < this->meshK) - { - kmesh_used += 2; - Mathzone::Simpson_Integral(kmesh_used, functionk, rabk, normk ); - } -// ofs << "Psi(k) norm(0.999)=" << normk * fpi << endl; - ofs << "Ecut(Ry)(norm>0.9990)=" << pow(dk*kmesh_used,2)*2 << endl; - - while(normk*fpi< 0.9999 && kmesh_used < this->meshK) - { - kmesh_used += 2; - Mathzone::Simpson_Integral(kmesh_used, functionk, rabk, normk ); - } -// ofs << "Psi(k) norm(0.999)=" << normk * fpi << endl; - ofs << "Ecut(Ry)(norm>0.9999)=" << pow(dk*kmesh_used,2)*2 << endl; - - ofs << endl; - - delete[] function; - delete[] functionk; - delete[] rabk; - delete[] rab; - delete[] psik; - delete[] jj; - return; -} - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Plot_Psi.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Plot_Psi.h deleted file mode 100644 index c7d82e4bdf..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Plot_Psi.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef PLOT_PSI_H -#define PLOT_PSI_H - -#include "common.h" - -class Plot_Psi -{ - public: - Plot_Psi(); - ~Plot_Psi(); - - void radial_wave_function(void); - - private: - - // (1) about uniform mesh. - double dr; - int meshU; // U stands for uniform. - int meshL;// L stands for log. - double* rU;// uniform mesh. - double* rL;// log mesh. - int meshK; - double dk;//classic bug, change dk to 'int' type. then see .... - - // (2) about logmesh. - double xmin; - double zed; - double dx; - double xmax; - - // (3) about the wave functions. - matrix psiU; // sum c*j(l,x) - matrix psiL; // - matrix psiUK; - - int total_nchi; - double rcut; - int lmax; - int ne; - int test; - - void allocate(void); - - // mohan add smooth, sigam and rcut 2009-08-28 - void get_psi( const int &mesh, const double *r,const int &l, - double *psi1, double *c4, const double *eigen1, bool logmesh)const; - - void print_orbitals_plot(void)const; - void print_orbitalsU_used(void)const; - void print_orbitalsL_used(void)const; - - // mohan add 2010-04-13 - void establish_ecut( ofstream &ofs, const int &ik, double *psi, const int &L); -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Psi_Second.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Psi_Second.cpp deleted file mode 100644 index c23068e3ee..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Psi_Second.cpp +++ /dev/null @@ -1,333 +0,0 @@ -#include "Psi_Second.h" -#include "Calculate_C4.h" -#include "tools.h" - -Psi_Second::Psi_Second() -{ - test=0; - r = new double[1]; - rab = new double[1]; - psi = new double[1]; - psi_first = new double[1]; - psi_second = new double[1]; - eigen1 = new double[1]; - os_position = new double[100]; - below_max_os = new bool[1]; - count = 0; -} - -Psi_Second::~Psi_Second() -{ - delete[] r; - delete[] rab; - delete[] psi; - delete[] psi_first; - delete[] psi_second; - delete[] eigen1; - delete[] os_position; - delete[] below_max_os; -} - -void Psi_Second::init( - ifstream &ifs, - const int &ne_in, - const int &lmax_in, - const double &rcut_in, - const int &total_nchi_in, - const double &tolerence) -{ - TITLE("Psi_Second","init"); - - this->dr = KINETIC_DR; - assert( dr > 0.0); - cout << "\n KINETIC_DR=" << dr; - -// this->start = 5; // start away from 0, which may be some strange oscillation. - this->start = 1; // mohan fix 2010-04-16 - - // number of Jlq used. - this->ne = ne_in; - // lmax needed. - this->lmax = lmax_in; - // Cutoff radius. - this->rcut = rcut_in; - // Total number of radial wave functions. - this->total_nchi = total_nchi_in; - - this->mesh = static_cast(this->rcut/this->dr); - if(this->mesh%2==0) this->mesh++; - - if(test==2) - { - cout << "\n ne=" << ne; - cout << "\n lmax=" << lmax; - cout << "\n mesh=" << mesh; - cout << "\n total_nchi=" << total_nchi; - cout << "\n dr=" << dr; - } - - // init psi matrix, generate eigenvalue matrix - // this eigenvalue will be used in many functions. - this->eigenvalue.create( this->lmax+1, this->ne); - this->jjnorm.create( this->lmax+1, this->ne); - - delete[] this->eigen1; - this->eigen1 = new double[ne]; - - delete[] this->r; - delete[] this->rab; - delete[] this->psi; - delete[] this->psi_first; - delete[] this->psi_second; - delete[] this->below_max_os; - delete[] this->os_number; - - this->r = new double[mesh]; - this->rab = new double[mesh]; - this->psi = new double[mesh]; - this->psi_first = new double[mesh]; - this->psi_second = new double[mesh]; - - this->below_max_os = new bool[total_nchi]; - this->os_number = new int[total_nchi]; - - for(int ir=0; irne, - this->eigenvalue, - this->lmax, - this->rcut, - tolerence); - - // (2) to calculate jl(qr) - this->jle = new double**[this->lmax+1]; - double* g; - if(SMOOTH) - { - g = new double[mesh]; - double sigma2 = SIGMA*SIGMA; - for(int ir=0; irrcut)*(r[ir]-this->rcut)/2.0/sigma2) ); - } - } - - for(int l=0; leigen1[ie] = this->eigenvalue(l, ie);} - - // allocate space - this->jle[l] = new double*[ne]; - - for(int ie=0; iene; ie++) - { - this->jle[l][ie] = new double[this->mesh]; - Mathzone::Spherical_Bessel( this->mesh, this->r, this->eigen1[ie], l, jle[l][ie]); - - // (3) to calculate the jjnorm - double* f = new double[mesh]; - for(int ir=0; irjjnorm(l,ie) ); - jjnorm(l,ie)*=4.0*PI; -// cout << "\n jj = " << jjnorm(l,ie); - delete[] f; - - if(SMOOTH) - for(int ir=0; irofso.open("ORBITAL_OSCILATION.txt"); - this->ofsk.open("ORBITAL_KINETIC.txt"); - - return; -} - - -double Psi_Second::get_ecut( double *c4, const int &L) -{ - timer::tick("Psi_Second","get_ecut"); - - static double fpi = 4*PI; - static double sfpi = sqrt(fpi); - static double prefac_k = fpi / pow(2*PI,1.5); - static double dk = 0.01; - static int meshK = 800; // 8*8*2=128Ry - static double* g; - static double* rab; - static double* rabk; - static double* functionk; - static bool init = false; - static double norm; - static double normk; - static double ecut; - - if(!init) - { - if(meshK%2==0) ++meshK; - - g = new double[mesh]; // smooth function - rab = new double[mesh]; - rabk = new double[meshK]; - functionk = new double[meshK]; - if(SMOOTH) - { - double sigma2 = SIGMA*SIGMA; - for(int ir=0; irrcut)*(r[ir]-this->rcut)/2.0/sigma2) ); - } - } - for(int ir=0; ireigen1[ie] = this->eigenvalue(L, ie);} - - ZEROS(psi,mesh); - for(int ie=0; ie0.999)=" << ecut << endl; - - delete[] jj; - delete[] psik; - delete[] function; - timer::tick("Psi_Second","get_ecut"); - return ecut; -} - - -void Psi_Second::norm_c4( double *c4, const int &L) -{ - ZEROS(this->psi,mesh); - for(int ie=0; iejle, mesh); -// Mathzone::Spherical_Bessel( this->mesh, this->r, this->eigen1[ie], L, jle); - - for(int ir=0; irpsi[ir] += c4[ie] * jle[L][ie][ir];} - } - - double* function = new double[mesh]; - for(int ir=0; ir0.0); - - for(int ie=0; ie -// The number of local(ie) orbitals is : nwfc; -// The number of Bloch orbitals is : nbands; -// The number of ie is : ne -// The number of k points : nks; -//========================================================== -void ReadData::OverlapQandS(const string &name) -{ - TITLE(ofs_running, "ReadData", "OverlapQandS"); - - ifstream ifs; - - double* weighttmp = new double[NKSTOT]; - double* carkx = new double[NKSTOT]; - double* carky = new double[NKSTOT]; - double* carkz = new double[NKSTOT]; - ZEROS(weighttmp, NKSTOT); - - if(MY_RANK==0) - { - ifs.open(name.c_str()); - - if (!ifs) - { - cout << "\n Can't find file : " << name; - WARNING_QUIT("ReadData::OverlapQandS","Can't find file."); - } - else - { - cout << " FILE : " << name << endl; - } - - double lat0; - ifs >> lat0; - assert(lat0 == LAT0); - - double e11,e12,e13,e21,e22,e23,e31,e32,e33; - - ifs >> e11 >> e12 >> e13; - ifs >> e21 >> e22 >> e23; - ifs >> e31 >> e32 >> e33; - - assert( e11 == LATVEC.e11); - assert( e12 == LATVEC.e12); - assert( e13 == LATVEC.e13); - assert( e21 == LATVEC.e21); - assert( e22 == LATVEC.e22); - assert( e23 == LATVEC.e23); - assert( e31 == LATVEC.e31); - assert( e32 == LATVEC.e32); - assert( e33 == LATVEC.e33); - - int ntype; - READ_VALUE(ifs, ntype); // 1 - assert(ntype==NTYPE); - - double x,y,z; - for(int it=0; it> x >> y >> z; - } - } - - double tmp_ecutwfc; - double tmp_ecutwfc_jlq; - double tmp_rcut; - - READ_VALUE(ifs, tmp_ecutwfc);// 4 - READ_VALUE(ifs, tmp_ecutwfc_jlq);// 5 - READ_VALUE(ifs, tmp_rcut);// 6 - - assert(tmp_ecutwfc == ECUT); - assert(tmp_ecutwfc_jlq == ECUT_JLQ); - assert(tmp_rcut == RCUT); - - // mohan add 2009-08-28 - // make sure all structures have - // same SMOOTH and SIGMA value! - bool tmp_smooth; - double tmp_sigma; - double tmp_tolerence; - - READ_VALUE(ifs, tmp_smooth); // 7 - READ_VALUE(ifs, tmp_sigma); // 8 - READ_VALUE(ifs, tmp_tolerence); // 9 - - assert(tmp_smooth == SMOOTH); - assert(tmp_sigma == SIGMA); - assert(tmp_tolerence == TOLERENCE); - - int lmaxall, nkstot, nbands, nwfcall, ne; - - READ_VALUE(ifs, lmaxall); // 10 - READ_VALUE(ifs, nkstot);// 11 - READ_VALUE(ifs, nbands);// 12 - READ_VALUE(ifs, nwfcall);// 13 - READ_VALUE(ifs, ne);// 14 - - assert(lmaxall == LMAXALL); - assert(nkstot == NKSTOT); - assert(nbands == NBANDS); - assert(nwfcall == NWFCALL); - assert(ne == NE); - - //========================================== - // if use IBZ k-points, weight is different - // for each k point - //========================================== - // 0 means don't need to search from start. - if( SCAN_BEGIN(ifs,"",0) ) - { - ofs_running << " Kx/Ky/Kz/Kweight" ; - for(int ik=0; ik> carkx[ik] - >> carky[ik] - >> carkz[ik] - >> weighttmp[ik]; - ofs_running << " " << carkx[ik] - << " " << carky[ik] - << " " << carkz[ik] - << " " << weighttmp[ik] << endl; - } - SCAN_END(ifs,""); - } - - double sum = 0; - for(int ik=0; ik",restart,quit) ) - { - USEPW = false; - } - } - -#ifdef __MPI - Parallel_Common::bcast_bool(USEPW); -#endif - - if(USEPW) - { - ofs_running << " USE PLANE WAVE BASIS" << endl; - } - else - { - ofs_running << " USE Q and S matrix" << endl; - } - - if(CALSPI==0) return; - - if(!USEPW) - { - this->Sq1q2 = new ComplexArray[ NKS ]; - for(int ik=0; ikSq1q2[ik].create(NWFCALL, NWFCALL, NE, NE); - } - } - - -#ifdef __MPI - if(!USEPW) - { - const int ndata = NWFCALL * NWFCALL * NE * NE; - double* buffera = new double[ndata]; - double* bufferb = new double[ndata]; - for(int ik=0; ik> buffera[id] >> bufferb[id]; - } - } - //ofs_running << "\n ik=" << ik; - MPI_Status ierror; - const int pool = Pkpoints.whichpool[ik]; - const int iknow = ik - Pkpoints.startk_pool[MY_POOL]; - const int startdata = 0; // this is differnt from Q. - - //ofs_running << " this k point belong to pool : " << pool; - //ofs_running << " my pool : " << MY_POOL << endl; - - if(MY_RANK==0) - { - // always ready to send data to other processors. - if(pool==0) - { - // send copies (nproc - 1). - for(int ip=1; ipSq1q2[iknow].ptr[id + startdata] = std::complex (buffera[id], bufferb[id]); - } - // ofs_running << "\n local data copy "; - } - else - { - // send copys: nproc - for(int ip=0; ipSq1q2[iknow].ptr[id + startdata] = std::complex (buffera[id], bufferb[id]); - } - // ofs_running << "\n receive data end" << endl; - } - else - { - // ofs_running << "\n do nothing"; - } - } - MPI_Barrier(MPI_COMM_WORLD); - } - delete[] buffera; - delete[] bufferb; - }// end begin -#else - assert(NKS==NKSTOT); - if(!USEPW) - { - double a,b; - for (int ik = 0; ik < NKSTOT; ik++) - { - this->Sq1q2[ik].create(NWFCALL, NWFCALL, NE, NE); - - for (int i = 0; i < Sq1q2[ik].getSize(); i++) - { - ifs >> a >> b; - Sq1q2[ik].ptr[i] = std::complex(a,b); - } - } - } -#endif - -// SCAN_END(ifs,""); - - timer::tick("ReadData", "OverlapSq1q2"); - return; -} - -void ReadData::OverlapQ(ifstream &ifs) -{ - if(CALSPI==0) return; -// TITLE("ReadData", "OverlapQ"); - timer::tick("ReadData", "OverlapQ"); - - assert(NKS > 0); - assert(NBANDS > 0); - assert(NWFCALL > 0); - assert(NE > 0); - - this->Qin.create(NKS, NBANDS, NWFCALL, NE); - - ofs_running << " DIMENSION OF Q=" << endl; - OUT(ofs_running,"NKS",NKS); - OUT(ofs_running,"NBANDS",NBANDS); - OUT(ofs_running,"NWFCALL",NWFCALL); - OUT(ofs_running,"NE",NE); - - bool begin = false; - - if(MY_RANK ==0 ) - { - if( SCAN_BEGIN(ifs,"",0) ) - { - begin = true; - } - } - -#ifdef __MPI - Parallel_Common::bcast_bool(begin); -#endif - - - - if(begin) - { - double a,b; -#ifdef __MPI - const int ndata = NBANDS * NWFCALL * NE; - double* buffera = new double[ndata]; - double* bufferb = new double[ndata]; - for(int ik=0; ik> buffera[id] >> bufferb[id]; - } - } - - //ofs_running << "\n ik=" << ik; - - MPI_Status ierror; - const int pool = Pkpoints.whichpool[ik]; - const int iknow = ik - Pkpoints.startk_pool[MY_POOL]; - const int startdata = iknow * ndata; - - //ofs_running << "\n this k point belong to pool : " << pool; - //ofs_running << "\n my pool : " << MY_POOL; - - if(MY_RANK==0) - { - // always ready to send data to other processors. - if(pool==0) - { - // send copies (nproc - 1). - for(int ip=1; ipQin.ptr[id + startdata] = std::complex (buffera[id], bufferb[id]); - } - //ofs_running << "\n local data copy "; - } - else - { - // send copys: nproc - for(int ip=0; ipQin.ptr[id + startdata] = std::complex (buffera[id], bufferb[id]); - } - //ofs_running << "\n receive data end" << endl; - } - else - { - //ofs_running << "\n do nothing"; - } - } - - MPI_Barrier(MPI_COMM_WORLD); - }// endik - delete[] buffera; - delete[] bufferb; -#else - for(int i=0; i> a >> b; - this->Qin.ptr[i] = std::complex( a, b ); - } -#endif - } - - - - //SCAN_END(ifs,""); - - timer::tick("ReadData", "OverlapQ"); - - return; -} - -//========================================================== -// Readin inverse S matrix. -// Sinv is fail to use if C4 change. -//========================================================== -void ReadData::OverlapSinv(const string &name) -{ -// TITLE("ReadData", "OverlapSinv"); - ifstream ifs(name.c_str()); - - if (!ifs) - { - cout << "\n Can't find file : " << name; - cout << "\n But maybe we don't need it."; - return; - } - - assert(NKS > 0); - assert(NWFCALL > 0); - - this->Sinv.create(NKS, NWFCALL, NWFCALL); - - return; - - string tmp; - int row, col; - - for (int i = 0; i < NKS; i++) - { - ifs >> tmp >> row >> col; -// cout << "\n" << tmp << " row=" << row << " col=" << col << endl; - assert(row == NWFCALL); - assert(col == NWFCALL); - - for (int j = 0; j < row; j++) - { - for (int k = 0; k < col; k++) - { - double a,b; - ifs >> a >> b; - Sinv(i,j,k) = std::complex(a,b); - } - } - } - ifs.close(); - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/ReadData.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/ReadData.h deleted file mode 100644 index 4e4d356d4b..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/ReadData.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ReadData_H -#define ReadData_H - -#include "common.h" - -class ReadData -{ - public: - - ComplexArray Qin; - ComplexArray *Sq1q2; - ComplexArray Sinv; - - //=================================== - // read in data Q= , S= - //=================================== - void OverlapQandS( const string &name); - - //======================================================== - // inverse matrix of S directly, - // used for checking the correctness - // of spillage calculation - //======================================================== - void OverlapSinv( const string &name); - - double *weight; - - private: - void OverlapQ( ifstream &ifs); - void OverlapSq1q2( ifstream &ifs ); - - int test; - - public: - ReadData(); - ~ReadData(); - -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageStep.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageStep.cpp deleted file mode 100644 index 24aa442be1..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageStep.cpp +++ /dev/null @@ -1,1072 +0,0 @@ -#include "SpillageStep.h" -#include "../src_parallel/parallel_reduce.h" -#include "tools.h" - -SpillageStep::SpillageStep() -{ - test = 0; - info = new Type_Information[1]; - data = new Step_Data[1]; - wayc = new Way2c4[1]; - wayd = new Way2Data[1]; -} -SpillageStep::~SpillageStep() -{ - delete[] info; - delete[] data; - delete[] wayc; - delete[] wayd; -} - - -void SpillageStep::set_info(const int &ntype_in) -{ - this->ntype = ntype_in; - cout << "\n Element type = " << ntype; - assert(ntype > 0); - delete[] info; - info = new Type_Information[ntype]; - return; -} - -void SpillageStep::set_nwfc() -{ - TITLE("SpillageStep","set_nwfc"); - assert( ntype > 0); - //=============================== - // (1) generate nwfc, nwfc2 - //=============================== - this->nwfc = 0; - this->nwfc2 = 0; - for (int i=0; iwayd[iw2].ic = ic; - if (test==2) cout << "\n iw2=" << iw2 << " ic=" << ic; - ++iw2; - }// end m - } - else if (info[it].fa[l] == "a") - { - this->wayd[iw2].ic = ic; - ++iw2; - } - ++ic; - }// end n - }// end l - nw_this_type = iw2 - index_copy; - } - else - { - for (int j=index_copy; jwayd[iw2].ic = this->wayd[j].ic; - if (test==2) cout << "\n iw2=" << iw2 << " ic=" << wayd[iw2].ic; - iw2++; - } - } - } - } - - //cout << "\n iw2 = " << iw2; - //cout << "\n nwfc2 = " << nwfc2; - assert(iw2==nwfc2); - return; -} - - -void SpillageStep::set_iw00(void) -{ - //========================= - // (3) generate iw00 - //========================= - - int iw00 = 0; - int iw2 = 0; - for (int it=0; it not equal."); - } - //cout << " type=" << it << " lmax=" << info[it].lmax << endl; - for (int i=0; i< NA[it]; i++) - { - //for (int l=0; l<= mz.lmax_type[it]; l++) - for (int l=0; l<= LMAXALL; l++) // mohan fix bug 2010-08-06 - { - if ( l <= info[it].lmax ) - { - for (int n=0; nwayd[iw2].iw00 = copy;// position to get overlap. - if (test == 2) - { - cout << "\n iw2=" << iw2 << " iw00=" << copy; - } - ++copy; - ++iw2; - } - } - else if ( info[it].fa[l] == "a" ) - { - this->wayd[iw2].iw00 = iw00; // just the start position to get overlap. - ++iw2; - } - } - } - iw00 += 2*l + 1; - } - } - } - - if (iw00!=NWFCALL) - { - cout << "\n iw00=" << iw00 << " NWFCALL=" << NWFCALL; - WARNING_QUIT("SpillageStep::set_iw00","iw00!=input.QS_data[0].nwfc"); - } - assert(iw2==nwfc2); - - return; -} - - -void SpillageStep::set_nchi() -{ - if (test==1)TITLE("SpillageStep","set_nchi"); - assert( ntype >0 ); - //========================= - // (1) generate nchi - //========================= - this->nchi = 0; - for (int i=0; i 0 ); - - delete[] this->data; - this->data = new Step_Data[ STRNUM ]; - this->ne = NE; - - for ( int is=0; isnwfc, - this->nwfc2, - NWFCALL // all read in wave functions number - ); - - if (istep == 0) - { - for (int ik=0; ik 0 ) - { - for(int ik=0; ik< data[is].nks; ik++) - { - for(int ib=0; ib< data[is].nbands; ib++) - { - for(int ie=0; ie< data[is].ne; ie++) - { - data[is].Qin(ik, ib, iw_step, ie) = input.QS_data[is].Qin(ik, ib, iw, ie); - } - } - } - if(test==2)cout << "\n iw_step=" << iw_step << " iw=" << iw; - iw_step++; - } - } - iw++; - } - } - } - } - */ -// cout << "\n iw_step = " << iw_step; -// cout << "\n iw = " << iw; - } - - return; -} - -void SpillageStep::init_QS_matrix( const int &is) -{ - if (test==1)TITLE("SpillageStep","init_QS_matrix"); - - if (USEPW) - { - // notice! calculate_psi1d must consistent - // with psi3d in the same init_QS_matrix - // function. because the init_QS_matrix - // may be called in two differnt places. - PW.calculate_psi1d(); - } - - for (int ik = 0; ik < this->data[is].nks; ik++) - { - if (USEPW) - { - PW.calculate_psi3d(ilevel, ik); - } - - this->data[is].Soverlap[ik].zero_out(); - this->data[is].Qoverlap[ik].zero_out(); - // init Q matrix - for (int ib = 0; ib < this->data[is].nbands; ib++) - { - for (int iw = 0; iw < this->data[is].nwfc2; iw++) - { - const int jw = this->wayd[iw].iw00; - const int T = this->wayd[iw].type; - const int L = this->wayd[iw].L; - const int N = this->wayd[iw].N; - for (int ie=0; iedata[is].ne; ie++) - { - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - // if use 'full orbitals' - if ( this->wayd[iw].average == false) - { - data[is].Qoverlap[ik](iw,ib) += - input.Coef.C4( T, L, N, ie ) * - data[is].Qin(ik, ib, jw, ie); - } - else// if use 'average orbitals' - { - const int nofm = 2*L+1; // number of m - std::complex avalue = std::complex(0.0, 0.0); - - for (int m=0; m< nofm; m++) - { - avalue += data[is].Qin(ik, ib, jw+m, ie); - } - avalue /= nofm; - - data[is].Qoverlap[ik](iw,ib) += - input.Coef.C4( T, L, N, ie ) * avalue; - } - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - } - } - } - - // init S matrix - for (int iw=0; iwwayd[iw].type; - const int L1 = this->wayd[iw].L; - const int N1 = this->wayd[iw].N; - const int iw001 = this->wayd[iw].iw00; - - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - for (int iw2 = iw; iw2 < nwfc2; iw2++) - { - const int T2 = this->wayd[iw2].type; - const int L2 = this->wayd[iw2].L; - const int N2 = this->wayd[iw2].N; - const int iw002 = this->wayd[iw2].iw00; - - if (USEPW) - { - this->data[is].Soverlap[ik](iw, iw2) = PW.calculateS(iw, iw2, ik); -#ifdef __MPI - Parallel_Reduce::reduce_complex_double_pool(this->data[is].Soverlap[ik](iw, iw2)); -#endif - } - else - { -// double value = 0.0; - for (int ie = 0; ie < ne; ie++) - { - for (int ie2 = 0; ie2 < ne; ie2++) - { - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - // case 1 - if ( !wayd[iw].average && !wayd[iw2].average) - { - this->data[is].Soverlap[ik](iw, iw2) += - input.Coef.C4( T1, L1, N1, ie ) * - input.Coef.C4( T2, L2, N2, ie2) * - input.QS_data[is].Sq1q2[ik](iw001, iw002, ie, ie2); - } - // case 2 - else - { - std::complex avalue = std::complex(0.0, 0.0); - // case 21 - if ( wayd[iw].average && wayd[iw2].average) - { - for (int m1=0; m1<2*L1+1; m1++) - { - for (int m2=0; m2<2*L2+1; m2++) - { - avalue += input.QS_data[is].Sq1q2[ik](iw001+m1, iw002+m2, ie, ie2); - } - } - avalue /= ((2*L1+1) * (2*L2+1)); - } - // case 22 - if ( !wayd[iw].average && wayd[iw2].average) - { - for (int m2=0; m2<2*L2+1; m2++) - { - avalue += input.QS_data[is].Sq1q2[ik](iw001, iw002+m2, ie, ie2); - } - avalue /= (2*L2+1); - } - // case 23 - if ( wayd[iw].average && !wayd[iw2].average) - { - for (int m1=0; m1<2*L1+1; m1++) - { - avalue += input.QS_data[is].Sq1q2[ik](iw001+m1, iw002, ie, ie2); - } - avalue /= (2*L1+1); - } - this->data[is].Soverlap[ik](iw, iw2) += - input.Coef.C4( T1, L1, N1, ie ) * - input.Coef.C4( T2, L2, N2, ie2) * - avalue; - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - } - }// ie2 - }// ie - }// iw - -// if(iw==3) -// { -// ofs_running << "\n iw=" << iw << " iw2=" << iw2 << " S[" << ik << "]=" << this->data[is].Soverlap[ik](iw, iw2); -// } - }// ib - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - }//ik - - -// if(ik==0) -// { -// PRINTCM("S", data[is].Soverlap[ik]); -// PRINTCM("Q", data[is].Qoverlap[ik]); -// } - - // because S has symmetry : S^{+} = S -// for(int iw=0; iwdata[is].inverse.using_zpotrf(this->data[is].Soverlap[ik]); - // notice : only half A is stored!!! - this->data[is].Sinv[ik] = this->data[is].inverse.A; - //if(ik==0) - //PRINTCM("init_QS_matrix :: Sinv",data[is].inverse.A); - } - - return; -} - -// (1) Calculate The Spillage Value -// (2) For each Coefficient(type,l,n,ie) changed orbital. -double SpillageStep::get_spillage( - const int &is, // index of structure - const int &ic, // index of orbitals: (type,l,n) - const int &ie // index of eigenvalue of Jlq -) -{ - double spillage; // not need to initialized. - double fill = 0.0; - Step_Data* Stru = &this->data[is]; - - // mohan add 2010-05-02 - // (1) this part is to control the number of - // bands needed to be performed. - static int bands_start; - static int bands_end; - static int bands_number; - - if (BANDS_CONTROL) - { - bands_start = BANDS_START; - bands_end = BANDS_END; - assert(BANDS_END <= Stru->nbands); - bands_number = bands_end - bands_start; - assert(bands_number <= Stru->nbands); - } - else - { - bands_start = 0; - bands_end = Stru->nbands; - bands_number = bands_end - bands_start; - } - - // (2) get new c4 coefficient from ic. - const double c4_new = input.Coef.C4( - this->wayc[ic].type, - this->wayc[ic].L, - this->wayc[ic].N, - ie); - - // (3) get old c4 coefficient. - const double c4_old = input.Coef.C4_old( - this->wayc[ic].type, - this->wayc[ic].L, - this->wayc[ic].N, - ie); - - int unstable = 0; - - if (USEPW) - { - PW.nwfc2 = nwfc2; - PW.update_psi1d(ilevel, ic, ie, c4_new, c4_old); - } - - //ofs_running << "\n ic_now = " << ic << " ie_now=" << ie; - for (int ik = 0; ik < Stru->nks ; ik++) - { - // cout << "ik=" << ik << endl; - // cout << "\n ik = " << ik <<" c4_new=" << c4_new << " c4_old=" << c4_old << " nks=" << Stru->nks << endl; - - // If new Q,S corespodding to the new C4 - // is not accepted. - Stru->Qtrial[ik] = Stru->Qoverlap[ik]; - Stru->Strial[ik] = Stru->Soverlap[ik]; - - this->newQ(is, ic, ie, ik, c4_new, c4_old); - - if (USEPW) - { - PW.update_psi3d(ilevel, ic, ik); - - timer::tick("PW_Basis","calculateS"); - - // old version need to change pw_basis too - if (NPROC_IN_POOL==1) - { - for (int mu=0; muwayd[mu ].ic; - const int ic2 = this->wayd[nu].ic; - if (ic1==ic || ic2==ic) - { - this->data[is].Strial[ik](mu, nu) = PW.calculateS(mu, nu, ik); - } - } - } - } - else - { - int count = 0; - for (int mu=0; muwayd[mu].ic; - const int ic2 = this->wayd[nu].ic; - - // a small trick - if (ic1==ic || ic2==ic) - { - PW.save[count] = PW.calculateS(mu, nu, ik); - PW.posmu[count] = mu; - PW.posnu[count] = nu; - //this->data[is].Strial[ik](mu, nu) = PW.calculateS(mu, nu, ik); - //ofs_running << "\n save=" << save[count] << " mu=" << mu << " nu=" << nu; - ++count; - } - } - } -#ifdef __MPI - Parallel_Reduce::reduce_complex_double_pool(PW.save, count); -#endif - for (int index=0; indexdata[is].Strial[ik](PW.posmu[index], PW.posnu[index]) = PW.save[index]; - // ofs_running << "\n mu=" << pos[index*2] << " nu=" << pos[index*2+1] << " save=" << save[index]; - } - } - timer::tick("PW_Basis","calculateS"); - } - else - { - this->newS(is, ic, ie, ik, c4_new, c4_old); - } - - Stru->inverse.using_zpotrf( Stru->Strial[ik] ); -// if(ik==3) -// { -// PRINTCM("S",data[is].Strial[ik]); -// PRINTCM("Q",data[is].Qtrial[ik]); -// PRINTCM("Sinv",Stru->inverse.A); -// } - -// BLOCK_HERE("spillage"); - - // assert all 'Stru' have same k points and bands. - // mohan 2010-05-02 - Stru->Mk[ik] = 0.00; -//>>>>> -// Keep the flexibility to calculate the spillage value -// of different number of bands for different structures - //for (int ib = 0; ib < Stru->nbands; ib++) -//<<<<< - //but now I want to calculate the spillage of given number of bands - //(1)from input, for all steps. (2) for each step. - for (int ib=bands_start; ibMkb_used(ik,ib) = 0.0; - for (int iw = 0; iw < Stru->nwfc2; iw++) - { - for (int iw2 = 0; iw2 < Stru->nwfc2; iw2++) - { - //Mk += (conj(Qtrial[ik](iw, ib)) * sinv(iw, iw2) * Qtrial[ik](iw2, ib)).real(); - if (iw <= iw2) - { - Stru->Mkb_used(ik,ib) += (conj( Stru->Qtrial[ik](iw, ib)) - * Stru->inverse.A(iw, iw2) - * Stru->Qtrial[ik](iw2, ib)).real(); - } - else - { - Stru->Mkb_used(ik,ib) += (conj( Stru->Qtrial[ik](iw, ib)) - * conj( Stru->inverse.A(iw2, iw)) - * Stru->Qtrial[ik](iw2, ib)).real(); - } - } - } - Stru->Mk[ik] += Stru->Mkb_used(ik,ib); - //ofs_running << "ik=" << ik << " ib=" << ib << " Mk=" << Stru->Mk[ik] << endl; - } - - Stru->Mk[ik] /= (double)bands_number; - //cout << endl; - - // in fact this is caused by numerical unstability. - //if (Stru->Mk[ik]*Stru->weight[ik] > upbound)//mohan fix bug 2010-06-14 - if (fill > Stru->spillage0 )//mohan refix bug 2010-06-18 - { - ++unstable; - } - else if (Stru->Mk[ik] < 0.0) - { - ++unstable; - } - else - { - fill += Stru->Mk[ik] * Stru->weight[ik]; - } - }//end ik - - -#ifdef __MPI -// Parallel_Reduce::reduce_int_all(unstable); - if (unstable>0) - { - ofs_running << "\n unstable=" << unstable; - //return Stru->spillage0; - } - Parallel_Reduce::reduce_double_allpool(fill); -#endif - - spillage = Stru->spillage0 - fill; - - if (spillage < 0.0 || spillage > 1.0 || unstable) - { - cout << "\n spillage0 = " << Stru->spillage0; - cout << "\n Type=" << this->wayc[ic].type - << " L=" << this->wayc[ic].L - << " N=" << this->wayc[ic].N; - cout << "\n bands_number = " << bands_number; - - for (int ib=0; ibMkb_used(ik,ib) * Stru->weight[ik]/bands_number; - } - cout << "\n ib=" << ib << " new fill=" << mm; - } - - double sum = 0.0; - for (int ik=0; ikMk[ik]; - sum += Stru->Mk[ik] * Stru->weight[ik]; - } - cout << "\n sum fill = " << sum; - cout << endl; - QUIT(); - return Stru->spillage0; - } - - return spillage; -} - - -void SpillageStep::newQ( const int &is, const int &ic, const int &ie, const int &ik, - const double &c4_now ,const double &c4_old) -{ -// TITLE("SpillageStep","newQ"); - const double delta = c4_now - c4_old; - for (int iw = 0; iw < nwfc2; iw++) - { - const int jw = this->wayd[iw].iw00; - if ( this->wayd[iw].ic == ic) - { - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - if ( !wayd[iw].average ) - { - // the change of dQ= is due to - // the change of Jlq(iw)=delta(Jlq(iw)) - for (int ib = 0; ib < this->data[is].nbands; ib++) - { - this->data[is].Qtrial[ik](iw, ib) += delta - * this->data[is].Qin(ik, ib, jw, ie); - } - } - else // if use average orbital - { - const int L = wayd[iw].L; - for (int ib = 0; ib < this->data[is].nbands; ib++) - { - std::complex avalue = std::complex(0.0, 0.0); - for (int m=0; m<2*L+1; m++) - { - avalue += this->data[is].Qin(ik, ib, jw+m, ie); - } - avalue /= (2*L+1); - this->data[is].Qtrial[ik](iw, ib) += delta * avalue; - } - } - //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - } - } - return; -} - - -void SpillageStep::newS( - const int &is, const int &ic, const int &ie, const int &ik, - const double &c4_now ,const double &c4_old) -{ -// TITLE("SpillageStep","newS"); - // example c = c2, ie2 = ie - //========================================================================================================== - // iw0-s iw1p1 iw2p2 iw3p3 iw4s - // c1 *c2 *c2 *c2 c3 - // ea eb ec ea eb ec ea eb ec ea eb ec ea eb ec - // ea h h h - // iw0-s eb h h h - // c1 ec h h h - //---------------------------------------------------------------------------------------------------------- - // ea h h h - // iw1-p1 *eb h h h ? h ? ? h ? h h h h (? must do because JLq contain k vector) - // *c2 ec h h h - //---------------------------------------------------------------------------------------------------------- - // ea h h h - // iw2-p2 *eb h h h ? h ? h h h h h - // *c2 ec h h h - //---------------------------------------------------------------------------------------------------------- - // ea h h h - // iw3-p3 *eb h h h h h h h h h - // *c2 ec h h h - //----------------------------------------------------------------------------------------------------------- - // ea h h h - // iw4-s eb h h h - // c3 ec h h h - //------------------------------------------------------------------------------------------------------------ - // ea h h h - // iw5-p1 eb . . . - // c4 ec . . . - //----------------------------------------------------------------------------------------------------------- - // ea - // iw6-p2 eb - // c4 ec - //-------------------------------------------------------------------------- - // ea - // iw7-p3 eb - // c4 ec - // - // (e1) - //========================================================================== - //================================================= - // search in all wavefunction ( type, i, l, m, n ) - //================================================= - for (int iw = 0; iw < this->data[is].nwfc2; iw++) - { - const int jw = this->wayd[iw].iw00; - const int ic1 = this->wayd[iw].ic; - const int T1 = this->wayd[iw].type; - const int L1 = this->wayd[iw].L; - const int N1 = this->wayd[iw].N; - // belong to which group of c, eg. p1,p2,p3 may - // have the same ic1. - //============================================= - // search in all other eigenvalues (ic1 != ic). - //============================================= - for (int ie1 = 0; ie1 < this->data[is].ne; ie1++) - { - // update for the 'ic' row - if ( ie1 != ie || ic1 !=ic ) - { - for (int iw2 = iw; iw2 < this->data[is].nwfc2; iw2++) - { - const int kw = this->wayd[iw2].iw00; - if (this->wayd[iw2].ic == ic) - { - // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - // case 1 - if ( !wayd[iw].average && !wayd[iw2].average) - { - this->data[is].Strial[ik](iw, iw2) += - (c4_now * input.Coef.C4( T1, L1, N1, ie1 ) - - c4_old * input.Coef.C4_old( T1, L1, N1, ie1 ) ) - * input.QS_data[is].Sq1q2[ik](jw, kw, ie1, ie); - } - else // case 2 - { - const int L2 = this->wayd[iw2].L; - std::complex avalue = std::complex(0.0, 0.0); - // case 2.1 - if ( wayd[iw].average && !wayd[iw2].average) - { - for (int m1=0; m1<2*L1+1; m1++) - { - avalue += input.QS_data[is].Sq1q2[ik](jw+m1, kw, ie1, ie); - } - avalue /= (2*L1+1); - } - // case 2.2 - if ( !wayd[iw].average && wayd[iw2].average) - { - for (int m2=0; m2<2*L2+1; m2++) - { - avalue += input.QS_data[is].Sq1q2[ik](jw, kw+m2, ie1, ie); - } - avalue /= (2*L2+1); - } - // case 2.3 - if ( wayd[iw].average && wayd[iw2].average) - { - for (int m1=0; m1<2*L1+1; m1++) - { - for (int m2=0; m2<2*L2+1; m2++) - { - avalue += input.QS_data[is].Sq1q2[ik](jw+m1, kw+m2, ie1, ie); - } - } - avalue /= ( (2*L1+1)*(2*L2+1) ); - } - this->data[is].Strial[ik](iw, iw2) += - (c4_now * input.Coef.C4( T1, L1, N1, ie1 ) - - c4_old * input.Coef.C4_old( T1, L1, N1, ie1 ) ) - * avalue; - } - // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - } - } - } - else - { - for (int iw2 = iw; iw2 < this->data[is].nwfc2; iw2++) - { - const int ic2 = this->wayd[iw2].ic; - const int kw = this->wayd[iw2].iw00; - const int T2 = this->wayd[iw2].type; - const int L2 = this->wayd[iw2].L; - const int N2 = this->wayd[iw2].N; - for (int ie2 = 0; ie2 < this->data[is].ne; ie2++) - { - // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - if ( !wayd[iw].average && !wayd[iw2].average) - { - this->data[is].Strial[ik](iw, iw2) += - (c4_now * input.Coef.C4( T2, L2, N2, ie2 ) - - c4_old * input.Coef.C4_old( T2, L2, N2, ie2 ) ) - * input.QS_data[is].Sq1q2[ik](jw, kw, ie, ie2); - } - else // case 2 - { - const int L2 = this->wayd[iw2].L; - std::complex avalue = std::complex(0.0, 0.0); - // case 2.1 - if ( wayd[iw].average && !wayd[iw2].average) - { - for (int m1=0; m1<2*L1+1; m1++) - { - avalue += input.QS_data[is].Sq1q2[ik](jw+m1, kw, ie, ie2); - } - avalue /= (2*L1+1); - } - // case 2.2 - if ( !wayd[iw].average && wayd[iw2].average) - { - for (int m2=0; m2<2*L2+1; m2++) - { - avalue += input.QS_data[is].Sq1q2[ik](jw, kw+m2, ie, ie2); - } - avalue /= (2*L2+1); - } - // case 2.3 - if ( wayd[iw].average && wayd[iw2].average) - { - for (int m1=0; m1<2*L1+1; m1++) - { - for (int m2=0; m2<2*L2+1; m2++) - { - avalue += input.QS_data[is].Sq1q2[ik](jw+m1, kw+m2, ie, ie2); - } - } - avalue /= ( (2*L1+1)*(2*L2+1) ); - } - this->data[is].Strial[ik](iw, iw2) += - (c4_now * input.Coef.C4( T2, L2, N2, ie2 ) - - c4_old * input.Coef.C4_old( T2, L2, N2, ie2 ) ) - * avalue; - } - // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - } - } - } - } - } - - // PRINTCM("S",Strial[ik]); - return; -} - - - -void SpillageStep::updateQS( const int &is ) -{ -// if(test==1)TITLE("SpillageStep","updateQS"); - for (int ik=0; ik< data[is].nks; ik++) - { - data[is].Qoverlap[ik] = data[is].Qtrial[ik]; - data[is].Soverlap[ik] = data[is].Strial[ik]; - } - return; -} - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageStep.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageStep.h deleted file mode 100644 index 6b3afcc846..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageStep.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef SPILLAGE_STEP -#define SPILLAGE_STEP - -#include "common.h" -#include "Step_Data.h" -#include "Type_Information.h" - -// use orbital index to find the information -// of each orbital. -struct Way2Data // dimension : nwfc2 -{ - int type; - int i; // atom index - int L; - int N; - int m; // mohan add 2010-06-16 - - int iw0; // to label , which not include 'N', but not used now, - int iw00; // to - int ic; - - bool average; // mohan add 2009-07-12 -}; - -struct Way2c4 // dimension : nchi -{ - int type; - int L; - int N; - char spd; //mohan add 2010-04-17, the orbital type. -}; - -// (1) It's a memeber of MultiZeta. -// (2) define the operations for each step. -// (3) Especially it defines many complicated index. -// (4) It also defines the main routine to calculate the spillage value. -// (5) Also the update of Q and S matrix using complicated index. -// (6) It also contains four calss: Type_Information; Step_Data; Way2c4; Way2Data; -class SpillageStep -{ - public: - SpillageStep(); - ~SpillageStep(); - - Type_Information *info; // dimension : type - Step_Data *data; - Way2c4 *wayc; - Way2Data *wayd; - - void set_info(const int &ntype_in); - void set_nwfc(void); - void set_iw00(void); - void set_nchi(void); - - // allocate data for current level. - void allocate_data( const int &istep); - - void init_QS_matrix( const int &is); - double get_spillage( const int &is, const int &ic, const int &ie); - void updateQS( const int &is ); - - int ntype; - int nchi; // total radial wave functions(T,L,N); - int nwfc2; - int ne; - int ilevel; - - private: - - void newQ( const int &is, const int &ic, const int &ie, const int &ik, - const double &c4_now, const double &c4_old); - void newS( const int &is, const int &ic, const int &ie, const int &ik, - const double &c4_now ,const double &c4_old); - - int test; - int nwfc; -}; -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageValue.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageValue.cpp deleted file mode 100644 index 78e7146b6a..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageValue.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "SpillageValue.h" -#include "tools.h" - -SpillageValue::SpillageValue() -{ - dim = 0; - value = new double[1]; - value_old = new double[1]; -} - -SpillageValue::~SpillageValue() -{ - delete[] value; - delete[] value_old; -} - -void SpillageValue::allocate( const int &dim_in ) -{ - this->dim = dim_in; - assert( dim < 100); - assert( dim > 0); - - delete[] value; - delete[] value_old; - value = new double[dim]; - value_old = new double[dim]; - - // assume max step < 100 - const int max_levels = 100; - value_each_level.create(dim, max_levels); - - this->reset(); - - return; -} - -void SpillageValue::reset(void) -{ - for(int i=0; ivalue; - } - else - { - v = this->value_old; - } - - double mv=0.0; - // case 1: // get the largest spillage value. - if( abs(SCHEME_VALUE)==1) - { - for(int i=0; ivalue_each_level(i ,ilevel) = value_old[i]; - } - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageValue.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageValue.h deleted file mode 100644 index b0827a60f0..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/SpillageValue.h +++ /dev/null @@ -1,55 +0,0 @@ -// mohan mddify 2010-05-02 -#ifndef SPILLAGE_VALUE_H -#define SPILLAGE_VALUE_H - -#include "common.h" - -class SpillageValue -{ - friend class Read_INPUT; - - friend class MultiZeta; - // in multizeta, 'value_old' are calculated. - - friend class Metropolis; - // in metropolis, 'value' are set. - - friend class Out_Orbital; - // in OurOrbital, 'value each level' are used. - - public: - - // 1: get new spillage value. - // 0: get old spillage value. - double cal_defined_value( bool get_new_flag); - - void update_value(); - - void out(); - - void save_level( const int &ilevel); - - private: - - // spillage value for each structure. - double *value; - - // the previous spillage value for each structure. - double *value_old; - - // spillage for all structures. - matrix value_each_level; - - // dimension is the number of structures. - // eg. 5 different dimers. - int dim; - - void allocate( const int &dim_in ); - - void reset(); - - SpillageValue(); - ~SpillageValue(); -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Step_Data.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Step_Data.cpp deleted file mode 100644 index 8bd3d05e26..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Step_Data.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "Step_Data.h" - -Step_Data::Step_Data() -{ -// TITLE("Step_Data","Step_Data"); - Qoverlap = new ComplexMatrix[1]; - Soverlap = new ComplexMatrix[1]; - Qtrial = new ComplexMatrix[1]; - Strial = new ComplexMatrix[1]; - weight = new double[1]; - Sinv = new ComplexMatrix[1]; - Mk = new double[1]; - test = 0; -} - -Step_Data::~Step_Data() -{ -// TITLE("Step_Data","~Step_Data"); - delete[] Qoverlap; - delete[] Soverlap; - delete[] Qtrial; - delete[] Strial; - delete[] weight; - delete[] Sinv; - delete[] Mk; -} - -void Step_Data::init( - const int &nks_in, - const double* weight_in, - const int &nbands_in, - const int &ne_in, - const int &nwfc_in, - const int &nwfc2_in, - const int &nwfc_all_in) -{ - if(test==1)TITLE("Step_Data","init"); - this->nks = nks_in; - assert(nks > 0); - - delete[] Mk; //mohan add 2010-05-02 - this->Mk = new double[nks]; - ZEROS( Mk, nks ); - - delete[] weight; - this->weight = new double[nks]; - for(int ik=0; iknbands = nbands_in; - - assert(nbands > 0); - this->Mkb.create(nks, nbands);//mohan add 2010-05-02 - this->Mkb_used.create(nks, nbands); - this->Mkb.zero_out(); - this->Mkb_used.zero_out(); - - this->ne = ne_in; - this->nwfc = nwfc_in; - this->nwfc2 = nwfc2_in; - this->nwfc_all = nwfc_all_in; - - - if(test==1) - { - cout << "\n" << setw(10) << "nwfc" - << setw(10) << "nwfc2" - << setw(10) << "nwfc_all"; - - cout << "\n" << setw(10) << nwfc - << setw(10) << nwfc2 - << setw(10) << nwfc_all; - } - - this->allocate(); - - return; -} - -void Step_Data::allocate() -{ - this->Qin.create(nks, nbands, nwfc_all, ne); - return; -} - -// be called in Multi_Zeta.cpp -void Step_Data::initQS(void) -{ - if(test==1) TITLE("Step_Data","initQS"); - assert(nks > 0); - assert(nbands > 0); - assert(nwfc > 0); // nwfc is for , - assert(ne > 0); - - this->inverse.init(nwfc2); - delete[] Qtrial; - delete[] Strial; - delete[] Qoverlap; - delete[] Soverlap; - delete[] Sinv; - - this->Qoverlap = new ComplexMatrix[nks]; - this->Soverlap = new ComplexMatrix[nks]; - this->Qtrial = new ComplexMatrix[nks]; - this->Strial = new ComplexMatrix[nks]; - this->Sinv = new ComplexMatrix[nks]; - - for(int ik=0; ik=-1); - delete[] n; - delete[] nbase; - delete[] fa; - n = new int[lmax+1]; - nbase = new int[lmax+1]; - fa = new string[lmax+1]; - for(int i=0; inmax = 0; - for(int l=0; lnmax = std::max( nmax, n[l]+nbase[l] ); - } -// cout << "\n nmax = " << nmax; - return; -} - -void Type_Information::cal_nw(void) -{ - TITLE("Type_Information","cal_nw"); - // where is this lmax from ? - // in Multi_Zeta, - // read in from file directly - // for each level and each type. - - // be called in SpillageStep. - - // nw2: number of total local orbitals. - // (ia, l, n, m) - // Including multi-zeta orbitals, - // which are made up from same Jl(q). - this->nw2 = 0; - for(int l=0; l 1 - // f orbitals, 7 ==> 1 - } - //cout << "\n nw = " << nw; - } - - // nw: number of overlap we must save. - // doesn't consider n[l], - // the only condition is n[l] > 0 in this atom species. - this->nw = 0; - for(int l=0; l0) - { - nw += (2*l+1)*na; - } - } - - cout << " cal_nw::nw = " << nw; - cout << " cal_nw::nw2 = " << nw2 << endl; - return; -} - - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Type_Information.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Type_Information.h deleted file mode 100644 index 1a9e0d38f6..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/Type_Information.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef TYPE_INFORMATION_H -#define TYPE_INFORMATION_H -#include "common.h" - -// Information of a particular type -class Type_Information -{ - public: - Type_Information(); - ~Type_Information(); - int id;// index of element periodic table. - - int na;// number of atoms of this type. - - string *fa;// mohan add 2009-07-12 - // f: full orbtial used. - // a: average orbital used. - - string state; // mohan add 2009-08-27, new/skip - // state: new, start Metropolis calculation in this step. - // state: skip, skip this Metropolis calculation, - // used only in case RESTART=TRUE; - - int lmax;// lmax used. - - int *n;// number of radial function for each L. - - int *nbase;// number of radial function of each L, sum up all the steps information before! - - int nmax; - - int nw; - - int nw2; - - void init();// allocate n, nbase, fa; - void cal_nw(); - void cal_nmax(); -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/common.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/common.cpp deleted file mode 100644 index 3ec4fd9da4..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/common.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include "common.h" -void PRINTCM(const string &s, const ComplexMatrix &m) -{ - const int b1 = m.nr; - const int b2 = m.nc; - cout << "\n" << s << " " << b1 << " " << b2 ; - - if (b1*b2 == 0) return; - - cout << "\n norm : "; - for (int i = 0;i < b1;i++) - { - for (int j = 0;j < b2;j++) - { - if (j % 8 == 0) cout << "\n "; - double norm = ( conj( m(i, j) ) * m(i, j) ).real(); - if( abs(norm) > 1.0e-9) cout<< setw(12) << norm; - else cout< 1.0e-9) cout<< setw(12) << n; - else cout< 1.0e-9) cout<< setw(12) << n; - else cout<> SearchName; - if( SearchName == TargetName) - { - find = true; -// cout << " Find the block:" << TargetName << endl; - break; - } - } - if (!find && quit) - { - cout << "\n Can't find : " << TargetName; - exit(0); - } - return find; -} - -void SCAN_END(ifstream &ifs, const string &TargetName) -{ - string SearchName; - ifs >> SearchName; - if( SearchName != TargetName) - { - cout<<"\n"<<"In SCAN_END, can't find: "<> ok; - -} - -void QUIT(void) -{ - timer::finish(); -#ifdef __MPI - MPI_Finalize(); -#endif - exit(0); -} - -void TITLE(const string &class_name,const string &function_name) -{ -// ofs_running<<"\n\n ==> "< "< "< "< -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include "../src_tools/mathzone.h" -#include "../src_tools/realarray.h" -#include "../src_tools/intarray.h" -#include "../src_tools/matrix.h" -#include "../src_tools/matrix3.h" -#include "../src_tools/complexmatrix.h" -#include "../src_tools/complexarray.h" -#include "../src_tools/lapack_connector.h" -#include "../src_tools/Random.h" -#include "../src_tools/timer.h"// added 2009-4-17 -#include "../src_tools/inverse_matrix.h" - -#ifdef __MPI -#include -#endif - -template -static void READ_VALUE(ifstream &ifs, T &v) -{ - ifs >> v; - ifs.ignore(150, '\n'); - return; -} - - -bool SCAN_BEGIN(ifstream &ifs, const string &TargetName, const bool restart=1, const bool quit=true); -void SCAN_END(ifstream &ifs, const string &TargetName); -void TITLE(const string &class_name,const string &function_name); -void TITLE(ofstream &ofs, const string &class_name,const string &function_name); -void PRINTCM(const string &s, const ComplexMatrix &m); -//========================================================== -// GLOBAL FUNCTION : -// NAME : ZEROS -// set elements of u as zero which u is 1_d complex array -//========================================================== -template -void ZEROS(complex *u,const int n) -{ - assert(n!=0); - assert(u!=0); - for(int i=0;i(0.0,0.0); - } - return; -} - -template -void ZEROS(T *u,const int n) -{ - assert(n>=0); - for(int i=0;i -void OUT(ofstream &ofs,const string &name,const T &a) -{ - stringstream name2; - name2 << "[" << name << "]"; - ofs<< " " << setw(40) << name2.str() << " = " << a < -void OUT(ofstream &ofs,const string &name,const T &x, const T &y, const T &z) -{ - stringstream name2; - name2 << "[" << name << "]"; - ofs<< " " << setw(40) <",1,0) ) - { - READ_VALUE( ifs, BANDS_CONTROL); - if (BANDS_CONTROL) - { - READ_VALUE(ifs, BANDS_START); - assert(BANDS_START > 0); - BANDS_START -= 1; - // because the band index start from 0; - READ_VALUE(ifs, BANDS_END); - // BANDS_END need not -=1; - } - - ofs_running << " ATTENTION! YOU SELECT THE BANDS: " << endl; - ofs_running << " BANDS_START=" << BANDS_START+1 << " BANDS_END=" << BANDS_END << endl; - } - - // mohan add 2009-08-26 - if ( SCAN_BEGIN(ifs,"",1,0) ) - { - READ_VALUE( ifs, BLOCK_NE); - assert(BLOCK_NE>=0); - - READ_VALUE( ifs, BLOCK_NE_MIN); - assert(BLOCK_NE >= BLOCK_NE_MIN); - // static_cast( sqrt( 2.0 * ecut )* rcut/3.1415926535897932 ); - - ofs_running << " ATTENTION! YOU SELECT BLOCK_NE=" << BLOCK_NE << endl; - ofs_running << " ALSO BLOCK_NE_MIN=" << BLOCK_NE_MIN << endl; - } - - // mohan add 2009-08-31 - if ( SCAN_BEGIN(ifs,"",1,0) ) - { - double block_ne_energy; - double rcut_in; - READ_VALUE( ifs, block_ne_energy); - READ_VALUE( ifs, rcut_in ); - BLOCK_NE = static_cast( sqrt( 2.0 * block_ne_energy )* rcut_in/3.1415926535897932 ); - assert(BLOCK_NE >= 0); - - ofs_running << "\n Attential! Now, input BLOCK_NE parameter be replaced!" << endl; - ofs_running << "\n New BLOCK_NE = " << BLOCK_NE - << " energy_cut = " << block_ne_energy - << " rcut_in = " << rcut_in << endl; - } - - // mohan add 2009-08-28 - // 1: max spillage value. - // 2: average spillage value. - // 3: add kapa value. - if ( SCAN_BEGIN(ifs,"",1,0) ) - { - READ_VALUE( ifs, SCHEME_VALUE ); - assert(abs(SCHEME_VALUE)>0); - assert(abs(SCHEME_VALUE)<4); - } - - if ( SCAN_BEGIN(ifs,"",1,0) ) - { - READ_VALUE( ifs, NKSTOT ); - assert(NKSTOT>0); -#ifdef __MPI - READ_VALUE( ifs, KPAR ); - assert(KPAR>0); -#endif - } - - }// end ifs - - else if( ifs2 ) - { - if ( SCAN_BEGIN(ifs2,"",1,0) ) - { - READ_VALUE( ifs2, WFC_FILE); - } - - if ( SCAN_BEGIN(ifs2,"",1,0) ) - { - READ_VALUE( ifs2, SMOOTH); - assert(SMOOTH == 0 || SMOOTH == 1); - READ_VALUE( ifs2, SIGMA); - assert(SIGMA >= 0.0); - READ_VALUE( ifs2, ECUT_JLQ); - assert(ECUT_JLQ > 0 && ECUT_JLQ < 1000); - // mohan set the boundaries) - READ_VALUE( ifs2, RCUT); - assert(RCUT > 0 && RCUT < 15); - READ_VALUE( ifs2, TOLERENCE); - assert(TOLERENCE> 0.0); - } - - if ( SCAN_BEGIN(ifs2,"",1,0) ) - { - READ_VALUE( ifs2, NKSTOT ); - assert(NKSTOT>0); -#ifdef __MPI - READ_VALUE( ifs2, KPAR ); - assert(KPAR>0); -#endif - } - }// end ifs2 - } // end my rank0. - - //------------------------------------------------ - // second part - //------------------------------------------------ - // 2.1 - if( ifs ) - { - if (MY_RANK==0) - { - this->read_PW_QS_1(); - } - } - else if ( ifs2 ) - { - this->read_WFC(); - } - - // 2.2 - // bcast NKSTOT. - // bcast the global information. - // need to first bcast KPAR. - this->bcast(); - - // set the parallel information - // about pool. - Pkpoints.init(); - - // init the k point information. - Pkpoints.kinfo(NKSTOT); - - // calculate the local number of k points. -#ifdef __MPI - NKS = Pkpoints.nks_pool[MY_POOL]; -#else - NKS = NKSTOT; -#endif - - OUT(ofs_running,"NKS",NKS); - - // 2.3 - if( ifs ) - { - this->read_PW_QS_2(); - } - else if( ifs2 ) - { - this->read_WFC_2(); - USEPW = 1; - } - - return; -} - -void Read_INPUT::bcast(void) -{ -#ifdef __MPI - Parallel_Common::bcast_bool( BANDS_CONTROL ); - Parallel_Common::bcast_int( BANDS_START ); - Parallel_Common::bcast_int( BANDS_END ); - - Parallel_Common::bcast_int( BLOCK_NE ); - Parallel_Common::bcast_int( BLOCK_NE_MIN ); - - Parallel_Common::bcast_int( SCHEME_VALUE ); - Parallel_Common::bcast_int( KPAR ); - - Parallel_Common::bcast_int( CALSPI ); - Parallel_Common::bcast_bool( RESTART ); - Parallel_Common::bcast_bool( this->output ); - Parallel_Common::bcast_int( STRNUM ); - - OUT(ofs_running,"STRNUM",STRNUM); - - if (MY_RANK!=0) - { - delete[] qsfile; - qsfile = new string[STRNUM]; - } - - for (int i=0; iSV.allocate( STRNUM ); - delete[] this->QS_data; - this->QS_data = new ReadData[ STRNUM ]; - - for (int i=0; iQS_data[i].OverlapQandS( qsfile[i].c_str() ); - //this->QS_data[in].OverlapSinv( sinv_file.c_str() ); // not used - } - - return; -} - -void Read_INPUT::read_PW_QS_1(void) -{ - TITLE(ofs_running, "Read_INPUT","read_PW_QS_1"); - - if ( SCAN_BEGIN(ifs,"") ) - { - // <1> calculate spillage or not. - READ_VALUE( ifs, CALSPI ); - // <1.5> restart from file or not. - // mohan add this function 2009-08-27 - READ_VALUE( ifs, RESTART); - // <2> output file or not. - READ_VALUE( ifs, this->output ); - // <3> number of structures. - READ_VALUE( ifs, STRNUM ); - OUT(ofs_running,"STRNUM",STRNUM); - if (STRNUM<=0) - { - WARNING_QUIT("Read_INPUT::read_PW_QS_1","STRNUM<=0"); - } - - delete[] qsfile; - this->qsfile = new string[STRNUM]; - - // <4> read in each file. - for (int in=0; in< STRNUM; in++) - { - READ_VALUE(ifs, qsfile[in]); - ifstream check(qsfile[in].c_str()); - if (!check) - { - ofs_running << qsfile[in] << endl; - WARNING_QUIT("Read_INPUT","the file is not exist!"); - } - else - { - OUT(ofs_running,"FILE",qsfile[in]); - static bool already_read = false; - if (!already_read) - { - check >> LAT0; - OUT(ofs_running,"LAT0",LAT0); - check >> LATVEC.e11 >> LATVEC.e12 >> LATVEC.e13; - check >> LATVEC.e21 >> LATVEC.e22 >> LATVEC.e23; - check >> LATVEC.e31 >> LATVEC.e32 >> LATVEC.e33; - OUT(ofs_running,"a1",LATVEC.e11,LATVEC.e12,LATVEC.e13); - OUT(ofs_running,"a2",LATVEC.e21,LATVEC.e22,LATVEC.e23); - OUT(ofs_running,"a3",LATVEC.e31,LATVEC.e32,LATVEC.e33); - READ_VALUE(check, NTYPE); - OUT(ofs_running,"NTYPE",NTYPE); - assert( NTYPE > 0 ); - NA = new int[NTYPE]; - LABEL = new string[NTYPE]; - CARPOSX = new double*[NTYPE]; - CARPOSY = new double*[NTYPE]; - CARPOSZ = new double*[NTYPE]; - for(int it=0; it> CARPOSX[it][ia] >> CARPOSY[it][ia] >> CARPOSZ[it][ia]; - OUT(ofs_running,"POS",CARPOSX[it][ia],CARPOSY[it][ia],CARPOSZ[it][ia]); - } - } - - READ_VALUE(check, ECUT); - READ_VALUE(check, ECUT_JLQ); - READ_VALUE(check, RCUT); - READ_VALUE(check, SMOOTH); - READ_VALUE(check, SIGMA); - - READ_VALUE(check, TOLERENCE); - READ_VALUE(check, LMAXALL); - READ_VALUE(check, NKSTOT); - READ_VALUE(check, NBANDS); - READ_VALUE(check, NWFCALL); - READ_VALUE(check, NE); - - OUT(ofs_running,"ECUT(Ry)",ECUT); - OUT(ofs_running,"ECUT_JLQ(Ry)",ECUT_JLQ); - OUT(ofs_running,"RCUT(Bohr)",RCUT); - OUT(ofs_running,"SMOOTH",SMOOTH); - OUT(ofs_running,"SIGMA",SIGMA); - OUT(ofs_running,"TOLERENCE",TOLERENCE); - OUT(ofs_running,"LMAXALL",LMAXALL); - OUT(ofs_running,"NKSTOT",NKSTOT); - OUT(ofs_running,"NBANDS",NBANDS); - OUT(ofs_running,"NWFCALL",NWFCALL); - OUT(ofs_running,"NE",NE); - - if(SMOOTH) assert(SIGMA!=0.0); - - already_read = true; - }//only read once. - check.close(); - } - } - } - return; -} - -void Read_INPUT::read_WFC(void) -{ - TITLE("Read_INPUT","read_WFC"); - - ifstream ifswfc( WFC_FILE.c_str() ); - - if(!ifswfc) - { - cout << " Can't find wfc file : " << WFC_FILE << endl; - WARNING_QUIT("Read_INPUT::read_WFC","Can't find wavefunctions file."); - } - else - { - cout << " Find file: " << WFC_FILE << endl; - } - - if(MY_RANK==0) - { - - ifswfc >> LAT0; - cout << "\n LAT0 = " << LAT0; - ifswfc >> LATVEC.e11 >> LATVEC.e12 >> LATVEC.e13; - ifswfc >> LATVEC.e21 >> LATVEC.e22 >> LATVEC.e23; - ifswfc >> LATVEC.e31 >> LATVEC.e32 >> LATVEC.e33; - cout << "\n a1 = " << LATVEC.e11 << " " << LATVEC.e12 << " " << LATVEC.e13; - cout << "\n a2 = " << LATVEC.e21 << " " << LATVEC.e22 << " " << LATVEC.e23; - cout << "\n a3 = " << LATVEC.e31 << " " << LATVEC.e32 << " " << LATVEC.e33; - READ_VALUE(ifswfc, NTYPE); - cout << "\n NTYPE = " << NTYPE << endl; - assert( NTYPE > 0 ); - NA = new int[NTYPE]; - LABEL = new string[NTYPE]; - CARPOSX = new double*[NTYPE]; - CARPOSY = new double*[NTYPE]; - CARPOSZ = new double*[NTYPE]; - for(int it=0; it IMAG_UNIT = std::complex(0, 1.0); -const std::complex NEG_IMAG_UNIT = std::complex(0,-1.0); -const double PI_HALF = PI / 2.0; -const double SQRT2 = 1.41421356237309504880; - -// read wavefunction -string WFC_FILE = "WAVEFUNC.dat"; - -void DESTROY(void) -{ - if(NTYPE>0) - { - delete[] LABEL; - delete[] NA; - for(int i=0; i0) - { - delete[] CARKX; - delete[] CARKY; - delete[] CARKZ; - } -} - - - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/tools.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/tools.h deleted file mode 100644 index 21486a12ae..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_spillage/tools.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef TOOL_H -#define TOOL_H - -#include "common.h" -#include "../src_pw/pw_basis.h" -#include "MultiZeta.h" -#include "read_INPUT.h" -#include "../src_parallel/parallel_kpoints.h" // add 2010-06-12 -//plane wave , mohan add 2010-06-14 -extern PW_Basis PW; -extern MultiZeta mz; -extern Read_INPUT input; -extern Parallel_Kpoints Pkpoints; -extern ofstream ofs_running; - -// parallel information -extern int NPROC; // mohan add 2010-06-12 -extern int KPAR; -extern int MY_RANK; -extern int MY_POOL; -extern int NPROC_IN_POOL; -extern int RANK_IN_POOL; - -// global + input information. -extern int NKSTOT; -extern int NKS; -extern int NBANDS; -extern int NWFCALL; -extern int NE; - -// global information -extern int STRNUM; -extern int NTYPE; -extern string *LABEL; -extern int *NA; -extern double **CARPOSX; -extern double **CARPOSY; -extern double **CARPOSZ; -extern Matrix3 LATVEC; - -// plane wave information -extern bool USEPW; -extern double LAT0; - -// k points -extern double *CARKX; -extern double *CARKY; -extern double *CARKZ; - -//orbital + energy cutoff -extern double ECUT; -extern double ECUT_JLQ; -extern double RCUT; -extern bool SMOOTH; // use to make the second derivative of psi is continues. -extern double SIGMA; -extern double TOLERENCE; -extern int LMAXALL; -extern int LMAXUSED; -extern int NMAXUSED; // mohan 2010-06-17 -extern int NCHIUSED; - -// band information -extern bool BANDS_CONTROL; -extern int BANDS_START;//mohan add 2010-05-02 -extern int BANDS_END; - -// other global information -extern int CALSPI; // mohan 2010-06-17 -extern int BLOCK_NE; // if ie < BLOCK_NE, we use this Jlq(ie), mohan add 2009-08-26 -extern int BLOCK_NE_MIN; // mohan add 2009-08-27 -extern bool RESTART; -extern int TEST1; -extern int SCHEME_VALUE; - -extern int ACCEPTANCE_STEPS; // mohan add 2009-10-31 -extern double ACCEPTANCE_HIGH; -extern double ACCEPTANCE_LOW; - -extern double KINETIC_MAX; // mohan add 2009-10-31 -extern double KINETIC_DR; // mohan add 2010-04-12 -extern int OPTIMIZE_METHOD;// mohan add 2010-04-14 - -// constant -extern const double PI; // mohan add 2010-04-16 -extern const double TWO_PI; // mohan add 2010-06-14 -extern const double FOUR_PI; -extern const std::complex IMAG_UNIT; -extern const std::complex NEG_IMAG_UNIT;//mohan add 2010-06-14 -extern const double SQRT_INVERSE_FOUR_PI; -extern const double PI_HALF; -extern const double SQRT2; - -// read wavefunction -extern string WFC_FILE; - -void DESTROY(); -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/Random.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/Random.h deleted file mode 100644 index 32d43e4f63..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/Random.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef RANDOM_H -#define RANDOM_H -#include -#include - -class Random -{ - public: - Random(); - ~Random(); - - static void between0and1( double *v, const int &num ) - { - assert( v!= NULL); - assert( num > 1); - for(int i=0; i( std::rand() ) / RAND_MAX; - } - } - - static double betweenMinus2and2(void) - { - return 2.0*betweenMinus1and1(); - } - - static double betweenMinus1and1(void) - { - int a = std::rand() % 2; - if(a==0) return between0and1(); - else if(a==1) return betweenMinus1and0(); - } - - static double between0and1(void) - { - return static_cast( std::rand() )/RAND_MAX; - } - - static double betweenMinus1and0(void) - { - return -static_cast( std::rand() )/RAND_MAX; - } - -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexarray.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexarray.cpp deleted file mode 100644 index 22519a92c4..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexarray.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************* - * ESCP:Electro-Structure Calculate Package. - ********************************************/ - -#include -#include "complexarray.h" - -int ComplexArray::arrayCount = 0; - -void ComplexArrayAlloc() -{ - cout << "\n Allocation error for ComplexArray " << endl; - exit(0); -} - -ComplexArray::ComplexArray(const int d1,const int d2,const int d3) -{ - dim = 3; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = 0; - - set_new_handler(ComplexArrayAlloc); - - size = bound1 * bound2 * bound3 ; //* sizeof(float); - - ptr = new std::complex[size](); - assert(ptr != 0); - - ++arrayCount; -} - -ComplexArray::ComplexArray(const int d1,const int d2,const int d3,const int d4) -{ - dim = 4; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = (d4 <= 0) ? 1 : d4; - - set_new_handler(ComplexArrayAlloc); - - size = bound1 * bound2 * bound3 * bound4 ; //* sizeof(float); - - ptr = new std::complex[size](); - assert(ptr != 0); - - ++arrayCount; -} - -//******************************** -// -// Destructor for class ComplexArray -// -//******************************** -ComplexArray ::~ComplexArray() -{ - freemem(); -} - -void ComplexArray::freemem() -{ - delete [] ptr; - ptr = NULL; -} - -void ComplexArray::create(const int d1,const int d2,const int d3,const int d4) -{ - size = d1 * d2 * d3 * d4; - assert(size>0); - - dim = 4; - - bound1 = d1; - bound2 = d2; - bound3 = d3; - bound4 = d4; - - delete [] ptr; - ptr = new std::complex[size](); - assert(ptr != 0); -} - -void ComplexArray::create(const int d1,const int d2,const int d3) -{ - size = d1 * d2 * d3; - assert(size>0); - - dim = 3; - - bound1 = d1; - bound2 = d2; - bound3 = d3; - bound4 = 1; - - delete [] ptr; - ptr = new std::complex[size](); - assert(ptr != 0); -} - -const ComplexArray &ComplexArray::operator=(const ComplexArray &right) -{ - for (int i = 0;i < size;i++) ptr[i] = right.ptr[i]; - return *this;// enables x = y = z; -} - -const ComplexArray &ComplexArray::operator=(const std::complex &right) -{ - for (int i = 0;i < size;i++) ptr[i] = right; - return *this;// enables x = y = z; -} - -//******************************************************** -// -// overloaded subscript operator for const real Array -// const reference return create an cvakue -// -//******************************************************** -const std::complex &ComplexArray::operator() -(const int ind1,const int ind2,const int ind3)const -{ - const int ind = (ind1 * bound2 + ind2) * bound3 + ind3 ; - return ptr[ind]; -} - - -//******************************************************** -// -// overloaded subscript operator for const real Array -// const reference return creates an cvakue -// -//******************************************************** -const std::complex &ComplexArray::operator() -(const int ind1,const int ind2,const int ind3,const int ind4)const -{ - const int ind = ((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4; - return ptr[ind]; -} - -//******************************************************** -// -// overloaded subscript operator for non-const real Array -// const reference return creates an lvakue -// -//******************************************************** -complex &ComplexArray::operator()(const int ind1,const int ind2,const int ind3) -{ - const int ind = (ind1 * bound2 + ind2) * bound3 + ind3; - return ptr[ind]; // reference return -} - -//******************************************************** -// -// overloaded subscript operator for non-const real Array -// const reference return creates an lvakue -// -//******************************************************** -complex &ComplexArray::operator()(const int ind1,const int ind2,const int ind3,const int ind4) -{ - const int ind = ((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4; - return ptr[ind];// reference return -} - -//**************************** -// -// zeroes out the whole array -// -//**************************** -void ComplexArray::zero_out(void) -{ - if (size <= 0) return; - for (int i = 0;i < size; i++) ptr[i] = 0; - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexarray.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexarray.h deleted file mode 100644 index 6506fce530..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexarray.h +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************* - * ESCP:Electro-Structure Calculate Package. - ********************************************/ -#ifndef COMPLEXARRAY_H -#define COMPLEXARRAY_H - -#include -#include -#include -#include -#include - -using namespace std; - -class ComplexArray -{ -public: - complex *ptr; - - ComplexArray(const int d1 = 1 ,const int d2 = 1,const int d3 = 1); - ComplexArray(const int d1, const int d2,const int d3,const int d4); - ~ComplexArray(); - - void create(const int d1,const int d2,const int d3); - void create(const int d1,const int d2,const int d3,const int d4); - - const ComplexArray &operator=(const ComplexArray &right); - const ComplexArray &operator=(const std::complex &right); - - complex &operator()(const int d1,const int d2,const int d3); - complex &operator()(const int d1,const int d2,const int d3,const int d4); - - const std::complex &operator()(const int d1,const int d2,const int d3)const; - const std::complex &operator()(const int d1,const int d2,const int d3,const int d4)const; - - void zero_out(void); - - int getSize() const - { return size;} - - int getDim() const - { return dim;} - - int getBound1() const - { return bound1;} - - int getBound2() const - { return bound2;} - - int getBound3() const - { return bound3;} - - int getBound4() const - { return bound4;} - - int getArrayCount(void) - { return arrayCount;} - -private: - int size; - int dim; - int bound1, bound2, bound3, bound4; - static int arrayCount; - - void freemem(); -}; - -#endif // ComplexArray class diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexmatrix.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexmatrix.cpp deleted file mode 100644 index 19a81dead9..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexmatrix.cpp +++ /dev/null @@ -1,342 +0,0 @@ -//========================================================== -// AUTHOR : Lixin He, Mohan Chen -// LAST UPDATE : 2009-03-23 modify "=" operator -//========================================================== - -#include -#include -#include -#include -#include "complexmatrix.h" - -int ComplexMatrix::mCount = 0; - -// constructor with sizes -ComplexMatrix::ComplexMatrix(int nrows, int ncols) -{ - this->init(nrows, ncols); - ++mCount; -} - -// zero out the ComplexMatrix -void ComplexMatrix::zero_out(void) -{ - for (int i=0; i(0.0,0.0); -} - -/* -void need_more_memory() -{ - cout << "\n Sorry to crash... but the running need more momory! Exit." << endl; - exit(0); -} -*/ - -void ComplexMatrix::init(const int nrows,const int ncols) -{ - this->nr = nrows; - this->nc = ncols; - this->size = nr * nc; -// std::set_new_handler( need_more_memory ); - this->c = new std::complex[size]; - assert(c != 0); - this->zero_out(); -}//mohan the principle:as simple as possible:modify inline 2007-10-13 - -// Copy constructor -ComplexMatrix::ComplexMatrix(const ComplexMatrix &m1) -{ - this->init(m1.nr, m1.nc); - ++mCount; - for(int i=0; isize; i++) c[i] = m1.c[i]; -} - -// deconstructor -ComplexMatrix::~ComplexMatrix() -{ - this->freemem(); -} - -// Free up memory for ComplexMatrix -void ComplexMatrix::freemem(void) -{ - delete[] c; - c = NULL; -} - -// reallocate memory for Complex Matrix -void ComplexMatrix::create(const int nrow,const int ncol) -{ - // because c has been 'new' in init function. - delete[] c; - this->init(nrow, ncol); - return; -} - -void ComplexMatrix::set_as_identity_matrix() -{ - for(int i=0; i(1.0, 0.0); - else c[nc * i + j] = std::complex(0.0, 0.0); - } - } - return; -} - -// Adding matrices, as a friend -ComplexMatrix operator+(const ComplexMatrix &m1, const ComplexMatrix &m2) -{ - ComplexMatrix tm(m1); - tm+=m2; - return tm; -} - -// Subtracting matrices, as a friend -ComplexMatrix operator-(const ComplexMatrix &m1, const ComplexMatrix &m2) -{ - ComplexMatrix tm(m1); - tm-=m2; - return tm; -} - -// Multiplying matrices, as a friend -// mprod = m1 * m2 -ComplexMatrix operator*(const ComplexMatrix &m1, const ComplexMatrix &m2) -{ - assert(m1.nc == m2.nr); - ComplexMatrix mprod(m1.nr, m2.nc); - - complex z; - for (int i = 0;i < m1.nr;i++) - { - for (int j = 0;j < m2.nc;j++) - { - z = std::complex(0,0); - for (int k = 0;k < m1.nc;k++) - { - z += m1(i, k) * m2(k, j); - } - mprod(i, j) = z; - } - } - return mprod; -} - -// Scale a ComplexMatrix -ComplexMatrix operator*(const std::complex &c,const ComplexMatrix &m) -{ - ComplexMatrix sm(m); - for (int i=0 ;i &c) -{ - ComplexMatrix sm(m); - for (int i = 0;i < m.size;i++) sm.c[i] *= c; - return sm; -} - -ComplexMatrix operator*(const double &r,const ComplexMatrix &m) -{ - ComplexMatrix sm(m); - for(int i=0; inr || m.nc!=this->nc) - { - cout << "\n row/col number can't match in ComplexMatrix '=' operator\n"; - cout << " this nr = " << this->nr; - cout << " this nc = " << this->nc; - cout << " in nr = " << m.nr; - cout << " in nc = " << m.nc; - exit(0); - } - else { - this->create(m.nr, m.nc); - } - for(int i=0;isize;i++) c[i] = m.c[i]; - return *this; -} - -ComplexMatrix& ComplexMatrix::operator*=(const std::complex &s) -{ - for (int i = 0;i < this->size;i++) c[i] *= s; - return *this; -} - -// Accumulate to a ComplexMatrix in place -ComplexMatrix& ComplexMatrix::operator+=(const ComplexMatrix &m) -{ - for(int i=0; ic[i] += m.c[i]; - return *this; -} - -// decumulate to a ComplexMatrix in place -ComplexMatrix& ComplexMatrix::operator-=(const ComplexMatrix &m) -{ - for(int i=0; ic[i] -= m.c[i]; - return *this; -} - -// Returns trace of ComplexMatrix -complex trace(const ComplexMatrix &m) -{ - complex tr=complex(0,0); - assert(m.nr == m.nc); - for (int i=0; i &s, - const ComplexMatrix &min, - ComplexMatrix &mout) -{ - assert(min.nr == mout.nr); - assert(min.nc == mout.nc); - for (int j=0; j &s, - ComplexMatrix **min, - ComplexMatrix **mout) -{ - assert(nmat>=0); - for (int i=0; i &s1, - const ComplexMatrix &m1, - const std::complex &s2, - const ComplexMatrix &m2, - ComplexMatrix &mout) -{ - assert(m1.nr == m2.nr); - assert(m1.nr == mout.nr); - assert(m1.nc == m2.nc); - assert(m1.nc == mout.nc); - - for(int i=0; i &s1, - ComplexMatrix **m1, - const std::complex &s2, - ComplexMatrix **m2, - ComplexMatrix **mout) -{ - assert(nmat>0); - for(int i=0; i z; - for(int ic=0;ic z; - for(int ir=0;ir z; - - for (int i = 0;i < m.size;i++) - { - z = m.c[i]; - r += z.real() * z.real() + z.imag() * z.imag(); - } - return r; -} - -// Same for an array of matrices -double abs2(const int nmat, ComplexMatrix **m) -{ - double r = 0.0; - for (int i = 0;i < nmat;i++) - { - r += abs2(*m[i]); - } - return r; -} - -ComplexMatrix transpose(const ComplexMatrix &m, const bool &conjugate) -{ - ComplexMatrix tm(m.nc, m.nr); - if(conjugate) - { - for (int i = 0;i < m.nr;i++) - { - for (int j = 0;j < m.nc;j++) - { - tm(j, i) = conj ( m(i, j) ); - } - } - } - else - { - for (int i = 0;i < m.nr;i++) - { - for (int j = 0;j < m.nc;j++) - { - tm(j, i) = m(i, j); - } - } - } - return tm; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexmatrix.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexmatrix.h deleted file mode 100644 index c8495757cf..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/complexmatrix.h +++ /dev/null @@ -1,105 +0,0 @@ -//========================================================== -// Author : Lixin He, Mohan Chen -// Last Update : 2009-3-8 -//========================================================== -#ifndef COMPLEXMATRIX_H -#define COMPLEXMATRIX_H - -#include -using namespace std; - -class ComplexMatrix -{ - -public: - - complex *c; - int nr; - int nc; - int size; - - //============== - // Constructors - //============== - ComplexMatrix(const int nrows = 1,const int ncols = 1); - - //=================== - // Copy constructor - //================== - ComplexMatrix(const ComplexMatrix &m1); - ~ComplexMatrix(); - - //============ - // Operators - //============ - complex &operator()(const int i,const int j) - { - return c[nc * i + j];//mohan modify in-line 2007-10-1 - } - const std::complex &operator()(const int i,const int j)const - { - return c[nc * i + j];//mohan modify in-line 2007-10-13 - } - - friend ComplexMatrix operator+(const ComplexMatrix &m1, const ComplexMatrix &m2); - friend ComplexMatrix operator-(const ComplexMatrix &m1, const ComplexMatrix &m2); - friend ComplexMatrix operator*(const ComplexMatrix &m1, const ComplexMatrix &m2); - friend ComplexMatrix operator*(const std::complex &s, const ComplexMatrix &m); - friend ComplexMatrix operator*(const ComplexMatrix &m, const std::complex &s); - friend ComplexMatrix operator*(const double &s, const ComplexMatrix &m); - friend ComplexMatrix operator*(const ComplexMatrix &m, const double &s); - ComplexMatrix& operator=(const ComplexMatrix &m); - ComplexMatrix& operator*=(const std::complex &s); - ComplexMatrix& operator+=(const ComplexMatrix &m); - ComplexMatrix& operator-=(const ComplexMatrix &m); - - //================== - // member function: - //================== - void create(const int nrow,const int ncol); - void zero_out(void); - static int& getMCount(void){return mCount;} - void set_as_identity_matrix(void); -private: - - static int mCount; - void freemem(void);//mohan add 2007-11-20 - void init(const int nrows,const int ncols); -}; - -complex trace(const ComplexMatrix &m); -// mohan add 2008-7-1 -double abs2_row(const ComplexMatrix &m,const int ir); -// mohan add 2008-7-1 -double abs2_column(const ComplexMatrix &m,const int ic); -double abs2(const ComplexMatrix &m); -double abs2(const int nmat, ComplexMatrix **m); - -ComplexMatrix transpose(const ComplexMatrix &m, const bool &conjugate); - -void scale_accumulate( - const std::complex &s, - const ComplexMatrix &min, - ComplexMatrix &mout); - -void scale_accumulate( - const int &nmat, - const std::complex &s, - ComplexMatrix **min, - ComplexMatrix **mout); - -void scaled_sum( - const std::complex &s1, - const ComplexMatrix &m1, - const std::complex &s2, - const ComplexMatrix &m2, - ComplexMatrix &mout); - -void scaled_sum( - const int &nmat, - const std::complex &s1, - ComplexMatrix **m1, - const std::complex &s2, - ComplexMatrix **m2, - ComplexMatrix **mout); -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/intarray.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/intarray.cpp deleted file mode 100644 index 0f8cbf486c..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/intarray.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************* - * ESCP:Electro-Structure Calculate Package. - ********************************************/ -#include -#include "intarray.h" - -int IntArray::arrayCount = 0; - -void IntArrayAlloc() -{ - cout << "\n Allocation error for IntArray " << endl; - exit(0); -} - -IntArray::IntArray(const int d1,const int d2) -{ - dim = 2; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = bound4 = 0; - size = bound1 * bound2; - ptr = new int[size]; - assert( ptr != 0); - ++arrayCount; -} - -IntArray::IntArray(const int d1,const int d2,const int d3) -{ - dim = 3; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = 0; - set_new_handler(IntArrayAlloc); - size = bound1 * bound2 * bound3 ; //* sizeof(float); - ptr = new int[size]();assert(ptr != 0); - zero_out(); - ++arrayCount; -} - -IntArray::IntArray(const int d1,const int d2,const int d3,const int d4) -{ - dim = 4; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = (d4 <= 0) ? 1 : d4; - set_new_handler(IntArrayAlloc); - size = bound1 * bound2 * bound3 * bound4 ; //* sizeof(float); - ptr = new int[size]();assert(ptr != 0); - zero_out(); - ++arrayCount; -} - -IntArray::IntArray(const int d1,const int d2,const int d3, - const int d4,const int d5) -{ - dim = 5; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = (d4 <= 0) ? 1 : d4; - bound5 = (d5 <= 0) ? 1 : d5; - set_new_handler(IntArrayAlloc); - size = bound1 * bound2 * bound3 * bound4 * bound5; - ptr = new int[size]();assert(ptr != 0); - zero_out(); - ++arrayCount; -} - -IntArray::IntArray(const int d1,const int d2,const int d3, - const int d4,const int d5,const int d6) -{ - dim = 6; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = (d4 <= 0) ? 1 : d4; - bound5 = (d5 <= 0) ? 1 : d5; - bound6 = (d6 <= 0) ? 1 : d6; - set_new_handler(IntArrayAlloc); - size = bound1 * bound2 * bound3 * bound4 * bound5 * bound6; - ptr = new int[size]();assert(ptr != 0); - zero_out(); - ++arrayCount; -} - -//******************************** -// Destructor for class IntArray -//******************************** -IntArray ::~IntArray() -{ - freemem(); -} - -void IntArray::freemem() -{ - delete [] ptr; - ptr = NULL; -} - -void IntArray::create(const int d1,const int d2,const int d3,const int d4,const int d5,const int d6) -{ - size = d1 * d2 * d3 * d4 * d5 * d6;assert(size>0); - dim = 6; - bound1 = d1;bound2 = d2;bound3 = d3;bound4 = d4;bound5 = d5;bound6 = d6; - delete[] ptr; ptr = new int[size]; - assert(ptr != 0);zero_out(); -} - -void IntArray::create(const int d1,const int d2,const int d3,const int d4,const int d5) -{ - size = d1 * d2 * d3 * d4 * d5;assert(size>0); - dim = 5; - bound1 = d1;bound2 = d2;bound3 = d3;bound4 = d4;bound5 = d5; - delete[] ptr; ptr = new int[size]; - assert(ptr != 0);zero_out(); -} - -void IntArray::create(const int d1,const int d2,const int d3,const int d4) -{ - size = d1 * d2 * d3 * d4;assert(size>0); - dim = 4; - bound1 = d1;bound2 = d2;bound3 = d3;bound4 = d4; - delete[] ptr; ptr = new int[size]; - assert(ptr != 0);zero_out(); -} - -void IntArray::create(const int d1,const int d2,const int d3) -{ - size = d1 * d2 * d3;assert(size>0); - dim = 3; - bound1 = d1;bound2 = d2;bound3 = d3;bound4 = 1; - delete [] ptr;ptr = new int[size]; - assert(ptr != 0);zero_out(); -} - -void IntArray::create(const int d1, const int d2) -{ - size = d1 * d2;assert(size>0); - dim = 2; - bound1 = d1;bound2 = d2;bound3 = bound4 = 1; - delete[] ptr;ptr = new int[size]; - assert(ptr !=0 );zero_out(); -} - -const IntArray &IntArray::operator=(const IntArray &right) -{ - for (int i = 0;i < size;i++) ptr[i] = right.ptr[i]; - return *this;// enables x = y = z; -} - -const IntArray &IntArray::operator=(const int &value) -{ - for (int i = 0;i < size;i++) ptr[i] = value; - return *this;// enables x = y = z; -} - -//******************************************************** -// overloaded subscript operator for const Int Array -// const reference return create an cvakue -//******************************************************** -const int &IntArray::operator() -(const int ind1,const int ind2)const -{return ptr[ ind1 * bound2 + ind2 ];} - -const int &IntArray::operator() -(const int ind1,const int ind2,const int ind3)const -{return ptr[ (ind1 * bound2 + ind2) * bound3 + ind3 ];} - -const int &IntArray::operator() -(const int ind1,const int ind2,const int ind3,const int ind4)const -{return ptr[ ((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4 ];} - -const int &IntArray::operator() -(const int ind1,const int ind2,const int ind3,const int ind4,const int ind5)const -{return ptr[ (((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4) * bound5 + ind5 ];} - -const int &IntArray::operator() -(const int ind1,const int ind2,const int ind3,const int ind4,const int ind5,const int ind6)const -{return ptr[ ((((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4) * bound5 + ind5) * bound6 + ind6 ];} - -//******************************************************** -// overloaded subscript operator for non-const Int Array -// const reference return creates an lvakue -//******************************************************** -int &IntArray::operator()(const int ind1,const int ind2) -{return ptr[ind1 * bound2 + ind2];} - -int &IntArray::operator()(const int ind1,const int ind2,const int ind3) -{return ptr[ (ind1 * bound2 + ind2) * bound3 + ind3 ];} - -int &IntArray::operator()(const int ind1,const int ind2,const int ind3,const int ind4) -{return ptr[ ((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4 ];} - -int &IntArray::operator() -(const int ind1,const int ind2,const int ind3,const int ind4,const int ind5) -{return ptr[ (((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4) * bound5 + ind5 ];} - -int &IntArray::operator() -(const int ind1,const int ind2,const int ind3,const int ind4,const int ind5,const int ind6) -{return ptr[ ((((ind1 * bound2 + ind2) * bound3 + ind3) * bound4 + ind4) * bound5 + ind5) * bound6 + ind6 ];} - -//**************************** -// zeroes out the whole array -//**************************** -void IntArray::zero_out(void) -{ - if (size <= 0) return; - for (int i = 0;i < size; i++) ptr[i] = 0; - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/intarray.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/intarray.h deleted file mode 100644 index 3318578da1..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/intarray.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************* - * ESCP:Electro-Structure Calculate Package. - ********************************************/ - -#ifndef INTARRAY_H -#define INTARRAY_H - -#include -#include -#include -#include - -using namespace std; - -class IntArray -{ -public: - int *ptr; - - // Constructors for different dimesnions - IntArray(const int d1 = 1, const int d2 = 1); - IntArray(const int d1, const int d2,const int d3); - IntArray(const int d1, const int d2,const int d3,const int d4); - IntArray(const int d1, const int d2,const int d3,const int d4,const int d5); - IntArray(const int d1, const int d2,const int d3,const int d4,const int d5,const int d6); - - ~IntArray(); - - void create(const int d1, const int d2); - void create(const int d1, const int d2, const int d3); - void create(const int d1, const int d2, const int d3, const int d4); - void create(const int d1, const int d2, const int d3, const int d4, const int d5); - void create(const int d1, const int d2, const int d3, const int d4, const int d5, const int d6); - - const IntArray &operator=(const IntArray &right); - const IntArray &operator=(const int &right); - - int &operator()(const int d1, const int d2); - int &operator()(const int d1, const int d2, const int d3); - int &operator()(const int d1, const int d2, const int d3,const int d4); - int &operator()(const int d1, const int d2, const int d3, const int d4, const int d5); - int &operator()(const int d1, const int d2, const int d3, const int d4, const int d5, const int d6); - - const int &operator()(const int d1,const int d2)const; - const int &operator()(const int d1,const int d2,const int d3)const; - const int &operator()(const int d1,const int d2,const int d3,const int d4)const; - const int &operator()(const int d1,const int d2,const int d3,const int d4, const int d5)const; - const int &operator()(const int d1,const int d2,const int d3,const int d4, const int d5, const int d6)const; - - void zero_out(void); - - int getSize() const{ return size;} - int getDim() const{ return dim;} - int getBound1() const{ return bound1;} - int getBound2() const{ return bound2;} - int getBound3() const{ return bound3;} - int getBound4() const { return bound4;} - int getBound5() const { return bound5;} - int getBound6() const { return bound6;} - - int getArrayCount(void) - { return arrayCount;} - -private: - int size; - int dim; - int bound1, bound2, bound3, bound4, bound5, bound6; - static int arrayCount; - void freemem(); -}; - -#endif // IntArray class diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/inverse_matrix.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/inverse_matrix.cpp deleted file mode 100644 index 482c09c953..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/inverse_matrix.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "inverse_matrix.h" - -Inverse_Matrix::Inverse_Matrix(){} -Inverse_Matrix::~Inverse_Matrix(){} -void Inverse_Matrix::init(const int &dim_in) -{ - this->dim = dim_in; - this->e = new double[dim]; - this->lwork = 2*dim; - this->work2 = new std::complex[lwork]; - this->rwork = new double[3*dim-2]; - this->info = 0; - this->A.create(dim, dim); - this->EA.create(dim, dim); - return; -} - -void Inverse_Matrix::using_zheev( const ComplexMatrix &Sin, ComplexMatrix &Sout) -{ - timer::tick("Inverse","using_zheev"); - this->A = Sin; - - //LapackConnector::zhegv( 1, 'V', 'U', nwan , A , nwan , B , nwan , e, work2 , 80 , rwork , &info ); - LapackConnector::zheev('V', 'U', dim, this->A, dim, e, work2, lwork, rwork, &info); - - for(int i=0; iA(j,i) ) / e[i] ; - } - } - - Sout = this->A * this->EA; - timer::tick("Inverse","using_zheev"); - return; -} - -void Inverse_Matrix::using_zpotrf( const ComplexMatrix &Sin) -{ -// timer::tick("Inverse","using_zpotrf"); - - for(int i=0; i *work2; - double* rwork; - int info; - - ComplexMatrix EA; -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/lapack_connector.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/lapack_connector.h deleted file mode 100644 index ffadd34acb..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/lapack_connector.h +++ /dev/null @@ -1,404 +0,0 @@ -// ============================================================================= -// C++ Header File -// Project: LapackConnector -// File: LapackConnector.hpp -// Author: sltk -// Comment: LapackConnector provide the connector to the fortran Lapack routine. -// Warning: -// Start time: 2007-03-08 -// Last modified: 2008-08-12 ywcui : add zhegvx -// 2008-08-13 mohan : find bug,test. -// 2008-09-03 mohan : Add zgesv -// 2009-03-08 mohan : add ilaenv -// ============================================================================= - -#ifndef LAPACKCONNECTOR_HPP -#define LAPACKCONNECTOR_HPP - -#include -#include "complexmatrix.h" - - -extern "C" -{ - // ispec: the returnd value - // 1: an unblocked algorithm will give the best performance - // 2: the minimal block size for which the block routine should - // be used - // 3: the cross over point - // 4: the number of shift - // ... - int ilaenv_(int* ispec, - char* name, - char* opts, - const int* n1, - const int* n2, - const int* n3, - const int* n4); - - - void zpotrf_( const char* uplo, - const int* n, - const std::complex *A, - const int* lda, - const int* infp); - - void zpotri_( const char* uplo, - const int* n, - const std::complex *A, - const int* lda, - const int* infp); - - //======================================================================= - //ZGESV computes the solution to a complex system of linear equations - // A * X = B, - // where A is an N-by-N matrix and X and B are N-by-NRHS matrices. - // - // The LU decomposition with partial pivoting and row interchanges is - // used to factor A as - // A = P * L * U, - // where P is a permutation matrix, L is unit lower triangular, and U is - // upper triangular. The factored form of A is then used to solve the - // system of equations A * X = B. - // - // A = LDA * N - // B = LDB * NRHS (exit X = B) - //======================================================================== - void zgesv_(const int* n, - const int* nrhs, - const std::complex *A, - const int *lda, - const int *ipiv, - const std::complex *B, - const int* ldb, - int* info - ); - - /*zhegv computes all the eigenvalues, and optionally, the eigenvectors - of a complex generalized Hermitian-definite eigenproblem, of the form - A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. - Here A and B are assumed to be Hermitian and B is also - positive definite. - */ - - /*zhegvx computes selected eigenvalues, and optionally, eigenvectors - of a complex generalized Hermitian-definite eigenproblem, of the form - A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and - B are assumed to be Hermitian and B is also positive definite. - Eigenvalues and eigenvectors can be selected by specifying either a - range of values or a range of indices for the desired eigenvalues. - */ - - void zhegv_(const int* itype, - const char* jobz, - const char* uplo, - const int* n, - std::complex* a, - const int* lda, - std::complex* b, - const int* ldb, - double* w, - std::complex* work, - int* lwork, - double* rwork, - int* info ); - - void zheev_(const char* jobz, - const char* uplo, - const int* n, - complex *a, - const int* lda, - double* w, - complex* work, - const int* lwork, - double* rwork, - int* info ); - - //=================================================================================== - // zhegvx : - // itype : 1: A*x = (lambda)*B*x - // 2: A*B*x = (lambda)*x - // 3: B*A*x = (lambda)*x - // jobz : 'N': Compute eigenvalues only - // 'V': Compute eigenvalues and eigenvectors. - // range : 'A': all eigenvalues will be found. - // 'V': all eigenvalues in the half-open interval (VL,VU] will be found. - // 'I': the IL-th through IU-th eigenvalues will be found. - // uplo : 'U': Upper triangles of A and B are stored - // 'L': Lower triangles of A and B are stored - // N : The order of the matrices A and B. N >= 0. - // A : (input/output) COMPLEX*16 array, dimension (LDA, N) - // On entry, the Hermitian matrix A. If UPLO = 'U', the leading - // N-by-N upper triangular part of A contains the upper triangular - // part of the matrix A. If UPLO = 'L', the leading N-by-N lower - // triangular part of A contains the lower triangular part of the - // matrix A. - // LDA : The leading dimension of the array A. LDA >= max(1,N). - // LDB : On entry, the Hermitian matrix B. If UPLO = 'U', the leading - // N-by-N upper triangular part of B contains the upper triangular - // part of the matrix B. If UPLO = 'L', the leading N-by-N lower - // triangular part of B contains the lower triangular part of the - // matrix B. - // vl,vu : the lower and upper bounds of the interval to be searched for - // eigenvalues. VL < VU. Not referenced if RANGE = 'A' or 'I'. - // il,iu : the indices (in ascending order) of the smallest and largest - // eigenvalues to be returned. 1 <= IL <= IU <= N, if N > 0; - // IL = 1 and IU = 0 if N = 0. Not referenced if RANGE = 'A' or 'V'. - // abstol : The absolute error tolerance for the eigenvalues - // m : The total number of eigenvalues found ,0 <= M <= N. If RANGE - // = 'A', M = N, and if RANGE = 'I', M = IU-IL+1. - // w : The first M elements contain the selected eigenvalues in - // ascending order - // z : If JOBZ = 'N', then Z is not referenced. If JOBZ = 'V', then - // if INFO = 0, the first M columns of Z contain the orthonormal - // eigenvectors of the matrix A corresponding to the selected - // eigenvalues, with the i-th column of Z holding the eigenvector - // associated with W(i). The eigenvectors are normalized as fol- - // lows: if ITYPE = 1 or 2, Z**T*B*Z = I; if ITYPE = 3, - // Z**T*inv(B)*Z = I. - // If an eigenvector fails to converge, then that column of Z - // contains the latest approximation to the eigenvector, and the - // index of the eigenvector is returned in IFAIL. Note: the user - // must ensure that at least max(1,M) columns are supplied in the - // array Z; if RANGE = 'V', the exact value of M is not known in - // advance and an upper bound must be used - // LDZ : The leading dimension of the array Z. LDZ >= 1, and if JOBZ = - // 'V', LDZ >= max(1,N). - // work : On exit, if INFO = 0, WORK(1) returns the optimal LWORK. - // lwork : LWORK >= max(1,2*N). For optimal efficiency, LWORK >= (NB+1)*N, - // where NB is the blocksize for ZHETRD returned by ILAENV. - // rwork : dimension (7*N) - // iwork : dimension (5*N) - // info : = 0: successful exit - // < 0: if INFO = -i, the i-th argument had an illegal value - // > 0: ZPOTRF or ZHEEVX returned an error code: - //=================================================================================== - - /* - void zhegvx_(const int* itype, - const char* jobz, - const char* range, - const char* uplo, - const int* N, - std::complex *A, - const int* LDA, - std::complex *B, - const int* LDB, - const double* vl, - const double* vu, - const int* il, - const int* iu, - const double* abstol, - const int* m, - double* w, - std::complex *z, - const int *LDZ, - std::complex *work, - const int* lwork, - double* rwork, - int* iwork, - int* ifail, - int* info - ); - */ - -}; - -// Class LapackConnector provide the connector to fortran lapack routine. -// The entire function in this class are static and inline function. -// Usage example: LapackConnector::functionname(parameter list). -class LapackConnector -{ -private: - // Transpose the complex matrix to the fortran-form real-complex array. - static inline - complex* transpose(const ComplexMatrix& a, const int n, const int lda) - { - complex* aux = new std::complex[lda*n]; - for(int i = 0; i < n; ++i) - { for(int j = 0; j < lda; ++j) - { - aux[i*lda+j] = a(j,i); // aux[i*lda+j] means aux[i][j] in semantic, not in syntax! - } - } - return aux; - } - - // Transpose the fortran-form real-complex array to the complex matrix. - static inline - void transpose(const std::complex* aux, ComplexMatrix& a, const int n, const int lda) - { for(int i = 0; i < n; ++i) - { for(int j = 0; j < lda; ++j) - { - a(j, i) = aux[i*lda+j]; // aux[i*lda+j] means aux[i][j] in semantic, not in syntax! - } - } - } - -public: - - static inline - int ilaenv( int ispec, - char *name, - char *opts, - const int n1, - const int n2, - const int n3, - const int n4 - ) - { - const int nb = ilaenv_(&ispec, name, opts, &n1, &n2, &n3, &n4); - return nb; - } - - static inline - void zgesv (const int n, - const int nrhs, - ComplexMatrix &A, - const int lda, - const int *ipiv, - complex *B, - const int ldb, - int* info - ) - { - complex *aux = LapackConnector::transpose(A, n, lda); - - zgesv_(&n, &nrhs, aux, &lda, ipiv, B, &ldb, info); - - LapackConnector::transpose(aux, A, n, lda); - } - - static inline - void zpotrf(char uplo, - int n, - ComplexMatrix &a, - const int lda, - int info) - { - complex *aux = LapackConnector::transpose(a, n, lda); - zpotrf_( &uplo, &n, aux, &lda, &info); - LapackConnector::transpose(aux, a, n, lda); - delete[] aux; - } - - static inline - void zpotri(char uplo, - int n, - ComplexMatrix &a, - const int lda, - int info) - { - complex *aux = LapackConnector::transpose(a, n, lda); - zpotri_( &uplo, &n, aux, &lda, &info); - LapackConnector::transpose(aux, a, n, lda); - delete[] aux; - } - - - // wrap function of fortran lapack routine zhegv. - static inline - void zhegv( const int itype, - const char jobz, - const char uplo, - const int n, - ComplexMatrix& a, - const int lda, - ComplexMatrix& b, - const int ldb, - double* w, - std::complex* work, - int lwork, - double* rwork, - int info ) - { // Transpose the complex matrix to the fortran-form real-complex array. - complex* aux = LapackConnector::transpose(a, n, lda); - complex* bux = LapackConnector::transpose(b, n, ldb); - - // call the fortran routine - zhegv_(&itype, &jobz, &uplo, &n, aux, &lda, bux, &ldb, w, work, &lwork, rwork, &info); - - // Transpose the fortran-form real-complex array to the complex matrix. - LapackConnector::transpose(aux, a, n, lda); - LapackConnector::transpose(bux, b, n, ldb); - - // free the memory. - delete[] aux; - delete[] bux; - } - - // wrap function of fortran lapack routine zheev. - static inline - void zheev( const char jobz, - const char uplo, - const int n, - ComplexMatrix& a, - const int lda, - double* w, - complex< double >* work, - const int lwork, - double* rwork, - int* info ) - { // Transpose the complex matrix to the fortran-form real-complex array. - complex *aux = LapackConnector::transpose(a, n, lda); - - // call the fortran routine - zheev_(&jobz, &uplo, &n, aux, &lda, w, work, &lwork, rwork, info); - - // Transpose the fortran-form real-complex array to the complex matrix. - LapackConnector::transpose(aux, a, n, lda); - - // free the memory. - delete[] aux; - } - - // wrap function of fortran lapack routine zheev. - static inline - void zhegvx( const int itype, - const char jobz, - const char range, - const char uplo, - const int n, - ComplexMatrix& a, - const int lda, - ComplexMatrix& b, - const int ldb, - const double vl, - const double vu, - const int il, - const int iu, - const double abstol, - const int m, - double* w, - ComplexMatrix& z, - const int ldz, - std::complex* work, - const int lwork, - double* rwork, - int* iwork, - int* ifail, - int info) - { - // Transpose the complex matrix to the fortran-form real-complex array. - complex* aux = LapackConnector::transpose(a, n, lda); - complex* bux = LapackConnector::transpose(b, n, ldb); - complex* zux = LapackConnector::transpose(z, n, ldz); - - // call the fortran routine -// zhegvx_(&itype, &jobz, &range, &uplo, &n, aux, &lda, bux, &ldb, &vl, -// &vu, &il,&iu, &abstol, &m, w, zux, &ldz, work, &lwork, rwork, iwork, ifail, &info); - - // Transpose the fortran-form real-complex array to the complex matrix - LapackConnector::transpose(zux, z, n, ldz); - - // free the memory. - delete[] aux; - delete[] bux; - delete[] zux; - - } - - - -}; -#endif // LAPACKCONNECTOR_HPP diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/mathzone.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/mathzone.cpp deleted file mode 100644 index e42b107646..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/mathzone.cpp +++ /dev/null @@ -1,618 +0,0 @@ -#include "mathzone.h" - - -double Mathzone::PI = 3.14159265; - -Mathzone::Mathzone() -{ -} - -Mathzone::~Mathzone() -{ -} - -double Mathzone::BESSJY(double x, double xnu, double *rj, double *ry, double *rjp, double *ryp) -{ - const int XMIN = 2; - const double FPMIN = 1.0e-30; - const double EPS = 1.0e-10; - const int MAXIT = 10000; - - int i, isign, l, nl; - double a, b, br, bi, c, cr, ci, d, del, del1, den, di, dlr, dli, dr, e, f, fact, fact2, - fact3, ff, gam, gam1, gam2, gammi, gampl, h, p, pimu, pimu2, q, r, rjl, - rjl1, rjmu, rjp1, rjpl, rjtemp, ry1, rymu, rymup, rytemp, sum, sum1, - temp, w, x2, xi, xi2; - - if (x <= 0.0 || xnu < 0.0) - { -// WARNING_QUIT("Mathzone::BESSJY","bad arguments"); - exit(0); - } - - - nl = (x < XMIN ? (int)(xnu + 0.5) : IMAX(0, (int)(xnu - x + 1.5))); - const double xmu = xnu - nl; - const double xmu2 = xmu * xmu; - xi = 1.0 / x; - xi2 = 2.0 * xi; - w = xi2 / PI; - isign = 1; - h = xnu * xi; - if (h < FPMIN) h = FPMIN; - - b = xi2 * xnu; - - d = 0.0; - - c = h; - - for (i = 1;i <= MAXIT;i++) - { - b += xi2; - d = b - d; - - if (fabs(d) < FPMIN) d = FPMIN; - - c = b - 1.0 / c; - - if (fabs(c) < FPMIN) c = FPMIN; - - d = 1.0 / d; - - del = c * d; - - h = del * h; - - if (d < 0.0) isign = -isign; - - if (fabs(del - 1.0) < EPS) break; - } - - if (i > MAXIT) cout << "x too large in bessjy; try asymptotic expansion" << endl; - - rjl = isign * FPMIN; - - rjpl = h * rjl; - - rjl1 = rjl; - - rjp1 = rjpl; - - fact = xnu * xi; - - for (l = nl;l >= 1;l--) - { - rjtemp = fact * rjl + rjpl; - fact -= xi; - rjpl = fact * rjtemp - rjl; - rjl = rjtemp; - } - - if (rjl == 0.0) rjl = EPS; - - f = rjpl / rjl; - - if (x < XMIN) - { - x2 = 0.5 * x; - pimu = PI * xmu; - fact = (fabs(pimu) < EPS ? 1.0 : pimu / sin(pimu)); - d = -log(x2); - e = xmu * d; - fact2 = (fabs(e) < EPS ? 1.0 : sinh(e) / e); - // call BESCHB - BESCHB(xmu, &gam1, &gam2, &gampl, &gammi); - ff = 2.0 / PI * fact * (gam1 * cosh(e) + gam2 * fact2 * d); - e = exp(e); - p = e / (gampl * PI); - q = 1.0 / (e * PI * gammi); - pimu2 = 0.5 * pimu; - fact3 = (fabs(pimu2) < EPS ? 1.0 : sin(pimu2) / pimu2); - r = PI * pimu2 * fact3 * fact3; - c = 1.0; - d = -x2 * x2; - sum = ff + r * q; - sum1 = p; - - for (i = 1;i <= MAXIT;i++) - { - ff = (i * ff + p + q) / (i * i - xmu2); - c *= (d / i); - p /= (i - xmu); - q /= (i + xmu); - del = c * (ff + r * q); - sum += del; - del1 = c * p - i * del; - sum1 += del1; - - if (fabs(del) < (1.0 + fabs(sum))*EPS) break; - } - - if (i > MAXIT) cout << "bessy series failed to converge"; - - rymu = -sum; - - ry1 = -sum1 * xi2; - - rymup = xmu * xi * rymu - ry1; - - rjmu = w / (rymup - f * rymu); - } - - else - { - a = 0.25 - xmu2; - p = -0.5 * xi; - q = 1.0; - br = 2.0 * x; - bi = 2.0; - fact = a * xi / (p * p + q * q); - cr = br + q * fact; - ci = bi + p * fact; - den = br * br + bi * bi; - dr = br / den; - di = -bi / den; - dlr = cr * dr - ci * di; - dli = cr * di + ci * dr; - temp = p * dlr - q * dli; - q = p * dli + q * dlr; - p = temp; - - for (i = 2;i <= MAXIT;i++) - { - a += 2 * (i - 1); - bi += 2.0; - dr = a * dr + br; - di = a * di + bi; - - if (fabs(dr) + fabs(di) < FPMIN) dr = FPMIN; - - fact = a / (cr * cr + ci * ci); - - cr = br + cr * fact; - - ci = bi - ci * fact; - - if (fabs(cr) + fabs(ci) < FPMIN) cr = FPMIN; - - den = dr * dr + di * di; - - dr /= den; - - di /= -den; - - dlr = cr * dr - ci * di; - - dli = cr * di + ci * dr; - - temp = p * dlr - q * dli; - - q = p * dli + q * dlr; - - p = temp; - - if (fabs(dlr - 1.0) + fabs(dli) < EPS) break; - } - - if (i > MAXIT) cout << "cf2 failed in bessjy"; - - gam = (p - f) / q; - - rjmu = sqrt(w / ((p - f) * gam + q)); - - if(rjl >=0 ) rjmu = fabs(rjmu); - else rjmu = -fabs(rjmu); - - rymu = rjmu * gam; - - rymup = rymu * (p + q / gam); - - ry1 = xmu * xi * rymu - rymup; - } - - fact = rjmu / rjl; - - *rj = rjl1 * fact; - *rjp = rjp1 * fact; - - for (i = 1;i <= nl;i++) - { - rytemp = (xmu + i) * xi2 * ry1 - rymu; - rymu = ry1; - ry1 = rytemp; - } - - *ry = rymu; - - *ryp = xnu * xi * rymu - ry1; -} - -int Mathzone::IMAX(int a, int b) -{ - if (a > b) return a; - else return b; -} - -void Mathzone::BESCHB(double x, double *gam1, double *gam2, double *gampl, double *gammi) -{ - const int NUSE1 = 7; - const int NUSE2 = 8; - double xx; - static double c1[] = { -1.142022680371168e0, 6.5165112670737e-3, - 3.087090173086e-4, -3.4706269649e-6, - 6.9437664e-9, 3.67795e-11, -1.356e-13 - }; - static double c2[] = { 1.843740587300905e0, -7.68528408447867e-2, - 1.2719271366546e-3, -4.9717367042e-6, -3.31261198e-8, - 2.423096e-10, -1.702e-13, -1.49e-15 - }; - xx = 8.0 * x * x - 1.0; //Multiply x by 2 to make range be .1 to 1,and then apply transformation for evaluating even Chebyshev series. - *gam1 = CHEBEV(-1.0, 1.0, c1, NUSE1, xx); - *gam2 = CHEBEV(-1.0, 1.0, c2, NUSE2, xx); - *gampl = *gam2 - x * (*gam1); - *gammi = *gam2 + x * (*gam1); -} - -double Mathzone::CHEBEV(double a, double b, double c[], int m, double x) -{ - double d = 0.0, dd = 0.0, sv, y, y2; - int j; - - if ((x - a)*(x - b) > 0.0) cout << "x not in range in routine chebev" << endl; - - y2 = 2.0 * (y = (2.0 * x - a - b) / (b - a)); - - for (j = m - 1;j >= 1;j--) - { - sv = d; - d = y2 * d - dd + c[j]; - dd = sv; - } - - return y*d - dd + 0.5*c[0]; -} - - -double Mathzone::Spherical_Bessel_7(const int n, const double &x) -{ - if(x==0) - { - if(n!=0) return 0; - if(n==0) return 1; - } - double order, rj, rjp, ry, ryp; - - if (n < 0 || x <= 0.0) - { - exit(0); -// WARNING_QUIT("Mathzone::Spherical_Bessel_7","bad arguments in sphbes"); - } - - order = n + 0.5; - - // call BESSSJY - BESSJY(x, order, &rj, &ry, &rjp, &ryp); - - const double RTPIO2=1.2533141; // mohan remian question: here is INT???????????? - - const double factor = RTPIO2 / sqrt(x); - - return factor*rj; -} - - -void Mathzone::Spherical_Bessel_Roots -( - const int &num, - const int &l, - const double &epsilon, - double* eigenvalue, - const double &rcut -) -{ -// TITLE("Mathzone","Spherical_Bessel_Roots"); -// if(num<=0) WARNING_QUIT("Mathzone::Spherical_Bessel_Roots","num<=0"); - - const double max = 2*PI + (num + (l+0.5)/2 + 0.75)*PI/2 + - sqrt((num + (l+0.5)/2+0.75)*(num + (l+0.5)/2+0.75)*PI*PI/4-(l+0.5)*(l+0.5)/2); - - // magic number !! - // only need to > 1 - const int msh = 10 * num; -// cout<<"\n msh = "<(msh); - -// cout<<"\n delta = "<=7) - { - for(int ir=0; ir 1.0e-8) - { - ir0 = 0;//mohan modify 2007-10-13 - } - else - { - if (l == -1) - { - cout << "\n sph_bes, j_{-1}(0) ?//?"; - } - else if (l == 0) - { - jl [0] = 1.0;//mohan modify 2007-10-13 - } - else - { - jl [0] = 0.0;//mohan modify 2007-10-13 - } - ir0 = 1;//mohan modify 2007-10-13 - } - if (l == - 1) - { - for (ir = ir0;ir < msh; ir++) - { - x1 = q * r[ir]; - jl [ir] = cos(x1) / x1; - } - } - else if (l == 0) - { - for (ir = ir0;ir < msh;ir++) - { - x1 = q * r[ir]; - jl [ir] = sin(x1) / x1; - } - } - else if (l == 1) - { - for (ir = ir0;ir < msh;ir++) - { - x1 = q * r[ir]; - const double sinx = sin(x1); - const double cosx = cos(x1); - jl [ir] = (sinx / x1 - cosx) / x1; - } - } - else if (l == 2) - { - for (ir = ir0;ir < msh;ir++) - { - const double x1 = q * r[ir]; - const double sinx = sin(x1); - const double cosx = cos(x1); - jl [ir] = ((3.0 / x1 - x1) * sinx - - 3.0 * cosx) / (x1 * x1); - } - } - else if (l == 3) - { - for (ir = ir0;ir < msh;ir++) - { - x1 = q * r[ir]; - jl [ir] = (sin(x1) * (15.0 / x1 - 6.0 * x1) + - cos(x1) * (x1 * x1 - 15.0)) / pow(x1, 3);//mohan modify 2007-10-13 - } - } - else if (l == 4) - { - for (ir = ir0;ir < msh;ir++) - { - const double x1 = q * r[ir]; - const double x2 = x1 * x1; - const double x3 = x1 * x2; - const double x4 = x1 * x3; - const double x5 = x1 * x4; - jl [ir] = (sin(x1) * (105.0 - 45.0 * x2 + x4) + - cos(x1) * (10.0 * x3 - 105.0 * x1)) / x5; // mohan modify 2007-10-13 - } - } - else if (l == 5) - { - for (ir = ir0;ir < msh;ir++) - { - x1 = q * r[ir]; - - if (x1 < 0.14) - { - jl[ir] = 0;//mohan add 2007-10-15 - } - else - { - double cx1 = cos(x1); - double sx1 = sin(x1); - jl [ir] = (-cx1 - - (945.0 * cx1) / pow(x1, 4) + - (105.0 * cx1) / (x1 * x1) + - (945.0 * sx1) / pow(x1, 5) - - (420.0 * sx1) / pow(x1, 3) + - (15.0 * sx1) / x1) / x1; - - } - } - } - else if (l == 6) - { - for (ir = ir0;ir < msh;ir++) - { - x1 = q * r[ir]; - - if (x1 < 0.29) - { - jl[ir] = 0;//mohan add 2007-10-15 - } - else - { - double cx1 = cos(x1); - double sx1 = sin(x1); - jl [ir] = ((-10395.0 * cx1) / pow(x1, 5) + - (1260.0 * cx1) / pow(x1, 3) - - (21.0 * cx1) / x1 - sx1 + - (10395.0 * sx1) / pow(x1, 6) - - (4725.0 * sx1) / pow(x1, 4) + - (210.0 * sx1) / (x1 * x1)) / x1; - } - } - }//mohan modify 2007-11-20 reduce cos , sin , q*r[ir] times; - else - { - cout << "\n error in sph_bes, l out of {-1 ... 6},l = " << l ; - } - } -// printr1_d(ofs,"jl[] :",jl,msh); -// timer::tick("Mathzone","Spherical_Bessel"); - return; -} - -void Mathzone::Simpson_Integral -( - const int mesh, - const double *func, - const double *rab, - double &asum -) -{ - /* simpson's rule integration. On input: - ! mesh = mhe number of grid points (should be odd) - ! func(i)= function to be integrated - ! rab(i) = r(i) * dr(i)/di * di - ! For the logarithmic grid not including r=0 : - ! r(i) = r_0*exp((i-1)*dx) ==> rab(i)=r(i)*dx - ! For the logarithmic grid including r=0 : - ! r(i) = a(exp((i-1)*dx)-1) ==> rab(i)=(r(i)+a)*dx - ! Output in asum = \sum_i c_i f(i)*rab(i) = \int_0^\infty f(r) dr - ! where c_i are alternativaly 2/3, 4/3 except c_1 = c_mesh = 1/3 - */ - // simpson's rule integrator for function stored on the - // radial logarithmic mesh - // routine assumes that mesh is an odd number so run check - if (mesh % 2 == 0) - { - cout << "\n error in subroutine simpson "; - cout << "\n routine assumes mesh is odd but mesh = " - << mesh << endl; - return; - } - - asum = 0.00; - const double r12 = 1.00 / 12.00; - double f3 = func [0] * rab [0] * r12; - for (int i = 1;i < mesh;i += 2) - { - const double f1 = f3; - const double f2 = func [i] * rab [i] * r12; - f3 = func [i + 1] * rab [i + 1] * r12; - asum += 4.00 * f1 + 16.00 * f2 + 4.00 * f3; - } - return; -}// end subroutine simpson - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/mathzone.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/mathzone.h deleted file mode 100644 index b5b26f5407..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/mathzone.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef MATHZONE_H -#define MATHZONE_H - -#include -#include - -#include -#include -#include -#include -#include - -using namespace std; - -class Mathzone -{ -public: - - Mathzone(); - ~Mathzone(); - - //======================================================== - // Spherical Bessel - //======================================================== - static void Spherical_Bessel - ( - const int &msh, //number of grid points - const double *r,//radial grid - const double &q, // - const int &l, //angular momentum - double *jl //jl(1:msh) = j_l(q*r(i)),spherical bessel function - ); - static void Spherical_Bessel_Roots - ( - const int &num, - const int &l, - const double &epsilon, - double* eigenvalue, - const double &rcut - ); - static void Simpson_Integral( - const int mesh, - const double *func, - const double *rab, - double &asum - ); - static double PI; - -private: - static double Spherical_Bessel_7(const int n, const double &x); - static double BESSJY(double x, double xnu, double *rj, double *ry, double *rjp, double *ryp); - static void BESCHB(double x, double *gam1, double *gam2, double *gampl, double *gammi); - static double CHEBEV(double a, double b, double c[], int m, double x); - static int IMAX(int a, int b); - - -}; - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix.cpp deleted file mode 100644 index 5b6df2600d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* matrix.cpp file */ -#include -#include -#include -#include -#include - -#include -#include - -using namespace std; -#include "matrix.h" - -//********************************************************* -// The init() function is the main initialization routine. -// Sets up sizes and allocates memory for matrix class. -// All constructors call init() -// ******************************************************** - -int matrix::mCount = 0; - -void matrixAlloc() -{ - cout << "\n Allocation error for Matrix " << endl; - abort(); -} - -void matrix::init(const int nrows,const int ncols) -{ - nr = nrows; - nc = ncols; - c = NULL; -// hermetian = 0; - set_new_handler(matrixAlloc); - - if(nr*nc == 0) c = NULL; - else - { - c = new double[nrows*ncols](); - this->zero_out(); - assert(c!=0);// terminate if memory not allocated - } - - mCount++; -} - -// Free up memory for matrix -void matrix::freemem(void) -{ - delete [] c; - c = NULL; -} - -// constructor with sizes -matrix::matrix(const int nrows,const int ncols) -{ - this->init(nrows, ncols); -} - -//****************** -// -// Copy constructor -// -//****************** -matrix::matrix(const matrix &m1) -{ - init(m1.nr, m1.nc); - //hermetian = m1.hermetian; - // Copy over m1 contents - for (int i = 0; i < nr*nc; i++) c[i] = m1.c[i]; -} - -//************* -// -// destructor -// -//************* -matrix::~matrix() -{ - this->freemem(); -} - -//****************************** -// reallocate memory for matrix -//****************************** -void matrix::create(const int nrow,const int ncol) -{ - delete [] c; - nr = nrow; - nc = ncol; - c = new double[nrow * ncol](); - return; -} - -/* Assignment: nonstandard in that it returns void. To make it standard, - * replace void -> matrix and uncomment the return *this; */ - -void matrix::operator=(const matrix & m1) -{ - for (int i = 0; i < nr*nc; i++) c[i] = m1.c[i]; -} - -/* Adding matrices, as a friend */ -matrix operator+(const matrix &m1, const matrix &m2) -{ - assert(m1.nr == m2.nr); - assert(m2.nc == m2.nc); - - matrix tm(m1); - for (int i = 0; i < m1.nr*m1.nc; i++) tm.c[i] += m2.c[i]; - return tm; -} - -/* Subtracting matrices, as a friend */ -matrix operator-(const matrix &m1, const matrix &m2) -{ - assert(m1.nr == m2.nr); - assert(m2.nc == m2.nc); - - matrix tm(m1); - for(int i = 0; i < m1.nr*m1.nc; i++) tm.c[i] -= m2.c[i]; - return tm; -} - -//*************************************** -// -// Multiplying matrices, as a friend -// -// ************************************* -matrix operator*(const matrix &m1, const matrix &m2) -{ - assert(m1.nr == m2.nr); - assert(m2.nc == m2.nc); - - // allocate the result and zero it out - matrix mprod(m2.nr, m1.nc); - - mprod.zero_out(); - - // do the multiply and return - for (int i = 0;i < m2.nr;i++) - { - for (int j = 0;j < m1.nc;j++) - { - for (int k = 0;k < m2.nc;k++) - { - mprod(i, j) += m2(i, k) * m1(k, j); - } - } - } - - return mprod; -} - -/* Scale a matrix */ -matrix operator*(const double &s, const matrix &m) -{ - matrix sm(m); - for (int i = 0; i < m.nr*m.nc; i++) sm.c[i] *= s; - return sm; -} - -/* matrix * double */ -matrix operator*(const matrix &m,const double &s) -{ - matrix sm(m); - for (int i = 0; i < m.nr*m.nc; i++)sm.c[i] *= s; - return sm; -} - -/* Scale a matrix in place */ -void matrix::operator*=(const double &s) -{ - for (int i = 0; i < nc*nr; i++) c[i] *= s; -} - -/* Accumulate to a matrix in place */ -void matrix::operator+=(const matrix & m) -{ - if (nr != m.nr || nc != m.nc) - { - cout << " void matrix::operator+=(const matrix &m) has size mismatch\n"; - abort(); - } - for (int i = 0; i < nc*nr; i++) c[i] += m.c[i]; -} - - -/* decumulate to a matrix in place */ -void matrix::operator-=(const matrix & m) -{ - if (nr != m.nr || nc != m.nc) - { - cout << "void matrix::operator-=(const matrix &m) has size mismatch\n"; - abort(); - } - for (int i = 0; i < nc*nr; i++) c[i] -= m.c[i]; -} - -/* zero out the matrix */ -void matrix::zero_out(void) -{ - for(int i = 0; i < nr*nc; i++) - { - c[i] = 0.0; - } - return; -} - - -matrix transpose(matrix m) -{ - matrix tm(m.nc, m.nr); - - for (int i = 0;i < m.nr;i++) - { - for (int j = 0;j < m.nc;j++) - { - tm(j, i) = m(i, j); - } - } - return tm; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix.h deleted file mode 100644 index 5c3e896f55..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef MATRIX_H -#define MATRIX_H -class matrix -{ - /* data */ -public: - double *c; /* Holds the data */ - int nr; - int nc; /* Number of rows and columns */ - int hermetian; - static int mCount; - - /* Constructors and destructor */ - matrix(const int nrows = 1,const int ncols = 1); - matrix(const matrix &m1); /* copy constructor */ - ~matrix(); - - void create(const int nrow,const int ncol); - void operator=(const matrix &m1); /* Nonstandard: returns void */ - - double &operator()(const int ir,const int ic) - { return c[nc*ir + ic]; }; - - const double &operator()(const int ir,const int ic)const - { return c[nc*ir + ic]; }; - -// inline double &operator()(int i,int j) const -// { return c[nc*i+j]; } - - friend matrix operator+(const matrix &m1, const matrix &m2); - friend matrix operator-(const matrix &m1, const matrix &m2); - friend matrix operator*(const matrix &m1, const matrix &m2); - friend matrix operator*(const double &s, const matrix &m); - friend matrix operator*(const matrix &m, const double &s); - void operator*=(const double &s); - void operator+=(const matrix &m); - void operator-=(const matrix &m); - - /* member function: */ - matrix Inverse(void); - - double det(void); - - /* Does the memory allocations of the constructor */ - void init(int nrows, int ncols); - - /* Free up memory */ - void freemem(void); - - /* zero out all the entries */ - void zero_out(void); -}; - -matrix transpose(matrix m); - -#endif // MATRIX_H diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix3.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix3.cpp deleted file mode 100644 index 67ccc3c8f4..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix3.cpp +++ /dev/null @@ -1,212 +0,0 @@ -#include "matrix3.h" - -Matrix3::Matrix3(const double &r11, const double &r12, const double &r13, - const double &r21, const double &r22, const double &r23, - const double &r31, const double &r32, const double &r33) -{ - e11 = r11;e12 = r12;e13 = r13; - e21 = r21;e22 = r22;e23 = r23; - e31 = r31;e32 = r32;e33 = r33; -} - -void Matrix3::Reset(void) -{ - e11 = 1;e12 = 0;e13 = 0; - e21 = 0;e22 = 1;e23 = 0; - e31 = 0;e32 = 0;e33 = 1; -} - -void Matrix3::Identity(void) -{ - e11 = 1;e12 = 0;e13 = 0; - e21 = 0;e22 = 1;e23 = 0; - e31 = 0;e32 = 0;e33 = 1; -} - -double Matrix3::Det(void) const -{ - return e11*e22*e33 - - e11*e32*e23 + - e21*e32*e13 - - e21*e12*e33 + - e31*e12*e23 - - e31*e22*e13; -} - -Matrix3 Matrix3::Transpose(void) const -{ - return Matrix3(e11, e21, e31, e12, e22, e32, e13, e23, e33); -} - -Matrix3 Matrix3::Inverse(void) const -{ - double d = this->Det(); - - if(d == 0)d = 1; - - return Matrix3((e22*e33 - e23*e32) / d, - -(e12*e33 - e13*e32) / d, - (e12*e23 - e13*e22) / d, - -(e21*e33 - e23*e31) / d, - (e11*e33 - e13*e31) / d, - -(e11*e23 - e13*e21) / d, - (e21*e32 - e22*e31) / d, - -(e11*e32 - e12*e31) / d, - (e11*e22 - e12*e21) / d); -} - -Matrix3& Matrix3::operator = (const Matrix3 &m) -{ - e11 = m.e11;e12 = m.e12;e13 = m.e13; - e21 = m.e21;e22 = m.e22;e23 = m.e23; - e31 = m.e31;e32 = m.e32;e33 = m.e33; - return *this; -} - -Matrix3& Matrix3::operator +=(const Matrix3 &m) -{ - e11 += m.e11;e12 += m.e12;e13 += m.e13; - e21 += m.e21;e22 += m.e22;e23 += m.e23; - e31 += m.e31;e32 += m.e32;e33 += m.e33; - return *this; -} - -Matrix3& Matrix3::operator -=(const Matrix3 &m) -{ - e11 -= m.e11;e12 -= m.e12;e13 -= m.e13; - e21 -= m.e21;e22 -= m.e22;e23 -= m.e23; - e31 -= m.e31;e32 -= m.e32;e33 -= m.e33; - return *this; -} - -Matrix3& Matrix3::operator *=(const double &s) -{ - e11 *= s;e12 *= s;e13 *= s; - e21 *= s;e22 *= s;e23 *= s; - e31 *= s;e32 *= s;e33 *= s; - return *this; -} - -Matrix3& Matrix3::operator /=(const double &s) -{ - e11 /= s;e12 /= s;e13 /= s; - e21 /= s;e22 /= s;e23 /= s; - e31 /= s;e32 /= s;e33 /= s; - return *this; -} - -//m1+m2 -Matrix3 operator +(const Matrix3 &m1, const Matrix3 &m2) -{ - return Matrix3(m1.e11 + m2.e11, - m1.e12 + m2.e12, - m1.e13 + m2.e13, - m1.e21 + m2.e21, - m1.e22 + m2.e22, - m1.e23 + m2.e23, - m1.e31 + m2.e31, - m1.e32 + m2.e32, - m1.e33 + m2.e33); -} - -//m1-m2 -Matrix3 operator -(const Matrix3 &m1, const Matrix3 &m2) -{ - return Matrix3(m1.e11 + m2.e11, - m1.e12 - m2.e12, - m1.e13 - m2.e13, - m1.e21 - m2.e21, - m1.e22 - m2.e22, - m1.e23 - m2.e23, - m1.e31 - m2.e31, - m1.e32 - m2.e32, - m1.e33 - m2.e33); -} - -//m/s -Matrix3 operator /(const Matrix3 &m, const double &s) -{ - return Matrix3(m.e11 / s, m.e12 / s, m.e13 / s, - m.e21 / s, m.e22 / s, m.e23 / s, - m.e31 / s, m.e32 / s, m.e33 / s); -} - -//m1*m2 -Matrix3 operator *(const Matrix3 &m1, const Matrix3 &m2) -{ - return Matrix3(m1.e11*m2.e11 + m1.e12*m2.e21 + m1.e13*m2.e31, - m1.e11*m2.e12 + m1.e12*m2.e22 + m1.e13*m2.e32, - m1.e11*m2.e13 + m1.e12*m2.e23 + m1.e13*m2.e33, - m1.e21*m2.e11 + m1.e22*m2.e21 + m1.e23*m2.e31, - m1.e21*m2.e12 + m1.e22*m2.e22 + m1.e23*m2.e32, - m1.e21*m2.e13 + m1.e22*m2.e23 + m1.e23*m2.e33, - m1.e31*m2.e11 + m1.e32*m2.e21 + m1.e33*m2.e31, - m1.e31*m2.e12 + m1.e32*m2.e22 + m1.e33*m2.e32, - m1.e31*m2.e13 + m1.e32*m2.e23 + m1.e33*m2.e33); -} - -//m*s -Matrix3 operator *(const Matrix3 &m,const double &s) -{ - return Matrix3(m.e11*s, m.e12*s, m.e13*s, - m.e21*s, m.e22*s, m.e23*s, - m.e31*s, m.e32*s, m.e33*s); -} - -//s*m -Matrix3 operator *(const double &s, const Matrix3 &m) -{ - return Matrix3(m.e11*s, m.e12*s, m.e13*s, - m.e21*s, m.e22*s, m.e23*s, - m.e31*s, m.e32*s, m.e33*s); -} - -//m*u -Vector3 operator *(const Matrix3 &m, const Vector3 &u) -{ - return Vector3(m.e11*u.x + m.e12*u.y + m.e13*u.z, - m.e21*u.x + m.e22*u.y + m.e23*u.z, - m.e31*u.x + m.e32*u.y + m.e33*u.z); -} - -//u*m -Vector3 operator *(const Vector3 &u, const Matrix3 &m) -{ - return Vector3(u.x*m.e11 + u.y*m.e21 + u.z*m.e31, - u.x*m.e12 + u.y*m.e22 + u.z*m.e32, - u.x*m.e13 + u.y*m.e23 + u.z*m.e33); -} - - -// whether m1==m2 -bool operator==(const Matrix3 &m1, const Matrix3 &m2) -{ - if(m1.e11 == m2.e11 && - m1.e12 == m2.e12 && - m1.e13 == m2.e13 && - m1.e21 == m2.e21 && - m1.e22 == m2.e22 && - m1.e23 == m2.e23 && - m1.e31 == m2.e31 && - m1.e32 == m2.e32 && - m1.e33 == m2.e33) - { - return true; - } - return false; -} - -//whether m1 != m2 -bool operator!=(const Matrix3 &m1, const Matrix3 &m2) -{ - return !(m1 == m2); //!= defined in terms of operator == -} - - -void Matrix3::print(void)const -{ - cout << e11 << setw(15) << e12 << setw(15) << e13 << endl ; - cout << e21 << setw(15) << e22 << setw(15) << e23 << endl ; - cout << e31 << setw(15) << e32 << setw(15) << e33 << endl ; - return; -} diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix3.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix3.h deleted file mode 100644 index 024f19870d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/matrix3.h +++ /dev/null @@ -1,54 +0,0 @@ -//========================================================== -// AUTHOR: Lixin He, Mohan Chen -// LAST UPDATE : 2009-03-24 add operator == and != -//========================================================== -#ifndef MatriX3_H -#define MatriX3_H - -#ifdef _MCD_CHECK -#include "./src_parallel/mcd.h" -#endif - -#include "vector3.h" - -class Matrix3 -{ - /* data */ -public: - // element eij:i_column,j_row - double e11, e12, e13, e21, e22, e23, e31, e32, e33; - - /* Constructors and destructor */ - Matrix3(const double &r11 = 1,const double &r12 = 0,const double &r13 = 0, - const double &r21 = 0,const double &r22 = 1,const double &r23 = 0, - const double &r31 = 0,const double &r32 = 0,const double &r33 = 1); - - void Reset(void); - void Identity(void); - double Det(void) const ; - Matrix3 Transpose(void) const ; - Matrix3 Inverse(void) const ; - - Matrix3& operator=(const Matrix3 &m); - Matrix3& operator+=(const Matrix3 &m); - Matrix3& operator-=(const Matrix3 &m); - Matrix3& operator*=(const double &s); - Matrix3& operator/=(const double &s); - - void print(void)const; -}; - -Matrix3 operator +(const Matrix3 &m1, const Matrix3 &m2); //m1+m2 -Matrix3 operator -(const Matrix3 &m1, const Matrix3 &m2); //m1-m2 -Matrix3 operator /(const Matrix3 &m,const double &s); //m/s -Matrix3 operator *(const Matrix3 &m1,const Matrix3 &m2); //m1*m2 -Matrix3 operator *(const Matrix3 &m,const double &s); //m*s -Matrix3 operator *(double &s, const Matrix3 &m); //s*m -Vector3 operator *(const Matrix3 &m, const Vector3 &u); //m*u -Vector3 operator *(const Vector3 &u, const Matrix3 &m); //u*m - -bool operator ==(const Matrix3 &m1, const Matrix3 &m2); //whether m1 == m2 -bool operator !=(const Matrix3 &m1, const Matrix3 &m2); //whethor m1 != m2 - -#endif // MATRIX3_H - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/realarray.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/realarray.cpp deleted file mode 100644 index 86c17471db..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/realarray.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************* - * ESCP:Electro-Structure Calculate Package. - ********************************************/ - -#include -#include "realarray.h" - -int realArray::arrayCount = 0; - -void realArrayAlloc() -{ - cout << "\n Allocation error for realArray " << endl; - exit(0); -} - -realArray::realArray(const int d1,const int d2,const int d3) -{ - dim = 3; - bound1 = (d1 <= 0) ? 1 : d1; - bound2 = (d2 <= 0) ? 1 : d2; - bound3 = (d3 <= 0) ? 1 : d3; - bound4 = 0; - - set_new_handler(realArrayAlloc); - - size = bound1 * bound2 * bound3 ; //* sizeof(float); - - ptr = new double[size](); - assert(ptr != 0); - for(int i=0; i0); - - dim = 4; - - bound1 = d1; - bound2 = d2; - bound3 = d3; - bound4 = d4; - - delete [] ptr; - ptr = new double[size](); - assert(ptr != 0); - for(int i=0; i0); - - dim = 3; - - bound1 = d1; - bound2 = d2; - bound3 = d3; - bound4 = 1; - - delete [] ptr; - ptr = new double[size](); - assert(ptr != 0); - for(int i=0; i -#include -#include -#include - -using namespace std; - -class realArray -{ -public: - double *ptr; - - realArray(const int d1 = 1 ,const int d2 = 1,const int d3 = 1); - realArray(const int d1, const int d2,const int d3,const int d4); - ~realArray(); - - void create(const int d1,const int d2,const int d3); - void create(const int d1,const int d2,const int d3,const int d4); - - const realArray &operator=(const realArray &right); - const realArray &operator=(const double &right); - - double &operator()(const int d1,const int d2,const int d3); - double &operator()(const int d1,const int d2,const int d3,const int d4); - - const double &operator()(const int d1,const int d2,const int d3)const; - const double &operator()(const int d1,const int d2,const int d3,const int d4)const; - - void zero_out(void); - - int getSize() const - { return size;} - - int getDim() const - { return dim;} - - int getBound1() const - { return bound1;} - - int getBound2() const - { return bound2;} - - int getBound3() const - { return bound3;} - - int getBound4() const - { return bound4;} - - int getArrayCount(void) - { return arrayCount;} - -private: - int size; - int dim; - int bound1, bound2, bound3, bound4; - static int arrayCount; - - void freemem(); -}; - -//************************************************** -// set elements of a as zeros which a is 1_d array. -//************************************************** -template -void zeros(T *u,const int n) -{ - assert(n>0); - for (int i = 0;i < n;i++) u[i] = 0; -} - -#endif // realArray class diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/timer.cpp b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/timer.cpp deleted file mode 100644 index ec1660d9ce..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/timer.cpp +++ /dev/null @@ -1,244 +0,0 @@ -//========================================================== -// AUTHOR : fangwei , mohan -// DATE : 2008-11-06 -//========================================================== -#include "timer.h" - -using namespace std; - -//---------------------------------------------------------- -// EXPLAIN : -//---------------------------------------------------------- -bool timer::disabled = false; -int timer::n_clock = 100; -int timer::n_now = 0; -int timer::start_flag = -1; -double* timer::cpu_second; -double* timer::cpu_start; -string* timer::name; -string* timer::class_name; -int* timer::calls; -bool timer::delete_flag=false; - -timer::timer() -{ -}; - -timer::~timer() -{ -}; - -void timer::finish() -{ - timer::tick("","total"); - print_all(); - if(delete_flag) - { - delete[] cpu_second; - delete[] cpu_start; - delete[] name; - delete[] class_name; - delete[] calls; - } -} - -//---------------------------------------------------------- -// -//---------------------------------------------------------- -void timer::start(void) -{ - cpu_second = new double[n_clock](); - cpu_start = new double[n_clock](); - name = new string[n_clock](); - class_name = new string[n_clock](); - calls = new int[n_clock](); - delete_flag = true; - - for (int i = 0; i < n_clock; i++) - { - cpu_start[i] = (double)start_flag; - name[i]= "\0"; - class_name[i]= "\0"; - calls[i] = 0; - } - - // first init ,then we can use tick - timer::tick("","total"); - return; -} - -double timer::cpu_time(void) -{ - clock_t t1 = 0; -//---------------------------------------------------------- -// EXPLAIN : here static is important !! -// only first call can let t0 = 0,clock begin -// when enter this function second time , t0 > 0 -//---------------------------------------------------------- - static clock_t t0 = 0; - if (t0 == 0) - { - t0 = clock(); - } - t1 = clock() - t0; - - if(t1 < 0) return 0; // mohan add, abandon the cross point time 2^32 ~ -2^32 . - else return (double)t1/CLOCKS_PER_SEC; -} - -void timer::tick(const string &tagc,const string &tag) -{ -//---------------------------------------------------------- -// EXPLAIN : if timer is disabled , return -//---------------------------------------------------------- - if (disabled) - { - return; - } - - int find_clock=0;//counter -//---------------------------------------------------------- -// EXPLAIN : find if the tag has been used -//---------------------------------------------------------- - for(find_clock=0; find_clock= n_clock) - { - cout << "\nError! Too many timer!"; - return; - } - -//---------------------------------------------------------- -// CALL MEMBER FUNCTION : -// NAME : cpu_time -// -// EXPLAIN : start_flag is minus 1, -// so if cpu_start == start_flag,means a new clock counting -// begin, hence we record the start time of this clock -// counting , if cpu_start != start_flag, means it's -// the end of this counting, so we add the time during -// this two 'time point' to the clock time storage. -//---------------------------------------------------------- - if (cpu_start[find_clock] == start_flag ) - { - cpu_start[find_clock] = cpu_time(); - calls[find_clock]++; - } - else - { - cpu_second[find_clock] += cpu_time() - cpu_start[find_clock]; - cpu_start[find_clock] = start_flag; - } - return; -} - - - -void timer::enable(void) -{ - disabled = false; - return; -} - -void timer::disable(void) -{ - disabled = true; - return; -} - -double timer::print(const string &tag) -{ - int index = 0; - for(int i=0; i 1s , set small = 10^6 - - cout<<"\n--------- CLASS NAME--------------- NAME ----- TIME(sec) -- CALLS ----- AVG ----- PER%"; - bool *print_flag = new bool[n_clock]; - for(int i=0; i -#include -#include -#include -#include -using namespace std; - -//========================================================== -// CLASS : -// NAME : timer(calculate time) -//========================================================== -class timer -{ - timer(); - ~timer(); - - public: -//========================================================== -// MEMBER FUNCTIONS : -// NAME : tick(use twice at a time) -// NAME : start -// NAME : finish -// NAME : enable -// NAME : disable -// NAME : print -// NAME : print_all -//========================================================== - static void tick(const string &class_name_in,const string &name_in); - - static void start(void); - static void finish(void); - - static void enable(void); - static void disable(void); - - static void print_all(void); - static long double print_until_now(void); - static double print(const string &name_in); - - private: - -//========================================================== -// MEMBER VARIABLES : -// NAME : disabled(if disabled , timer can't work) -// NAME : n_clock(uplimit number of clock numbers) -// NAME : n_now(the index of clocks) -// NAME : start_flag -// NAME : cpu_start -// NAME : cput_second(record cpu time) -// NAME : name(record clock name) -// NAME : class_name(record another name for clock) -//========================================================== - static bool disabled; - static int n_clock; - static int n_now; - static int start_flag; - static double *cpu_start; - static double *cpu_second; - static string *name; - static string *class_name; - static int *calls; - -//========================================================== -// MEMBER FUNCTIONS : -// NAME : cpu_time(calculate time) -//========================================================== - static double cpu_time(void); - static bool delete_flag; - -}; -#endif - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/vector3.h b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/vector3.h deleted file mode 100644 index 945f117855..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_tools/vector3.h +++ /dev/null @@ -1,237 +0,0 @@ -//========================================================== -// -//========================================================== -#ifndef VECTOR3_H -#define VECTOR3_H - -#ifdef _MCD_CHECK -#include "./src_parallel/mcd.h" -#endif - -#include -#include -#include -using namespace std; - -template -class Vector3 -{ -public: - T x; - T y; - T z; - Vector3(const T &x1 = 0,const T &y1 = 0,const T &z1 = 0); - - Vector3& operator=(const Vector3 &u); - Vector3& operator+=(const Vector3 &u); - Vector3& operator-=(const Vector3 &u); - Vector3& operator*=(const Vector3 &u); - Vector3& operator*=(const T &s); - Vector3& operator/=(const Vector3 &u); - Vector3& operator/=(const T &s); - - void set(const T &x1, const T &y1,const T &z1); - - inline T norm(void) const - { return sqrt(x*x + y*y + z*z); } - - T norm2(void)const; - void normalize(void); - void reverse(void); - - // mohan add 2009-11-29 - void print(void)const ; -}; - -template -Vector3 operator+(const Vector3 &u,const Vector3 &v); -template -Vector3 operator-(const Vector3 &u,const Vector3 &v); -// | i j k | -// | ux uy uz | -// | vx vy vz | -//u.v=(uy*vz-uz*vy)i+(-ux*vz+uz*vx)j+(ux*vy-uy*vx)k -template -Vector3 operator^(const Vector3 &u,const Vector3 &v); -//u.v=(ux*vx)+(uy*vy)+(uz*vz) -template -T operator*(const Vector3 &u,const Vector3 &v); -template -Vector3 operator*(const T &s,const Vector3 &u); -template -Vector3 operator/(const Vector3 &u,const T &s); -template -Vector3 cross(const Vector3 &u,const Vector3 &v); -//u.v=(ux*vx)+(uy*vy)+(uz*vz) -template -T dot(const Vector3 &u,const Vector3 &v); -//template -//T TripleSalarProduct(Vector3 u, Vector3 v, Vector3 w); - -//========================================================== -// Define Constructor -//========================================================== -template -Vector3::Vector3(const T &x1,const T &y1, const T &z1) -:x(x1),y(y1),z(z1) -{} - -template -void Vector3::set(const T &x1,const T &y1,const T &z1) -{ - x = x1; y = y1; z = z1; -} - -template -T Vector3::norm2(void)const -{ - return x*x + y*y + z*z; -} - -//|v| = sqrt(x*x+y*y+z*z)=1 -template -void Vector3::normalize(void) -{ - T m = sqrt(x*x + y*y + z*z); - x /= m;y /= m;z /= m; -} - -template -void Vector3::reverse(void) -{ - x = -x;y = -y;z = -z; -} - -template -Vector3& Vector3::operator=(const Vector3 &u) -{ - x = u.x;y = u.y;z = u.z; - return *this; -} - -template -Vector3& Vector3::operator+=(const Vector3 &u) -{ - x += u.x;y += u.y;z += u.z; - return *this; -} - -template -Vector3& Vector3::operator-=(const Vector3 &u) -{ - x -= u.x;y -= u.y;z -= u.z; - return *this; -} - -template -Vector3& Vector3::operator*=(const T &s) -{ - x *= s;y *= s;z *= s; - return *this; -} - -template -Vector3& Vector3::operator/=(const T &s) -{ - x /= s;y /= s;z /= s; - return *this; -} - -template -Vector3 operator+(const Vector3 &u,const Vector3 &v) -{ - return Vector3(u.x + v.x, u.y + v.y, u.z + v.z); -} - -template -Vector3 operator-(const Vector3 &u,const Vector3 &v) -{ - return Vector3(u.x - v.x, u.y - v.y, u.z - v.z); -} - -// u.v=(uy*vz-uz*vy)i+(-ux*vz+uz*vx)j+(ux*vy-uy*vzx)k -template -Vector3 operator^(const Vector3 &u,const Vector3 &v) -{ - return Vector3 (u.y * v.z - u.z * v.y, - -u.x * v.z + u.z * v.x, - u.x * v.y - u.y * v.x); -} - -//u.v=(ux*vx)+(uy*vy)+(uz*vz) -template -T operator*(const Vector3 &u,const Vector3 &v) -{ - return (u.x * v.x + u.y * v.y + u.z * v.z); -} - -template // mohan add 2009-5-10 -Vector3 operator*(const Vector3 &u, const T &s) -{ - return Vector3(u.x * s, u.y * s, u.z * s); -} - -template -Vector3 operator*(const T &s,const Vector3 &u) -{ - return Vector3(u.x * s, u.y * s, u.z * s); -} - -template -Vector3 operator /(const Vector3 &u,const T &s) -{ - return Vector3(u.x / s, u.y / s, u.z / s); -} - -// u.v=(uy*vz-uz*vy)i+(-ux*vz+uz*vx)j+(ux*vy-uy*vzx)k -template -Vector3 cross(const Vector3 &u, const Vector3 &v) -{ - return Vector3 (u.y * v.z - u.z * v.y, - -u.x * v.z + u.z * v.x, - u.x * v.y - u.y * v.x); -} - -template -T dot(const Vector3 &u,const Vector3 &v) -{ - return (u.x * v.x + u.y * v.y + u.z * v.z); -} - -//whether u == v -template -bool operator ==(const Vector3 &u, const Vector3 &v) -{ - if(u.x == v.x && u.y == v.y && u.z == v.z) - { - return true; - } - return false; -} - -//whether m1 != m2 -template -bool operator !=(const Vector3 &u, const Vector3 &v) -{ - return !(u == v); -} - -template -void Vector3::print(void)const -{ - cout.precision(5) ; - cout << "(" << setw(10) << x << "," << setw(10) << y << "," - << setw(10) << z << ")" << endl ; - return ; -} - -//s = u.(v x w) -//template -//T TripleScalarProduct(Vector3 u, Vector3 v, Vector3 w) -//{ -// return T((u.x * (v.y * w.z - v.z * w.y)) + -// (u.y * (-v.x * w.z + v.z * w.x)) + -// (u.z * (v.x * w.y - v.y * w.x))); -//} - -#endif diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/INPUT b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/INPUT deleted file mode 100644 index 7ef20626a7..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/INPUT +++ /dev/null @@ -1,79 +0,0 @@ - -1 // if or not calculate the spillage. 1/0 -0 // restart from file or not. 1/0 -0 // if or not output the file. 1/0 -1 // number of structures. -/home/mohan/3_my_program/1_MCSP/GaAs.10.5.dat_haha - - - -8 //number of kpoints. -1 //number of pools. - - - -20 - - - -2 //1:max 2:average - - - -1.0e-9 // Init temparature for spillage -0.5 // Cooling rate -1 // Number of temperatures(spillage) -0 // Number of temperatures(kinetical) -100 // Number of steps per temparature -0.005 // Delta kappa -5 // Selectly output information -100 // Acceptance_steps -0.4 // Acceptance_high -0.2 // Acceptance_low -100 // Max kinetic energy(Rydberg). -0.01 // 'dr' for kinetic minimized. -1 // 1: Kin 2: Ecut - - - -0 // to control the number of bands.(Yes1/No0) -3 // int, the start band index(>0). -4 // int, the ed band index( - - -2 // Number of levels. -# label / na / skip / lmax / each L / -31 1 new 2 0 1 1 -33 1 new 2 0 1 1 - -31 1 new 1 1 1 -33 1 new 1 1 1 - - - - - -0.005 //dr(a.u.) of uniform mesh. Attention!!dr will affect kinetic energy minmized largely. --6 //xmin -1 //zed, chosen as valence charge. -0.01 //dx -6.0 //xmax - - - -0 -2 -./FILE/Si-S.ORBITAL -0 -./FILE/Si-P.ORBITAL -1 - - - -0 // 'yes' to do this. -14.0 // rcut, only useful for test program -0.01 // dr, for simpson integral -2 // test eigenvalue index -2 // lmax - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/mpi.sh b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/mpi.sh deleted file mode 100644 index 516726f973..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/mpi.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -#PBS -l nodes=2:ppn=4 -#PBS -j oe -#PBS -V -#PBS -N MCSP - -# go to work dir -cd $PBS_O_WORKDIR - -# setup Nums of Processor -NP=`cat $PBS_NODEFILE|wc -l` -echo "Numbers of Processors: $NP" -echo "---------------------------" - -# running program -/share/data1/mpich-intel/bin/mpirun -np $NP -machinefile $PBS_NODEFILE ../040.MCSP_p.exe > Log.txt diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/node_openmpi b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/node_openmpi deleted file mode 100644 index a816c13efc..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/node_openmpi +++ /dev/null @@ -1 +0,0 @@ -compute-0-13 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/p.sh b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/p.sh deleted file mode 100644 index 8e958557ec..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_p/p.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -#/share/data2/openmpi-gnu/bin/mpirun -np $1 -machinefile node_openmpi ../042.MCSP_p.exe -/opt/openmpi-intel9/bin/mpirun -np $1 -machinefile node_openmpi ../042.MCSP_p.exe - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_s/INPUT b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_s/INPUT deleted file mode 100644 index 3f6fb190e0..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_s/INPUT +++ /dev/null @@ -1,83 +0,0 @@ - -1 // if or not calculate the spillage. 1/0 -0 // restart or not. 1/0 -1 // if or not output the file. 1/0 -1 // number of structures. -H-6-0.6.15.dat - - - -1 //number of k points -1 // number of pools - - - -15 - - - -2 - - - -1.0e-8 // Start temparature for spillage -0.5 // Cooling rate -2 // Number of temperatures(spillage) -500 // Number of steps per temparature - -1.0e-2 // start temperature for kinetic energy -0.8 // Cooling rate -1 // Number of temperatures(kinetical) -100 // Number of steps per temparature - -0.05 // Delta kappa -49 // Selectly output information - -100 // Acceptance_steps -0.4 // Acceptance_high -0.2 // Acceptance_low - -50 // Max kinetic energy(Rydberg). -0.01 // 'dr' for kinetic minimized. -1 // 1: Kin 2: Ecut - - - -1 // to control the number of bands.(Yes1/No0) -1 // int, the start band index(>0). -1 // int, the ed band index( - - -2 // Number of levels. -# label / na / skip / lmax / each L / -01 2 new 1 1 1 -01 2 new 1 1 1 -01 2 new 1 1 1 - - - -0.01 //dr(a.u.) of uniform mesh. Attention!!dr will affect kinetic energy minmized largely. --6 //xmin -1 //zed, chosen as valence charge. -0.01 //dx -6.0 //xmax - - - -0 -2 -./FILE/Si-S.ORBITAL -0 -./FILE/Si-P.ORBITAL -1 - - - -0 // 'yes' to do this. -14.0 // rcut, only useful for test program -0.01 // dr, for simpson integral -2 // test eigenvalue index -2 // lmax - - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_s/s.sh b/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_s/s.sh deleted file mode 100644 index 225b61ca0d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/tests_s/s.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -#/share/apps/mpich/1.2.7-gnu/bin/mpirun -machinefile node -np $1 ./fp_mpi.x $2 -../046.MCSP_s.exe diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/07_N.stru b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/07_N.stru deleted file mode 100644 index 2822c6509d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/07_N.stru +++ /dev/null @@ -1,15 +0,0 @@ -ATOMIC_SPECIES -N 1 N.LDA.UPF -LATTICE_CONSTANT -20 // add lattice constant(a.u.) -LATTICE_VECTORS -1 0 0 -0 1 0 -0 0 1 -ATOMIC_POSITIONS -Cartesian_angstrom //Cartesian or Direct coordinate. -N //Element Label -0.0 //starting magnetism -2 //number of atoms -0.0 0.0 0.0 0 0 0 // crystal coor. -0.0 0.0 3.0 0 0 0 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/INPUT b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/INPUT deleted file mode 100644 index e679976f94..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/INPUT +++ /dev/null @@ -1,85 +0,0 @@ - -1 // if or not calculate the spillage. 1/0 -0 // restart or not. 1/0 -1 // if or not output the file. 1/0 -5 // number of structures. -../N-6-1.0.20.dat -../N-6-1.1.20.dat -../N-6-1.5.20.dat -../N-6-2.0.20.dat -../N-6-3.0.20.dat - - - -1 //number of k points -1 // number of pools - - - -100 - - - -2 - - - -1.0e-4 // Start temparature for spillage -0.8 // Cooling rate -20 // Number of temperatures(spillage) -500 // Number of steps per temparature - -1.0e-2 // start temperature for kinetic energy -0.8 // Cooling rate -15 // Number of temperatures(kinetical) -500 // Number of steps per temparature - -0.01 // Delta kappa -50 // Selectly output information - -100 // Acceptance_steps -0.4 // Acceptance_high -0.2 // Acceptance_low - -100 // Max kinetic energy(Rydberg). -0.01 // 'dr' for kinetic minimized. -1 // 1: Kin 2: Ecut - - - - -1 // to control the number of bands.(Yes1/No0) -1 // int, the start band index(>0). -5 // int, the ed band index( - -2 // Number of levels. -label / na / skip / lmax / each L / -07 2 new 1 1 1 -07 2 new 2 1 1 1 - - -0.01 //dr(a.u.) of uniform mesh. Attention!!dr will affect kinetic energy minmized largely. --6 //xmin -1 //zed, chosen as valence charge. -0.01 //dx -6.0 //xmax - - - -0 -2 -./FILE/Si-S.ORBITAL -0 -./FILE/Si-P.ORBITAL -1 - - - -0 // 'yes' to do this. -14.0 // rcut, only useful for test program -0.01 // dr, for simpson integral -2 // test eigenvalue index -2 // lmax - - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_ECUT.txt b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_ECUT.txt deleted file mode 100644 index 7e6cd30872..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_ECUT.txt +++ /dev/null @@ -1,40 +0,0 @@ -WaveFunctionIndex=0 -T=0 L=0 N=0 -Psi(r) norm=1 -Psi(k) norm=0.999999782881 -Ecut(Ry)(norm>0.9900)=9.9458 -Ecut(Ry)(norm>0.9990)=25.205 -Ecut(Ry)(norm>0.9999)=56.3922 - -WaveFunctionIndex=1 -T=0 L=0 N=1 -Psi(r) norm=1 -Psi(k) norm=0.999989795187 -Ecut(Ry)(norm>0.9900)=14.9058 -Ecut(Ry)(norm>0.9990)=48.6098 -Ecut(Ry)(norm>0.9999)=119.5058 - -WaveFunctionIndex=2 -T=0 L=1 N=0 -Psi(r) norm=1 -Psi(k) norm=0.999998837269 -Ecut(Ry)(norm>0.9900)=43.245 -Ecut(Ry)(norm>0.9990)=73.6898 -Ecut(Ry)(norm>0.9999)=100.5362 - -WaveFunctionIndex=3 -T=0 L=1 N=1 -Psi(r) norm=1 -Psi(k) norm=0.999970231609 -Ecut(Ry)(norm>0.9900)=43.6178 -Ecut(Ry)(norm>0.9990)=85.2818 -Ecut(Ry)(norm>0.9999)=245.0898 - -WaveFunctionIndex=4 -T=0 L=2 N=0 -Psi(r) norm=1 -Psi(k) norm=0.99999991021 -Ecut(Ry)(norm>0.9900)=29.3378 -Ecut(Ry)(norm>0.9990)=39.2498 -Ecut(Ry)(norm>0.9999)=90.0482 - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_KINETIC.txt b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_KINETIC.txt deleted file mode 100644 index 367a8e01e1..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_KINETIC.txt +++ /dev/null @@ -1,81 +0,0 @@ - -Type=1 L=0 N=1 - nq Coefficient Eigen(Ry) Kinetic_Energy - 0 0.1999257021 0.2741556778 0.3729652745 (Rydberg) - 1 0.3751982321 1.0966227112 2.7642403305 (Rydberg) - 2 0.3432468744 2.4674011003 3.5304040380 (Rydberg) - 3 0.2073591969 4.3864908449 1.7327165049 (Rydberg) - 4 0.0931472419 6.8538919452 0.4393041607 (Rydberg) - 5 0.0083973628 9.8696044011 0.0042991179 (Rydberg) - 6 -0.0297123833 13.4336282126 0.0629471137 (Rydberg) - 7 -0.0516185574 17.5459633797 0.2175198693 (Rydberg) - 8 -0.0382587902 22.2066099025 0.1346230553 (Rydberg) - 9 -0.0372573067 27.4155677808 0.1420138674 (Rydberg) - 10 -0.0172176072 33.1728370148 0.0333925432 (Rydberg) - 11 -0.0103250414 39.4784176044 0.0131102812 (Rydberg) - 12 0.0026804530 46.3323095496 0.0009578357 (Rydberg) - Total kinetic energy = 9.448494 -Type=1 L=0 N=2 - nq Coefficient Eigen(Ry) Kinetic_Energy - 0 -0.1702497983 0.2741556778 0.2704608137 (Rydberg) - 1 0.2534448310 1.0966227112 1.2613078798 (Rydberg) - 2 0.4888213204 2.4674011003 7.1599750417 (Rydberg) - 3 0.5222909302 4.3864908449 10.9927379792 (Rydberg) - 4 0.2303528994 6.8538919452 2.6866598328 (Rydberg) - 5 0.0620139329 9.8696044011 0.2344617885 (Rydberg) - 6 -0.1163669901 13.4336282126 0.9655181584 (Rydberg) - 7 -0.0859112414 17.5459633797 0.6025418209 (Rydberg) - 8 -0.0985168655 22.2066099025 0.8926437058 (Rydberg) - 9 -0.0426973954 27.4155677808 0.1865136443 (Rydberg) - 10 -0.0428123662 33.1728370148 0.2064630638 (Rydberg) - 11 0.0018740871 39.4784176044 0.0004319246 (Rydberg) - 12 -0.0084670389 46.3323095496 0.0095573551 (Rydberg) - Total kinetic energy = 25.469273 -Type=1 L=1 N=1 - nq Coefficient Eigen(Ry) Kinetic_Energy - 0 0.2164573822 0.5608535710 0.1823044396 (Rydberg) - 1 0.4057926751 1.6577643318 1.2230981466 (Rydberg) - 2 0.4861068166 3.3027741434 2.5785150375 (Rydberg) - 3 0.4610084700 5.4960503109 3.0559555815 (Rydberg) - 4 0.4348967984 8.2376225593 3.3738081306 (Rydberg) - 5 0.3597307410 11.5274995628 2.7554285473 (Rydberg) - 6 0.3151565858 15.3656846066 2.4577729551 (Rydberg) - 7 0.2482453379 19.7521791593 1.7375780566 (Rydberg) - 8 0.2060286651 24.6869839575 1.3432642193 (Rydberg) - 9 0.1438652547 30.1700994040 0.7263414985 (Rydberg) - 10 0.1212418394 36.2015257342 0.5665469305 (Rydberg) - 11 0.0684532379 42.7812630931 0.1967551594 (Rydberg) - 12 0.0553649958 49.9093115739 0.1392755624 (Rydberg) - Total kinetic energy = 20.336644 -Type=1 L=1 N=2 - nq Coefficient Eigen(Ry) Kinetic_Energy - 0 -0.3763905304 0.5608535710 0.5512261576 (Rydberg) - 1 -0.0888280438 1.6577643318 0.0586074867 (Rydberg) - 2 0.1302521048 3.3027741434 0.1851295502 (Rydberg) - 3 0.4325781938 5.4960503109 2.6906578410 (Rydberg) - 4 0.3949252540 8.2376225593 2.7821322575 (Rydberg) - 5 0.4671645398 11.5274995628 4.6470119505 (Rydberg) - 6 0.2754001683 15.3656846066 1.8767973849 (Rydberg) - 7 0.2885824014 19.7521791593 2.3481282166 (Rydberg) - 8 0.1505796194 24.6869839575 0.7175274811 (Rydberg) - 9 0.1931202686 30.1700994040 1.3088344972 (Rydberg) - 10 0.0634761902 36.2015257342 0.1552932442 (Rydberg) - 11 0.0871485093 42.7812630931 0.3189026032 (Rydberg) - 12 -0.0091213667 49.9093115739 0.0037802821 (Rydberg) - Total kinetic energy = 17.644029 -Type=1 L=2 N=1 - nq Coefficient Eigen(Ry) Kinetic_Energy - 0 0.2785034840 0.9227072754 0.2120066356 (Rydberg) - 1 0.5400231772 2.2977564195 1.4381202299 (Rydberg) - 2 0.5488705668 4.2181909490 2.1262000543 (Rydberg) - 3 0.5010634435 6.6861918496 2.2994761176 (Rydberg) - 4 0.4158007439 9.7022244414 1.9447098442 (Rydberg) - 5 0.3185822021 13.2664394039 1.3530246041 (Rydberg) - 6 0.1814579245 17.3788978899 0.5073962301 (Rydberg) - 7 0.0638373509 22.0396286238 0.0712584183 (Rydberg) - 8 0.0196008810 27.2486465715 0.0075148838 (Rydberg) - 9 -0.0055101245 33.0059601610 0.0006568109 (Rydberg) - 10 -0.0073862428 39.3115744362 0.0012932630 (Rydberg) - 11 -0.0419052885 46.1654925666 0.0452643366 (Rydberg) - 12 -0.0154503452 53.5677166258 0.0066473916 (Rydberg) - Total kinetic energy = 10.013569 \ No newline at end of file diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_RESULTS.txt b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_RESULTS.txt deleted file mode 100644 index a9c0f98b4b..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/ORBITAL_RESULTS.txt +++ /dev/null @@ -1,120 +0,0 @@ - - - AUTHOR : Mohan Chen - StartDate : 2009-4-01 - LastModify: 2012-6-27 - LOCATION : LQCC, Hefei, China - EMAIL : mohan@mail.ustc.edu.cn - Description : Calculate the coefficients C4 of f(r) in Spherical Bessel Basis J(qr). - Formula : C4 = integral(r)[ f(r)*jl(qr)*r^{2} ]dr - P.S. : We default consider f(r) read from file is in the form : ( f(r) * r ). - - - - 50 Energy cutoff(Hartree.). - 6 rcut (a.u.) - 13 eigenvalue number( sqrt(ecut*2)*rcut/PI ). - 1e-12 tolerence to calculate eigenvalue. - 1 Number of atom types. - N Atom Label. - 2 Number of atoms. - 1 start band index. - 5 ended band index. - - - - 5 kinds of structures. -Average Spillage Value - 1 7.650351e-03 - 2 8.278485e-04 -StructureIndex 1 - 1 1.506165e-02 - 2 1.055605e-03 -StructureIndex 2 - 1 1.188785e-02 - 2 8.129575e-04 -StructureIndex 3 - 1 4.682161e-03 - 2 5.446124e-04 -StructureIndex 4 - 1 2.776286e-03 - 2 7.192063e-04 -StructureIndex 5 - 1 3.843813e-03 - 2 1.006862e-03 - - - - 0.0001 Start temperature (Kelvin) for spillage minimization. - 0.8 Decreasing rate of temperature. - 20 Number of different temperature (for spillage). - 500 Number of steps for each temperature (for spillage). - 0.01 Start temperature (Kelvin) for kinetical energy minimization. - 0.8 Decreasing rate of temperature. - 15 Number of different temperature (for kinetical). - 500 Number of steps for each temperature (for kineitcal). - - - - 5 Total number of radial orbitals. - Type L Zeta-Orbital - 1 0 1 - 1.999250044317221e-01 3.751969227337711e-01 3.432456765469037e-01 2.073584732609919e-01 - 9.314691687667399e-02 8.397333486846110e-03 -2.971227959854509e-02 -5.161837730564619e-02 - -3.825865671040287e-02 -3.725717664915303e-02 -1.721754715716488e-02 -1.032500537125548e-02 - 2.680443619439835e-03 - Type L Zeta-Orbital - 1 0 2 - -1.702201715837411e-01 2.534007267810289e-01 4.887362562363810e-01 5.222000416077341e-01 - 2.303128136068122e-01 6.200314129285323e-02 -1.163467400337028e-01 -8.589629116750186e-02 - -9.849972164762605e-02 -4.268996523281798e-02 -4.280491608417234e-02 1.873760994926852e-03 - -8.465565474560767e-03 - Type L Zeta-Orbital - 1 1 1 - 2.164535445775128e-01 4.057854806094318e-01 4.860981982244601e-01 4.610002966249457e-01 - 4.348890879607927e-01 3.597243631643592e-01 3.151509983240102e-01 2.482409366723193e-01 - 2.060250123843398e-01 1.438627040954304e-01 1.212396898433255e-01 6.845202427155371e-02 - 5.536401417985657e-02 - Type L Zeta-Orbital - 1 1 2 - -3.762037711323521e-01 -8.878396866870972e-02 1.301874756443146e-01 4.323635550163406e-01 - 3.947292980338761e-01 4.669327397849226e-01 2.752635189166638e-01 2.884392112197917e-01 - 1.505049040360807e-01 1.930244452517024e-01 6.344469423490053e-02 8.710526756514543e-02 - -9.116840805608572e-03 - Type L Zeta-Orbital - 1 2 1 - 2.785031543681187e-01 5.400225379952365e-01 5.488699171620391e-01 5.010628504779375e-01 - 4.158002517627723e-01 3.185818250191300e-01 1.814577097580852e-01 6.383727531458160e-02 - 1.960085784964030e-02 -5.510117995398617e-03 -7.386234028268464e-03 -4.190523892239696e-02 - -1.545032687222988e-02 - - - - 2 Total number of orbitals optimized levels. -Bands start from 0 -Bands ended at 5 -Optimized bands number 5 -Spillage per band is 2.000000000000000e-01 - -Fill Left Hilbert space of each band(average) by LCAO for Level 1 -BANDS New Fill Total Fill Left Spillage - 1 1.9779943263e-01 1.9779943263e-01 2.2005673718e-03 - 2 1.9946785652e-01 1.9946785652e-01 5.3214348069e-04 - 3 1.9863039476e-01 1.9863039476e-01 1.3696052437e-03 - 4 1.9911764330e-01 1.9911764330e-01 8.8235670366e-04 - 5 1.9733432171e-01 1.9733432171e-01 2.6656782927e-03 -New Fill Contribution = 9.9234964891e-01 -Total Fill Contribution = 9.9234964891e-01 -Left spillage = 7.6503510925e-03 - -Fill Left Hilbert space of each band(average) by LCAO for Level 2 -BANDS New Fill Total Fill Left Spillage - 1 2.0431561108e-03 1.9984258874e-01 1.5741126105e-04 - 2 4.7700392608e-04 1.9994486045e-01 5.5139554606e-05 - 3 1.2339426427e-03 1.9986433740e-01 1.3566260096e-04 - 4 6.9334367966e-04 1.9981098698e-01 1.8901302400e-04 - 5 2.3750561983e-03 1.9970937791e-01 2.9062209440e-04 -New Fill Contribution = 6.8225025575e-03 -Total Fill Contribution = 9.9917215146e-01 -Left spillage = 8.2784853502e-04 - \ No newline at end of file diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/running_1.txt b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/running_1.txt deleted file mode 100644 index 63af99fe91..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/6/running_1.txt +++ /dev/null @@ -1,1590 +0,0 @@ - ATTENTION! YOU SELECT THE BANDS: - BANDS_START=1 BANDS_END=5 - ATTENTION! YOU SELECT BLOCK_NE=100 - ALSO BLOCK_NE_MIN=-10000 - [STRNUM] = 5 - [FILE] = ../N-6-1.0.20.dat - [LAT0] = 20 - [a1] = 1, 0, 0 - [a2] = 0, 1, 0 - [a3] = 0, 0, 1 - [NTYPE] = 1 - [LABEL] = N - [NA] = 2 - [POS] = 0, 0, 0 - [POS] = 0, 0, 0.0944863 - [ECUT(Ry)] = 50 - [ECUT_JLQ(Ry)] = 50 - [RCUT(Bohr)] = 6 - [SMOOTH] = 1 - [SIGMA] = 0.1 - [TOLERENCE] = 1e-12 - [LMAXALL] = 2 - [NKSTOT] = 1 - [NBANDS] = 8 - [NWFCALL] = 18 - [NE] = 13 - [FILE] = ../N-6-1.1.20.dat - [FILE] = ../N-6-1.5.20.dat - [FILE] = ../N-6-2.0.20.dat - [FILE] = ../N-6-3.0.20.dat - [NKS] = 1 - Kx/Ky/Kz/Kweight - 0 0 0 1 - NKS=1 - DIMENSION OF Q= - [NKS] = 1 - [NBANDS] = 8 - [NWFCALL] = 18 - [NE] = 13 - USE Q and S matrix - Kx/Ky/Kz/Kweight - 0 0 0 1 - NKS=1 - DIMENSION OF Q= - [NKS] = 1 - [NBANDS] = 8 - [NWFCALL] = 18 - [NE] = 13 - USE Q and S matrix - Kx/Ky/Kz/Kweight - 0 0 0 1 - NKS=1 - DIMENSION OF Q= - [NKS] = 1 - [NBANDS] = 8 - [NWFCALL] = 18 - [NE] = 13 - USE Q and S matrix - Kx/Ky/Kz/Kweight - 0 0 0 1 - NKS=1 - DIMENSION OF Q= - [NKS] = 1 - [NBANDS] = 8 - [NWFCALL] = 18 - [NE] = 13 - USE Q and S matrix - Kx/Ky/Kz/Kweight - 0 0 0 1 - NKS=1 - DIMENSION OF Q= - [NKS] = 1 - [NBANDS] = 8 - [NWFCALL] = 18 - [NE] = 13 - USE Q and S matrix - [nlevel] = 2 - - >>>>> Level=1 - id=7 na=2 lmax=1 - L=0 Zeta=1 fain(FULL/AVERAGE)=f start_n(0)=1 - L=1 Zeta=1 fain(FULL/AVERAGE)=f start_n(1)=1 - - >>>>> Level=2 - id=7 na=2 lmax=2 - L=0 Zeta=1 fain(FULL/AVERAGE)=f start_n(0)=2 - L=1 Zeta=1 fain(FULL/AVERAGE)=f start_n(1)=2 - L=2 Zeta=1 fain(FULL/AVERAGE)=f start_n(2)=1 - Type=1 L=0 Zeta=2 - Type=1 L=1 Zeta=2 - Type=1 L=2 Zeta=1 - N Zeta(including all atom species) = 5 - [ntype] = 1 - [lmax] = 2 - [nmax] = 2 - [ecut(Ry)] = 50 - [ecut_jlq(Ry)] = 50 - [rcut(Bohr)] = 6 - [enumber] = 13 - [enumber_jlq] = 13 - [tolerence] = 1e-12 - - Init C4: T=1 L=0 N=0 - 0.840188 0.394383 0.783099 0.79844 - 0.911647 0.197551 0.335223 0.76823 - 0.277775 0.55397 0.477397 0.628871 - 0.364784 - Init C4: T=1 L=0 N=1 - 0.513401 0.95223 0.916195 0.635712 - 0.717297 0.141603 0.606969 0.0163006 - 0.242887 0.137232 0.804177 0.156679 - 0.400944 - Init C4: T=1 L=1 N=0 - 0.12979 0.108809 0.998925 0.218257 - 0.512932 0.839112 0.61264 0.296032 - 0.637552 0.524287 0.493583 0.972775 - 0.292517 - Init C4: T=1 L=1 N=1 - 0.771358 0.526745 0.769914 0.400229 - 0.891529 0.283315 0.352458 0.807725 - 0.919026 0.0697553 0.949327 0.525995 - 0.0860558 - Init C4: T=1 L=2 N=0 - 0.192214 0.663227 0.890233 0.348893 - 0.0641713 0.020023 0.457702 0.0630958 - 0.23828 0.970634 0.902208 0.85092 - 0.266666 - Init C4: T=1 L=2 N=1 - 0.53976 0.375207 0.760249 0.512535 - 0.667724 0.531606 0.0392803 0.437638 - 0.931835 0.93081 0.720952 0.284293 - 0.738534 - Coefficients init done. - - begin read in Metropolis parameter. - - Metropolis init done. - - - =================================================== - level = 1 - =================================================== - - ---> SpillageTemp 1 - Temperature 0.0001 -STEPS SPILLAGE UPDATES - 1 0.3309946985 14 - 51 0.0087771406 19 - 101 0.0079490573 4 - 151 0.0090947695 10 - 201 0.0088332778 8 - 251 0.0089455489 13 - 301 0.0082376656 9 - 351 0.0083162101 8 - 401 0.0087117832 4 - 451 0.0082860137 12 - - ---> SpillageTemp 2 - Temperature 0.0000800000 -STEPS SPILLAGE UPDATES - 1 0.0082743277 4 - 51 0.0082003508 5 - 101 0.0084675255 9 - 151 0.0087625449 13 - 201 0.0081672612 6 - 251 0.0084199079 9 - 301 0.0082258407 5 - 351 0.0085253923 10 - 401 0.0085717830 10 - 451 0.0082892537 10 - - ---> SpillageTemp 3 - Temperature 0.0000640000 -STEPS SPILLAGE UPDATES - 1 0.0089643731 6 - 51 0.0082668436 9 - 101 0.0081673141 4 - 151 0.0081949380 7 - 201 0.0082183903 8 - 251 0.0081050102 7 - 301 0.0081340003 10 - 351 0.0079467388 7 - 401 0.0082222252 6 - 451 0.0080419315 5 - - ---> SpillageTemp 4 - Temperature 0.0000512000 -STEPS SPILLAGE UPDATES - 1 0.0080441720 6 - 51 0.0081048826 6 - 101 0.0084264015 8 - 151 0.0085138686 7 - 201 0.0078628474 6 - 251 0.0081037349 7 - 301 0.0080416538 8 - 351 0.0080321831 8 - 401 0.0081018412 8 - 451 0.0080313583 9 - - ---> SpillageTemp 5 - Temperature 0.0000409600 -STEPS SPILLAGE UPDATES - 1 0.0083568548 6 - 51 0.0079922470 7 - 101 0.0082780765 10 - 151 0.0079784420 9 - 201 0.0078877744 4 - 251 0.0080886601 9 - 301 0.0079044038 6 - 351 0.0081096348 6 - 401 0.0079948955 5 - 451 0.0084156832 10 - - ---> SpillageTemp 6 - Temperature 0.0000327680 -STEPS SPILLAGE UPDATES - 1 0.0080916426 4 - 51 0.0078989783 7 - 101 0.0080734892 5 - 151 0.0078119924 8 - 201 0.0078936969 7 - 251 0.0078943541 6 - 301 0.0079151761 3 - 351 0.0078459608 5 - 401 0.0081016012 9 - 451 0.0079922860 9 - - ---> SpillageTemp 7 - Temperature 0.0000262144 -STEPS SPILLAGE UPDATES - 1 0.0079587536 6 - 51 0.0077087018 5 - 101 0.0078779753 7 - 151 0.0077492502 10 - 201 0.0077557969 10 - 251 0.0077928864 8 - 301 0.0077980258 4 - 351 0.0077009098 7 - 401 0.0078339608 3 - 451 0.0079451743 10 - - ---> SpillageTemp 8 - Temperature 0.0000209715 -STEPS SPILLAGE UPDATES - 1 0.0078608908 9 - 51 0.0077354661 10 - 101 0.0079076298 7 - 151 0.0077017768 9 - 201 0.0078336689 7 - 251 0.0078069575 12 - 301 0.0078242767 8 - 351 0.0077138677 9 - 401 0.0077583423 8 - 451 0.0076866744 9 - - ---> SpillageTemp 9 - Temperature 0.0000167772 -STEPS SPILLAGE UPDATES - 1 0.0078694650 5 - 51 0.0076879612 3 - 101 0.0077934113 5 - 151 0.0078380508 10 - 201 0.0077046334 7 - 251 0.0077466466 8 - 301 0.0077468168 5 - 351 0.0078148585 5 - 401 0.0078381559 5 - 451 0.0078264111 8 - - ---> SpillageTemp 10 - Temperature 0.0000134218 -STEPS SPILLAGE UPDATES - 1 0.0077933037 5 - 51 0.0077006941 9 - 101 0.0077451908 6 - 151 0.0076869368 8 - 201 0.0076934570 9 - 251 0.0076805353 6 - 301 0.0077057731 3 - 351 0.0076708507 6 - 401 0.0076458727 5 - 451 0.0077264179 5 - - ---> SpillageTemp 11 - Temperature 0.0000107374 -STEPS SPILLAGE UPDATES - 1 0.0077486213 10 - 51 0.0076837475 8 - 101 0.0077174539 6 - 151 0.0076870113 6 - 201 0.0076746707 10 - 251 0.0076104973 4 - 301 0.0076532889 7 - 351 0.0076615281 8 - 401 0.0077179601 9 - 451 0.0076610017 7 - - ---> SpillageTemp 12 - Temperature 0.0000085899 -STEPS SPILLAGE UPDATES - 1 0.0076488318 5 - 51 0.0076541182 7 - 101 0.0076569555 7 - 151 0.0076227848 7 - 201 0.0076609131 13 - 251 0.0077068434 8 - 301 0.0076521429 7 - 351 0.0076357749 8 - 401 0.0076954904 11 - 451 0.0076330031 8 - - ---> SpillageTemp 13 - Temperature 0.0000068719 -STEPS SPILLAGE UPDATES - 1 0.0077120681 10 - 51 0.0076496318 6 - 101 0.0076151178 5 - 151 0.0076287363 9 - 201 0.0076440469 11 - 251 0.0076145779 5 - 301 0.0076393483 9 - 351 0.0076405271 9 - 401 0.0076857903 7 - 451 0.0076330561 10 - - ---> SpillageTemp 14 - Temperature 0.0000054976 -STEPS SPILLAGE UPDATES - 1 0.0076155824 7 - 51 0.0075981623 6 - 101 0.0076199160 11 - 151 0.0076072979 7 - 201 0.0076717832 8 - 251 0.0076065015 8 - 301 0.0075974778 9 - 351 0.0076516951 5 - 401 0.0076182869 6 - 451 0.0076318834 8 - - ---> SpillageTemp 15 - Temperature 0.0000043980 -STEPS SPILLAGE UPDATES - 1 0.0075964429 5 - 51 0.0076067077 7 - 101 0.0075957240 7 - 151 0.0075961912 7 - 201 0.0075962745 8 - 251 0.0076089490 9 - 301 0.0076158752 6 - 351 0.0076374719 9 - 401 0.0076222606 5 - 451 0.0076344774 6 - - ---> SpillageTemp 16 - Temperature 0.0000035184 -STEPS SPILLAGE UPDATES - 1 0.0076101769 5 - 51 0.0075855373 5 - 101 0.0076087578 5 - 151 0.0076147639 10 - 201 0.0076180043 9 - 251 0.0075875422 8 - 301 0.0075864171 4 - 351 0.0075983651 2 - 401 0.0076034855 5 - 451 0.0075916968 8 - - ---> SpillageTemp 17 - Temperature 0.0000028147 -STEPS SPILLAGE UPDATES - 1 0.0075974192 6 - 51 0.0075791386 5 - 101 0.0075928657 4 - 151 0.0075979190 7 - 201 0.0075922844 10 - 251 0.0075847793 11 - 301 0.0076024569 10 - 351 0.0075939144 9 - 401 0.0075808603 7 - 451 0.0075744180 10 - - ---> SpillageTemp 18 - Temperature 0.0000022518 -STEPS SPILLAGE UPDATES - 1 0.0075858718 5 - 51 0.0076061658 6 - 101 0.0075949507 9 - 151 0.0075797949 8 - 201 0.0075722436 8 - 251 0.0075884769 11 - 301 0.0075844114 8 - 351 0.0075942629 8 - 401 0.0075797609 8 - 451 0.0075894255 6 - - ---> SpillageTemp 19 - Temperature 0.0000018014 -STEPS SPILLAGE UPDATES - 1 0.0075856143 5 - 51 0.0075662509 8 - 101 0.0075849928 8 - 151 0.0075875231 9 - 201 0.0075669101 7 - 251 0.0075722579 9 - 301 0.0075758916 8 - 351 0.0075745658 9 - 401 0.0075774396 12 - 451 0.0075826563 10 - - ---> SpillageTemp 20 - Temperature 0.0000014412 -STEPS SPILLAGE UPDATES - 1 0.0075870448 6 - 51 0.0075747612 3 - 101 0.0075788916 10 - 151 0.0075722285 9 - 201 0.0075812008 7 - 251 0.0075791597 9 - 301 0.0075778654 7 - 351 0.0075739285 5 - 401 0.0075728669 6 - 451 0.0075716282 3 - - - Spillage at final temperature 0.0075761909 - Orbital 1 Initial E_kin 9.8435207212 - Orbital 2 Initial E_kin 17.6546055056 - 1s 0.0984 9.62763578 - 1p 0.177 17.63932956 - Notice: Change temperature of orbital 1 to 0.1738461571 - Notice: Change temperature of orbital 2 to 0.1738461571 - 51s 0.174 10.0582196 - 51p 0.174 17.34811765 - 101s 0.174 9.811089715 - 101p 0.174 17.11998766 - 151s 0.174 9.463845523 - 151p 0.174 17.08429263 - 201s 0.174 9.770056132 - 201p 0.174 17.1098172 - 251s 0.174 9.93977316 - 251p 0.174 17.27965214 - 301s 0.174 10.05687602 - 301p 0.174 17.30764581 - 351s 0.174 9.894898348 - 351p 0.174 17.23648344 - 401s 0.174 9.598292088 - 401p 0.174 17.36304886 - 451s 0.174 9.677738709 - 451p 0.174 17.44106461 - Temperature for orbital 1 = 0.139077 - Temperature for orbital 2 = 0.139077 - new kappa=1.01 - 1s 0.139 10.0105606 - 1p 0.139 17.79737082 - 51s 0.139 9.905800361 - 51p 0.139 17.42935556 - 101s 0.139 9.925029777 - 101p 0.139 17.15700595 - 151s 0.139 9.847855869 - 151p 0.139 17.46322202 - 201s 0.139 10.08731215 - 201p 0.139 17.15092773 - 251s 0.139 9.999744035 - 251p 0.139 17.11278982 - 301s 0.139 9.935782163 - 301p 0.139 17.21477136 - 351s 0.139 9.888885453 - 351p 0.139 17.40023143 - 401s 0.139 9.753547881 - 401p 0.139 17.41330777 - 451s 0.139 9.689487666 - 451p 0.139 17.04027621 - Temperature for orbital 1 = 0.111262 - Temperature for orbital 2 = 0.111262 - new kappa=1.01 - 1s 0.111 9.679046689 - 1p 0.111 17.20591209 - 51s 0.111 9.651772782 - 51p 0.111 17.42544761 - 101s 0.111 9.763936005 - 101p 0.111 17.01446582 - 151s 0.111 9.539872161 - 151p 0.111 17.23115944 - 201s 0.111 9.840367612 - 201p 0.111 17.15494505 - 251s 0.111 9.636225842 - 251p 0.111 17.47978738 - 301s 0.111 10.07554947 - 301p 0.111 16.99336997 - 351s 0.111 9.953302536 - 351p 0.111 17.20002945 - 401s 0.111 9.726317179 - 401p 0.111 17.41834135 - 451s 0.111 9.943599024 - 451p 0.111 17.27025359 - Temperature for orbital 1 = 0.0890092 - Temperature for orbital 2 = 0.0890092 - new kappa=1.01 - 1s 0.089 9.920501966 - 1p 0.089 17.25726278 - 51s 0.089 9.583347778 - 51p 0.089 17.20781897 - 101s 0.089 10.15397339 - 101p 0.089 17.06205039 - 151s 0.089 9.572306038 - 151p 0.089 17.19537893 - 201s 0.089 9.536663095 - 201p 0.089 17.07805797 - 251s 0.089 9.749936689 - 251p 0.089 17.19640066 - 301s 0.089 9.970329423 - 301p 0.089 17.161427 - 351s 0.089 9.957074449 - 351p 0.089 17.31961471 - 401s 0.089 9.734376491 - 401p 0.089 17.2794045 - 451s 0.089 9.740099482 - 451p 0.089 17.23890656 - Temperature for orbital 1 = 0.0712074 - Temperature for orbital 2 = 0.0712074 - new kappa=1.01 - 1s 0.0712 9.784002886 - 1p 0.0712 17.17792283 - 51s 0.0712 9.643212279 - 51p 0.0712 17.1347901 - 101s 0.0712 9.58593599 - 101p 0.0712 17.19716661 - 151s 0.0712 9.747992074 - 151p 0.0712 17.08222068 - 201s 0.0712 9.546969309 - 201p 0.0712 17.16290059 - 251s 0.0712 9.708067711 - 251p 0.0712 17.08906273 - 301s 0.0712 9.734363455 - 301p 0.0712 17.14218551 - 351s 0.0712 9.662233648 - 351p 0.0712 17.30034655 - 401s 0.0712 9.807777146 - 401p 0.0712 16.84869896 - 451s 0.0712 9.64402337 - 451p 0.0712 17.0374737 - Temperature for orbital 1 = 0.0569659 - Temperature for orbital 2 = 0.0569659 - new kappa=1.01 - 1s 0.057 9.834600102 - 1p 0.057 17.2131919 - 51s 0.057 9.629814218 - 51p 0.057 17.13800513 - 101s 0.057 9.647632576 - 101p 0.057 17.01720585 - 151s 0.057 9.642003111 - 151p 0.057 17.33321222 - 201s 0.057 9.671393942 - 201p 0.057 17.18354721 - 251s 0.057 9.867637406 - 251p 0.057 16.96792687 - 301s 0.057 9.849664911 - 301p 0.057 17.14470365 - 351s 0.057 9.418379478 - 351p 0.057 16.91680824 - 401s 0.057 9.744983431 - 401p 0.057 16.89554671 - 451s 0.057 9.724034909 - 451p 0.057 17.21255366 - Temperature for orbital 1 = 0.0455727 - Temperature for orbital 2 = 0.0455727 - new kappa=1.01 - 1s 0.0456 9.565760965 - 1p 0.0456 17.08055032 - 51s 0.0456 9.629226141 - 51p 0.0456 16.86919778 - 101s 0.0456 9.604563547 - 101p 0.0456 17.01729434 - 151s 0.0456 9.694677988 - 151p 0.0456 16.94287911 - 201s 0.0456 9.647800799 - 201p 0.0456 17.04031903 - 251s 0.0456 9.611660354 - 251p 0.0456 17.04051827 - 301s 0.0456 9.639695397 - 301p 0.0456 17.03316364 - 351s 0.0456 9.549683972 - 351p 0.0456 17.08032493 - 401s 0.0456 9.54576593 - 401p 0.0456 17.01159541 - 451s 0.0456 9.610342393 - 451p 0.0456 16.9343174 - Temperature for orbital 1 = 0.0364582 - Temperature for orbital 2 = 0.0364582 - new kappa=1.01 - 1s 0.0365 9.861430164 - 1p 0.0365 16.89159396 - 51s 0.0365 9.52217601 - 51p 0.0365 16.90950644 - 101s 0.0365 9.547805279 - 101p 0.0365 16.90306704 - 151s 0.0365 9.805034809 - 151p 0.0365 16.78256165 - 201s 0.0365 9.500556838 - 201p 0.0365 17.11523304 - 251s 0.0365 9.565687068 - 251p 0.0365 16.93114693 - 301s 0.0365 9.658022594 - 301p 0.0365 16.92043902 - 351s 0.0365 9.61020314 - 351p 0.0365 16.98445956 - 401s 0.0365 9.458837287 - 401p 0.0365 16.98282707 - 451s 0.0365 9.434558787 - 451p 0.0365 17.16768164 - Temperature for orbital 1 = 0.0291665 - Temperature for orbital 2 = 0.0291665 - new kappa=1.01 - 1s 0.0292 9.512761281 - 1p 0.0292 16.92056063 - 51s 0.0292 9.467852669 - 51p 0.0292 16.92805158 - 101s 0.0292 9.551641312 - 101p 0.0292 17.02268577 - 151s 0.0292 9.709907727 - 151p 0.0292 17.16597815 - 201s 0.0292 9.66072488 - 201p 0.0292 17.05208656 - 251s 0.0292 9.532296179 - 251p 0.0292 17.00950151 - 301s 0.0292 9.647933197 - 301p 0.0292 16.82801448 - 351s 0.0292 9.511923235 - 351p 0.0292 16.93603789 - 401s 0.0292 9.67754883 - 401p 0.0292 16.78934272 - 451s 0.0292 9.743569186 - 451p 0.0292 16.7633208 - Temperature for orbital 1 = 0.0233332 - Temperature for orbital 2 = 0.0233332 - new kappa=1.01 - 1s 0.0233 9.515123717 - 1p 0.0233 16.90343066 - 51s 0.0233 9.43352984 - 51p 0.0233 17.02839821 - 101s 0.0233 9.466108596 - 101p 0.0233 16.93211244 - 151s 0.0233 9.483058925 - 151p 0.0233 16.9682902 - 201s 0.0233 9.6221229 - 201p 0.0233 16.91400569 - 251s 0.0233 9.562249819 - 251p 0.0233 16.92121283 - 301s 0.0233 9.411474168 - 301p 0.0233 17.0113801 - 351s 0.0233 9.583135183 - 351p 0.0233 16.84773297 - 401s 0.0233 9.598621216 - 401p 0.0233 16.87217044 - 451s 0.0233 9.582863528 - 451p 0.0233 16.93248206 - Temperature for orbital 1 = 0.0186666 - Temperature for orbital 2 = 0.0186666 - new kappa=1.01 - 1s 0.0187 9.591135583 - 1p 0.0187 16.81487345 - 51s 0.0187 9.626000321 - 51p 0.0187 16.81447038 - 101s 0.0187 9.578701569 - 101p 0.0187 16.85546997 - 151s 0.0187 9.509148684 - 151p 0.0187 16.8709893 - 201s 0.0187 9.46437926 - 201p 0.0187 16.85493996 - 251s 0.0187 9.505397893 - 251p 0.0187 16.91521117 - 301s 0.0187 9.497431442 - 301p 0.0187 16.85053838 - 351s 0.0187 9.687827241 - 351p 0.0187 16.73218911 - 401s 0.0187 9.570387949 - 401p 0.0187 16.82370518 - 451s 0.0187 9.579018975 - 451p 0.0187 16.82044646 - Temperature for orbital 1 = 0.0149333 - Temperature for orbital 2 = 0.0149333 - new kappa=1.01 - 1s 0.0149 9.470588761 - 1p 0.0149 16.97780582 - 51s 0.0149 9.554483964 - 51p 0.0149 16.78387462 - 101s 0.0149 9.510341093 - 101p 0.0149 16.8548797 - 151s 0.0149 9.529134212 - 151p 0.0149 16.79012253 - 201s 0.0149 9.533698645 - 201p 0.0149 16.82985203 - 251s 0.0149 9.546054237 - 251p 0.0149 16.82680756 - 301s 0.0149 9.62935242 - 301p 0.0149 16.7547523 - 351s 0.0149 9.602463331 - 351p 0.0149 16.71889076 - 401s 0.0149 9.521937578 - 401p 0.0149 16.80439454 - 451s 0.0149 9.536978714 - 451p 0.0149 16.78948973 - Temperature for orbital 1 = 0.0119466 - Temperature for orbital 2 = 0.0119466 - new kappa=1.01 - 1s 0.0119 9.649508527 - 1p 0.0119 16.69255941 - 51s 0.0119 9.49071347 - 51p 0.0119 16.78940465 - 101s 0.0119 9.583400967 - 101p 0.0119 16.71654806 - 151s 0.0119 9.526409039 - 151p 0.0119 16.74960102 - 201s 0.0119 9.550596643 - 201p 0.0119 16.78634246 - 251s 0.0119 9.535570512 - 251p 0.0119 16.80657201 - 301s 0.0119 9.455019123 - 301p 0.0119 16.86067353 - 351s 0.0119 9.478687985 - 351p 0.0119 16.85942795 - 401s 0.0119 9.532661894 - 401p 0.0119 16.83899486 - 451s 0.0119 9.481166055 - 451p 0.0119 16.8070209 - Temperature for orbital 1 = 0.00955729 - Temperature for orbital 2 = 0.00955729 - new kappa=1.01 - 1s 0.00956 9.432259571 - 1p 0.00956 16.87014768 - 51s 0.00956 9.476787268 - 51p 0.00956 16.793239 - 101s 0.00956 9.514503427 - 101p 0.00956 16.74494795 - 151s 0.00956 9.557254588 - 151p 0.00956 16.72364963 - 201s 0.00956 9.451746378 - 201p 0.00956 16.93335851 - 251s 0.00956 9.506222556 - 251p 0.00956 16.747587 - 301s 0.00956 9.487040563 - 301p 0.00956 16.80947687 - 351s 0.00956 9.430377133 - 351p 0.00956 16.86391219 - 401s 0.00956 9.555849507 - 401p 0.00956 16.72953763 - 451s 0.00956 9.644253437 - 451p 0.00956 16.72470723 - Temperature for orbital 1 = 0.00764583 - Temperature for orbital 2 = 0.00764583 - new kappa=1.01 - 1s 0.00765 9.521783857 - 1p 0.00765 16.78810332 - 51s 0.00765 9.49792147 - 51p 0.00765 16.77961062 - 101s 0.00765 9.496810829 - 101p 0.00765 16.783224 - 151s 0.00765 9.51157508 - 151p 0.00765 16.72918137 - 201s 0.00765 9.411812314 - 201p 0.00765 16.86089304 - 251s 0.00765 9.433540842 - 251p 0.00765 16.85315641 - 301s 0.00765 9.442319755 - 301p 0.00765 16.82943614 - 351s 0.00765 9.419347576 - 351p 0.00765 16.86269655 - 401s 0.00765 9.467043024 - 401p 0.00765 16.86395374 - 451s 0.00765 9.481151163 - 451p 0.00765 16.77362151 - Temperature for orbital 1 = 0.00611667 - Temperature for orbital 2 = 0.00611667 - new kappa=1.01 - - mkb_information. - - NBANDS=8 STRNUM=5 - - - =================================================== - level = 2 - =================================================== - - Orthogonal....... - - ---> SpillageTemp 1 - Temperature 8e-05 -STEPS SPILLAGE UPDATES - 1 0.004238716431 34 - 51 0.002204185306 38 - 101 0.001891990404 36 - 151 0.001580550269 35 - 201 0.001906721007 36 - 251 0.002503391767 38 - 301 0.001851175854 33 - 351 0.001754102874 35 - 401 0.001666624408 36 - 451 0.001611573559 38 - - ---> SpillageTemp 2 - Temperature 6.4e-05 -STEPS SPILLAGE UPDATES - 1 0.002051734153 18 - 51 0.001349911931 38 - 101 0.001617876721 35 - 151 0.001639503791 38 - 201 0.002036899515 28 - 251 0.001424066012 35 - 301 0.001369776362 33 - 351 0.001752070183 26 - 401 0.001726796595 19 - 451 0.001659588375 35 - - ---> SpillageTemp 3 - Temperature 5.12e-05 -STEPS SPILLAGE UPDATES - 1 0.001733304092 3 - 51 0.00155254319 22 - 101 0.001524533221 25 - 151 0.001716600142 34 - 201 0.00170206917 23 - 251 0.001572685082 34 - 301 0.001617620237 13 - 351 0.001445621465 18 - 401 0.001981655565 16 - 451 0.001667653623 36 - - ---> SpillageTemp 4 - Temperature 4.096e-05 -STEPS SPILLAGE UPDATES - 1 0.001805104273 3 - 51 0.001576287574 33 - 101 0.001290407269 21 - 151 0.001900221698 9 - 201 0.001564577799 32 - 251 0.001651007328 29 - 301 0.001452829383 25 - 351 0.001325638706 25 - 401 0.001858550845 29 - 451 0.001412465727 34 - - ---> SpillageTemp 5 - Temperature 3.2768e-05 -STEPS SPILLAGE UPDATES - 1 0.001728719099 0 - 51 0.001362944332 13 - 101 0.001414898103 9 - 151 0.0014304848 20 - 201 0.00131263858 19 - 251 0.001406024483 28 - 301 0.001514319842 27 - 351 0.001430873474 16 - 401 0.001433519397 24 - 451 0.001331035074 21 - - ---> SpillageTemp 6 - Temperature 2.62144e-05 -STEPS SPILLAGE UPDATES - 1 0.001275467932 4 - 51 0.001222585567 14 - 101 0.001123091743 10 - 151 0.00163451431 30 - 201 0.001105489795 23 - 251 0.0014937024 26 - 301 0.001243217189 27 - 351 0.001222901819 16 - 401 0.001312248413 28 - 451 0.001213965591 31 - - ---> SpillageTemp 7 - Temperature 2.097152e-05 -STEPS SPILLAGE UPDATES - 1 0.001239425769 4 - 51 0.001119722363 22 - 101 0.001203060684 18 - 151 0.001250884617 17 - 201 0.001266762645 27 - 251 0.001095720755 26 - 301 0.001077564162 29 - 351 0.001118345403 21 - 401 0.001230330172 28 - 451 0.00126890155 23 - - ---> SpillageTemp 8 - Temperature 1.6777216e-05 -STEPS SPILLAGE UPDATES - 1 0.00103769447 2 - 51 0.0009583628062 2 - 101 0.0011156847 10 - 151 0.0009934413326 33 - 201 0.001014046697 11 - 251 0.001104512138 13 - 301 0.0010400206 27 - 351 0.001075134583 18 - 401 0.000999797116 30 - 451 0.001105475085 21 - - ---> SpillageTemp 9 - Temperature 1.34217728e-05 -STEPS SPILLAGE UPDATES - 1 0.001050925662 3 - 51 0.0009624363612 23 - 101 0.0009522481368 23 - 151 0.001000534776 20 - 201 0.001001125183 19 - 251 0.001169467789 17 - 301 0.0009975585439 24 - 351 0.001020398162 19 - 401 0.001119673481 22 - 451 0.0009969132873 18 - - ---> SpillageTemp 10 - Temperature 1.073741824e-05 -STEPS SPILLAGE UPDATES - 1 0.001068694762 2 - 51 0.001103118078 19 - 101 0.001021634037 11 - 151 0.0009470125926 13 - 201 0.000925793021 18 - 251 0.0009548300248 19 - 301 0.0009831101995 29 - 351 0.0009581798058 13 - 401 0.0009749601193 26 - 451 0.0009645875099 10 - - ---> SpillageTemp 11 - Temperature 8.589934592e-06 -STEPS SPILLAGE UPDATES - 1 0.0009524029116 2 - 51 0.000963058153 15 - 101 0.0009863365535 11 - 151 0.000946408503 19 - 201 0.000915525914 12 - 251 0.0009463622763 20 - 301 0.0009954613605 17 - 351 0.0009082683608 22 - 401 0.0009284378293 10 - 451 0.0009626635686 22 - - ---> SpillageTemp 12 - Temperature 6.871947674e-06 -STEPS SPILLAGE UPDATES - 1 0.0009421413303 8 - 51 0.0009607826902 17 - 101 0.0009293895704 18 - 151 0.0009198861885 7 - 201 0.0009063273307 14 - 251 0.0009280010497 14 - 301 0.000922448856 23 - 351 0.0009120021357 13 - 401 0.0009457272902 19 - 451 0.0009401100665 13 - - ---> SpillageTemp 13 - Temperature 5.497558139e-06 -STEPS SPILLAGE UPDATES - 1 0.0008669735539 11 - 51 0.0008949974626 14 - 101 0.0008769201076 14 - 151 0.0008600503275 13 - 201 0.0009219562184 13 - 251 0.0009498936802 17 - 301 0.0009059463527 9 - 351 0.0008992085122 21 - 401 0.0009111056941 12 - 451 0.0009169568485 19 - - ---> SpillageTemp 14 - Temperature 4.398046511e-06 -STEPS SPILLAGE UPDATES - 1 0.0009320148336 5 - 51 0.0008882390874 8 - 101 0.0008527759942 10 - 151 0.0008575033318 16 - 201 0.0008565426338 17 - 251 0.0008909604504 20 - 301 0.0008442928776 11 - 351 0.0008927931227 24 - 401 0.0008592225561 15 - 451 0.0008604598681 14 - - ---> SpillageTemp 15 - Temperature 3.518437209e-06 -STEPS SPILLAGE UPDATES - 1 0.0008765026253 7 - 51 0.0008713341999 8 - 101 0.0008693094366 8 - 151 0.0008498218499 19 - 201 0.0008599048656 13 - 251 0.0008981648427 14 - 301 0.0008639679111 12 - 351 0.0008743918421 11 - 401 0.0008689389926 15 - 451 0.0008613184351 20 - - ---> SpillageTemp 16 - Temperature 2.814749767e-06 -STEPS SPILLAGE UPDATES - 1 0.000849530424 12 - 51 0.0008320238305 12 - 101 0.0008623071914 8 - 151 0.0008381675531 12 - 201 0.0008359958721 17 - 251 0.0008352792895 12 - 301 0.000828698949 9 - 351 0.0008469099688 15 - 401 0.0008470376314 12 - 451 0.0008511427712 15 - - ---> SpillageTemp 17 - Temperature 2.251799814e-06 -STEPS SPILLAGE UPDATES - 1 0.000843140494 7 - 51 0.0008539615146 13 - 101 0.0008360171289 16 - 151 0.0008300672533 14 - 201 0.0008374974691 15 - 251 0.0008353180998 16 - 301 0.0008347838497 11 - 351 0.0008341005947 7 - 401 0.0008418331923 15 - 451 0.0008346817951 12 - - ---> SpillageTemp 18 - Temperature 1.801439851e-06 -STEPS SPILLAGE UPDATES - 1 0.0008258687778 9 - 51 0.000826544169 14 - 101 0.0008264790532 7 - 151 0.0008407239161 8 - 201 0.0008365610345 11 - 251 0.0008203240439 9 - 301 0.00082989101 15 - 351 0.0008440721635 19 - 401 0.0008357438115 16 - 451 0.0008284765677 15 - - ---> SpillageTemp 19 - Temperature 1.441151881e-06 -STEPS SPILLAGE UPDATES - 1 0.0008333785162 8 - 51 0.0008238177391 8 - 101 0.0008333537279 16 - 151 0.0008241698516 11 - 201 0.0008311405367 12 - 251 0.0008343828962 11 - 301 0.0008357696759 15 - 351 0.0008274318925 10 - 401 0.0008241296197 12 - 451 0.0008388857211 8 - - ---> SpillageTemp 20 - Temperature 1.152921505e-06 -STEPS SPILLAGE UPDATES - 1 0.0008306048954 7 - 51 0.0008132937463 11 - 101 0.0008161275962 13 - 151 0.0008223109026 15 - 201 0.0008217272149 11 - 251 0.0008264780438 11 - 301 0.0008208276892 22 - 351 0.0008151810134 13 - 401 0.0008224422965 9 - 451 0.0008174043081 14 - - - Spillage at final temperature 0.0008196650601 - Orbital 1 Initial E_kin 39.96517235 - Orbital 2 Initial E_kin 21.51765972 - Orbital 3 Initial E_kin 9.037166729 - 1s 0.4 39.67100824 - 1p 0.215 20.039438 - 1d 0.0904 8.579940544 - Notice: Change temperature of orbital 1 to 0.3067077853 - Notice: Change temperature of orbital 2 to 0.3067077853 - Notice: Change temperature of orbital 3 to 0.3067077853 - 51s 0.307 30.43298678 - 51p 0.307 16.59705916 - 51d 0.307 5.997003923 - 101s 0.307 28.30153988 - 101p 0.307 15.64808848 - 101d 0.307 6.563331645 - 151s 0.307 28.04187425 - 151p 0.307 16.58653822 - 151d 0.307 6.363882516 - 201s 0.307 29.2136826 - 201p 0.307 15.23658843 - 201d 0.307 6.255017622 - 251s 0.307 27.73291149 - 251p 0.307 16.87635511 - 251d 0.307 6.410993283 - 301s 0.307 27.75736843 - 301p 0.307 16.04392269 - 301d 0.307 6.825439488 - 351s 0.307 27.14998937 - 351p 0.307 17.59485769 - 351d 0.307 6.726728974 - 401s 0.307 28.82264849 - 401p 0.307 15.86829501 - 401d 0.307 6.257442163 - 451s 0.307 27.07918977 - 451p 0.307 16.6906881 - 451d 0.307 6.74999379 - Temperature for orbital 1 = 0.245366 - Temperature for orbital 2 = 0.245366 - Temperature for orbital 3 = 0.245366 - new kappa=1.01 - 1s 0.245 28.81606863 - 1p 0.245 16.60063987 - 1d 0.245 6.467118249 - 51s 0.245 27.41715007 - 51p 0.245 15.75530891 - 51d 0.245 6.05322345 - 101s 0.245 29.16387142 - 101p 0.245 15.99173976 - 101d 0.245 6.682903877 - 151s 0.245 27.09895689 - 151p 0.245 16.51111432 - 151d 0.245 7.346237783 - 201s 0.245 26.70940176 - 201p 0.245 16.03132434 - 201d 0.245 6.81145155 - 251s 0.245 26.69606255 - 251p 0.245 15.48024705 - 251d 0.245 7.181162922 - 301s 0.245 27.95483806 - 301p 0.245 17.07888144 - 301d 0.245 6.13872147 - 351s 0.245 28.8624077 - 351p 0.245 16.04585411 - 351d 0.245 7.016546446 - 401s 0.245 27.81777376 - 401p 0.245 16.41402448 - 401d 0.245 7.09982648 - 451s 0.245 26.95335492 - 451p 0.245 17.20095472 - 451d 0.245 6.859765672 - Temperature for orbital 1 = 0.196293 - Temperature for orbital 2 = 0.196293 - Temperature for orbital 3 = 0.196293 - new kappa=1.01 - 1s 0.196 29.14928721 - 1p 0.196 16.83984062 - 1d 0.196 6.871348968 - 51s 0.196 27.5080708 - 51p 0.196 16.12733945 - 51d 0.196 6.388763137 - 101s 0.196 26.08240463 - 101p 0.196 17.04036866 - 101d 0.196 6.468669144 - 151s 0.196 27.38353557 - 151p 0.196 15.78951287 - 151d 0.196 6.487885895 - 201s 0.196 27.55650641 - 201p 0.196 15.75995315 - 201d 0.196 6.60410481 - 251s 0.196 30.50823161 - 251p 0.196 15.32752238 - 251d 0.196 6.525509706 - 301s 0.196 26.66964164 - 301p 0.196 17.01717098 - 301d 0.196 6.485673839 - 351s 0.196 26.97748859 - 351p 0.196 16.01161333 - 351d 0.196 6.738827678 - 401s 0.196 27.88642126 - 401p 0.196 15.7313449 - 401d 0.196 6.801557689 - 451s 0.196 27.29841143 - 451p 0.196 16.34533697 - 451d 0.196 6.689051629 - Temperature for orbital 1 = 0.157034 - Temperature for orbital 2 = 0.157034 - Temperature for orbital 3 = 0.157034 - new kappa=1.01 - 1s 0.157 26.91215126 - 1p 0.157 15.5842629 - 1d 0.157 6.820826291 - 51s 0.157 27.46541402 - 51p 0.157 15.34711234 - 51d 0.157 6.797486652 - 101s 0.157 27.09272522 - 101p 0.157 16.52069833 - 101d 0.157 6.263615317 - 151s 0.157 25.16653865 - 151p 0.157 17.82935386 - 151d 0.157 6.850723979 - 201s 0.157 26.14992716 - 201p 0.157 16.63195459 - 201d 0.157 6.270444893 - 251s 0.157 26.2452515 - 251p 0.157 16.5391229 - 251d 0.157 6.310441843 - 301s 0.157 26.48223344 - 301p 0.157 16.30936331 - 301d 0.157 6.527222149 - 351s 0.157 27.15367001 - 351p 0.157 15.80433055 - 351d 0.157 6.660546194 - 401s 0.157 26.40631292 - 401p 0.157 15.93727824 - 401d 0.157 7.08719209 - 451s 0.157 26.15397446 - 451p 0.157 16.22287933 - 451d 0.157 6.838154726 - Temperature for orbital 1 = 0.125628 - Temperature for orbital 2 = 0.125628 - Temperature for orbital 3 = 0.125628 - new kappa=1.01 - 1s 0.126 27.49659207 - 1p 0.126 15.35360729 - 1d 0.126 6.392221025 - 51s 0.126 27.98710135 - 51p 0.126 16.35188508 - 51d 0.126 6.432149743 - 101s 0.126 27.87714716 - 101p 0.126 14.3372253 - 101d 0.126 6.774860747 - 151s 0.126 26.74892074 - 151p 0.126 15.6202167 - 151d 0.126 6.220658763 - 201s 0.126 26.57712633 - 201p 0.126 15.07489832 - 201d 0.126 6.471023451 - 251s 0.126 26.7898173 - 251p 0.126 15.11619129 - 251d 0.126 6.507627212 - 301s 0.126 25.7617698 - 301p 0.126 15.88960109 - 301d 0.126 6.479559944 - 351s 0.126 26.41667165 - 351p 0.126 15.55528379 - 351d 0.126 6.836554051 - 401s 0.126 25.98077076 - 401p 0.126 15.72216757 - 401d 0.126 6.344748945 - 451s 0.126 26.30903812 - 451p 0.126 16.08851086 - 451d 0.126 6.390425702 - Temperature for orbital 1 = 0.100502 - Temperature for orbital 2 = 0.100502 - Temperature for orbital 3 = 0.100502 - new kappa=1.01 - 1s 0.101 26.80121561 - 1p 0.101 15.3077465 - 1d 0.101 7.257532455 - 51s 0.101 27.57579412 - 51p 0.101 14.82835257 - 51d 0.101 6.44505252 - 101s 0.101 27.57097531 - 101p 0.101 14.08457539 - 101d 0.101 7.129125376 - 151s 0.101 26.76867588 - 151p 0.101 14.60612606 - 151d 0.101 6.501155465 - 201s 0.101 25.6357622 - 201p 0.101 15.93031384 - 201d 0.101 6.501439972 - 251s 0.101 25.799775 - 251p 0.101 16.18767453 - 251d 0.101 6.438813771 - 301s 0.101 25.22509251 - 301p 0.101 16.94296153 - 301d 0.101 6.199915586 - 351s 0.101 24.90034332 - 351p 0.101 16.21236557 - 351d 0.101 6.358372066 - 401s 0.101 26.57118519 - 401p 0.101 15.05514658 - 401d 0.101 6.648967921 - 451s 0.101 25.53284443 - 451p 0.101 16.24788592 - 451d 0.101 6.448798517 - Temperature for orbital 1 = 0.0804016 - Temperature for orbital 2 = 0.0804016 - Temperature for orbital 3 = 0.0804016 - new kappa=1.01 - 1s 0.0804 25.80416903 - 1p 0.0804 16.56006214 - 1d 0.0804 6.652792259 - 51s 0.0804 26.39604219 - 51p 0.0804 14.51941537 - 51d 0.0804 6.628689568 - 101s 0.0804 26.56518448 - 101p 0.0804 14.91171727 - 101d 0.0804 6.40079993 - 151s 0.0804 26.44046818 - 151p 0.0804 14.7443956 - 151d 0.0804 6.338915387 - 201s 0.0804 26.47184393 - 201p 0.0804 15.20952059 - 201d 0.0804 6.444584311 - 251s 0.0804 26.17006921 - 251p 0.0804 15.32737993 - 251d 0.0804 6.527346263 - 301s 0.0804 26.20035424 - 301p 0.0804 14.75709224 - 301d 0.0804 6.890219438 - 351s 0.0804 26.62434237 - 351p 0.0804 15.30781048 - 351d 0.0804 6.693932907 - 401s 0.0804 26.33707098 - 401p 0.0804 14.97498733 - 401d 0.0804 6.477676209 - 451s 0.0804 26.61952936 - 451p 0.0804 14.62631502 - 451d 0.0804 6.739112719 - Temperature for orbital 1 = 0.0643213 - Temperature for orbital 2 = 0.0643213 - Temperature for orbital 3 = 0.0643213 - new kappa=1.01 - 1s 0.0643 26.96636658 - 1p 0.0643 15.05844124 - 1d 0.0643 6.114774039 - 51s 0.0643 26.84028617 - 51p 0.0643 14.58457804 - 51d 0.0643 6.464503072 - 101s 0.0643 26.61524284 - 101p 0.0643 14.7608193 - 101d 0.0643 6.235737668 - 151s 0.0643 26.26063151 - 151p 0.0643 14.8921183 - 151d 0.0643 6.37627149 - 201s 0.0643 25.48645401 - 201p 0.0643 15.60701104 - 201d 0.0643 6.417846793 - 251s 0.0643 25.2450281 - 251p 0.0643 15.75029955 - 251d 0.0643 6.46400338 - 301s 0.0643 25.81383104 - 301p 0.0643 15.28950942 - 301d 0.0643 6.28806422 - 351s 0.0643 25.45640438 - 351p 0.0643 15.60504616 - 351d 0.0643 6.595647855 - 401s 0.0643 26.01392666 - 401p 0.0643 15.13610704 - 401d 0.0643 6.4951003 - 451s 0.0643 26.32995471 - 451p 0.0643 15.10247374 - 451d 0.0643 6.429459731 - Temperature for orbital 1 = 0.051457 - Temperature for orbital 2 = 0.051457 - Temperature for orbital 3 = 0.051457 - new kappa=1.01 - 1s 0.0515 25.67425155 - 1p 0.0515 15.51931471 - 1d 0.0515 6.493664398 - 51s 0.0515 25.6767945 - 51p 0.0515 15.18037143 - 51d 0.0515 6.518347694 - 101s 0.0515 25.65309904 - 101p 0.0515 15.35573079 - 101d 0.0515 6.607083361 - 151s 0.0515 25.81879854 - 151p 0.0515 15.26272591 - 151d 0.0515 6.403883818 - 201s 0.0515 25.47351784 - 201p 0.0515 15.48879141 - 201d 0.0515 6.491180377 - 251s 0.0515 25.59439385 - 251p 0.0515 15.35661736 - 251d 0.0515 6.73747466 - 301s 0.0515 25.61655145 - 301p 0.0515 15.16714293 - 301d 0.0515 6.743239915 - 351s 0.0515 25.44886373 - 351p 0.0515 15.51255131 - 351d 0.0515 6.400542011 - 401s 0.0515 25.58144614 - 401p 0.0515 15.10991857 - 401d 0.0515 6.634439639 - 451s 0.0515 26.1107637 - 451p 0.0515 15.06758956 - 451d 0.0515 6.255551613 - Temperature for orbital 1 = 0.0411656 - Temperature for orbital 2 = 0.0411656 - Temperature for orbital 3 = 0.0411656 - new kappa=1.01 - 1s 0.0412 26.0493607 - 1p 0.0412 14.95441561 - 1d 0.0412 6.267455848 - 51s 0.0412 25.64765183 - 51p 0.0412 15.45383789 - 51d 0.0412 6.205843943 - 101s 0.0412 25.9676965 - 101p 0.0412 14.83856396 - 101d 0.0412 6.456608623 - 151s 0.0412 26.0222611 - 151p 0.0412 15.10366429 - 151d 0.0412 6.484475617 - 201s 0.0412 25.84167413 - 201p 0.0412 14.95285074 - 201d 0.0412 6.417991304 - 251s 0.0412 25.40514199 - 251p 0.0412 15.40552435 - 251d 0.0412 6.391836593 - 301s 0.0412 25.73064582 - 301p 0.0412 15.41062119 - 301d 0.0412 6.393063652 - 351s 0.0412 25.76546361 - 351p 0.0412 15.21238376 - 351d 0.0412 6.443636115 - 401s 0.0412 26.34783504 - 401p 0.0412 14.49786784 - 401d 0.0412 6.646764929 - 451s 0.0412 26.79579584 - 451p 0.0412 14.55151669 - 451d 0.0412 6.319073175 - Temperature for orbital 1 = 0.0329325 - Temperature for orbital 2 = 0.0329325 - Temperature for orbital 3 = 0.0329325 - new kappa=1.01 - 1s 0.0329 26.45818194 - 1p 0.0329 14.64316094 - 1d 0.0329 6.270891472 - 51s 0.0329 25.76289419 - 51p 0.0329 15.06364174 - 51d 0.0329 6.521146127 - 101s 0.0329 25.82888983 - 101p 0.0329 15.05094978 - 101d 0.0329 6.25219022 - 151s 0.0329 26.06061515 - 151p 0.0329 14.97719797 - 151d 0.0329 6.353129669 - 201s 0.0329 25.7729493 - 201p 0.0329 14.73638382 - 201d 0.0329 6.495588227 - 251s 0.0329 26.23670707 - 251p 0.0329 14.5548042 - 251d 0.0329 6.383763437 - 301s 0.0329 26.28589745 - 301p 0.0329 14.45817567 - 301d 0.0329 6.237770013 - 351s 0.0329 26.094174 - 351p 0.0329 14.78606682 - 351d 0.0329 6.381721161 - 401s 0.0329 25.94594249 - 401p 0.0329 14.81208892 - 401d 0.0329 6.312659685 - 451s 0.0329 26.12163325 - 451p 0.0329 14.79066043 - 451d 0.0329 6.333235533 - Temperature for orbital 1 = 0.026346 - Temperature for orbital 2 = 0.026346 - Temperature for orbital 3 = 0.026346 - new kappa=1.01 - 1s 0.0263 26.08250044 - 1p 0.0263 14.6774487 - 1d 0.0263 6.611005627 - 51s 0.0263 25.84670355 - 51p 0.0263 14.81511356 - 51d 0.0263 6.34382471 - 101s 0.0263 25.78014199 - 101p 0.0263 14.97946446 - 101d 0.0263 6.305002605 - 151s 0.0263 25.84278467 - 151p 0.0263 14.75586173 - 151d 0.0263 6.442082538 - 201s 0.0263 25.82677235 - 201p 0.0263 14.88961345 - 201d 0.0263 6.335292119 - 251s 0.0263 25.924204 - 251p 0.0263 14.58933623 - 251d 0.0263 6.391695464 - 301s 0.0263 25.89351187 - 301p 0.0263 14.61534109 - 301d 0.0263 6.473405261 - 351s 0.0263 25.84495673 - 351p 0.0263 14.73357081 - 351d 0.0263 6.342476653 - 401s 0.0263 25.6679727 - 401p 0.0263 14.90408174 - 401d 0.0263 6.351955919 - 451s 0.0263 25.85202429 - 451p 0.0263 14.82953625 - 451d 0.0263 6.273970582 - Temperature for orbital 1 = 0.0210768 - Temperature for orbital 2 = 0.0210768 - Temperature for orbital 3 = 0.0210768 - new kappa=1.01 - 1s 0.0211 25.535221 - 1p 0.0211 15.20061268 - 1d 0.0211 6.283215989 - 51s 0.0211 25.53004414 - 51p 0.0211 15.16221758 - 51d 0.0211 6.387149938 - 101s 0.0211 25.71956405 - 101p 0.0211 15.19531986 - 101d 0.0211 6.324016932 - 151s 0.0211 25.62791271 - 151p 0.0211 15.23334183 - 151d 0.0211 6.387440375 - 201s 0.0211 25.68967139 - 201p 0.0211 14.9983746 - 201d 0.0211 6.255762049 - 251s 0.0211 25.83071454 - 251p 0.0211 14.69283911 - 251d 0.0211 6.457066047 - 301s 0.0211 25.79718971 - 301p 0.0211 14.89890604 - 301d 0.0211 6.224657325 - 351s 0.0211 25.88755813 - 351p 0.0211 14.81878778 - 351d 0.0211 6.321493829 - 401s 0.0211 25.78502656 - 401p 0.0211 14.8045349 - 401d 0.0211 6.382430445 - 451s 0.0211 25.6556047 - 451p 0.0211 14.78968773 - 451d 0.0211 6.467683082 - Temperature for orbital 1 = 0.0168614 - Temperature for orbital 2 = 0.0168614 - Temperature for orbital 3 = 0.0168614 - new kappa=1.01 - 1s 0.0169 25.60081248 - 1p 0.0169 14.7535336 - 1d 0.0169 6.564782724 - 51s 0.0169 25.57325598 - 51p 0.0169 14.8732399 - 51d 0.0169 6.313725466 - 101s 0.0169 25.65253921 - 101p 0.0169 14.72236467 - 101d 0.0169 6.529704865 - 151s 0.0169 25.57244994 - 151p 0.0169 14.79605118 - 151d 0.0169 6.402900008 - 201s 0.0169 25.78392092 - 201p 0.0169 14.73367005 - 201d 0.0169 6.370160803 - 251s 0.0169 25.79857288 - 251p 0.0169 14.71989195 - 251d 0.0169 6.345028717 - 301s 0.0169 25.64633906 - 301p 0.0169 14.83123636 - 301d 0.0169 6.365175647 - 351s 0.0169 25.88425149 - 351p 0.0169 14.56728512 - 351d 0.0169 6.432249933 - 401s 0.0169 25.71058371 - 401p 0.0169 14.6873394 - 401d 0.0169 6.4148066 - 451s 0.0169 25.56473341 - 451p 0.0169 14.82431108 - 451d 0.0169 6.408022641 - Temperature for orbital 1 = 0.0134892 - Temperature for orbital 2 = 0.0134892 - Temperature for orbital 3 = 0.0134892 - new kappa=1.01 - 1s 0.0135 25.52231626 - 1p 0.0135 14.95790021 - 1d 0.0135 6.277784551 - 51s 0.0135 25.52331378 - 51p 0.0135 15.01090972 - 51d 0.0135 6.253447614 - 101s 0.0135 25.28989054 - 101p 0.0135 15.05682143 - 101d 0.0135 6.417908857 - 151s 0.0135 25.32602525 - 151p 0.0135 15.03167125 - 151d 0.0135 6.399327215 - 201s 0.0135 25.67023414 - 201p 0.0135 14.81798677 - 201d 0.0135 6.241213669 - 251s 0.0135 25.57572419 - 251p 0.0135 14.87592317 - 251d 0.0135 6.303751063 - 301s 0.0135 25.3878796 - 301p 0.0135 15.02208482 - 301d 0.0135 6.378682399 - 351s 0.0135 25.37798809 - 351p 0.0135 14.96765003 - 351d 0.0135 6.437441094 - 401s 0.0135 25.33054398 - 401p 0.0135 15.01570326 - 401d 0.0135 6.3753643 - 451s 0.0135 25.59412327 - 451p 0.0135 14.9065055 - 451d 0.0135 6.355837484 - Temperature for orbital 1 = 0.0107913 - Temperature for orbital 2 = 0.0107913 - Temperature for orbital 3 = 0.0107913 - new kappa=1.01 - - mkb_information. - - NBANDS=8 STRNUM=5 - - NBANDS=8 STRNUM=5 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUT b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUT deleted file mode 100644 index f0069dd7b0..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUT +++ /dev/null @@ -1,26 +0,0 @@ -INPUT_PARAMETERS -suffix N-6-3.0 -latname N-6-3.0 -stru_file 07_N.stru -pseudo_dir ../../../../data/elements/07_N/1_LDA/ -kpoint_file KPOINTS -wannier_card INPUTw -calculation scf -ntype 1 -nspin 1 -lmaxmax 2 - -symmetry 0 -nbands 8 - -ecutwfc 50 -scf_thr 1.0e-7 // about iteration -scf_nmax 1000 - -smearing_method gauss -smearing_sigma 0.01 - -mixing_type pulay // about charge mixing -mixing_beta 0.4 -mixing_ndim 8 -printe 1 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUTs b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUTs deleted file mode 100644 index 6fdb094b87..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUTs +++ /dev/null @@ -1,8 +0,0 @@ -INPUT_ORBITAL_INFORMATION - -1 // smooth or not -0.1 // smearing_sigma -50 // energy cutoff for spherical bessel functions(Ry) -6 // cutoff of wavefunctions(a.u.) -1.0e-12 // tolerence - diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUTw b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUTw deleted file mode 100644 index 707219528d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/INPUTw +++ /dev/null @@ -1,3 +0,0 @@ -WANNIER_PARAMETERS -rcut 10 -out_spillage 2 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/KPOINTS b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/KPOINTS deleted file mode 100644 index c289c0158a..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/07_N/KPOINTS +++ /dev/null @@ -1,4 +0,0 @@ -K_POINTS -0 -Gamma -1 1 1 0 0 0 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/DIS.txt b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/DIS.txt deleted file mode 100644 index 2f29b7d239..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/DIS.txt +++ /dev/null @@ -1,102 +0,0 @@ -01_H 0.6 0.75 0.9 1.2 1.5 -02_He 1.25 1.75 2.40 3.25 -03_Li 1.5 2.1 2.5 2.8 3.2 3.5 4.2 -04_Be 1.75 2.0 2.375 3.00 4.00 -05_B 1.25 1.625 2.5 3.5 -06_C 1.0 1.25 1.5 2.0 3.0 -07_N 1.0 1.1 1.5 2.0 3.0 -08_O 1.0 1.208 1.5 2.0 3.0 -09_F 1.2 1.418 1.75 2.25 3.25 -100_Fm 1.98 2.375 2.75 3.25 4.25 -101_Md 2.08 2.50 3.00 3.43 4.25 -102_No 2.60 3.125 3.75 4.27 5.00 -10_Ne 1.5 1.75 2.25 2.625 3.0 3.5 -11_Na 2.05 2.4 2.8 3.1 3.3 3.8 4.3 -12_Mg 2.125 2.375 2.875 3.375 4.5 -13_Al 2.0 2.5 3.0 3.75 4.5 -14_Si 1.75 2.0 2.25 2.75 3.75 -15_P 1.625 1.875 2.5 3.25 4.0 -16_S 1.6 1.9 2.5 3.25 4.0 -17_Cl 1.65 2.0 2.5 3.25 4.0 -18_Ar 2.25 2.625 3.0 3.375 4.0 -19_K 1.8 2.6 3.4 3.8 4.0 4.4 4.8 -20_Ca 2.5 3.0 3.5 4.0 5.0 -21_Sc 1.75 2.15 2.75 3.5 4.5 -22_Ti 1.6 1.85 2.5 3.25 4.25 -23_V 1.45 1.65 2.25 3.00 4.00 -24_Cr 1.375 1.55 2.00 2.75 3.75 -25_Mn 1.40 1.60 2.10 2.75 3.75 -26_Fe 1.45 1.725 2.25 3.00 4.00 -27_Co 1.8 2.0 2.5 3.5 -28_Ni 1.65 2.00 2.50 3.00 4.00 -29_Cu 1.8 2.2 3.0 4.0 -30_Zn 2.00 2.30 2.85 3.50 4.25 -31_Ga 1.85 2.10 2.45 3.00 4.00 -32_Ge 1.80 2.00 2.35 3.00 4.00 -33_As 1.75 2.10 2.50 3.00 4.00 -34_Se 1.85 2.15 2.50 3.00 4.00 -35_Br 1.90 2.25 2.75 3.25 4.00 -36_Kr 2.40 3.00 3.675 4.25 5.00 -37_Rb 2.45 3.00 4.00 5.00 -38_Sr 2.75 3.50 4.40 5.00 -39_Y 2.125 2.5 2.875 3.25 4.00 5.00 -40_Zr 1.9 2.25 3.00 4.00 -41_Nb 1.75 2.05 2.40 3.00 4.00 -42_Mo 1.675 1.9 2.375 3.00 4.00 -43_Tc 1.70 1.915 2.375 3.00 4.00 -44_Ru 1.725 1.925 2.375 3.00 4.00 -45_Rh 1.80 2.10 2.50 3.00 4.00 -46_Pd 2.0 2.275 2.75 3.75 -47_Ag 2.1 2.45 3.00 4.00 -48_Cd 2.15 2.50 3.10 4.00 5.00 -49_In 2.15 2.50 3.00 3.75 4.75 -50_Sn 2.10 2.40 3.75 3.50 4.50 -51_Sb 2.10 2.50 3.00 3.50 4.50 -52_Te 2.15 2.55 3.10 3.60 4.50 -53_I 2.22 2.65 3.25 4.25 -54_Xe 3.0 3.5 4.06 4.50 5.25 -55_Cs 2.70 3.50 4.50 5.50 -56_Ba 2.65 3.00 3.50 4.40 5.50 -57_La 2.2 2.6 3.25 4.00 5.00 -58_Ce 2.0 2.375 2.875 3.5 4.5 -59_Pr 1.90 2.25 2.75 3.5 4.5 -60_Nd 1.80 2.125 2.625 3.375 4.5 -61_Pm 1.775 2.05 2.5 3.25 4.25 -62_Sm 1.775 2.05 2.5 3.25 4.25 -63_Eu 1.775 2.075 2.5 3.25 4.25 -64_Gd 1.80 2.11 2.625 3.375 4.1 5.0 -65_Tb 1.825 2.16 2.625 3.375 4.1 5.0 -66_Dy 1.85 2.24 2.625 3.375 4.1 5.0 -67_Ho 1.93 2.375 3.0 4.1 5.0 -68_Er 2.025 2.5 3.125 4.1 5.0 -69_Tm 2.20 2.625 3.25 4.1 5.0 -70_Yb 2.5 3.0 3.5 4.1 5.0 -71_Lu 2.20 2.50 3.04 4.0 5.0 -72_Hf 1.975 2.49 3.25 4.50 -73_Ta 1.85 2.12 2.625 3.25 4.50 -74_W 1.775 1.99 2.50 3.25 4.50 -75_Re 1.775 2.01 2.50 3.25 4.25 -76_Os 1.80 2.04 2.50 3.25 4.50 -77_Ir 1.85 2.125 2.5 3.25 4.25 -78_Pt 2.00 2.275 2.75 3.75 -79_Au 2.10 2.45 3.00 4.00 -80_Hg 2.225 2.50 3.04 4.00 5.00 -81_Tl 2.21 2.60 3.11 3.75 4.75 -82_Pb 2.225 2.50 2.88 3.625 4.50 -83_Bi 2.225 2.61 3.125 3.75 4.75 -84_Po 2.30 2.72 3.25 3.875 4.75 -85_At 2.375 2.83 3.50 4.50 -86_Rn 2.80 3.50 4.17 4.75 5.50 -87_Fr 2.85 3.50 4.43 5.50 -88_Ra 3.15 3.50 4.25 5.12 6.00 -89_Ac 2.48 3.10 3.72 4.25 5.00 -90_Th 2.25 2.65 3.25 4.00 5.00 -91_Pa 2.04 2.30 3.00 3.75 4.75 -92_U 1.89 2.09 2.75 3.50 4.50 -93_Np 1.84 2.05 2.625 3.375 4.50 -94_Pu 1.81 2.02 2.5 3.25 4.25 -95_Am 1.81 2.03 2.5 3.25 4.25 -96_Cm 1.83 2.07 2.5 3.25 4.25 -97_Bk 1.86 2.12 2.5 3.0 4.0 -98_Cf 1.89 2.19 2.625 3.125 4.0 -99_Es 1.93 2.29 2.625 3.125 4.0 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/ORBITAL_INPUT b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/ORBITAL_INPUT deleted file mode 100644 index a3c977d874..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/ORBITAL_INPUT +++ /dev/null @@ -1,51 +0,0 @@ -#1.exe_dir -#-------------------------------------------------------------------------------- -EXE_pw ../../../../bin/ABACUS.fp_mpi.x -EXE_orbital ../../../1_Source/SIA_s.exe -#-------------------------------------------------------------------------------- -#( In this part, the direction of the two used exe is provided ) - -#2.electronic calculatation -#-------------------------------------------------------------------------------- -targets 07_N # element -ref_bands 5 # reference bands -nbands 8 # num of bands for calculate ( > reference bands) -Ecut 50 # cutoff energy (in Ry) -Rcut 6 # cutoff radius (in a.u.) -Pseudo_dir ../../../../data/elements/07_N/1_LDA/ -Pseudo N.LDA.UPF -smearing_sigma 0.01 # energy range for gauss smearing (in Ry) -#-------------------------------------------------------------------------------- -#( In this part , some parameters of calculating are given ) - -#3.structure information -#-------------------------------------------------------------------------------- -Dis 1.0 1.1 1.5 2.0 3.0 -#-------------------------------------------------------------------------------- -#( In this part , it gives us the bond length of the reference system( in -#angstrom) ) - -#4.orbital calculatation -#-------------------------------------------------------------------------------- -maxL 2 # the max angular momentum -Level 2 # num of levels to generate orbitals(<=5) -#(num) (the max ang) (num of S) (num of P) (num of D) (num of F) (num of G) -level1 1 1 1 -level2 2 1 1 1 -#-------------------------------------------------------------------------------- -#( In this part, some information of orbital is given ) - -#5.Metropolis parameters (in most cases do not need to change) -#-------------------------------------------------------------------------------- -Start_tem_S 1.0e-4 # start temperature for optimize Spillage (default 1.0e-4) -Start_tem_K 1.0e-2 # start temperature for optimize Kinetic (default 1.0e-2) -Step_S 20 # num of steps for optimize Spillage (default 20) -Step_K 15 # num of steps for optimize Kinetic (default 15) -Delta_kappa 0.01 # delta kappa (default 0.01) -#-------------------------------------------------------------------------------- -#( In this part , some parameters of Metropolis is given . In most cases , they -#do not need to be changed , only when you run into a situation , that the -#Kinnetic energy is larger than the maximum value allowed , you can enlarge -#the start temperature appropritely , or you can enlarge the delta_kappa, e.g. -#start_tem_k 1.0e-2 to 5.0e-1, delta_kappa 0.01 to 0.02. more steps can make -#the orbitals better , too) diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/README b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/README deleted file mode 100644 index 974be0126b..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/README +++ /dev/null @@ -1,4 +0,0 @@ -http://abacus.ustc.edu.cn/manual_411.html can be a reference to generate orbitals. - -First, change some parameter in ORBITAL_INPUT, for EXE_pw, EXE_orbital and Pseudo_dir, you'd better use the absolute path; -Second, run the script: ./generate_orbital.sh diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/generate_orbital.sh b/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/generate_orbital.sh deleted file mode 100644 index 074addb35d..0000000000 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/2_Generate/generate_orbital.sh +++ /dev/null @@ -1,470 +0,0 @@ -#!/bin/bash -# author mohan -# edit by Pengfei Li 2013-6-4 -# edit by Wenshuai Zhang 2016-11-30 -#----------------------------------------------------------------- -# -# (0.0) fixed parameters -# -#----------------------------------------------------------------- -mass=1 #not used yet. -lat0=20 #in a.u -cpu_num=8 -export OMP_NUM_THREADS=1 -#hostfpath="/home/nic/wszhang/eclipse_project/mesia_dft/error_estimates_for_DFT/cif2cellroot/0abacus_lcao/myhosts" -#hostfpath="/home/nic/wszhang/eclipse_project/mesia_dft/delta_test/delta_dft/cifs2deltaDFT/myhosts" -#----------------------------------------------------------------- -# -# (0.1) input parameters -# -#----------------------------------------------------------------- -# (0.1.1) get exe -EXE_pw=`grep "EXE_pw" ORBITAL_INPUT | awk -F "EXE_pw" '{print $0}' | awk '{print $2}'` - -# (0.1.2)get SIA -EXE_orbital=`grep "EXE_orbital" ORBITAL_INPUT | awk -F "EXE_orbital" '{print $0}' | awk '{print $2}'` - -# (0.1.3)get the targets element and id -targets=`grep "targets" ORBITAL_INPUT | awk -F "targets" '{print $0}' | awk '{print $2}'` - -for name in $targets; do - -element=`echo "$name" | awk -F "_" '{print $2}'` -id=`echo "$name" | awk -F "_" '{print $1}'` - -# (0.1.4)get the nbands -nbands=`grep "nbands" ORBITAL_INPUT | awk -F "nbands" '{print $0}' | awk '{print $2}'` - -# (0.1.5)get the ref_bands -ref_bands=`grep "ref_bands" ORBITAL_INPUT | awk -F "$ref_bands" '{print $0}' | awk '{print $2}'` - -# (0.1.6)get the pseudo_dir -pseudo_dir=`grep "Pseudo_dir" ORBITAL_INPUT | awk -F "Pseudo_dir" '{print $0}' | awk '{print $2}'` - -# (0.1.7)get maxL S P D -maxL=`grep "maxL" ORBITAL_INPUT | awk -F "maxL" '{print $0}' | awk '{print $2}'` - -#if ( test $maxL = 0 ) // mohan's scheme -#then -#S_MIN=1 -#P_MIN=" " -#D_MIN=" " -#elif ( test $maxL = 1 ) -#then -#S_MIN=1 -#P_MIN=1 -#D_MIN=" " -#else -#S_MIN=1 -#P_MIN=1 -#D_MIN=1 -#fi - -# (0.1.8)get the level -Level=`grep "Level" ORBITAL_INPUT | awk -F "level" '{print $0}' | awk '{print $2}'` - -# (0.1.9)get every level`s lmax s p d f g -L[0]=`grep "level1" ORBITAL_INPUT | awk -F "level1" '{print $2}'` -L[1]=`grep "level2" ORBITAL_INPUT | awk -F "level2" '{print $2}'` -L[2]=`grep "level3" ORBITAL_INPUT | awk -F "level3" '{print $2}'` -L[3]=`grep "level4" ORBITAL_INPUT | awk -F "level4" '{print $2}'` -L[4]=`grep "level5" ORBITAL_INPUT | awk -F "level5" '{print $2}'` -L[5]=`grep "level6" ORBITAL_INPUT | awk -F "level6" '{print $2}'` -L[6]=`grep "level7" ORBITAL_INPUT | awk -F "level7" '{print $2}'` -L[7]=`grep "level8" ORBITAL_INPUT | awk -F "level8" '{print $2}'` -L[8]=`grep "level9" ORBITAL_INPUT | awk -F "level9" '{print $2}'` - -# (0.1.10)get some parameters for METROPOLIS -Start_tem_S_in=`grep "Start_tem_S" ORBITAL_INPUT | awk -F "Start_tem_S" '{print $0}' | awk '{print $2}'` -if ( test $Start_tem_S_in != " ") -then -Start_tem_S=$Start_tem_S_in -else -Start_tem_S=1.0e-4 #default -fi - - -Start_tem_K_in=`grep "Start_tem_K" ORBITAL_INPUT | awk -F "Start_tem_K" '{print $0}' | awk '{print $2}'` -if ( test $Start_tem_K_in != " " ) -then -Start_tem_K=$Start_tem_K_in -else -Start_tem_K=1.0e-2 #default -fi - -Step_S_in=`grep "Step_S" ORBITAL_INPUT | awk -F "Step_S" '{print $0}' | awk '{print $2}'` -if ( test $Step_S_in != " " ) -then -Step_S=$Step_S_in -else -Step_S=20 #default -fi - -Step_K_in=`grep "Step_K" ORBITAL_INPUT | awk -F "Step_K" '{print $0}' | awk '{print $2}'` -if ( test $Step_K_in != " ") -then -Step_K=$Step_K_in -else -Step_K=15 #default -fi - -Delta_kappa_in=`grep "Delta_kappa" ORBITAL_INPUT | awk -F "Delta_kappa" '{print $0}' | awk '{print $2}'` -Delta_kappa=$Delta_kappa_in -#echo "Delta_kappa=$Delta_kappa" - -# (0.1.11) calculate the number of different dimers or trimers. -info=`grep "Dis" ORBITAL_INPUT | awk -F "Dis" '{print $2}'` -echo "info=$info" -dimers_number=`echo "$info" | awk '// {print NF}'` -echo "dimers_number=$dimers_number" - -# (0.1.12) get the ecut -ecut=`grep "Ecut" ORBITAL_INPUT | awk -F "Ecut" '{print $0}' | awk '{print $2}'` - -# (0.1.13) get the info about rcut,pseudo -info_r=`grep "Rcut" ORBITAL_INPUT | awk -F "Rcut" '{print $0}' | awk '{print $2}'` -rcut_number=`echo "$info_r" | awk '// {print NF}'` -echo "ecut=$ecut, info_r=$info_r, rcut_number=$rcut_number" - -# (0.1.14) get the pseudopotential -pseudofile=`grep "Pseudo " ORBITAL_INPUT | awk -F "Pseudo " '{print $0}' | awk '{print $2}'` -echo "pseudo=$pseudofile" - -# (0.1.15) get the smearing -smearing_sigma=`grep "smearing_sigma " ORBITAL_INPUT | awk -F "smearing_sigma " '{print $0}' | awk '{print $2}'` -echo "smearing_sigma=$smearing_sigma" - -#----------------------------------------------------------------- -# -# (1) big cicle, cicle of targets -# -#----------------------------------------------------------------- - -# (1.1) output which element you want to calculate - -echo "--------------------------> $element" - -# (1.2) make the dir, the name is 'name' -if ( test -d $name ) -then - echo "The dir exist: $name" -else - echo "make dir: $name" - mkdir $name -fi - -# (1.3) enter the name dir -cd $name - -# (1.4) another big cicle come: the rcut cicle. -count_r=1 -while [ $count_r -le $rcut_number ] -do - - # (1.4.1) - rcut=`echo "$info_r" | awk '{print $'$count_r'}' ` - echo "rcut=$rcut" - - - # (1.4.2) enter the third big cicle : the dimer distance cicle. - count=1 - while [ $count -le $dimers_number ] - do - - # (1.4.2.0) calculate the distance of dimers - dis=`echo "$info" | awk '{print $'$count'}' ` - dis1=$(echo "scale=5;$dis * 0.86603 "|bc) - dis2=$(echo "scale=5;$dis * 0.5 "|bc) - dis3=$(echo "scale=5;$dis * 0.81649 "|bc) - dis4=$(echo "scale=5;$dis * 0.28867 "|bc) - echo "dis=$dis" - - -# (1.4.2.1) get the" structures" -if ( test $element = Na -o $element = Li -o $element = K -o $element = Ca ) -then -echo "use trimer" -na=3 -cat > $name.stru << EOF -ATOMIC_SPECIES -$element $mass $pseudofile -LATTICE_CONSTANT -$lat0 // add lattice constant(a.u.) -LATTICE_VECTORS -1 0 0 -0 1 0 -0 0 1 -ATOMIC_POSITIONS -Cartesian_angstrom //Cartesian or Direct coordinate. -$element //Element Label -0.0 //starting magnetism -3 //number of atoms -0.0 0.0 0.0 0 0 0 // crystal coor. -0.0 0.0 $dis 0 0 0 -0.0 $dis1 $dis2 0 0 0 -EOF - -#elif ( test $element = Mn -o $element = Fe ) -#then -#echo "use tetramer" -#na=4 -#cat > $name.stru << EOF -#ATOMIC_SPECIES -#$element $mass $pseudofile -#LATTICE_CONSTANT -#$lat0 // add lattice constant(a.u.) -#LATTICE_VECTORS -#1 0 0 -#0 1 0 -#0 0 1 -#ATOMIC_POSITIONS -#Cartesian_angstrom //Cartesian or Direct coordinate. -#$element //Element Label -#0.0 //starting magnetism -#4 //number of atoms -#0.0 0.0 0.0 0 0 0 // crystal coor. -#0.0 0.0 $dis 0 0 0 -#0.0 $dis1 $dis2 0 0 0 -#$dis3 $dis4 $dis2 0 0 0 -#EOF - -else -echo "use dimer" -na=2 -cat > $name.stru << EOF -ATOMIC_SPECIES -$element $mass $pseudofile -LATTICE_CONSTANT -$lat0 // add lattice constant(a.u.) -LATTICE_VECTORS -1 0 0 -0 1 0 -0 0 1 -ATOMIC_POSITIONS -Cartesian_angstrom //Cartesian or Direct coordinate. -$element //Element Label -0.0 //starting magnetism -2 //number of atoms -0.0 0.0 0.0 0 0 0 // crystal coor. -0.0 0.0 $dis 0 0 0 -EOF -fi - -# (1.4.2.2) get KPOINTS -cat > KPOINTS << EOF -K_POINTS -0 -Gamma -1 1 1 0 0 0 -EOF - -# (1.4.2.3) get INPUTw -cat > INPUTw << EOF -WANNIER_PARAMETERS -rcut 10 -out_spillage 2 -EOF - - -# (1.4.2.4) get INPUTs -cat > INPUTs << EOF -INPUT_ORBITAL_INFORMATION - -1 // smooth or not -0.1 // smearing_sigma -$ecut // energy cutoff for spherical bessel functions(Ry) -$rcut // cutoff of wavefunctions(a.u.) -1.0e-12 // tolerence - -EOF - - -# (1.4.2.5) get INPUT -cat > INPUT << EOF -INPUT_PARAMETERS -suffix $element-$rcut-$dis -latname $element-$rcut-$dis -stru_file $name.stru -pseudo_dir $pseudo_dir -kpoint_file KPOINTS -wannier_card INPUTw -calculation scf -ntype 1 -nspin 1 -lmaxmax $maxL - -symmetry 0 -nbands $nbands - -ecutwfc $ecut -scf_thr 2.0e-8 // about iteration -scf_nmax 1000 - -smearing_method gauss -smearing_sigma $smearing_sigma - -mixing_type pulay // about charge mixing -mixing_beta 0.4 -mixing_ndim 8 -printe 1 -EOF - -let count++ - -# (1.4.2.6) -#test -e ../node_openmpi && cp ../node_openmpi . - -#------------- -#on Dirac -#------------- -#/opt/openmpi/bin/mpirun -np $cpu_number -machinefile node_openmpi $exe - -#------------- -#on Einstein -#------------- -#mpiexec -np $cpu_num -machinefile node_openmpi $EXE_pw -#mpiexec -np $1 -machinefile $EXE_pw -mpirun -np $cpu_num $EXE_pw -#mpirun -np $cpu_num -hostfile $hostfpath $EXE_pw - -#$EXE_pw - -#mpiexec -n 12 -machinefile $PBS_NODEFILE $EXE_pw >> Log.txt -# end (1.4.2), dimer distace cicle -done - -# (1.4.3) mkdir of rcut -test -d $rcut || mkdir $rcut -# (1.4.3.1) -cd $rcut - -# (1.4.3.2) prepare for the INPUT file -cat > INPUT << EOF - -1 // if or not calculate the spillage. 1/0 -0 // restart or not. 1/0 -1 // if or not output the file. 1/0 -$dimers_number // number of structures. -EOF - -# (1.4.3.3) input the file names -count_files=1 -while [ $count_files -le $dimers_number ] -do -dis=`echo "$info" | awk '{print $'$count_files'}' ` -cat >> INPUT << EOF -../$element-$rcut-$dis.$lat0.dat -EOF -let count_files++ -done - -cat >> INPUT << EOF - - - -1 //number of k points -1 // number of pools - - - -100 - - - -2 - - - -$Start_tem_S // Start temparature for spillage -0.8 // Cooling rate -$Step_S // Number of temperatures(spillage) -600 // Number of steps per temparature - -$Start_tem_K // start temperature for kinetic energy -0.8 // Cooling rate -$Step_K // Number of temperatures(kinetical) -600 // Number of steps per temparature - -$Delta_kappa // Delta kappa -50 // Selectly output information - -100 // Acceptance_steps -0.4 // Acceptance_high -0.2 // Acceptance_low - -100 // Max kinetic energy(Rydberg). -0.01 // 'dr' for kinetic minimized. -1 // 1: Kin 2: Ecut - - - - -1 // to control the number of bands.(Yes1/No0) -1 // int, the start band index(>0). -$ref_bands // int, the ed band index( -EOF - -cat >> INPUT << EOF - -$Level // Number of levels. -label / na / skip / lmax / each L / -EOF - -for((i=0;i<$Level;i++)) -do -cat >> INPUT << EOF -$id $na new ${L[i]} -EOF -done - -cat >> INPUT << EOF - -EOF - -cat >> INPUT << EOF - -0.01 //dr(a.u.) of uniform mesh. Attention!!dr will affect kinetic energy minmized largely. --6 //xmin -1 //zed, chosen as valence charge. -0.01 //dx -6.0 //xmax - - - -0 -2 -./FILE/Si-S.ORBITAL -0 -./FILE/Si-P.ORBITAL -1 - - - -0 // 'yes' to do this. -14.0 // rcut, only useful for test program -0.01 // dr, for simpson integral -2 // test eigenvalue index -2 // lmax - - -EOF - -#mpiexec -n 1 -machinefile $PBS_NODEFILE $EXE_orbital >> Log.txt -$EXE_orbital -#mpirun -np cpu_num $EXE_orbital - -# (1.4.3.5) -cd .. - -let count_r++ -# end(1.4), rcut cicle -done - -# (1.5) exit the name dir. -cd .. - -done -# end targets cicle - -unset OMP_NUM_THREADS diff --git a/tools/SIAB/SimulatedAnnealing/source/Makefile b/tools/SIAB/SimulatedAnnealing/source/Makefile index 8c2cdca19f..aa6ff02147 100644 --- a/tools/SIAB/SimulatedAnnealing/source/Makefile +++ b/tools/SIAB/SimulatedAnnealing/source/Makefile @@ -1,30 +1,28 @@ #=========================================================== # AUTHOR : mohan # DATE START FROM : 2009-04-14 +# LAST UPDATE : 2025-08-28 # FUNCTION : spillage makefile #=========================================================== -### Dirac -#CPLUSPLUS =CXX -O3 -w -ffast-math -funroll-loops -#CPLUSPLUS = /export/soft/intel2015/impi/5.0.2.044/intel64/bin/mpiicpc -#CXXFLAGS = -std=c++11 -O3 -openmp -#CPLUSPLUS_GPROF = g++ -gp -#CPLUSPLUS_MPI = /opt/openmpi/bin/mpicxx -O3 -w -#CPLUSPLUS_MPI=/export/soft/intel2015/impi/5.0.2.044/intel64/bin/mpiicpc +MKLROOT=/home/mohan/intel/oneapi/mkl/021.3.0/ -### Einstein -#CPLUSPLUS_MPI = /opt/openmpi-intel9/bin/mpicxx -O3 -w +#------------------------------ +# for serial version: make s +#------------------------------ +CPLUSPLUS = icpc -#LIBS=-L/export/soft/intel2015/composer_xe_2015.1.133/mkl/lib/intel64 -i-dynamic -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -lpthread \ +#------------------------------ +# for parallel version: make p +#------------------------------ +#CPLUSPLUS = mpiicpc -### Version TC4600 wszhang -CPLUSPLUS = mpiicpc -CPLUSPLUS_MPI = mpiicpc -CXXFLAGS = -std=c++11 -O2 -xCORE-AVX2 -align -fma -ftz -fomit-frame-pointer -finline-functions \ - -I${MKLROOT}/include -I${MKLROOT}/include/intel64/ilp64 -LIBS = -L${MKLROOT}/lib/intel64 \ - -lmkl_blacs_intelmpi_lp64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -limf +CXXFLAGS = -std=c++11 -O3 - +#CXXFLAGS = -std=c++11 -O2 -xCORE-AVX2 -align -fma -ftz -fomit-frame-pointer -finline-functions \ + -I${MKLROOT}/include -I${MKLROOT}/include/intel64/ilp64 \ + -lmkl_blacs_intelmpi_lp64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -limf + +LIBS=-L${MKLROOT}/lib/intel64 -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5 -lpthread -lm TOOLS_OBJS=src_tools/mathzone.o \ src_tools/matrix.o \ @@ -86,7 +84,7 @@ s : ${OBJS} ${CPLUSPLUS} ${CXXFLAGS} -o SIA_s.exe ${OBJS} ${LIBS} p : ${OBJS} - $(CPLUSPLUS_MPI) -D__MPI ${CXXFLAGS} -o SIA_p.exe $(OBJS) $(LIBS) + ${CPLUSPLUS} -D__MPI ${CXXFLAGS} -o SIA_p.exe ${OBJS} ${LIBS} note : @echo 'atom type label : it ' @@ -117,7 +115,6 @@ note : .cpp.o: ${CPLUSPLUS} ${CXXFLAGS} -c $< -o $@ -# $(CPLUSPLUS_MPI) -c -D__MPI $< -o $@ .PHONY:clean clean: diff --git a/tools/SIAB/SimulatedAnnealing/source/Makefile_hanhai20_hpcx2.9_intel2019 b/tools/SIAB/SimulatedAnnealing/source/Makefile_hanhai20_hpcx2.9_intel2019 deleted file mode 100644 index 4c58a4e778..0000000000 --- a/tools/SIAB/SimulatedAnnealing/source/Makefile_hanhai20_hpcx2.9_intel2019 +++ /dev/null @@ -1,124 +0,0 @@ -#=========================================================== -# AUTHOR : mohan -# DATE START FROM : 2009-04-14 -# FUNCTION : spillage makefile -#=========================================================== -### Dirac -#CPLUSPLUS =CXX -O3 -w -ffast-math -funroll-loops -#CPLUSPLUS = /export/soft/intel2015/impi/5.0.2.044/intel64/bin/mpiicpc -#CXXFLAGS = -std=c++11 -O3 -openmp -#CPLUSPLUS_GPROF = g++ -gp -#CPLUSPLUS_MPI = /opt/openmpi/bin/mpicxx -O3 -w -#CPLUSPLUS_MPI=/export/soft/intel2015/impi/5.0.2.044/intel64/bin/mpiicpc - -### Einstein -#CPLUSPLUS_MPI = /opt/openmpi-intel9/bin/mpicxx -O3 -w - -#LIBS=-L/export/soft/intel2015/composer_xe_2015.1.133/mkl/lib/intel64 -i-dynamic -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -lpthread \ - -### Version TC4600 wszhang -CPLUSPLUS = /opt/hpcx/2.9.0/ompi-icc/2019.update5/bin/mpicxx -CPLUSPLUS_MPI = /opt/hpcx/2.9.0/ompi-icc/2019.update5/bin/mpicxx -CXXFLAGS = -std=c++11 -O2 -xCORE-AVX2 -align -fma -ftz -fomit-frame-pointer -finline-functions \ - -I${MKLROOT}/include -I${MKLROOT}/include/intel64/ilp64 -LIBS = -L${MKLROOT}/lib/intel64 \ - -lmkl_blacs_intelmpi_lp64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -limf - - - -TOOLS_OBJS=src_tools/mathzone.o \ - src_tools/matrix.o \ - src_tools/matrix3.o \ - src_tools/realarray.o \ - src_tools/intarray.o \ - src_tools/complexmatrix.o \ - src_tools/complexarray.o\ - src_tools/timer.o \ - src_tools/inverse_matrix.o\ - src_tools/inverse_matrix_iterate.o\ - src_tools/Simulated_Annealing.o\ - -SPILLAGE_OBJS=src_spillage/main.o \ - src_spillage/read_INPUT.o\ - src_spillage/ReadData.o\ - src_spillage/Calculate_C4.o\ - src_spillage/Coefficients.o\ - src_spillage/MultiZeta.o\ - src_spillage/SpillageStep.o\ - src_spillage/SpillageValue.o\ - src_spillage/Step_Data.o\ - src_spillage/Inverse_Matrix_S.o\ - src_spillage/Orthogonal.o\ - src_spillage/Type_Information.o\ - src_spillage/Metropolis.o\ - src_spillage/Metropolis_2.o\ - src_spillage/Out_Orbital.o\ - src_spillage/Plot_Psi.o\ - src_spillage/Psi_Second.o\ - src_spillage/tools.o \ - src_spillage/common.o \ - -PARALLEL_OBJS=src_parallel/parallel_global.o\ - src_parallel/parallel_common.o\ - src_parallel/parallel_reduce.o\ - src_parallel/parallel_kpoints.o - -PW_OBJS=src_pw/pw_basis.o\ - src_pw/pw_complement.o\ - src_pw/heapsort.o\ - src_pw/numerical_basis.o\ - src_pw/bessel_basis.o\ - src_pw/ylm_real.o\ - src_pw/memory_calculation.o\ - -OBJS = ${TOOLS_OBJS} \ - ${SPILLAGE_OBJS} \ - ${PARALLEL_OBJS} \ - ${PW_OBJS}\ - -help : - @echo 'make target list: ' - @echo 's : Series version of Monte Carlo Spillage Program.' - @echo 'p : Parallel Version of Monte Carlo Spillage Program.' - @echo 'note : some notes.' - -s : ${OBJS} - ${CPLUSPLUS} ${CXXFLAGS} -o SIA_s.exe ${OBJS} ${LIBS} - -p : ${OBJS} - $(CPLUSPLUS_MPI) -D__MPI ${CXXFLAGS} -o SIA_p.exe $(OBJS) $(LIBS) - -note : - @echo 'atom type label : it ' - @echo 'atom label for each type : ia ' - @echo 'The angular momentum : l ' - @echo 'The multiplicity : n ' - @echo 'The magnetic quantum num : m ' - @echo 'The k point index : ik ' - @echo 'The band index : ib ' - @echo 'The eigenvalue of Jlq : ie ' - @echo 'The radius cutoff (a.u.) : rcut ' - @echo 'The state is : psi(ib,ik) ' - @echo 'The local orbitals is : phi(it,ia,l,n,m) ' - @echo 'The index of local basis : nwfc(it,l,n)' - @echo 'The index of local basis : nwfc2(it,ia,l,n,m) ' - @echo 'The Spherical Bessel func : Jl(ie,rcut) ' - @echo 'The SB transform : \int Jl(ie,rcut) * Jl' - @echo 'The index of Jlq coef : Coef(it,l,n,ie)' - @echo 'The local orbitals formu : phi=\sum_{ie} Coef(it,l,n,ie) * Jl(ie,rcut)' - @echo 'The spillage formula is : S = ' - @echo 'The projector P is : P = \sum_{mu,nu} |phi_mu> S^{-1} = (1-P1) |psi1>' - @echo 'So we can fonud that : P1|psi2> = 0 ' - @echo 'the Q matrix is : Q = ' - @echo 'the S matrix is : S = ' - @echo 'start index of band : BANDS_START(count from 1, not 0) ' - @echo 'end index of band : BANDS_END ' - -.cpp.o: - ${CPLUSPLUS} ${CXXFLAGS} -c $< -o $@ -# $(CPLUSPLUS_MPI) -c -D__MPI $< -o $@ - -.PHONY:clean -clean: - ${RM} *.o *.exe core* src_tools/*.o src_spillage/*.o tests_s/ORBITAL* tests_s/ORBITAL* src_parallel/*.o src_pw/*.o diff --git a/tools/SIAB/SimulatedAnnealing/source/Makefiles/Makefile.Einstein b/tools/SIAB/SimulatedAnnealing/source/Makefiles/Makefile.Einstein deleted file mode 100644 index c0bd26a3e9..0000000000 --- a/tools/SIAB/SimulatedAnnealing/source/Makefiles/Makefile.Einstein +++ /dev/null @@ -1,115 +0,0 @@ -#=========================================================== -# AUTHOR : mohan -# DATE START FROM : 2009-04-14 -# FUNCTION : spillage makefile -#=========================================================== -#Dirac -CPLUSPLUS =/usr/mpi/intel/openmpi-1.4.1/bin/mpicxx -O3 -#CPLUSPLUS_GPROF = g++ -gp -#CPLUSPLUS_MPI = /opt/openmpi/bin/mpicxx -O3 -w -CPLUSPLUS_MPI=/usr/mpi/intel/openmpi-1.4.1/bin/mpicxx -#Einstein -#CPLUSPLUS_MPI = /opt/openmpi-intel9/bin/mpicxx -O3 -w - -#EINSTEIN -#LIBS=-L/home/common/lib -llapack -lblas -lf2c - -#DIRAC -#LIBS = -L/share/apps/lib/ -llapack -lblas -L/share/data1/lib/ -lf2c\ - #-L/opt/intel/fce/9.1.052/lib/ -lifcore \ -#Einstein -#LIBS = -L/share/apps/lib -llapack -lblas -L/opt/intel/fce/9.1.052/lib/ -lifcore -LIBS = -L/opt/intel/cmkl/10.2.5.035/lib/em64t -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread - -TOOLS_OBJS=src_tools/mathzone.o \ - src_tools/matrix.o \ - src_tools/matrix3.o \ - src_tools/realarray.o \ - src_tools/intarray.o \ - src_tools/complexmatrix.o \ - src_tools/complexarray.o\ - src_tools/timer.o \ - src_tools/inverse_matrix.o\ - -SPILLAGE_OBJS=src_spillage/main.o \ - src_spillage/read_INPUT.o\ - src_spillage/ReadData.o\ - src_spillage/Calculate_C4.o\ - src_spillage/Coefficients.o\ - src_spillage/MultiZeta.o\ - src_spillage/SpillageStep.o\ - src_spillage/SpillageValue.o\ - src_spillage/Step_Data.o\ - src_spillage/Orthogonal.o\ - src_spillage/Type_Information.o\ - src_spillage/Metropolis.o\ - src_spillage/Out_Orbital.o\ - src_spillage/Plot_Psi.o\ - src_spillage/Psi_Second.o\ - src_spillage/tools.o \ - src_spillage/common.o \ - -PARALLEL_OBJS=src_parallel/parallel_global.o\ - src_parallel/parallel_common.o\ - src_parallel/parallel_reduce.o\ - src_parallel/parallel_kpoints.o - -PW_OBJS=src_pw/pw_basis.o\ - src_pw/pw_complement.o\ - src_pw/heapsort.o\ - src_pw/numerical_basis.o\ - src_pw/bessel_basis.o\ - src_pw/ylm_real.o\ - src_pw/memory_calculation.o\ - -OBJS = ${TOOLS_OBJS} \ - ${SPILLAGE_OBJS} \ - ${PARALLEL_OBJS} \ - ${PW_OBJS}\ - -help : - @echo 'make target list: ' - @echo 's : Series version of Monte Carlo Spillage Program.' - @echo 'p : Parallel Version of Monte Carlo Spillage Program.' - @echo 'note : some notes.' - -s : ${OBJS} - ${CPLUSPLUS} -o 045.MCSP_s.exe ${OBJS} ${LIBS} - -p : ${OBJS} - $(CPLUSPLUS_MPI) -D__MPI -o 045.MCSP_p.exe $(OBJS) $(LIBS) - -note : - @echo 'atom type label : it ' - @echo 'atom label for each type : ia ' - @echo 'The angular momentum : l ' - @echo 'The multiplicity : n ' - @echo 'The magnetic quantum num : m ' - @echo 'The k point index : ik ' - @echo 'The band index : ib ' - @echo 'The eigenvalue of Jlq : ie ' - @echo 'The radius cutoff (a.u.) : rcut ' - @echo 'The state is : psi(ib,ik) ' - @echo 'The local orbitals is : phi(it,ia,l,n,m) ' - @echo 'The index of local basis : nwfc(it,l,n)' - @echo 'The index of local basis : nwfc2(it,ia,l,n,m) ' - @echo 'The Spherical Bessel func : Jl(ie,rcut) ' - @echo 'The SB transform : \int Jl(ie,rcut) * Jl' - @echo 'The index of Jlq coef : Coef(it,l,n,ie)' - @echo 'The local orbitals formu : phi=\sum_{ie} Coef(it,l,n,ie) * Jl(ie,rcut)' - @echo 'The spillage formula is : S = ' - @echo 'The projector P is : P = \sum_{mu,nu} |phi_mu> S^{-1} = (1-P1) |psi1>' - @echo 'So we can fonud that : P1|psi2> = 0 ' - @echo 'the Q matrix is : Q = ' - @echo 'the S matrix is : S = ' - @echo 'start index of band : BANDS_START(count from 1, not 0) ' - @echo 'end index of band : BANDS_END ' - -.cpp.o: - ${CPLUSPLUS} -c $< -o $@ -# $(CPLUSPLUS_MPI) -c -D__MPI $< -o $@ - -.PHONY:clean -clean: - ${RM} *.o *.exe core* src_tools/*.o src_spillage/*.o tests_s/ORBITAL* tests_s/ORBITAL* src_parallel/*.o src_pw/*.o diff --git a/tools/SIAB/SimulatedAnnealing/source/README b/tools/SIAB/SimulatedAnnealing/source/README deleted file mode 100644 index 6c81c93ab5..0000000000 --- a/tools/SIAB/SimulatedAnnealing/source/README +++ /dev/null @@ -1 +0,0 @@ -New version with CXX11 diff --git a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/doc/Format.txt b/tools/SIAB/SimulatedAnnealing/source/README.md similarity index 78% rename from tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/doc/Format.txt rename to tools/SIAB/SimulatedAnnealing/source/README.md index 8a0963fb7e..89c6641010 100644 --- a/tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/doc/Format.txt +++ b/tools/SIAB/SimulatedAnnealing/source/README.md @@ -1,3 +1,6 @@ +The code is used to generate numerical atomic orbitals + + The format of orbital file: (1) First line: @@ -8,3 +11,4 @@ delta r (unit: Bohr) (3) Type(always 0, you can ignore it), L(angular momentum), N (multizeta) (4) wave function: psi (note, not psi*r). + diff --git a/tools/SIAB/SimulatedAnnealing/source/doc/Format.txt b/tools/SIAB/SimulatedAnnealing/source/doc/Format.txt deleted file mode 100644 index 8a0963fb7e..0000000000 --- a/tools/SIAB/SimulatedAnnealing/source/doc/Format.txt +++ /dev/null @@ -1,10 +0,0 @@ -The format of orbital file: - -(1) First line: -Mesh number - -(2) Second line: -delta r (unit: Bohr) - -(3) Type(always 0, you can ignore it), L(angular momentum), N (multizeta) -(4) wave function: psi (note, not psi*r). diff --git a/tools/SIAB/SimulatedAnnealing/source/src_spillage/Inverse_Matrix_S.h b/tools/SIAB/SimulatedAnnealing/source/src_spillage/Inverse_Matrix_S.h index 7317f7ef26..f177b534da 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_spillage/Inverse_Matrix_S.h +++ b/tools/SIAB/SimulatedAnnealing/source/src_spillage/Inverse_Matrix_S.h @@ -20,7 +20,7 @@ class Inverse_Matrix_S size_t dim{0}; size_t loop_count{0}; size_t exact_loop_num{1}; - const ComplexMatrix *inverse_old{nullptr}; + const ComplexMatrix *inverse_old = NULL; inline void copy_matrix_U2L(ComplexMatrix &matrix); inline void zero_matrix_L(ComplexMatrix &matrix); diff --git a/tools/SIAB/SimulatedAnnealing/source/src_spillage/Orthogonal.cpp b/tools/SIAB/SimulatedAnnealing/source/src_spillage/Orthogonal.cpp index 9c784b6ed8..71616d1405 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_spillage/Orthogonal.cpp +++ b/tools/SIAB/SimulatedAnnealing/source/src_spillage/Orthogonal.cpp @@ -42,7 +42,9 @@ void Orthogonal::start(SpillageStep &step1, SpillageStep &step2) } inverse.init( step1.data[istr].nwfc2 ); + #ifdef _OPENMP #pragma omp parallel for // Peize Lin add 2016-01-18 + #endif for (int ik=0; iknks ; ik++) { // cout << "ik=" << ik << endl; diff --git a/tools/SIAB/SimulatedAnnealing/source/src_spillage/common.h b/tools/SIAB/SimulatedAnnealing/source/src_spillage/common.h index 6973e7e896..a573be5462 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_spillage/common.h +++ b/tools/SIAB/SimulatedAnnealing/source/src_spillage/common.h @@ -24,7 +24,7 @@ using namespace std; #include "../src_tools/matrix3.h" #include "../src_tools/complexmatrix.h" #include "../src_tools/complexarray.h" -#include "../src_tools/module_external/lapack_connector.h" +#include "../src_tools/lapack_connector.h" #include "../src_tools/Random.h" #include "../src_tools/timer.h"// added 2009-4-17 #include "../src_tools/inverse_matrix.h" diff --git a/tools/SIAB/SimulatedAnnealing/source/src_spillage/main.cpp b/tools/SIAB/SimulatedAnnealing/source/src_spillage/main.cpp index 97b85d202c..19711cd88a 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_spillage/main.cpp +++ b/tools/SIAB/SimulatedAnnealing/source/src_spillage/main.cpp @@ -16,7 +16,7 @@ int main(int argc, char **argv) time_t time_start = time(NULL); timer::start(); cout <<" Start Time : " << ctime(&time_start); - std::srand(std::time(nullptr)); + std::srand(std::time(NULL)); // (2) if parallel, prepare. cout << " First read in the parameters from INPUT." << endl; diff --git a/tools/SIAB/SimulatedAnnealing/source/src_tools/complexarray.h b/tools/SIAB/SimulatedAnnealing/source/src_tools/complexarray.h index 525fb07fc0..6506fce530 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_tools/complexarray.h +++ b/tools/SIAB/SimulatedAnnealing/source/src_tools/complexarray.h @@ -35,25 +35,25 @@ class ComplexArray void zero_out(void); - const int getSize() const + int getSize() const { return size;} - const int getDim() const + int getDim() const { return dim;} - const int getBound1() const + int getBound1() const { return bound1;} - const int getBound2() const + int getBound2() const { return bound2;} - const int getBound3() const + int getBound3() const { return bound3;} - const int getBound4() const + int getBound4() const { return bound4;} - static const int getArrayCount(void) + int getArrayCount(void) { return arrayCount;} private: diff --git a/tools/SIAB/SimulatedAnnealing/source/src_tools/intarray.h b/tools/SIAB/SimulatedAnnealing/source/src_tools/intarray.h index 0fc7e90e16..3318578da1 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_tools/intarray.h +++ b/tools/SIAB/SimulatedAnnealing/source/src_tools/intarray.h @@ -49,16 +49,16 @@ class IntArray void zero_out(void); - const int getSize() const{ return size;} - const int getDim() const{ return dim;} - const int getBound1() const{ return bound1;} - const int getBound2() const{ return bound2;} - const int getBound3() const{ return bound3;} - const int getBound4() const { return bound4;} - const int getBound5() const { return bound5;} - const int getBound6() const { return bound6;} + int getSize() const{ return size;} + int getDim() const{ return dim;} + int getBound1() const{ return bound1;} + int getBound2() const{ return bound2;} + int getBound3() const{ return bound3;} + int getBound4() const { return bound4;} + int getBound5() const { return bound5;} + int getBound6() const { return bound6;} - static const int getArrayCount(void) + int getArrayCount(void) { return arrayCount;} private: diff --git a/tools/SIAB/SimulatedAnnealing/source/src_tools/inverse_matrix_iterate.h b/tools/SIAB/SimulatedAnnealing/source/src_tools/inverse_matrix_iterate.h index c224cd976c..19ef02ee38 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_tools/inverse_matrix_iterate.h +++ b/tools/SIAB/SimulatedAnnealing/source/src_tools/inverse_matrix_iterate.h @@ -24,11 +24,11 @@ class Inverse_Matrix_Iterate inline void iterate(const ComplexMatrix &old_X, ComplexMatrix &new_X); private: - ComplexMatrix *A_ptr{nullptr}; + ComplexMatrix *A_ptr = NULL; ComplexMatrix X_store_1; ComplexMatrix X_store_2; - const ComplexMatrix *X0_ptr{nullptr}; - const ComplexMatrix *inverse_ptr{nullptr}; + const ComplexMatrix *X0_ptr = NULL; + const ComplexMatrix *inverse_ptr = NULL; ComplexMatrix identity; ComplexMatrix matrix_tmp_1; ComplexMatrix matrix_tmp_2; @@ -52,4 +52,4 @@ class Inverse_Matrix_Iterate private: }; -#endif \ No newline at end of file +#endif diff --git a/tools/SIAB/SimulatedAnnealing/source/src_tools/realarray.h b/tools/SIAB/SimulatedAnnealing/source/src_tools/realarray.h index 4f4ec1c0ee..8c9e917f98 100644 --- a/tools/SIAB/SimulatedAnnealing/source/src_tools/realarray.h +++ b/tools/SIAB/SimulatedAnnealing/source/src_tools/realarray.h @@ -35,25 +35,25 @@ class realArray void zero_out(void); - const int getSize() const + int getSize() const { return size;} - const int getDim() const + int getDim() const { return dim;} - const int getBound1() const + int getBound1() const { return bound1;} - const int getBound2() const + int getBound2() const { return bound2;} - const int getBound3() const + int getBound3() const { return bound3;} - const int getBound4() const + int getBound4() const { return bound4;} - static const int getArrayCount(void) + int getArrayCount(void) { return arrayCount;} private: diff --git a/tools/SIAB/SimulatedAnnealing/source/tests_p/mpi.sh b/tools/SIAB/SimulatedAnnealing/source/tests_p/mpi.sh deleted file mode 100644 index 516726f973..0000000000 --- a/tools/SIAB/SimulatedAnnealing/source/tests_p/mpi.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -#PBS -l nodes=2:ppn=4 -#PBS -j oe -#PBS -V -#PBS -N MCSP - -# go to work dir -cd $PBS_O_WORKDIR - -# setup Nums of Processor -NP=`cat $PBS_NODEFILE|wc -l` -echo "Numbers of Processors: $NP" -echo "---------------------------" - -# running program -/share/data1/mpich-intel/bin/mpirun -np $NP -machinefile $PBS_NODEFILE ../040.MCSP_p.exe > Log.txt