51 |
|
#include "UseTheForce/ForceField.hpp" |
52 |
|
#include "utils/simError.h" |
53 |
|
#include "utils/Tuple.hpp" |
54 |
– |
#include "UseTheForce/DarkSide/atype_interface.h" |
55 |
– |
#include "UseTheForce/DarkSide/fForceOptions_interface.h" |
56 |
– |
#include "UseTheForce/DarkSide/switcheroo_interface.h" |
54 |
|
namespace OpenMD { |
55 |
|
|
56 |
|
ForceField::ForceField() { |
66 |
|
} |
67 |
|
} |
68 |
|
|
69 |
< |
|
70 |
< |
ForceField::~ForceField() { |
71 |
< |
deleteAtypes(); |
72 |
< |
deleteSwitch(); |
73 |
< |
} |
74 |
< |
|
69 |
> |
/** |
70 |
> |
* getAtomType by string |
71 |
> |
* |
72 |
> |
* finds the requested atom type in this force field using the string |
73 |
> |
* name of the atom type. |
74 |
> |
*/ |
75 |
|
AtomType* ForceField::getAtomType(const std::string &at) { |
76 |
|
std::vector<std::string> keys; |
77 |
|
keys.push_back(at); |
78 |
|
return atomTypeCont_.find(keys); |
79 |
|
} |
80 |
|
|
81 |
+ |
/** |
82 |
+ |
* getAtomType by ident |
83 |
+ |
* |
84 |
+ |
* finds the requested atom type in this force field using the |
85 |
+ |
* integer ident instead of the string name of the atom type. |
86 |
+ |
*/ |
87 |
+ |
AtomType* ForceField::getAtomType(int ident) { |
88 |
+ |
std::string at = atypeIdentToName.find(ident)->second; |
89 |
+ |
return getAtomType(at); |
90 |
+ |
} |
91 |
+ |
|
92 |
|
BondType* ForceField::getBondType(const std::string &at1, |
93 |
|
const std::string &at2) { |
94 |
|
std::vector<std::string> keys; |
451 |
|
std::vector<std::string> keys; |
452 |
|
keys.push_back(at1); |
453 |
|
keys.push_back(at2); |
454 |
< |
|
454 |
> |
|
455 |
|
//try exact match first |
456 |
|
NonBondedInteractionType* nbiType = nonBondedInteractionTypeCont_.find(keys); |
457 |
|
if (nbiType) { |
458 |
|
return nbiType; |
459 |
|
} else { |
460 |
|
//if no exact match found, try wild card match |
461 |
< |
return nonBondedInteractionTypeCont_.find(keys, wildCardAtomTypeName_); |
461 |
> |
return nonBondedInteractionTypeCont_.find(keys, wildCardAtomTypeName_); |
462 |
|
} |
463 |
|
} |
464 |
|
|
515 |
|
bool ForceField::addAtomType(const std::string &at, AtomType* atomType) { |
516 |
|
std::vector<std::string> keys; |
517 |
|
keys.push_back(at); |
518 |
+ |
atypeIdentToName[atomType->getIdent()] = at; |
519 |
|
return atomTypeCont_.add(keys, atomType); |
520 |
|
} |
521 |
|
|
522 |
|
bool ForceField::replaceAtomType(const std::string &at, AtomType* atomType) { |
523 |
|
std::vector<std::string> keys; |
524 |
|
keys.push_back(at); |
525 |
+ |
atypeIdentToName[atomType->getIdent()] = at; |
526 |
|
return atomTypeCont_.replace(keys, atomType); |
527 |
|
} |
528 |
|
|
641 |
|
return ffStream; |
642 |
|
} |
643 |
|
|
634 |
– |
void ForceField::setFortranForceOptions(){ |
635 |
– |
ForceOptions theseFortranOptions; |
636 |
– |
forceFieldOptions_.makeFortranOptions(theseFortranOptions); |
637 |
– |
setfForceOptions(&theseFortranOptions); |
638 |
– |
} |
644 |
|
} //end namespace OpenMD |