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 707 by mmeineke, Wed Aug 20 19:42:31 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 | void buildMap( double &x, double &y, double &z,
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 235 | Line 250 | int buildRandomBilayer( void ){
250  
251    // find the best box size for the sim
252  
253 +  int nCellsX, nCellsY, nCellsZ;
254 +
255 +  const double boxTargetX = 56;
256 +  const double boxTargetY = 41;
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 +  
287 +
288    // create an fcc lattice in the water box.
289    
290    ndx = 0;
291 <  for( i=0; i < nCells; i++ ){
292 <    for( j=0; j < nCells; j++ ){
293 <      for( k=0; k < nCells; k++ ){
291 >  for( i=0; i < nCellsX; i++ ){
292 >    for( j=0; j < nCellsY; j++ ){
293 >      for( k=0; k < nCellsZ; k++ ){
294  
295          myFCC.getLatticePoints(&posX, &posY, &posZ, i, j, k);
296          for(l=0; l<4; l++){
# Line 355 | Line 377 | int buildRandomBilayer( void ){
377      }
378    }
379          
380 +
381 +  // zSort of the lipid positions
382 +
383 +
384 +  vector< pair<int,double> >zSortArray;
385 +  for(i=0;i<nLipids;i++)
386 +    zSortArray.push_back( make_pair(i, lipidSites[i].pos[2]) );
387 +
388 +  sort(zSortArray.begin(),zSortArray.end(),SortCond());
389 +
390 +  ofstream outFile( "./zConBead3-01.bass", ios::app);
391 +
392 +  for(i=0; i<nLipids; i++){
393 +    outFile << "zConstraint[" << i << "]{\n"
394 +            << "  molIndex = " << zSortArray[i].first <<  ";\n"
395 +            << "  zPos = ";
396 +
397 +    if(i<32) outFile << "60.0;\n";
398 +    else outFile << "100.0;\n";
399 +
400 +    outFile << "  kRatio = 0.5;\n"
401 +            << "}\n";
402 +  }
403 +  
404 +  outFile.close();
405 +
406 +
407    // cut out the waters that overlap with the lipids.
408    
409  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines