-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunCharge
More file actions
235 lines (166 loc) · 8.05 KB
/
runCharge
File metadata and controls
235 lines (166 loc) · 8.05 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/bin/bash
# --------------------------------------------------#
# PARTIAL CHARGE COMPUTING AND STRUCTURE ANALYSIS #
# --------------------------------------------------#
# This script prepare everything for RASPA simulations!
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
adsorbate=charge_equilibration
# --------------------------------------------------#
# CHECK BELOW THE PARAMETERS #
# --------------------------------------------------#
cutoff=12; # CutOff of the simulation
Cores=17; # Cores I would like to use
FreeProcessors=0;
start=$(date +%d%b%y)
mkdir ./frameworks/BoronCIF
echo -e "Here the log-file named COF_analysis.$start.log" >> COF_pore.$start.log
# --------------------------------------------------#
# PARAMETER DECLARATION #
# --------------------------------------------------#
echo -e "Name Density H B C O N P S Cl" >> composition.temp
symbol=(H B C O N P S Cl)
mass=(1.00784 10.811 12.0107 15.999 14.0067 30.973762 32.065 35.453)
probe_radius1=1.2 ## (A) for Channel identification and dimensionality
chan_radius=1.2
probe_radius2=1.2
num_samples=2000
clear
echo -e "_______________________________________________________________________\n"
echo " "
echo "This script computes ${green}Composition${reset}"
echo "This script computes ${green}Surface area${reset}"
echo "This script compute ${green}Charge Equilibration${reset}"
echo " "
echo -e "\n_______________________________________________________________________\n"
# All the CIF structures in the folder FRAMEWORK are analyzed
for filename in /home/s2216474/RASPA/simulations/share/raspa/structures/cif/TpPa*.cif
do
FreeProcessors=0 # Assuming there are no Free Processors available, so we can go through the while loop.
## Check if a processor is resting and stop until one is ready to go
while [ $FreeProcessors -le 0 ]
do
# --------------------------------------------------#
# HEADER #
# --------------------------------------------------#
clear ## Clean the screen and the header below
echo -e "_______________________________________________________________________\n"
echo " "
echo "This script computes ${green}Stoichiometric Composition${reset}"
echo "This script computes ${green}Surface area${reset} using Zeo++ (probe radius $probe_radius A)"
echo "This script performes ${green}Charge Equilibration${reset} using RASPA"
echo " "
## Check the cores working on RASPA
Jobs=$(ps ax | grep -c RASPA)
Jobs=$(($Jobs-1))
FreeProcessors=$(($Cores-$Jobs))
echo -e "Cores used ${green}$Jobs / $Cores${reset}.\n"
## Print the log to show the progress
cat COF_analysis.$start.log
echo -e "\n_______________________________________________________________________\n"
sleep 0.5s ## Hold on a moment
done ## Check every 5s if a core is free.
COFname=$(basename "$filename" .cif)
## Check if this is the first time I see this CIF.
# if [ -d $adsorbate ] #~RDS/ChargedCIF/$COFname ] ## Is there a folder in urea folder?#
#
# then ## In the case there is already a folder
#
# echo "I already worked on ${red}$COFname${reset}. Let's place it in DONE and pick the next one."
# #mv $filename ./done
# echo -e "$COFname \t$(date)\tSKIPPED" >> COF_analysis.$start.log
#
# else ## Otherwise#
#
# echo -e "\nLet's pick a new one!"
## Copy the structure in the main CIF folder of RASPA
#cp $filename /home/s2216474/RASPA/simulations/share/raspa/structures/cif/$COFname.cif
TotalMass=0
N_C=0; N_O=0; N_N=0; N_H=0;
n=(0 0 0 0 0 0 0 0)
massfrac=(0 0 0 0 0 0 0 0)
TotalMass=0; TotalMol=0
# --------------------------------------------------#
# COMPOSITION OF CIF (H,B,C,N,S,P) #
# --------------------------------------------------#
for i in {0..7} ## Let's compute atoms presence
do
n[i]=$(grep -o " ${symbol[i]} " "$filename" | wc -l)
TotalMol=$(echo "${n[i]}+$TotalMol" | bc -l )
m[i]=$(echo "${mass[i]}*${n[i]}" | bc -l )
TotalMass=$(echo "${m[i]}+$TotalMass" | bc -l )
done
echo -ne "\n$COFname\t" >> composition.temp ## Save results
echo -ne "$TotalMass\t" >> composition.temp
for i in {0..7} ## Let's compute composition
do
molarfrac[i]=$(echo "${n[i]}/$TotalMol" | bc -l )
massfrac[i]=$(echo "${m[i]}/$TotalMass" | bc -l )
echo -ne "${molarfrac[i]}\t" >> composition.temp ## Save results in a file
echo -ne "${massfrac[i]}\t" >> composition.temp ## Save results in a file
done
echo -e "Composition analysis: Done."
##echo -e "Boron concentration ${molarfrac[1]}"
##echo "$(echo "${molarfrac[1]} < 0.00001" | bc -l)"
## Let's check if there are B atoms in the CIF structure and skip them.
if [ $(echo "${molarfrac[1]} < 1" | bc -l) -eq 1 ]
then
cd ./$adsorbate
mkdir -p $COFname
echo "Building a folder for ${red}$COFname${reset} and copying required files."
cp ../start/* ./$COFname
cd ./$COFname
rm ./simulation.input >> outputfile
# --------------------------------------------------#
# TOPOLOGICAL ANALYSIS OF CIF #
# --------------------------------------------------#
#echo -e "Done. Pore diameters."
## echo -e "Done. \n Channel identification and dimensionality."
#/home/s2216474/zeo++-0.3/network -ha -sa "$probe_radius" "$probe_radius" 5000 ../../$filename >> outputfile
##echo -e "Done. \n Channel identification and dimensionality."
##../../../../../zeo++-0.3/network -ha -chan 1.2 ../../$filename >> channel.txt
##echo -e "Done. \n Vornoi."
##../../../../../zeo++-0.3/network -r -nt2 ../../$filename
##echo -e "Done. \n Spheres."
##../../../../../zeo++-0.3/network -gridG ../../$filename
##echo -e "Done. \n Spheres."
##../../../../../zeo++-0.3/network -gridBOV ../../$filename
##../../../../../zeo++-0.3/network -ray_atom 1.2 1.2 500 outputfile.ray ../../$filename
##../../../../../zeo++-0.3/network -axs 1.6 outputfile.axs ../../$filename
##echo -e "Done. \n Surface area."
##../../../../../zeo++-0.3/network -ha -psd 1.2 1.2 50000 ../../$filename >> outputfile
##echo -e "Done. \n Structure analysis."
##../../../../../zeo++-0.3/network -strinfo ../../$filename >> outputfile
# --------------------------------------------------#
# PREPARE THE INPUT FILE FOR CHARGE EQUILIBRATION #
# --------------------------------------------------#
echo "Writing simulation input file!"
echo "SimulationType MonteCarlo
NumberOfCycles 0
InitializationCycles 0
Forcefield Local
Framework 0
FrameworkName $COFname
UnitCells 1 1 1 ## To be understood if this is enough!
ChargeFromChargeEquilibration yes
ChargeEquilibrationPeriodic yes" >> ./simulation.input
./run > outputfile 2>&1 & ## Run the Charge Equilibration in background
cd ../../
echo -e "Launched Charge Equilibration on $COFname . Done!"
echo -e "$COFname \t$(date)\tRUN" >> COF_analysis.$start.log ## Report the CIF in the log
## Wanna see the input?
## more ./simulation.input
else ## This is the case of a Boron containing CIF structure
echo -e "${red} $COFname contains Boron!${reset} Let's skip this structure."
echo -e "$COFname \t$(date)\tBORON " >> COF_analysis.$start.log
## Sort these CIF files, place them in a folder and forget about them for the moment
mv $filename ./BoronCIF
fi
#fi
echo -e "\n_______________________________________________________________________\n"
sleep 2s ## Just a little break!
done ## Let's start with a new one!
mv *.log ./log/ ## Place the log in a safe place!
echo -e "\n The charge equilibration is over! Let's move forward with the Widom. \n"
##./runHenry ## Recall the script for this purpose.