ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/utilities/waterBoxer
(Generate patch)

Comparing trunk/src/applications/utilities/waterBoxer (file contents):
Revision 1115 by gezelter, Tue Jan 9 03:42:14 2007 UTC vs.
Revision 1214 by xsun, Wed Jan 23 21:22:18 2008 UTC

# Line 3 | Line 3
3   # program that builds water boxes
4  
5   # author    = "Chris Fennell
6 < # version   = "$Revision: 1.2 $"
7 < # date      = "$Date: 2007-01-09 03:42:14 $"
6 > # version   = "$Revision: 1.5 $"
7 > # date      = "$Date: 2008-01-23 21:22:18 $"
8   # copyright = "Copyright (c) 2006 by the University of Notre Dame"
9   # license   = "OOPSE"
10  
# Line 104 | Line 104 | if ($waterName eq 'DPD') {
104    # DPD waters are stand-ins for 4 water molecules
105    $density = $density * 0.25;
106   }
107 + if ($waterName eq 'CG2') {
108 +  # CG2 waters are stand-ins for 2 water molecules
109 +  $density = $density * 0.5;
110 + }
111  
112   if (defined($opt_l)){
113    $nothingSelected = 0;
# Line 170 | Line 174 | if ($lattice == 0){
174    }
175   } elsif ($lattice == 1){
176    $crystalNumReal = ($nMol/1.0)**(1.0/3.0);
177 <  $crystalNum = int($crystalNumReal);
177 >  $crystalNum = int($crystalNumReal + $tolerance);
178    $remainder = $crystalNumReal - $crystalNum;
179    
180    # again, if crystalNumReal wasn't an integer, we bump the crystal to the next
# Line 256 | Line 260 | if ($lattice == 0) {
260    $zCorr[3] = $cell2Z;
261   # assemble the lattice
262    $counter = 0;
263 <  for ($z = 0; $z < $nx; $z++) {
263 >  for ($z = 0; $z < $nz; $z++) {
264      for ($y = 0; $y < $ny; $y++) {
265 <      for ($x = 0; $x < $nz; $x++) {
265 >      for ($x = 0; $x < $nx; $x++) {
266          for ($uc = 0; $uc < 4; $uc++) {
267            $xCorr[$uc+$counter] = $xCorr[$uc] + $cellLengthX*$x;
268            $yCorr[$uc+$counter] = $yCorr[$uc] + $cellLengthY*$y;
# Line 277 | Line 281 | if ($lattice == 0) {
281    $zCorr[0] = $cell2Z;
282   #assemble the lattice
283    $counter = 0;
284 <  for ($z = 0; $z < $nx; $z++) {
284 >  for ($z = 0; $z < $nz; $z++) {
285      for ($y = 0; $y < $ny; $y++) {
286 <      for ($x = 0; $x < $nz; $x++) {
286 >      for ($x = 0; $x < $nx; $x++) {
287          $xCorr[$counter] = $xCorr[0] + $cellLengthX*$x;
288          $yCorr[$counter] = $yCorr[0] + $cellLengthY*$y;
289          $zCorr[$counter] = $zCorr[0] + $cellLengthZ*$z;
# Line 439 | Line 443 | sub printWaterMD {
443    printSPCE();
444    printSPC();
445    printDPD();
446 +  printCG2();
447    print WATERMD "\n\n#endif";
448   }
449  
# Line 760 | Line 765 | sub printDPD {
765   }"
766   }
767  
768 + sub printCG2 {
769 +  print $waterFileHandle "\n\nmolecule{
770 +  name = \"CG2\";
771 +  
772 +  atom[0]{
773 +    type = \"CG2\";
774 +    position(0.0, 0.0, 0.0);
775 +  }
776 + }"
777 + }
778  
779   sub printFakeWater {
780    print $waterFileHandle "\n\nmolecule{
# Line 788 | Line 803 | sub validateWater {
803    elsif ($waterName eq 'SPCE')     { $waterCase = 11;   }
804    elsif ($waterName eq 'SPC')      { $waterCase = 12;   }
805    elsif ($waterName eq 'DPD')      { $waterCase = 13;   }
806 +  elsif ($waterName eq 'CG2')      { $waterCase = 14;   }
807    else                             { $invalidWater = 1; }
808   }
809  
# Line 806 | Line 822 | sub printWaterModel {
822    elsif ($waterCase == 11) { printSPCE();    }
823    elsif ($waterCase == 12) { printSPC();     }
824    elsif ($waterCase == 13) { printDPD();     }
825 +  elsif ($waterCase == 14) { printCG2();     }
826   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines