| 35 |
|
* |
| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
| 39 |
|
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
* Created by Kelsey M. Stocker on 2/9/12. |
| 55 |
|
|
| 56 |
|
#include "config.h" |
| 57 |
|
#include "shapedLatticeRod.hpp" |
| 58 |
+ |
#include "shapedLatticeEllipsoid.hpp" |
| 59 |
|
#include "nanorodBuilderCmd.h" |
| 60 |
|
#include "lattice/LatticeFactory.hpp" |
| 61 |
|
#include "utils/MoLocator.hpp" |
| 76 |
|
|
| 77 |
|
int main(int argc, char *argv []) { |
| 78 |
|
|
| 78 |
– |
//register force fields |
| 79 |
– |
registerForceFields(); |
| 79 |
|
registerLattice(); |
| 80 |
|
|
| 81 |
|
gengetopt_args_info args_info; |
| 82 |
|
std::string latticeType; |
| 83 |
|
std::string inputFileName; |
| 84 |
|
std::string outputFileName; |
| 86 |
– |
|
| 85 |
|
MoLocator* locator; |
| 86 |
|
int nComponents; |
| 87 |
|
double latticeConstant; |
| 90 |
– |
std::vector<double> lc; |
| 91 |
– |
|
| 88 |
|
RealType rodRadius; |
| 89 |
|
RealType rodLength; |
| 94 |
– |
|
| 90 |
|
Mat3x3d hmat; |
| 96 |
– |
std::vector<Vector3d> latticePos; |
| 97 |
– |
std::vector<Vector3d> latticeOrt; |
| 98 |
– |
|
| 91 |
|
DumpWriter *writer; |
| 92 |
|
|
| 93 |
|
// Parse Command Line Arguments |
| 117 |
|
rodLength = args_info.length_arg; |
| 118 |
|
Globals* simParams = oldInfo->getSimParams(); |
| 119 |
|
|
| 120 |
< |
/* Create nanorod */ |
| 121 |
< |
shapedLatticeRod nanoRod(latticeConstant, latticeType, |
| 122 |
< |
rodRadius, rodLength); |
| 123 |
< |
|
| 124 |
< |
/* Build a lattice and get lattice points for this lattice constant */ |
| 125 |
< |
vector<Vector3d> sites = nanoRod.getSites(); |
| 126 |
< |
vector<Vector3d> orientations = nanoRod.getOrientations(); |
| 120 |
> |
vector<Vector3d> sites; |
| 121 |
> |
vector<Vector3d> orientations; |
| 122 |
> |
|
| 123 |
> |
if (args_info.ellipsoid_flag) { |
| 124 |
> |
shapedLatticeEllipsoid nanoEllipsoid(latticeConstant, latticeType, |
| 125 |
> |
rodLength, rodRadius); |
| 126 |
> |
sites = nanoEllipsoid.getSites(); |
| 127 |
> |
orientations = nanoEllipsoid.getOrientations(); |
| 128 |
> |
} else { |
| 129 |
> |
|
| 130 |
> |
/* Create nanorod */ |
| 131 |
> |
shapedLatticeRod nanoRod(latticeConstant, latticeType, |
| 132 |
> |
rodRadius, rodLength); |
| 133 |
> |
/* Build a lattice and get lattice points for this lattice constant */ |
| 134 |
> |
sites = nanoRod.getSites(); |
| 135 |
> |
orientations = nanoRod.getOrientations(); |
| 136 |
> |
} |
| 137 |
> |
|
| 138 |
|
std::vector<int> vacancyTargets; |
| 139 |
|
vector<bool> isVacancy; |
| 140 |
|
|
| 141 |
|
Vector3d myLoc; |
| 142 |
|
RealType myR; |
| 143 |
|
|
| 144 |
< |
for (int i = 0; i < sites.size(); i++) |
| 144 |
> |
for (unsigned int i = 0; i < sites.size(); i++) |
| 145 |
|
isVacancy.push_back(false); |
| 146 |
< |
|
| 146 |
> |
|
| 147 |
|
// cerr << "checking vacancyPercent" << "\n"; |
| 148 |
|
if (args_info.vacancyPercent_given) { |
| 149 |
|
// cerr << "vacancyPercent given" << "\n"; |
| 168 |
|
} |
| 169 |
|
if (vIR >= 0.0 && vOR <= rodRadius && vOR >= vIR) { |
| 170 |
|
|
| 171 |
< |
for (int i = 0; i < sites.size(); i++) { |
| 171 |
> |
for (unsigned int i = 0; i < sites.size(); i++) { |
| 172 |
|
myLoc = sites[i]; |
| 173 |
|
myR = myLoc.length(); |
| 174 |
|
if (myR >= vIR && myR <= vOR) { |
| 188 |
|
simError(); |
| 189 |
|
|
| 190 |
|
isVacancy.clear(); |
| 191 |
< |
for (int i = 0; i < sites.size(); i++) { |
| 191 |
> |
for (unsigned int i = 0; i < sites.size(); i++) { |
| 192 |
|
bool vac = false; |
| 193 |
< |
for (int j = 0; j < vacancyTargets.size(); j++) { |
| 193 |
> |
for (unsigned int j = 0; j < vacancyTargets.size(); j++) { |
| 194 |
|
if (i == vacancyTargets[j]) vac = true; |
| 195 |
|
} |
| 196 |
|
isVacancy.push_back(vac); |
| 215 |
|
std::vector<Component*> components = simParams->getComponents(); |
| 216 |
|
std::vector<RealType> molFractions; |
| 217 |
|
std::vector<RealType> shellRadii; |
| 215 |
– |
std::vector<RealType> molecularMasses; |
| 218 |
|
std::vector<int> nMol; |
| 219 |
|
std::map<int, int> componentFromSite; |
| 220 |
|
nComponents = components.size(); |
| 319 |
|
} |
| 320 |
|
} else { |
| 321 |
|
|
| 322 |
< |
for (int i = 0; i < shellRadii.size(); i++) { |
| 322 |
> |
for (unsigned int i = 0; i < shellRadii.size(); i++) { |
| 323 |
|
if (shellRadii.at(i) > rodRadius + 1e-6 ) { |
| 324 |
|
sprintf(painCave.errMsg, "One of the shellRadius values exceeds the rod Radius."); |
| 325 |
|
painCave.isFatal = 1; |
| 341 |
|
simError(); |
| 342 |
|
/* Random rod is the default case*/ |
| 343 |
|
|
| 344 |
< |
for (int i = 0; i < sites.size(); i++) |
| 344 |
> |
for (unsigned int i = 0; i < sites.size(); i++) |
| 345 |
|
if (!isVacancy[i]) ids.push_back(i); |
| 346 |
|
|
| 347 |
|
std::random_shuffle(ids.begin(), ids.end()); |
| 351 |
|
painCave.isFatal = 0; |
| 352 |
|
simError(); |
| 353 |
|
|
| 354 |
< |
RealType smallestSoFar; |
| 354 |
> |
// RealType smallestSoFar; |
| 355 |
|
int myComponent = -1; |
| 356 |
|
nMol.clear(); |
| 357 |
|
nMol.resize(nComponents); |
| 358 |
|
|
| 359 |
|
// cerr << "shellRadii[0] " << shellRadii[0] << "\n"; |
| 360 |
< |
// cerr << "rodRadius " << rodRadius << "\n"; |
| 360 |
> |
// cerr << "rodRadius " << rodRadius << "\n"; |
| 361 |
|
|
| 362 |
< |
for (int i = 0; i < sites.size(); i++) { |
| 362 |
> |
for (unsigned int i = 0; i < sites.size(); i++) { |
| 363 |
|
myLoc = sites[i]; |
| 364 |
|
myR = myLoc.length(); |
| 365 |
< |
smallestSoFar = rodRadius; |
| 366 |
< |
//cerr << "vac = " << isVacancy[i]<< "\n"; |
| 365 |
> |
// smallestSoFar = rodRadius; |
| 366 |
> |
// cerr << "vac = " << isVacancy[i]<< "\n"; |
| 367 |
|
|
| 368 |
|
if (!isVacancy[i]) { |
| 369 |
|
|
| 391 |
|
|
| 392 |
|
createMdFile(inputFileName, outputFileName, nMol); |
| 393 |
|
|
| 394 |
< |
if (oldInfo != NULL) |
| 393 |
< |
delete oldInfo; |
| 394 |
> |
delete oldInfo; |
| 395 |
|
|
| 396 |
|
SimCreator newCreator; |
| 397 |
|
SimInfo* NewInfo = newCreator.createSim(outputFileName, false); |
| 402 |
|
mol = NewInfo->beginMolecule(mi); |
| 403 |
|
|
| 404 |
|
int l = 0; |
| 404 |
– |
int whichSite = 0; |
| 405 |
|
|
| 406 |
< |
for (int i = 0; i < nComponents; i++){ |
| 406 |
> |
for (unsigned int i = 0; i < nComponents; i++){ |
| 407 |
|
locator = new MoLocator(NewInfo->getMoleculeStamp(i), |
| 408 |
|
NewInfo->getForceField()); |
| 409 |
|
|
| 410 |
|
// cerr << "nMol = " << nMol.at(i) << "\n"; |
| 411 |
|
if (!args_info.molFraction_given) { |
| 412 |
< |
for (int n = 0; n < sites.size(); n++) { |
| 412 |
> |
for (unsigned int n = 0; n < sites.size(); n++) { |
| 413 |
|
if (!isVacancy[n]) { |
| 414 |
|
if (componentFromSite[n] == i) { |
| 415 |
|
mol = NewInfo->getMoleculeByGlobalIndex(l); |
| 419 |
|
} |
| 420 |
|
} |
| 421 |
|
} else { |
| 422 |
< |
for (int n = 0; n < nMol.at(i); n++) { |
| 422 |
> |
for (unsigned int n = 0; n < nMol.at(i); n++) { |
| 423 |
|
mol = NewInfo->getMoleculeByGlobalIndex(l); |
| 424 |
|
locator->placeMol(sites[ids[l]], orientations[ids[l]], mol); |
| 425 |
|
l++; |
| 480 |
|
newMdFile.open(newMdFileName.c_str()); |
| 481 |
|
oldMdFile.getline(buffer, MAXLEN); |
| 482 |
|
|
| 483 |
< |
int i = 0; |
| 483 |
> |
unsigned int i = 0; |
| 484 |
|
while (!oldMdFile.eof()) { |
| 485 |
|
|
| 486 |
|
//correct molecule number |