forked from igor-1982/rest_workspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig
More file actions
executable file
·161 lines (150 loc) · 7.5 KB
/
Config
File metadata and controls
executable file
·161 lines (150 loc) · 7.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env bash
#==================================================================
# 0): Prerequisite libraries for REST:
# - These libraries must be installed and accessable during
# compilation and excution of the REST package.
# - For Detailed information, refer to the `README.rst` file
#==================================================================
# 1): set the current folder as REST_HOME
#==================================================================
REST_HOME=`pwd`
REST_EXT_DIR=$REST_HOME/lib
[ ! -d $REST_EXT_DIR ] && mkdir -p $REST_EXT_DIR
REST_EXT_INC=$REST_HOME/include
[ ! -d $REST_EXT_INC ] && mkdir -p $REST_EXT_INC
REST_CINT_DIR=$REST_EXT_DIR
REST_BLAS_DIR=$REST_EXT_DIR
#==================================================================
# parse the input arguements and initialize some parameters
#==================================================================
repository="github"
local_path=""
active="y"
REST_FORTRAN_COMPILER="gfortran"
while getopts r:p:ef:h option
do
case "${option}"
in
r) repository=${OPTARG};;
p) local_path=${OPTARG};;
e)
echo "DONOT add enviroments to bashrc"
active="n"
;;
f) REST_FORTRAN_COMPILER=${OPTARG};;
h)
echo "Usage: $(basename $0) [OPTION...] [OPTARG]"
echo "Configure the complitation and simulation environment for the REST package on Linux OS."
echo ""
echo "OPTION:"
echo " -h print the help information"
echo " -r OPTARG set the repository. The default OPTARG: github"
echo " local: local repositories"
echo " github: repositories on github"
echo " -p OPTARG provide the path to the local repositories"
echo " It is not necessary for the repositories on github"
echo " -e DONOT add enviroments to bashrc"
echo " This script will NOT modify your bashrc file. Use it only if you understand its implications"
echo " -f OPTARG set the compiler for the Fortran code. The default OPTARG: gfortran"
echo " "
echo " Example:"
echo " 0) ./Config"
echo " : use the repositories on github by default"
echo " 1) ./Config -r github -f fortran"
echo " : use the repositories on github by default, and it is not necessary to declare the repository path with '-p' "
echo " 2) ./Config -r local -p userid_@local_server:/path-to-the-repositories"
echo " : The configure script will then clone the rest, rest_tensors, rest_libcints via:"
echo " userid_@local_server:/path-to-the-repositories/rest.mirror"
echo " userid_@local_server:/path-to-the-repositories/rest_tensors.mirror"
echo " userid_@local_server:/path-to-the-repositories/rest_libcints.mirror"
echo " userid_@local_server:/path-to-the-repositories/rest_regression.mirror"
echo ""
echo "================================ IMPORTANT ISSUE =================================================="
echo "! External libraries for REST:"
echo "! - These libraries are required and should be placed in the `$REST_EXT_DIR` directory."
echo "! - For detailed information about the required libraries, please refer to the `README.rts` file."
echo "======================================================================================================"
echo ""
echo "Enjoy the electronic-structure calculations using the REST package!"
echo ""
exit
;;
?)
echo "script usage: $(basename $0) [-h] [-e] [-r] [OPTARG] [-p] [OPTARG]" >&2
exit 1
;;
esac
done
if [ $repository = "github" ]; then
export rest_repo_path="git@github.com:igor-1982/rest.git"
export rest_tensors_repo_path="git@github.com:igor-1982/rest_tensors.git"
export rest_libcint_repo_path="git@github.com:igor-1982/rest_libcint.git"
export rest_regress_repo_path="git@github.com:igor-1982/rest_regression.git"
echo $repository
elif [ $repository = "local" ]; then
export rest_repo_path="${local_path}/rest.mirror"
export rest_tensors_repo_path="${local_path}/rest_tensors.mirror"
export rest_libcint_repo_path="${local_path}/rest_libcint.mirror"
export rest_regress_repo_path="${local_path}/rest_regression.mirror"
echo $repository
else
echo "Invalid repository is used: $repository"
exit
fi
#==================================================================
# Clone the source codes from repositories
#==================================================================
[ ! -d rest ] && git clone $rest_repo_path rest
[ ! -d rest_tensors ] && git clone $rest_tensors_repo_path rest_tensors
[ ! -d rest_libcint ] && git clone $rest_libcint_repo_path rest_libcint
[ ! -d rest_regression ] && git clone $rest_regress_repo_path rest_regression
# untar the basis sets in the json format from BSE
if [ -f rest/basis_sets-json.tar.bz2 ]; then
tar -xjf rest/basis_sets-json.tar.bz2
mv basis_sets-json.tar.bz2 rest/bse_pool
fi
if ! command -v $REST_FORTRAN_COMPILER &> /dev/null
then
echo "The fortran compiler $REST_FORTRAN_COMPILER could not be found. Please use an available fortran compiler"
exit
else
echo "The fortran compiler $REST_FORTRAN_COMPILER is available"
fi
#============================================================================
# Appending the environment variables to `$HOME/.bash_profile`
#============================================================================
if [ $active = "y" ]; then
if [ ! -f $HOME/.bash_profile ]; then
echo 'export REST_FORTRAN_COMPILER="'$REST_FORTRAN_COMPILER'"' > $HOME/.bash_profile
else
echo 'export REST_FORTRAN_COMPILER="'$REST_FORTRAN_COMPILER'"' >> $HOME/.bash_profile
fi
echo 'export REST_HOME="'$REST_HOME'"' >> $HOME/.bash_profile
echo 'export REST_EXT_DIR="'$REST_EXT_DIR'"' >> $HOME/.bash_profile
echo 'export REST_EXT_INC="'$REST_EXT_INC'"' >> $HOME/.bash_profile
echo 'export REST_CINT_DIR="'$REST_CINT_DIR'"' >> $HOME/.bash_profile
echo 'export LD_LIBRARY_PATH="$REST_EXT_DIR:$LD_LIBRARY_PATH"' >> $HOME/.bash_profile
echo 'export HDF5_DIR="'$REST_HOME'"' >> $HOME/.bash_profile
echo "! Environment variables have been appended to $HOME/.bash_profile"
echo "! Activating them by running 'source \$HOME/.bash_profile'"
else
echo "! Note: Please activate the following environments manually..."
echo "-----------------------------------"
echo 'REST_FORTRAN_COMPILER="'$REST_FORTRAN_COMPILER'"'
echo 'REST_HOME="'$REST_HOME'"'
echo 'REST_EXT_DIR="'$REST_EXT_DIR'"'
echo 'REST_EXT_INC="'$REST_EXT_INC'"'
echo 'REST_CINT_DIR="'$REST_CINT_DIR'"'
echo 'export HDF5_DIR="'$REST_HOME'"'
echo 'LD_LIBRARY_PATH="$REST_EXT_DIR:$LD_LIBRARY_PATH"'
echo "-----------------------------------"
fi
echo "================================ IMPORTANT ISSUE =================================================="
echo "! External libraries for REST:"
echo "! - These libraries are required and should be placed in the `$REST_EXT_DIR` directory."
echo "! - For detailed information about the required libraries, please refer to the `README.rts` file."
echo "======================================================================================================"
#echo "! After running 'source \$HOME/.bash_profile', please execute the following commands in your terminal..."
#echo "! Note: After activating enviroments, please run the following commands in your terminal..."
#echo 'export RUSTDOCFLAGS="--html-in-header $REST_HOME/rest/katex.html"'
#echo 'export RUSTFLAGS="-L $REST_XC_DIR -lxc -L $REST_EXT_DIR -lrest2fch -C target-cpu=native"'