Skip to content

Commit 35b96e6

Browse files
authored
Merge pull request #86 from wszhang/develop
Integrate pytorch+dpsi method into original orbital-generation-script
2 parents 126336c + 6f43aa3 commit 35b96e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+978
-15238
lines changed

tools/SIAB/Generate_Orbital_AllInOne.sh

Lines changed: 546 additions & 202 deletions
Large diffs are not rendered by default.

tools/SIAB/README

Lines changed: 0 additions & 31 deletions
This file was deleted.

tools/SIAB/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SIAB Package Description
2+
3+
4+
(S)ystematically
5+
(I)mprovable
6+
(A)tomic orbital
7+
(B)asis generator based on spillage formula
8+
9+
10+
# HOW TO USE SIAB
11+
12+
The optimization can choose three minimization methods: 'Simulated Annealing', 'PyTorch Gradient' and 'PyTorch Gradient whit dpsi'.
13+
14+
The executable files for three methods are './SimulatedAnnealing/source/SIA_s.exe', './PyTorchGradient/source/main.py', '../opt_orb_pytorch_dpsi/main.py', respectively.
15+
16+
17+
## (1) write input file
18+
Firstly, write the input file, such as "ORBITAL_INPUT_DZP" in example-directories, for script 'Generate_Orbital_AllInOne.sh'.
19+
Both approachs, 'PyTorch Gradient' and 'Simulated Annealing', work with one bash script and use the same input file.
20+
Please use the absolute path for each each file and directory.
21+
22+
23+
## (2) set up dependence env
24+
Then, we set up the dependence env for ABACUS and SIAB, such as:
25+
'''
26+
module load hpcx/2.9.0/hpcx-intel-2019.update5 mkl/2019.update5 elpa/2019.05.002/hpcx-intel-2019.update5
27+
'''
28+
Especially for SIAB with 'PyTorch Gradient' approach, we need pytorch v1.1.0.
29+
30+
31+
### how to install pytorch:
32+
Take the HanHai20@USTC system for example:
33+
34+
''' bash
35+
$ module load gcc/7.5.0min #:optional, larger version gcc may not be necessary.
36+
$ module load anaconda3
37+
$ module list
38+
Currently Loaded Modulefiles:
39+
1) elpa/2019.05.002/hpcx-intel-2019.update5 4) hpcx/2.9.0/hpcx-intel-2019.update5 7) libxc/4.3.4/hpcx-intel-2019.update5
40+
2) gcc/7.5.0min 5) mkl/2019.update5
41+
3) intel/2019.update5 6) anaconda3_nompi
42+
$ python3 -V
43+
Python 3.7.4
44+
45+
$ conda create -n pytorch110 python=3.7
46+
$ source activate pytorch110 #or: conda activate pytorch110
47+
$ conda install pytorch torchvision torchaudio cpuonly -c pytorch
48+
$ source deactivate #or: conda deactivate
49+
50+
$ source activate pytorch110 #or: conda activate pytorch110
51+
$ pip3 install --user scipy numpy
52+
$ pip3 install --user torch_optimizer
53+
'''
54+
55+
56+
## (3) run generation
57+
Finally, 'cd' into an example folder, and run command like this:
58+
59+
''' bash
60+
../Generate_Orbital_AllInOne.sh ORBITAL_INPUT_DZP
61+
# or
62+
bsub -q idle -n 8 -oo running.log ../Generate_Orbital_AllInOne.sh ORBITAL_INPUT_DZP
63+
'''
64+
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#===========================================================
2+
# AUTHOR : mohan
3+
# DATE START FROM : 2009-04-14
4+
# FUNCTION : spillage makefile
5+
#===========================================================
6+
### Dirac
7+
#CPLUSPLUS =CC -O3 -w -ffast-math -funroll-loops
8+
#CPLUSPLUS = /export/soft/intel2015/impi/5.0.2.044/intel64/bin/mpiicpc
9+
#CXXFLAGS = -std=c++11 -O3 -openmp
10+
#CPLUSPLUS_GPROF = g++ -gp
11+
#CPLUSPLUS_MPI = /opt/openmpi/bin/mpicxx -O3 -w
12+
#CPLUSPLUS_MPI=/export/soft/intel2015/impi/5.0.2.044/intel64/bin/mpiicpc
13+
14+
### Einstein
15+
#CPLUSPLUS_MPI = /opt/openmpi-intel9/bin/mpicxx -O3 -w
16+
17+
#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 \
18+
19+
### Version TC4600 wszhang
20+
CPLUSPLUS = /opt/hpcx/2.9.0/ompi-icc/2019.update5/bin/mpicxx
21+
CPLUSPLUS_MPI = /opt/hpcx/2.9.0/ompi-icc/2019.update5/bin/mpicxx
22+
CXXFLAGS = -std=c++11 -O2 -xCORE-AVX2 -align -fma -ftz -fomit-frame-pointer -finline-functions \
23+
-I${MKLROOT}/include -I${MKLROOT}/include/intel64/ilp64
24+
LIBS = -L${MKLROOT}/lib/intel64 \
25+
-lmkl_blacs_intelmpi_lp64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -limf
26+
27+
28+
29+
TOOLS_OBJS=src_tools/mathzone.o \
30+
src_tools/matrix.o \
31+
src_tools/matrix3.o \
32+
src_tools/realarray.o \
33+
src_tools/intarray.o \
34+
src_tools/complexmatrix.o \
35+
src_tools/complexarray.o\
36+
src_tools/timer.o \
37+
src_tools/inverse_matrix.o\
38+
src_tools/inverse_matrix_iterate.o\
39+
src_tools/Simulated_Annealing.o\
40+
41+
SPILLAGE_OBJS=src_spillage/main.o \
42+
src_spillage/read_INPUT.o\
43+
src_spillage/ReadData.o\
44+
src_spillage/Calculate_C4.o\
45+
src_spillage/Coefficients.o\
46+
src_spillage/MultiZeta.o\
47+
src_spillage/SpillageStep.o\
48+
src_spillage/SpillageValue.o\
49+
src_spillage/Step_Data.o\
50+
src_spillage/Inverse_Matrix_S.o\
51+
src_spillage/Orthogonal.o\
52+
src_spillage/Type_Information.o\
53+
src_spillage/Metropolis.o\
54+
src_spillage/Metropolis_2.o\
55+
src_spillage/Out_Orbital.o\
56+
src_spillage/Plot_Psi.o\
57+
src_spillage/Psi_Second.o\
58+
src_spillage/tools.o \
59+
src_spillage/common.o \
60+
61+
PARALLEL_OBJS=src_parallel/parallel_global.o\
62+
src_parallel/parallel_common.o\
63+
src_parallel/parallel_reduce.o\
64+
src_parallel/parallel_kpoints.o
65+
66+
PW_OBJS=src_pw/pw_basis.o\
67+
src_pw/pw_complement.o\
68+
src_pw/heapsort.o\
69+
src_pw/numerical_basis.o\
70+
src_pw/bessel_basis.o\
71+
src_pw/ylm_real.o\
72+
src_pw/memory_calculation.o\
73+
74+
OBJS = ${TOOLS_OBJS} \
75+
${SPILLAGE_OBJS} \
76+
${PARALLEL_OBJS} \
77+
${PW_OBJS}\
78+
79+
help :
80+
@echo 'make target list: '
81+
@echo 's : Series version of Monte Carlo Spillage Program.'
82+
@echo 'p : Parallel Version of Monte Carlo Spillage Program.'
83+
@echo 'note : some notes.'
84+
85+
s : ${OBJS}
86+
${CPLUSPLUS} ${CXXFLAGS} -o SIA_s.exe ${OBJS} ${LIBS}
87+
88+
p : ${OBJS}
89+
$(CPLUSPLUS_MPI) -D__MPI ${CXXFLAGS} -o SIA_p.exe $(OBJS) $(LIBS)
90+
91+
note :
92+
@echo 'atom type label : it '
93+
@echo 'atom label for each type : ia '
94+
@echo 'The angular momentum : l '
95+
@echo 'The multiplicity : n '
96+
@echo 'The magnetic quantum num : m '
97+
@echo 'The k point index : ik '
98+
@echo 'The band index : ib '
99+
@echo 'The eigenvalue of Jlq : ie '
100+
@echo 'The radius cutoff (a.u.) : rcut '
101+
@echo 'The state is : psi(ib,ik) '
102+
@echo 'The local orbitals is : phi(it,ia,l,n,m) '
103+
@echo 'The index of local basis : nwfc(it,l,n)'
104+
@echo 'The index of local basis : nwfc2(it,ia,l,n,m) '
105+
@echo 'The Spherical Bessel func : Jl(ie,rcut) '
106+
@echo 'The SB transform : \int Jl(ie,rcut) * Jl'
107+
@echo 'The index of Jlq coef : Coef(it,l,n,ie)'
108+
@echo 'The local orbitals formu : phi=\sum_{ie} Coef(it,l,n,ie) * Jl(ie,rcut)'
109+
@echo 'The spillage formula is : S = <psi|(1-P)|psi>'
110+
@echo 'The projector P is : P = \sum_{mu,nu} |phi_mu> S^{-1} <phi_nu| '
111+
@echo 'The orthogonal formula is : |psi2> = (1-P1) |psi1>'
112+
@echo 'So we can fonud that : P1|psi2> = 0 '
113+
@echo 'the Q matrix is : Q = <Jlq|psi> '
114+
@echo 'the S matrix is : S = <Jlq|Jlq> '
115+
@echo 'start index of band : BANDS_START(count from 1, not 0) '
116+
@echo 'end index of band : BANDS_END '
117+
118+
.cpp.o:
119+
${CPLUSPLUS} ${CXXFLAGS} -c $< -o $@
120+
# $(CPLUSPLUS_MPI) -c -D__MPI $< -o $@
121+
122+
.PHONY:clean
123+
clean:
124+
${RM} *.o *.exe core* src_tools/*.o src_spillage/*.o tests_s/ORBITAL* tests_s/ORBITAL* src_parallel/*.o src_pw/*.o
-959 KB
Binary file not shown.

tools/SIAB/example1_Si_DZP_SA/14_Si_100/14_Si_100.stru

Lines changed: 0 additions & 15 deletions
This file was deleted.

tools/SIAB/example1_Si_DZP_SA/14_Si_100/6/INPUT

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)