| 147 |
|
outInitFileName = getPrefix(inputFileName.c_str()) + ".in"; |
| 148 |
|
} |
| 149 |
|
|
| 150 |
+ |
std::cout <<"Before build shaped lattice. "<<std::endl; |
| 151 |
|
|
| 151 |
– |
|
| 152 |
|
/* create Molocators */ |
| 153 |
|
locator = new MoLocator(oldInfo->getMoleculeStamp(0), oldInfo->getForceField()); |
| 154 |
|
|
| 155 |
|
/* Create nanoparticle */ |
| 156 |
|
shapedLatticeSpherical nanoParticle(latticeConstant,latticeType,particleRadius); |
| 157 |
+ |
|
| 158 |
+ |
std::cout <<"Before build getPoints. "<<std::endl; |
| 159 |
|
/* Build a lattice and get lattice points for this lattice constant */ |
| 160 |
|
vector<Vector3d> nanoParticleSites = nanoParticle.getPoints(); |
| 161 |
+ |
|
| 162 |
|
/* Get number of lattice sites */ |
| 163 |
|
numSites = nanoParticleSites.size(); |
| 164 |
|
|
| 165 |
+ |
//std::cout <<"numSites are %d "<<numSites<<std::endl; |
| 166 |
+ |
// std::cout <<"nComponents are %d "<<nComponents<<std::endl; |
| 167 |
|
numMol = new int[nComponents]; |
| 168 |
|
|
| 169 |
|
|
| 171 |
|
if (!args_info.ShellRadius_given){ |
| 172 |
|
std::cout << "Creating a random nanoparticle" << std::endl; |
| 173 |
|
/* Check to see if we have enough components */ |
| 174 |
< |
if (nComponents != args_info.molFraction_given + 1){ |
| 174 |
> |
if (nComponents != args_info.molFraction_given && nComponents != 1){ |
| 175 |
|
std::cerr << "Number of components does not equal molFraction occurances." << std::endl; |
| 176 |
|
exit(1); |
| 177 |
|
} |
| 178 |
|
/* Build the mole fractions and number of molecules of each type */ |
| 179 |
|
int totComponents = 0; |
| 180 |
< |
for (int i = 0;i<nComponents-2;i++){ /* Figure out Percent for each component */ |
| 180 |
> |
for (int i = 0;i<nComponents-1;i++){ /* Figure out Percent for each component */ |
| 181 |
|
numMol[i] = int((double)numSites * args_info.molFraction_arg[i]); |
| 182 |
+ |
std::cout<<numMol[i]<<std::endl; |
| 183 |
|
totComponents += numMol[i]; |
| 184 |
|
} |
| 185 |
|
numMol[nComponents-1] = numSites - totComponents; |
| 186 |
+ |
|
| 187 |
|
/* do the iPod thing, Shuffle da vector */ |
| 188 |
|
std::random_shuffle(nanoParticleSites.begin(), nanoParticleSites.end()); |
| 189 |
|
} else{ /*Handle core-shell with multiple components.*/ |
| 199 |
|
//get the orientation of the cell sites |
| 200 |
|
//for the same type of molecule in same lattice, it will not change |
| 201 |
|
latticeOrt = nanoParticle.getPointsOrt(); |
| 202 |
< |
|
| 203 |
< |
|
| 202 |
> |
std::cout<<"Orientational vector Size: "<< std::endl; |
| 203 |
> |
std::cout<<latticeOrt.size()<< std::endl; |
| 204 |
> |
|
| 205 |
|
|
| 206 |
+ |
|
| 207 |
|
// needed for writing out new md file. |
| 208 |
|
|
| 209 |
|
outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; |
| 219 |
|
// We need to read in new siminfo object. |
| 220 |
|
//parse md file and set up the system |
| 221 |
|
//SimCreator NewCreator; |
| 222 |
+ |
SimCreator newCreator; |
| 223 |
+ |
SimInfo* NewInfo = newCreator.createSim(outMdFileName, false); |
| 224 |
|
|
| 214 |
– |
SimInfo* NewInfo = oldCreator.createSim(outMdFileName, false); |
| 225 |
|
|
| 216 |
– |
|
| 226 |
|
// Place molecules |
| 227 |
|
Molecule* mol; |
| 228 |
|
SimInfo::MoleculeIterator mi; |
| 229 |
|
mol = NewInfo->beginMolecule(mi); |
| 230 |
|
int l = 0; |
| 231 |
|
for (mol = NewInfo->beginMolecule(mi); mol != NULL; mol = NewInfo->nextMolecule(mi)) { |
| 232 |
< |
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
| 232 |
> |
locator->placeMol(nanoParticleSites[l], latticeOrt[l], mol); |
| 233 |
|
l++; |
| 234 |
|
} |
| 235 |
+ |
|
| 236 |
|
|
| 237 |
|
|
| 228 |
– |
|
| 229 |
– |
|
| 230 |
– |
|
| 238 |
|
|
| 239 |
|
//fill Hmat |
| 240 |
|
hmat(0, 0)= latticeConstant; |