File size: 10,666 Bytes
74e10df | 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 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | #!/usr/bin/perl -w
use File::Copy;
use File::Path;
# framework-information
@framework = ("MOF-1-Dybtsev-dmol"); # list of structures
@HeliumVoidFraction = ("0.627073"); # list of helium-voidfractions for the structures
@UnitCells = ("3 3 3"); # list of sizes of the unit cells for the structures
@Forcefield=("ExampleMOFsForceField");
# temperature-information
@temperature = (313.0); # list of temperatures
@molecule = ("hexane","3-methylpentane","22-dimethylbutane"); # list of molecules
@mol_fraction = (1.0/3.0,1.0/3.0,1.0/3.0);
# loading-information
$loading_start = 1;
$loading_end = 80;
$number_of_loading_points = 32; # 32 point equally spaced
# simulation-information
$SimulationType="MolecularDynamics";
$NumberOfCycles="100000000000";
$NumberOfInitializationCycles="10000";
$NumberOfEquilibrationCycles="100000";
$PrintEvery="10000";
$RestartFile="no";
# system and queuing information
$divide_into_batches="yes"; # combine serial run in larger blocks
$batches = 8; # combine into an 8-core job
$queue = "mof1"; # the queue type
$job_name = "MD"; # name of the job
for($i=0;$i<$number_of_loading_points;$i++)
{
$loading[$i]=($loading_end-$loading_start)*($i/($number_of_loading_points-1))+$loading_start;
}
# get cluster-name
chomp($cluster = `hostname -s`);
# empty 'submit-file'
open(DATw4, ">submit") || die("Could not open file!");
close(DATw4);
$index_batches=0;
$count=0;
$index_framework=0;
foreach (@framework)
{
$dir_fr=$framework[$index_framework];
mkpath($dir_fr);
$index_temperature=0;
foreach (@temperature)
{
$dir_temp="$dir_fr/$temperature[$index_temperature]K";
mkpath($dir_temp);
# concat the molecule names with "-" between them
$molecule_list = join("-",@molecule);
$dir_mol="$dir_temp/$molecule_list";
mkpath($dir_mol);
$index_loading=0;
foreach (@loading)
{
$dir_loading="$dir_mol/$loading[$index_loading]_mol_per_cell";
mkpath($dir_loading);
open(DATw1, ">$dir_loading/run") || die("Could not open file!");
printf DATw1 "#! /bin/sh -f\n";
printf DATw1 "export RASPA_DIR=\${HOME}/RASPA/simulations/\n";
printf DATw1 "\${RASPA_DIR}/bin/simulate \$1";
close(DATw1);
chmod 0755, "$dir_loading/run";
if(($cluster eq "login3") || ($cluster eq "login4"))
{
open(DATw1, ">$dir_loading/bsub.job") || die("Could not open file!");
printf DATw1 "#!/bin/bash\n";
printf DATw1 "#PBS -S /bin/bash\n";
printf DATw1 "#PBS -l nodes=1\n";
printf DATw1 "#PBS -N $job_name\n";
printf DATw1 "#PBS -l walltime=120:00:00\n";
printf DATw1 "#PBS -o pbs.out\n";
printf DATw1 "#PBS -e pbs.err\n";
printf DATw1 "#PBS -r n\n";
printf DATw1 "#PBS -V\n";
printf DATw1 "#PBS -mba\n";
printf DATw1 "\n";
printf DATw1 "cd \${PBS_O_WORKDIR}\n";
printf DATw1 "\n";
printf DATw1 "echo \$JOB_ID > jobid\n";
printf DATw1 "export RASPA_DIR=\${HOME}/RASPA/simulations/\n";
printf DATw1 "\${RASPA_DIR}/bin//simulate \$1\n";
close(DATw1);
chmod 0755, "$dir_loading/bsub.job";
}
elsif($cluster eq "carbon")
{
open(DATw1, ">$dir_loading/bsub.job") || die("Could not open file!");
printf DATw1 "#!/bin/bash\n";
printf DATw1 "# script for Grid Engine\n";
printf DATw1 "#\$ -S /bin/bash\n";
printf DATw1 "#\$ -q $queue\n";
printf DATw1 "#\$ -N $job_name\n";
printf DATw1 "#\$ -V\n";
printf DATw1 "#\$ -cwd\n";
printf DATw1 "#\$ -notify\n";
printf DATw1 "\n";
printf DATw1 "echo \$JOB_ID > jobid\n";
printf DATw1 "export RASPA_DIR=\${HOME}/RASPA/simulations/\n";
printf DATw1 "\${RASPA_DIR}/bin/simulate \$1\n";
close(DATw1);
chmod 0755, "$dir_loading/bsub.job";
}
elsif($cluster eq "kraken")
{
open(DATw1, ">$dir_loading/bsub.job") || die("Could not open file!");
printf DATw1 "#!/bin/bash\n";
printf DATw1 "# script for Grid Engine\n";
printf DATw1 "#\$ -S /bin/bash\n";
printf DATw1 "#\$ -q $queue\n";
printf DATw1 "#\$ -N $job_name\n";
printf DATw1 "#\$ -V\n";
printf DATw1 "#\$ -cwd\n";
printf DATw1 "#\$ -notify\n";
printf DATw1 "\n";
printf DATw1 "# set path for intel compiler libraries\n";
printf DATw1 "source /opt/intel/cce/10.1.018/bin/iccvars.sh\n";
printf DATw1 "\n";
printf DATw1 "echo \$JOB_ID > jobid\n";
printf DATw1 "export RASPA_DIR=\${HOME}/RASPA/simulations/\n";
printf DATw1 "\${RASPA_DIR}/bin/simulate \$1\n";
close(DATw1);
chmod 0755, "$dir_loading/bsub.job";
}
open(DATw3, ">$dir_loading/simulation.input") || die("Could not open file!");
print DATw3 "SimulationType $SimulationType\n";
print DATw3 "NumberOfCycles $NumberOfCycles\n";
print DATw3 "NumberOfInitializationCycles $NumberOfInitializationCycles\n";
print DATw3 "NumberOfEquilibrationCycles $NumberOfEquilibrationCycles\n";
print DATw3 "PrintEvery $PrintEvery\n";
print DATw3 "RestartFile $RestartFile\n";
print DATw3 "\n";
print DATw3 "ContinueAfterCrash no\n";
print DATw3 "WriteBinaryRestartFileEvery 5000\n";
print DATw3 "\n";
print DATw3 "Ensemble NVT\n";
print DATw3 "\n";
print DATw3 "ChargeMethod Ewald\n";
print DATw3 "Forcefield $Forcefield[$index_framework]\n";
print DATw3 "EwaldPrecision 1e-6\n";
print DATw3 "TimeStep 0.0005\n";
print DATw3 "\n";
print DATw3 "Framework 0\n";
print DATw3 "FrameworkName $framework[$index_framework]\n";
print DATw3 "UnitCells $UnitCells[$index_framework]\n";
print DATw3 "HeliumVoidFraction $HeliumVoidFraction[$index_framework]\n";
print DATw3 "ExternalTemperature $temperature[$index_temperature]\n";
print DATw3 "ExternalPressure 0\n";
print DATw3 "\n";
$index_molecule=0;
foreach (@molecule)
{
print DATw3 "\n";
print DATw3 "Component $index_molecule MoleculeName $molecule[$index_molecule]\n";
print DATw3 " StartingBead 0\n";
print DATw3 " MoleculeDefinition ExampleDefinitions\n";
print DATw3 " FugacityCoefficient 1.0\n";
print DATw3 " TranslationProbability 1.0\n";
print DATw3 " RotationProbability 1.0\n";
print DATw3 " ReinsertionProbability 1.0\n";
print DATw3 " CBMCProbability 1.0\n";
print DATw3 " SwapProbability 0.0\n";
printf DATw3 " CreateNumberOfMolecules %d\n",$loading[$index_loading]*$mol_fraction[$index_molecule];
$index_molecule=$index_molecule+1;
}
close(DATw3);
if($divide_into_batches eq "yes")
{
if($count%$batches==0)
{
$index_batches=$index_batches+1;
if(($cluster eq "login3") || ($cluster eq "login4"))
{
open(DATw4, ">submit_$index_batches") || die("Could not open file!");
print DATw4 "\#\!/bin/bash\n";
print DATw4 "#PBS -S /bin/bash\n";
print DATw4 "#PBS -l nodes=1\n";
print DATw4 "#PBS -N $job_name\n";
print DATw4 "#PBS -l walltime=120:00:00\n";
print DATw4 "#PBS -o pbs.out\n";
print DATw4 "#PBS -e pbs.err\n";
print DATw4 "#PBS -r n\n";
print DATw4 "#PBS -V\n";
print DATw4 "#PBS -mba\n";
print DATw4 "\n";
print DATw4 "cd \$\{PBS_O_WORKDIR\}\n";
print DATw4 "\n";
close(DATw4);
chmod 0755, "submit_$index_batches"
}
elsif($cluster eq "carbon")
{
open(DATw4, ">submit_$index_batches") || die("Could not open file!");
printf DATw4 "#!/bin/bash\n";
printf DATw4 "# script for Grid Engine\n";
printf DATw4 "#\$ -S /bin/bash\n";
printf DATw4 "#\$ -q $queue\n";
printf DATw4 "#\$ -N $job_name\n";
printf DATw4 "#\$ -V\n";
printf DATw4 "#\$ -cwd\n";
printf DATw4 "#\$ -pe orte $batches\n";
printf DATw4 "#\$ -notify\n";
printf DATw4 "\n";
close(DATw4);
chmod 0755, "$dir_loading/bsub.job";
}
elsif($cluster eq "kraken")
{
open(DATw4, ">submit_$index_batches") || die("Could not open file!");
printf DATw4 "#!/bin/bash\n";
printf DATw4 "# script for Grid Engine\n";
printf DATw4 "#\$ -S /bin/bash\n";
printf DATw4 "#\$ -q $queue\n";
printf DATw4 "#\$ -N $job_name\n";
printf DATw4 "#\$ -V\n";
printf DATw4 "#\$ -cwd\n";
printf DATw4 "#\$ -pe orte $batches\n";
printf DATw4 "#\$ -notify\n";
printf DATw4 "\n";
printf DATw4 "# set path for intel compiler libraries\n";
printf DATw4 "source /opt/intel/cce/10.1.018/bin/iccvars.sh\n";
printf DATw4 "\n";
close(DATw4);
chmod 0755, "$dir_loading/bsub.job";
}
open(DATw5, ">>submit") || die("Could not open file!");
print DATw5 "qsub ./submit_$index_batches\n";
close(DATw5);
}
open(DATw5, ">>submit_$index_batches") || die("Could not open file!");
print DATw5 "cd \"$dir_loading\"\n";
print DATw5 ".\/run > out 2\>\&1\&\n";
print DATw5 "cd -\n";
if(($count+1)%$batches==0) {print DATw5 "wait\n";}
close(DATw5);
$count=$count+1;
}
else
{
open(DATw4, ">>submit") || die("Could not open file!");
print DATw4 "cd \"$dir_loading\"\n";
print DATw4 "qsub bsub.job\n";
print DATw4 "cd -\n";
close(DATw4);
}
$index_loading=$index_loading+1;
}
$index_temperature=$index_temperature+1;
}
$index_framework=$index_framework+1;
}
# put a "wait" on the last submit which (probably) is not a full batch
if($divide_into_batches eq "yes")
{
open(DATw5, ">>submit_$index_batches") || die("Could not open file!");
if(($count)%$batches!=0) {print DATw5 "wait\n";}
close(DATw5);
}
chmod 0755, "submit"
|