1 |
+ |
#include <iostream> |
2 |
+ |
|
3 |
|
#include <cstdlib> |
4 |
|
#include <cstring> |
5 |
|
#include <cmath> |
39 |
|
int nAtoms, atomIndex, molIndex, molID; |
40 |
|
int* molSeq; |
41 |
|
int* molMap; |
42 |
+ |
int* molStart; |
43 |
|
int* cardDeck; |
44 |
|
int deckSize; |
45 |
|
int rSite, rCard; |
57 |
|
|
58 |
|
srand48( RAND_SEED ); |
59 |
|
molSeq = NULL; |
60 |
+ |
molStart = NULL; |
61 |
|
molMap = NULL; |
62 |
|
cardDeck = NULL; |
63 |
|
atoms = NULL; |
106 |
|
molIndex = 0; |
107 |
|
locate = new MoLocator*[bsInfo.nComponents]; |
108 |
|
molSeq = new int[bsInfo.totNmol]; |
109 |
+ |
molStart = new int[bsInfo.totNmol]; |
110 |
|
for(i=0; i<bsInfo.nComponents; i++){ |
111 |
|
locate[i] = new MoLocator( bsInfo.compStamps[i] ); |
112 |
|
for(j=0; j<bsInfo.componentsNmol[i]; j++){ |
113 |
|
molSeq[molIndex] = i; |
114 |
+ |
molStart[molIndex] = nAtoms; |
115 |
|
molIndex++; |
116 |
|
nAtoms += bsInfo.compStamps[i]->getNAtoms(); |
117 |
|
} |
130 |
|
cell *= M_SQRT2; |
131 |
|
|
132 |
|
siteIndex = 0; |
127 |
– |
atomIndex = 0; |
133 |
|
for(i=0; i<nCells; i++){ |
134 |
|
for(j=0; j<nCells; j++){ |
135 |
|
for(k=0; k<nCells; k++){ |
141 |
|
|
142 |
|
getRandomRot( rot ); |
143 |
|
molID = molSeq[molMap[siteIndex]]; |
144 |
< |
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
145 |
< |
|
141 |
< |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
144 |
> |
atomIndex = molStart[ molMap[siteIndex] ]; |
145 |
> |
locate[molID]->placeMol( pos, rot, atoms, atomIndex ); |
146 |
|
} |
147 |
|
siteIndex++; |
148 |
|
|
150 |
|
pos[0] = i * cell + (0.5 * cell); |
151 |
|
pos[1] = j * cell; |
152 |
|
pos[2] = k * cell + (0.5 * cell); |
153 |
< |
|
153 |
> |
|
154 |
|
getRandomRot( rot ); |
155 |
|
molID = molSeq[molMap[siteIndex]]; |
156 |
< |
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
157 |
< |
|
154 |
< |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
156 |
> |
atomIndex = molStart[ molMap[siteIndex] ]; |
157 |
> |
locate[molID]->placeMol( pos, rot, atoms, atomIndex ); |
158 |
|
} |
159 |
|
siteIndex++; |
160 |
|
|
165 |
|
|
166 |
|
getRandomRot( rot ); |
167 |
|
molID = molSeq[molMap[siteIndex]]; |
168 |
< |
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
169 |
< |
|
167 |
< |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
168 |
> |
atomIndex = molStart[ molMap[siteIndex] ]; |
169 |
> |
locate[molID]->placeMol( pos, rot, atoms, atomIndex ); |
170 |
|
} |
171 |
|
siteIndex++; |
172 |
|
|
174 |
|
pos[0] = i * cell; |
175 |
|
pos[1] = j * cell + (0.5 * cell); |
176 |
|
pos[2] = k * cell + (0.5 * cell); |
177 |
< |
|
177 |
> |
|
178 |
|
getRandomRot( rot ); |
179 |
|
molID = molSeq[molMap[siteIndex]]; |
180 |
< |
locate[molID]->placeMol( pos, rot, &atoms[atomIndex] ); |
181 |
< |
|
180 |
< |
atomIndex += bsInfo.compStamps[molID]->getNAtoms(); |
180 |
> |
atomIndex = molStart[ molMap[siteIndex] ]; |
181 |
> |
locate[molID]->placeMol( pos, rot, atoms, atomIndex ); |
182 |
|
} |
183 |
|
siteIndex++; |
184 |
|
} |
197 |
|
simnfo->box_y = bsInfo.boxY; |
198 |
|
simnfo->box_z = bsInfo.boxZ; |
199 |
|
|
200 |
< |
sprintf( simnfo->statusName, "%s.dump", bsInfo.outPrefix ); |
200 |
> |
sprintf( simnfo->sampleName, "%s.dump", bsInfo.outPrefix ); |
201 |
|
sprintf( simnfo->finalName, "%s.init", bsInfo.outPrefix ); |
202 |
< |
|
202 |
> |
|
203 |
|
simnfo->atoms = atoms; |
204 |
|
|
205 |
|
// set up the writer and write out |