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 |
|
|
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; |
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++){ |
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 |
|
|