ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/utils/sysbuilder/bilayerSys.cpp
(Generate patch)

Comparing trunk/OOPSE/utils/sysbuilder/bilayerSys.cpp (file contents):
Revision 700 by chuckv, Mon Aug 18 20:59:47 2003 UTC vs.
Revision 763 by tim, Mon Sep 15 16:52:02 2003 UTC

# Line 1 | Line 1
1 +
2   #include <iostream>
3 + #include <vector>
4 + #include <algorithm>
5  
6   #include <cstdlib>
7   #include <cstring>
8   #include <cmath>
9  
10 +
11   #include "simError.h"
12   #include "SimInfo.hpp"
13   #include "ReadWrite.hpp"
# Line 14 | Line 18
18  
19   #include "latticeBuilder.hpp"
20  
21 + class SortCond{
22 +  
23 + public:
24 +  bool operator()(const pair<int, double>& p1, const pair<int, double>& p2){
25 +    return p1.second < p2.second;
26 +  }
27 +  
28 +  
29 + };
30 +
31 +
32   void buildMap( double &x, double &y, double &z,
33                 double boxX, double boxY, double boxZ );
34  
# Line 234 | Line 249 | int buildRandomBilayer( void ){
249    targetWaters = (int) ( targetWaters * 1.2 );
250  
251    // find the best box size for the sim
252 +
253 +  int nCellsX, nCellsY, nCellsZ;
254 +
255 +  const double boxTargetX = 66.22752;
256 +  const double boxTargetY = 60.53088;
257  
258 +  nCellsX = (int)ceil(boxTargetX / waterCell);
259 +  nCellsY = (int)ceil(boxTargetY / waterCell);
260 +  
261    int testTot;
262    int done = 0;
263 <  ndx = 0;
263 >  nCellsZ = 0;
264    while( !done ){
265          
266 <    ndx++;
267 <    testTot = 4 * ndx * ndx * ndx;
266 >    nCellsZ++;
267 >    testTot = 4 * nCellsX * nCellsY * nCellsZ;
268          
269      if( testTot >= targetWaters ) done = 1;
270    }
271  
249  nCells = ndx;
250        
251        
272    // create the new water box to the new specifications
273    
274 <  int newWaters = nCells * nCells * nCells * 4;
274 >  int newWaters = nCellsX * nCellsY * nCellsZ * 4;
275    
276    delete[] waterX;
277    delete[] waterY;
# Line 259 | Line 279 | int buildRandomBilayer( void ){
279    
280    coord* waterSites = new coord[newWaters];
281    
282 <  double box_x = waterCell * nCells;
283 <  double box_y = waterCell * nCells;
284 <  double box_z = waterCell * nCells;
282 >  double box_x = waterCell * nCellsX;
283 >  double box_y = waterCell * nCellsY;
284 >  double box_z = waterCell * nCellsZ;
285          
286    // create an fcc lattice in the water box.
287    
288    ndx = 0;
289 <  for( i=0; i < nCells; i++ ){
290 <    for( j=0; j < nCells; j++ ){
291 <      for( k=0; k < nCells; k++ ){
289 >  for( i=0; i < nCellsX; i++ ){
290 >    for( j=0; j < nCellsY; j++ ){
291 >      for( k=0; k < nCellsZ; k++ ){
292  
293          myFCC.getLatticePoints(&posX, &posY, &posZ, i, j, k);
294          for(l=0; l<4; l++){
# Line 355 | Line 375 | int buildRandomBilayer( void ){
375      }
376    }
377          
378 +
379 +  // zSort of the lipid positions
380 +
381 +
382 +  vector< pair<int,double> >zSortArray;
383 +  for(i=0;i<nLipids;i++)
384 +    zSortArray.push_back( make_pair(i, lipidSites[i].pos[2]) );
385 +
386 +  sort(zSortArray.begin(),zSortArray.end(),SortCond());
387 +
388 +  ofstream outFile( "./zipper.bass", ios::app);
389 +
390 +  for(i=0; i<nLipids; i++){
391 +    outFile << "zConstraint[" << i << "]{\n"
392 +            << "  molIndex = " << zSortArray[i].first <<  ";\n"
393 +            << "  zPos = ";
394 +
395 +    if(i<32) outFile << "60.0;\n";
396 +    else outFile << "100.0;\n";
397 +
398 +    outFile << "  kRatio = 0.5;\n"
399 +            << "}\n";
400 +  }
401 +  
402 +  outFile.close();
403 +
404 +
405    // cut out the waters that overlap with the lipids.
406    
407  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines