| 90 |
|
int nComponents; |
| 91 |
|
double latticeConstant; |
| 92 |
|
std::vector<double> lc; |
| 93 |
< |
double mass; |
| 93 |
> |
double mass; |
| 94 |
|
const double rhoConvertConst = 1.661; |
| 95 |
|
double density; |
| 96 |
|
double particleRadius; |
| 130 |
|
|
| 131 |
|
|
| 132 |
|
/*calculate lattice constant (in Angstrom) |
| 133 |
< |
latticeConstant = pow(rhoConvertConst * numMolPerCell * mass / density, |
| 134 |
< |
1.0 / 3.0);*/ |
| 133 |
> |
latticeConstant = pow(rhoConvertConst * numMolPerCell * mass / density, |
| 134 |
> |
1.0 / 3.0);*/ |
| 135 |
|
|
| 136 |
|
latticeConstant = args_info.latticeCnst_arg; |
| 137 |
|
particleRadius = args_info.radius_arg; |
| 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; |
| 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 |
|
|
| 184 |
|
} |
| 185 |
|
numMol[nComponents-1] = numSites - totComponents; |
| 186 |
|
|
| 187 |
< |
/* do the iPod thing, Shuffle da vector */ |
| 188 |
< |
std::random_shuffle(nanoParticleSites.begin(), nanoParticleSites.end()); |
| 187 |
> |
/* do the iPod thing, Shuffle da vector */ |
| 188 |
> |
std::random_shuffle(nanoParticleSites.begin(), nanoParticleSites.end()); |
| 189 |
|
} else{ /*Handle core-shell with multiple components.*/ |
| 190 |
|
std::cout << "Creating a core-shell nanoparticle." << std::endl; |
| 191 |
|
if (nComponents != args_info.ShellRadius_given + 1){ |
| 195 |
|
|
| 196 |
|
} |
| 197 |
|
|
| 198 |
< |
|
| 199 |
< |
//get the orientation of the cell sites |
| 198 |
> |
|
| 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 |
< |
std::cout<<"Orientational vector Size: "<< std::endl; |
| 203 |
< |
std::cout<<latticeOrt.size()<< std::endl; |
| 204 |
< |
|
| 201 |
> |
latticeOrt = nanoParticle.getPointsOrt(); |
| 202 |
> |
std::cout<<"Orientational vector Size: "<< std::endl; |
| 203 |
> |
std::cout<<latticeOrt.size()<< std::endl; |
| 204 |
|
|
| 206 |
– |
|
| 207 |
– |
// needed for writing out new md file. |
| 205 |
|
|
| 206 |
< |
outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; |
| 207 |
< |
outMdFileName = outPrefix + ".md"; |
| 206 |
> |
|
| 207 |
> |
// needed for writing out new md file. |
| 208 |
|
|
| 209 |
< |
//creat new .md file on fly which corrects the number of molecule |
| 210 |
< |
createMdFile(inputFileName, outMdFileName, nComponents,numMol); |
| 209 |
> |
outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; |
| 210 |
> |
outMdFileName = outPrefix + ".md"; |
| 211 |
|
|
| 212 |
+ |
//creat new .md file on fly which corrects the number of molecule |
| 213 |
+ |
createMdFile(inputFileName, outMdFileName, nComponents,numMol); |
| 214 |
+ |
|
| 215 |
|
if (oldInfo != NULL) |
| 216 |
|
delete oldInfo; |
| 217 |
|
|
| 219 |
|
// We need to read in new siminfo object. |
| 220 |
|
//parse md file and set up the system |
| 221 |
|
//SimCreator NewCreator; |
| 222 |
< |
SimCreator newCreator; |
| 222 |
> |
SimCreator newCreator; |
| 223 |
|
SimInfo* NewInfo = newCreator.createSim(outMdFileName, false); |
| 224 |
|
|
| 225 |
|
|
| 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(nanoParticleSites[l], latticeOrt[l], mol); |
| 233 |
< |
l++; |
| 230 |
> |
int l = 0; |
| 231 |
> |
for (mol = NewInfo->beginMolecule(mi); mol != NULL; mol = NewInfo->nextMolecule(mi)) { |
| 232 |
> |
locator->placeMol(nanoParticleSites[l], latticeOrt[l], mol); |
| 233 |
> |
l++; |
| 234 |
|
} |
| 235 |
|
|
| 236 |
|
|
| 297 |
|
|
| 298 |
|
//correct molecule number |
| 299 |
|
if (strstr(buffer, "nMol") != NULL) { |
| 300 |
< |
if(i<components){ |
| 301 |
< |
sprintf(buffer, "\tnMol = %i;", numMol[i]); |
| 302 |
< |
newMdFile << buffer << std::endl; |
| 303 |
< |
i++; |
| 304 |
< |
} |
| 300 |
> |
if(i<components){ |
| 301 |
> |
sprintf(buffer, "\tnMol = %i;", numMol[i]); |
| 302 |
> |
newMdFile << buffer << std::endl; |
| 303 |
> |
i++; |
| 304 |
> |
} |
| 305 |
|
} else |
| 306 |
|
newMdFile << buffer << std::endl; |
| 307 |
|
|