14 |
|
#include "sysBuild.hpp" |
15 |
|
#include "nanoBuilder.hpp" |
16 |
|
|
17 |
< |
|
18 |
< |
|
19 |
< |
nanoBuilder::nanoBuilder(int thisIsRandom, int thisHasVacancies, |
20 |
< |
int thisLatticeType, double thisParticleRadius, |
21 |
< |
double thisCoreRadius, double thisVacancyFraction, |
22 |
< |
double thisVacancyRadius, |
23 |
< |
double thisLatticeSpacing, |
24 |
< |
double solute_X, |
25 |
< |
int &hasError){ |
17 |
> |
nanoBuilder::nanoBuilder(int &hasError){ |
18 |
|
int Errors; |
19 |
|
int foundCore,foundShell; |
20 |
|
int i; |
21 |
< |
|
21 |
> |
|
22 |
|
//Zero variables |
23 |
|
particleRadius = 0.0; |
24 |
|
coreRadius = 0.0; |
49 |
|
|
50 |
|
hasError = 0; |
51 |
|
Errors = 0; |
52 |
+ |
|
53 |
+ |
//Initialize class members from bsInfo struct that sysbuilder provides. |
54 |
+ |
isRandom = bsInfo.isRandomParticle; |
55 |
+ |
hasVacancies = bsInfo.hasVacancies; |
56 |
+ |
latticeType = bsInfo.latticeType; |
57 |
+ |
particleRadius = bsInfo.particleRadius; |
58 |
+ |
coreRadius = bsInfo.coreRadius; |
59 |
+ |
vacancyFraction = bsInfo.vacancyFraction; |
60 |
+ |
latticeSpacing = bsInfo.latticeSpacing; |
61 |
+ |
soluteX = bsInfo.soluteX; //Mole fraction for random particle. |
62 |
|
|
63 |
|
|
62 |
– |
isRandom = thisIsRandom; |
63 |
– |
hasVacancies = thisHasVacancies; |
64 |
– |
latticeType = thisLatticeType; |
65 |
– |
particleRadius = thisParticleRadius; |
66 |
– |
coreRadius = thisCoreRadius; |
67 |
– |
vacancyFraction = thisVacancyFraction; |
68 |
– |
latticeSpacing = thisLatticeSpacing; |
69 |
– |
soluteX = solute_X; //Mole fraction for random particle. |
64 |
|
|
65 |
|
|
66 |
|
|
73 |
– |
|
74 |
– |
|
67 |
|
for (i=0;bsInfo.nComponents;i++){ |
68 |
|
if( !strcmp( bsInfo.compStamps[i]->getID(),bsInfo.coreName )){ |
69 |
|
foundCore = 1; |
192 |
|
double *rz; |
193 |
|
double pos[3]; |
194 |
|
double A[3][3]; |
195 |
< |
double HmatI[9]; |
195 |
> |
double HmatI[3][3]; |
196 |
|
|
197 |
|
int nCellSites; |
198 |
|
int iref; |
204 |
|
int nShellAtomCounter = 0; |
205 |
|
int hasError; |
206 |
|
|
207 |
< |
int i; |
207 |
> |
int i, j; |
208 |
|
|
209 |
|
int interfaceIndex = 0; |
210 |
|
double dist; |
215 |
|
DumpWriter* writer; |
216 |
|
SimInfo* simnfo; |
217 |
|
|
218 |
< |
Lattice::Lattice *myLattice; |
219 |
< |
MoLocator::MoLocator *coreLocate; |
220 |
< |
MoLocator::MoLocator *shellLocate; |
218 |
> |
Lattice *myLattice; |
219 |
> |
MoLocator *coreLocate; |
220 |
> |
MoLocator *shellLocate; |
221 |
|
|
222 |
|
|
223 |
|
Atom** atoms; |
334 |
|
if (! moleculeVector[i].isVacancy) { |
335 |
|
orientationMunger( A ); |
336 |
|
if( moleculeVector[i].isCore){ |
337 |
< |
nCoreAtomCounter =+ nCoreModelAtoms; |
337 |
> |
nCoreAtomCounter += nCoreModelAtoms; |
338 |
|
coreLocate->placeMol(moleculeVector[i].pos,A,atoms,nShellAtomCounter); |
339 |
|
} |
340 |
|
else { |
341 |
< |
nShellAtomCounter =+ nShellModelAtoms; |
341 |
> |
nShellAtomCounter += nShellModelAtoms; |
342 |
|
shellLocate->placeMol(moleculeVector[i].pos,A,atoms,nCoreAtomCounter); |
343 |
|
} |
344 |
|
shesActualSizetoMe++; |
348 |
|
|
349 |
|
// shellLocate.placeMol(pos, A, moleculeVector,shellAtomCount); |
350 |
|
|
351 |
< |
for (i=0;i<9;i++) simnfo->Hmat[i] = 0; |
352 |
< |
simnfo->Hmat[0] = 1; |
353 |
< |
simnfo->Hmat[4] = 1; |
362 |
< |
simnfo->Hmat[8] = 1; |
351 |
> |
for (i=0;i<3;i++) |
352 |
> |
for (j=0; j<3; j++) |
353 |
> |
simnfo->Hmat[i][j] = 0.0; |
354 |
|
|
355 |
+ |
simnfo->Hmat[0][0] = 1.0; |
356 |
+ |
simnfo->Hmat[1][1] = 1.0; |
357 |
+ |
simnfo->Hmat[2][2] = 1.0; |
358 |
+ |
|
359 |
|
// set up the SimInfo object |
360 |
+ |
|
361 |
|
simnfo = new SimInfo(); |
362 |
|
simnfo->n_atoms = nAtoms; |
367 |
– |
|
363 |
|
|
364 |
|
sprintf( simnfo->sampleName, "%s.dump", bsInfo.outPrefix ); |
365 |
|
sprintf( simnfo->finalName, "%s.init", bsInfo.outPrefix ); |
389 |
|
moleculeVector.push_back(myMol); |
390 |
|
|
391 |
|
if (dist <= coreRadius){ |
392 |
< |
coreAtomCount =+ nCoreModelAtoms; |
392 |
> |
coreAtomCount += nCoreModelAtoms; |
393 |
|
moleculeVector[moleculeCount].pos[0] = pos[0]; |
394 |
|
moleculeVector[moleculeCount].pos[1] = pos[1]; |
395 |
|
moleculeVector[moleculeCount].pos[2] = pos[2]; |
400 |
|
} |
401 |
|
// Place shell |
402 |
|
else{ |
403 |
< |
shellAtomCount =+ nShellModelAtoms; |
403 |
> |
shellAtomCount += nShellModelAtoms; |
404 |
|
moleculeVector[moleculeCount].pos[0] = pos[0]; |
405 |
|
moleculeVector[moleculeCount].pos[1] = pos[1]; |
406 |
|
moleculeVector[moleculeCount].pos[2] = pos[2]; |
424 |
|
moleculeVector.push_back(myMol); |
425 |
|
if (dist <= coreRadius){ |
426 |
|
|
427 |
< |
coreAtomCount =+ nCoreModelAtoms; |
427 |
> |
coreAtomCount += nCoreModelAtoms; |
428 |
|
moleculeVector[moleculeCount].pos[0] = pos[0]; |
429 |
|
moleculeVector[moleculeCount].pos[1] = pos[1]; |
430 |
|
moleculeVector[moleculeCount].pos[2] = pos[2]; |
440 |
|
} |
441 |
|
} else { |
442 |
|
// Place shell |
443 |
< |
shellAtomCount =+ nShellModelAtoms; |
443 |
> |
shellAtomCount += nShellModelAtoms; |
444 |
|
moleculeVector[moleculeCount].pos[0] = pos[0]; |
445 |
|
moleculeVector[moleculeCount].pos[1] = pos[1]; |
446 |
|
moleculeVector[moleculeCount].pos[2] = pos[2]; |
468 |
|
moleculeVector.push_back(myMol); |
469 |
|
if (nCoreMolCounter < nCoreMolecules){ |
470 |
|
|
471 |
< |
coreAtomCount =+ nCoreModelAtoms; |
471 |
> |
coreAtomCount += nCoreModelAtoms; |
472 |
|
moleculeVector[moleculeCount].pos[0] = pos[0]; |
473 |
|
moleculeVector[moleculeCount].pos[1] = pos[1]; |
474 |
|
moleculeVector[moleculeCount].pos[2] = pos[2]; |
478 |
|
|
479 |
|
|
480 |
|
} else { |
481 |
< |
shellAtomCount =+ nShellModelAtoms; |
481 |
> |
shellAtomCount += nShellModelAtoms; |
482 |
|
moleculeVector[moleculeCount].pos[0] = pos[0]; |
483 |
|
moleculeVector[moleculeCount].pos[1] = pos[1]; |
484 |
|
moleculeVector[moleculeCount].pos[2] = pos[2]; |