| 34 |
|
int buildRandomBilayer( void ){ |
| 35 |
|
|
| 36 |
|
int i,j,k; |
| 37 |
< |
int nAtoms, atomIndex; |
| 37 |
> |
int nAtoms, atomIndex, molIndex, molID; |
| 38 |
|
int* molSeq; |
| 39 |
|
int* molMap; |
| 40 |
|
int* cardDeck; |
| 67 |
|
nSites = 0; |
| 68 |
|
while( nSites < bsInfo.totNmol ){ |
| 69 |
|
nCells++; |
| 70 |
< |
nSites = 4 * pow( nCells, 3 ); |
| 70 |
> |
nSites = 4.0 * pow( (double)nCells, 3.0 ); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
| 107 |
|
for(j=0; j<bsInfo.componentsNmol[i]; j++){ |
| 108 |
|
molSeq[molIndex] = i; |
| 109 |
|
molIndex++; |
| 110 |
< |
nAtoms += bsInfo.compStamp[i]->getNAtoms(); |
| 110 |
> |
nAtoms += bsInfo.compStamps[i]->getNAtoms(); |
| 111 |
|
} |
| 112 |
|
} |
| 113 |
|
|
| 121 |
|
for(i=0; i<bsInfo.nComponents; i++){ |
| 122 |
|
if(cell < locate[i]->getMaxLength() ) cell = locate[i]->getMaxLength(); |
| 123 |
|
} |
| 124 |
< |
cell *= M_SQRT_2; |
| 124 |
> |
cell *= M_SQRT2; |
| 125 |
|
|
| 126 |
|
siteIndex = 0; |
| 127 |
|
atomIndex = 0; |
| 138 |
|
molID = molSeq[molMap[siteIndex]]; |
| 139 |
|
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
| 140 |
|
|
| 141 |
< |
atomIndex += bsInfo.compStamps[molID]->getNatoms(); |
| 141 |
> |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
| 142 |
|
} |
| 143 |
|
siteIndex++; |
| 144 |
|
|
| 151 |
|
molID = molSeq[molMap[siteIndex]]; |
| 152 |
|
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
| 153 |
|
|
| 154 |
< |
atomIndex += bsInfo.compStamps[molID]->getNatoms(); |
| 154 |
> |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
| 155 |
|
} |
| 156 |
|
siteIndex++; |
| 157 |
|
|
| 164 |
|
molID = molSeq[molMap[siteIndex]]; |
| 165 |
|
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
| 166 |
|
|
| 167 |
< |
atomIndex += bsInfo.compStamps[molID]->getNatoms(); |
| 167 |
> |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
| 168 |
|
} |
| 169 |
|
siteIndex++; |
| 170 |
|
|
| 177 |
|
molID = molSeq[molMap[siteIndex]]; |
| 178 |
|
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
| 179 |
|
|
| 180 |
< |
atomIndex += bsInfo.compStamps[molID]->getNatoms(); |
| 180 |
> |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
| 181 |
|
} |
| 182 |
|
siteIndex++; |
| 183 |
|
} |
| 191 |
|
bsInfo.boxZ = nCells * cell; |
| 192 |
|
|
| 193 |
|
simnfo = new SimInfo(); |
| 194 |
< |
simnfo.n_atoms = nAtoms; |
| 195 |
< |
simnfo.box_x = bsInfo.boxX; |
| 196 |
< |
simnfo.box_y = bsInfo.boxY; |
| 197 |
< |
simnfo.box_z = bsInfo.boxZ; |
| 194 |
> |
simnfo->n_atoms = nAtoms; |
| 195 |
> |
simnfo->box_x = bsInfo.boxX; |
| 196 |
> |
simnfo->box_y = bsInfo.boxY; |
| 197 |
> |
simnfo->box_z = bsInfo.boxZ; |
| 198 |
|
|
| 199 |
< |
sprintf( simnfo.statusName, "%s.dump", bsInfo.outPrefix ); |
| 200 |
< |
sprintf( simnfo.finalName, "%s.init", bsInfo.outPrefix ); |
| 199 |
> |
sprintf( simnfo->statusName, "%s.dump", bsInfo.outPrefix ); |
| 200 |
> |
sprintf( simnfo->finalName, "%s.init", bsInfo.outPrefix ); |
| 201 |
|
|
| 202 |
< |
simnfo.atoms = atoms; |
| 202 |
> |
simnfo->atoms = atoms; |
| 203 |
|
|
| 204 |
|
// set up the writer and write out |
| 205 |
|
|
| 206 |
< |
writer = new DumpWriter( &simnfo ); |
| 206 |
> |
writer = new DumpWriter( simnfo ); |
| 207 |
|
writer->writeFinal(); |
| 208 |
|
|
| 209 |
|
// clean up the memory |
| 246 |
|
|
| 247 |
|
rot[0][0] = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi)); |
| 248 |
|
rot[0][1] = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi)); |
| 249 |
< |
rot[0][2[ = sin(theta) * sin(psi); |
| 249 |
> |
rot[0][2] = sin(theta) * sin(psi); |
| 250 |
|
|
| 251 |
|
rot[1][0] = -(cos(phi) * sin(psi)) - (sin(phi) * cos(theta) * cos(psi)); |
| 252 |
|
rot[1][1] = -(sin(phi) * sin(psi)) + (cos(phi) * cos(theta) * cos(psi)); |