| 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 |
|
*/ |
| 44 |
|
* @file ForceField.cpp |
| 45 |
|
* @author tlin |
| 46 |
|
* @date 11/04/2004 |
| 47 |
– |
* @time 22:51am |
| 47 |
|
* @version 1.0 |
| 48 |
|
*/ |
| 49 |
|
|
| 80 |
|
|
| 81 |
|
namespace OpenMD { |
| 82 |
|
|
| 83 |
< |
ForceField::ForceField(std::string ffName) { |
| 83 |
> |
ForceField::ForceField(std::string ffName): wildCardAtomTypeName_("X") { |
| 84 |
|
|
| 85 |
|
char* tempPath; |
| 86 |
|
tempPath = getenv("FORCE_PARAM_PATH"); |
| 227 |
|
|
| 228 |
|
std::vector<std::pair<int, std::vector<std::string> > > foundBonds; |
| 229 |
|
|
| 230 |
< |
for (i = at1Chain.begin(); i != at1Chain.end(); i++) { |
| 230 |
> |
for (i = at1Chain.begin(); i != at1Chain.end(); ++i) { |
| 231 |
|
jj = 0; |
| 232 |
< |
for (j = at2Chain.begin(); j != at2Chain.end(); j++) { |
| 232 |
> |
for (j = at2Chain.begin(); j != at2Chain.end(); ++j) { |
| 233 |
|
|
| 234 |
|
bondTypeScore = ii + jj; |
| 235 |
|
|
| 247 |
|
} |
| 248 |
|
|
| 249 |
|
|
| 250 |
< |
if (foundBonds.size() > 0) { |
| 250 |
> |
if (!foundBonds.empty()) { |
| 251 |
|
// sort the foundBonds by the score: |
| 252 |
|
std::sort(foundBonds.begin(), foundBonds.end()); |
| 253 |
|
|
| 255 |
– |
int bestScore = foundBonds[0].first; |
| 254 |
|
std::vector<std::string> theKeys = foundBonds[0].second; |
| 255 |
|
|
| 256 |
|
BondType* bestType = bondTypeCont_.find(theKeys); |
| 308 |
|
|
| 309 |
|
std::vector<tuple3<int, int, std::vector<std::string> > > foundBends; |
| 310 |
|
|
| 311 |
< |
for (j = at2Chain.begin(); j != at2Chain.end(); j++) { |
| 311 |
> |
for (j = at2Chain.begin(); j != at2Chain.end(); ++j) { |
| 312 |
|
ii = 0; |
| 313 |
< |
for (i = at1Chain.begin(); i != at1Chain.end(); i++) { |
| 313 |
> |
for (i = at1Chain.begin(); i != at1Chain.end(); ++i) { |
| 314 |
|
kk = 0; |
| 315 |
< |
for (k = at3Chain.begin(); k != at3Chain.end(); k++) { |
| 315 |
> |
for (k = at3Chain.begin(); k != at3Chain.end(); ++k) { |
| 316 |
|
|
| 317 |
|
IKscore = ii + kk; |
| 318 |
|
|
| 332 |
|
jj++; |
| 333 |
|
} |
| 334 |
|
|
| 335 |
< |
if (foundBends.size() > 0) { |
| 335 |
> |
if (!foundBends.empty()) { |
| 336 |
|
std::sort(foundBends.begin(), foundBends.end()); |
| 339 |
– |
int jscore = foundBends[0].first; |
| 340 |
– |
int ikscore = foundBends[0].second; |
| 337 |
|
std::vector<std::string> theKeys = foundBends[0].third; |
| 338 |
|
|
| 339 |
|
BendType* bestType = bendTypeCont_.find(theKeys); |
| 402 |
|
|
| 403 |
|
std::vector<tuple3<int, int, std::vector<std::string> > > foundTorsions; |
| 404 |
|
|
| 405 |
< |
for (j = at2Chain.begin(); j != at2Chain.end(); j++) { |
| 405 |
> |
for (j = at2Chain.begin(); j != at2Chain.end(); ++j) { |
| 406 |
|
kk = 0; |
| 407 |
< |
for (k = at3Chain.begin(); k != at3Chain.end(); k++) { |
| 407 |
> |
for (k = at3Chain.begin(); k != at3Chain.end(); ++k) { |
| 408 |
|
ii = 0; |
| 409 |
< |
for (i = at1Chain.begin(); i != at1Chain.end(); i++) { |
| 409 |
> |
for (i = at1Chain.begin(); i != at1Chain.end(); ++i) { |
| 410 |
|
ll = 0; |
| 411 |
< |
for (l = at4Chain.begin(); l != at4Chain.end(); l++) { |
| 411 |
> |
for (l = at4Chain.begin(); l != at4Chain.end(); ++l) { |
| 412 |
|
|
| 413 |
|
ILscore = ii + ll; |
| 414 |
|
JKscore = jj + kk; |
| 432 |
|
jj++; |
| 433 |
|
} |
| 434 |
|
|
| 435 |
< |
if (foundTorsions.size() > 0) { |
| 435 |
> |
if (!foundTorsions.empty()) { |
| 436 |
|
std::sort(foundTorsions.begin(), foundTorsions.end()); |
| 441 |
– |
int jkscore = foundTorsions[0].first; |
| 442 |
– |
int ilscore = foundTorsions[0].second; |
| 437 |
|
std::vector<std::string> theKeys = foundTorsions[0].third; |
| 438 |
|
|
| 439 |
|
TorsionType* bestType = torsionTypeCont_.find(theKeys); |
| 501 |
|
|
| 502 |
|
std::vector<tuple3<int, int, std::vector<std::string> > > foundInversions; |
| 503 |
|
|
| 504 |
< |
for (j = at2Chain.begin(); j != at2Chain.end(); j++) { |
| 504 |
> |
for (j = at2Chain.begin(); j != at2Chain.end(); ++j) { |
| 505 |
|
kk = 0; |
| 506 |
< |
for (k = at3Chain.begin(); k != at3Chain.end(); k++) { |
| 506 |
> |
for (k = at3Chain.begin(); k != at3Chain.end(); ++k) { |
| 507 |
|
ii = 0; |
| 508 |
< |
for (i = at1Chain.begin(); i != at1Chain.end(); i++) { |
| 508 |
> |
for (i = at1Chain.begin(); i != at1Chain.end(); ++i) { |
| 509 |
|
ll = 0; |
| 510 |
< |
for (l = at4Chain.begin(); l != at4Chain.end(); l++) { |
| 510 |
> |
for (l = at4Chain.begin(); l != at4Chain.end(); ++l) { |
| 511 |
|
|
| 512 |
|
Iscore = ii; |
| 513 |
|
JKLscore = jj + kk + ll; |
| 531 |
|
jj++; |
| 532 |
|
} |
| 533 |
|
|
| 534 |
< |
if (foundInversions.size() > 0) { |
| 534 |
> |
if (!foundInversions.empty()) { |
| 535 |
|
std::sort(foundInversions.begin(), foundInversions.end()); |
| 542 |
– |
int iscore = foundInversions[0].first; |
| 543 |
– |
int jklscore = foundInversions[0].second; |
| 536 |
|
std::vector<std::string> theKeys = foundInversions[0].third; |
| 537 |
|
|
| 538 |
|
InversionType* bestType = inversionTypeCont_.permutedFindSkippingFirstElement(theKeys); |
| 578 |
|
|
| 579 |
|
std::vector<std::pair<int, std::vector<std::string> > > foundNBI; |
| 580 |
|
|
| 581 |
< |
for (i = at1Chain.begin(); i != at1Chain.end(); i++) { |
| 581 |
> |
for (i = at1Chain.begin(); i != at1Chain.end(); ++i) { |
| 582 |
|
jj = 0; |
| 583 |
< |
for (j = at2Chain.begin(); j != at2Chain.end(); j++) { |
| 583 |
> |
for (j = at2Chain.begin(); j != at2Chain.end(); ++j) { |
| 584 |
|
|
| 585 |
|
nbiTypeScore = ii + jj; |
| 586 |
|
|
| 598 |
|
} |
| 599 |
|
|
| 600 |
|
|
| 601 |
< |
if (foundNBI.size() > 0) { |
| 601 |
> |
if (!foundNBI.empty()) { |
| 602 |
|
// sort the foundNBI by the score: |
| 603 |
< |
std::sort(foundNBI.begin(), foundNBI.end()); |
| 612 |
< |
|
| 613 |
< |
int bestScore = foundNBI[0].first; |
| 603 |
> |
std::sort(foundNBI.begin(), foundNBI.end()); |
| 604 |
|
std::vector<std::string> theKeys = foundNBI[0].second; |
| 605 |
|
|
| 606 |
|
NonBondedInteractionType* bestType = nonBondedInteractionTypeCont_.find(theKeys); |
| 761 |
|
ifstrstream* ffStream = new ifstrstream(); |
| 762 |
|
|
| 763 |
|
//try to open the force filed file in current directory first |
| 764 |
< |
ffStream->open(forceFieldFilename.c_str(), ifstream::in | ifstream::binary); |
| 775 |
< |
|
| 764 |
> |
ffStream->open(forceFieldFilename.c_str()); |
| 765 |
|
if(!ffStream->is_open()){ |
| 766 |
|
|
| 767 |
|
forceFieldFilename = ffPath_ + "/" + forceFieldFilename; |
| 768 |
< |
ffStream->open( forceFieldFilename.c_str(), |
| 780 |
< |
ifstream::in | ifstream::binary ); |
| 768 |
> |
ffStream->open( forceFieldFilename.c_str() ); |
| 769 |
|
|
| 770 |
|
//if current directory does not contain the force field file, |
| 771 |
|
//try to open it in the path |