| 3 |
|
# program that builds water boxes |
| 4 |
|
|
| 5 |
|
# author = "Chris Fennell |
| 6 |
< |
# version = "$Revision: 1.3 $" |
| 7 |
< |
# date = "$Date: 2006-10-02 23:27:40 $" |
| 6 |
> |
# version = "$Revision: 1.4 $" |
| 7 |
> |
# date = "$Date: 2006-10-02 23:54:30 $" |
| 8 |
|
# copyright = "Copyright (c) 2006 by the University of Notre Dame" |
| 9 |
|
# license = "OOPSE" |
| 10 |
|
|
| 26 |
|
$waterCase = -1; |
| 27 |
|
|
| 28 |
|
# get our options |
| 29 |
< |
getopts('hmrvd:l:n:w:'); |
| 29 |
> |
getopts('hmrvd:l:n:o:w:'); |
| 30 |
|
|
| 31 |
|
# if we don't have a filename, drop to -h |
| 32 |
< |
$opt_h = 'true' if $#ARGV != 0; |
| 32 |
> |
$opt_h = 'true' if $#ARGV != -1; |
| 33 |
|
|
| 34 |
|
# our option output |
| 35 |
|
if ($opt_h){ |
| 36 |
|
print "waterBoxer: builds water boxes\n\n"; |
| 37 |
< |
print "usage: waterBoxer [-hv] [-d density] [-l lattice] [-n # waters]\n"; |
| 38 |
< |
print "\t[-w water name] [file name]\n\n"; |
| 37 |
> |
print "usage: waterBoxer [-hmrv] [-d density] [-l lattice] [-n # waters]\n"; |
| 38 |
> |
print "\t[-o file name] [-w water name] \n\n"; |
| 39 |
|
print " -h : show this message\n"; |
| 40 |
|
print " -m : print out a water.md file (file with all water models)\n"; |
| 41 |
|
print " -r : randomize orientations\n"; |
| 46 |
|
print " (default: 0)\n"; |
| 47 |
|
print " -n integer : # of water molecules\n"; |
| 48 |
|
print " (default: 500)\n"; |
| 49 |
+ |
print " -o char : output file name\n"; |
| 50 |
+ |
print " (default: freshWater.md)\n"; |
| 51 |
|
print " -w char : name of the water stunt double\n"; |
| 52 |
|
print " (default: SPCE)\n"; |
| 53 |
|
print "Example:\n"; |
| 54 |
< |
die " waterBoxer -d 0.997 -n 864 -w SSD_RF ssdrfWater.md\n"; |
| 54 |
> |
die " waterBoxer -d 0.997 -n 864 -w SSD_RF -o ssdrfWater.md\n"; |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
# set some variables to be used in the code |
| 58 |
< |
$fileName = $ARGV[0]; |
| 59 |
< |
if (defined($fileName)){ |
| 58 |
> |
if (defined($opt_o)){ |
| 59 |
> |
$fileName = $opt_o; |
| 60 |
|
} else { |
| 61 |
< |
$fileName = 'waterBox'; |
| 61 |
> |
$fileName = 'freshWater.md'; |
| 62 |
|
} |
| 63 |
|
if ($opt_m){ |
| 64 |
|
die "$fileName cannot be \"water.md\"\n\tPlease choose a different name\n" if $fileName eq 'water.md'; |
| 76 |
|
$waterName = 'SPCE'; |
| 77 |
|
} |
| 78 |
|
validateWater(); |
| 79 |
+ |
if ($invalidWater == 1){ |
| 80 |
+ |
print "Warning: \'$waterName\' is not a recognized water model name.\n"; |
| 81 |
+ |
print " Use the \'-m\' option to generate a \'water.md\' with the\n"; |
| 82 |
+ |
print " recognized water model geometries.\n"; |
| 83 |
+ |
} |
| 84 |
|
if (defined($opt_d)){ |
| 85 |
|
if ($opt_d =~ /^[0-9]/) { |
| 86 |
|
$density = $opt_d; |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
writeOutFile(); |
| 205 |
+ |
print "Water box \"$fileName\" generated.\n"; |
| 206 |
|
|
| 207 |
< |
if ($opt_m || $invalidWater){ |
| 207 |
> |
if ($opt_m){ |
| 208 |
|
printWaterMD(); |
| 209 |
+ |
print "File \"water.md\" generated for inclusion in \"$fileName\"\n"; |
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
# this marks the end of the main program, below is subroutines |