| 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" |
| 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 |
|
|
| 250 |
|
|
| 251 |
|
// find the best box size for the sim |
| 252 |
|
|
| 253 |
+ |
int nCellsX, nCellsY, nCellsZ; |
| 254 |
+ |
|
| 255 |
+ |
const double boxTargetX = 20; |
| 256 |
+ |
const double boxTargetY = 20; |
| 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; |
| 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++){ |
| 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( "./zipper.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 |
|
|