ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/primitives/Molecule.cpp
(Generate patch)

Comparing trunk/src/primitives/Molecule.cpp (file contents):
Revision 2052 by gezelter, Fri Jan 9 19:06:35 2015 UTC vs.
Revision 2053 by gezelter, Mon Jan 12 16:04:43 2015 UTC

# Line 197 | Line 197 | namespace OpenMD {
197        std::vector<AtomType*> ayb = at->allYourBase();
198        // use the last type in the chain of base types for the name:
199        std::string bn = ayb[ayb.size()-1]->getName();
200 +      
201 +      if (bn.compare("O")==0 || bn.compare("N")==0 || bn.compare("F")==0)
202 +        hBondAcceptors_.push_back( atom );
203  
201      int obanum = etab.GetAtomicNum(bn.c_str());
202      if (obanum != 0) {
203        RealType eneg = etab.GetElectroNeg(obanum);
204        if (eneg > 3.01) {
205          hBondAcceptors_.push_back( atom );
206        }
207      }
204      }
209
210    // find electronegative atoms that are either bonded to hydrogens or are
211    // present in the same rigid bodies:
205      
206 +    // find electronegative atoms that are either bonded to
207 +    // hydrogens or are present in the same rigid bodies:
208 +    
209      for (bond = beginBond(bi); bond != NULL; bond = nextBond(bi)) {
210        Atom* atom1 = bond->getAtomA();
211        Atom* atom2 = bond->getAtomB();
# Line 221 | Line 217 | namespace OpenMD {
217        // use the last type in the chain of base types for the name:
218        std::string bn1 = ayb1[ayb1.size()-1]->getName();
219        std::string bn2 = ayb2[ayb2.size()-1]->getName();
220 <      int obanum1 = etab.GetAtomicNum(bn1.c_str());
221 <      int obanum2 = etab.GetAtomicNum(bn2.c_str());
222 <
223 <      if (obanum1 == 1) {              
224 <        if (obanum2 != 0) {
225 <          RealType eneg = etab.GetElectroNeg(obanum2);
226 <          if (eneg > 3.01) {
227 <            HBondDonor* donor = new HBondDonor();
232 <            donor->donorAtom = atom2;
233 <            donor->donatedHydrogen = atom1;
234 <            hBondDonors_.push_back( donor );
235 <          }
220 >      
221 >      if (bn1.compare("H")==0) {
222 >        if (bn2.compare("O")==0 || bn2.compare("N")==0
223 >            || bn2.compare("F")==0) {
224 >          HBondDonor* donor = new HBondDonor();
225 >          donor->donorAtom = atom2;
226 >          donor->donatedHydrogen = atom1;
227 >          hBondDonors_.push_back( donor );
228          }
229        }
230 <      if (obanum2 == 1) {
231 <        if (obanum1 != 0) {
232 <          RealType eneg = etab.GetElectroNeg(obanum1);
233 <          if (eneg > 3.01) {
234 <            HBondDonor* donor = new HBondDonor();
235 <            donor->donorAtom = atom1;
244 <            donor->donatedHydrogen = atom2;
230 >      if (bn2.compare("H")==0) {
231 >        if (bn1.compare("O")==0 || bn1.compare("N")==0
232 >            || bn1.compare("F")==0) {
233 >          HBondDonor* donor = new HBondDonor();
234 >          donor->donorAtom = atom1;
235 >          donor->donatedHydrogen = atom2;
236              hBondDonors_.push_back( donor );
246          }
237          }
238 <      }
238 >      }
239      }
240 <
241 <    for (rb = beginRigidBody(rbIter); rb != NULL; rb = nextRigidBody(rbIter)) {
242 <      for(atom1 = rb->beginAtom(ai); atom1 != NULL; atom1 = rb->nextAtom(ai)) {
240 >    
241 >    for (rb = beginRigidBody(rbIter); rb != NULL;
242 >         rb = nextRigidBody(rbIter)) {
243 >      for(atom1 = rb->beginAtom(ai); atom1 != NULL;
244 >          atom1 = rb->nextAtom(ai)) {
245          AtomType* at1 = atom1->getAtomType();
246          // get the chain of base types for this atom type:
247          std::vector<AtomType*> ayb1 = at1->allYourBase();
248          // use the last type in the chain of base types for the name:
249          std::string bn1 = ayb1[ayb1.size()-1]->getName();
250 <        int obanum1 = etab.GetAtomicNum(bn1.c_str());
251 <        if (obanum1 != 0) {
252 <          RealType eneg = etab.GetElectroNeg(obanum1);
253 <          if (eneg > 3.01) {
254 <            for(atom2 = rb->beginAtom(aj); atom2 != NULL;
255 <                atom2 = rb->nextAtom(aj)) {
256 <              AtomType* at2 = atom2->getAtomType();
257 <              // get the chain of base types for this atom type:              
258 <              std::vector<AtomType*> ayb2 = at2->allYourBase();
259 <              // use the last type in the chain of base types for the name:
260 <              std::string bn2 = ayb2[ayb2.size()-1]->getName();
261 <              int obanum2 = etab.GetAtomicNum(bn2.c_str());
262 <              if (obanum2 == 1) {
263 <                HBondDonor* donor = new HBondDonor();
264 <                donor->donorAtom = atom1;
273 <                donor->donatedHydrogen = atom2;
274 <                hBondDonors_.push_back( donor );
275 <              }
250 >        
251 >        if (bn1.compare("O")==0 || bn1.compare("N")==0
252 >            || bn1.compare("F")==0) {
253 >          for(atom2 = rb->beginAtom(aj); atom2 != NULL;
254 >              atom2 = rb->nextAtom(aj)) {
255 >            AtomType* at2 = atom2->getAtomType();
256 >            // get the chain of base types for this atom type:              
257 >            std::vector<AtomType*> ayb2 = at2->allYourBase();
258 >            // use the last type in the chain of base types for the name:
259 >            std::string bn2 = ayb2[ayb2.size()-1]->getName();
260 >            if (bn2.compare("H")==0) {              
261 >              HBondDonor* donor = new HBondDonor();
262 >              donor->donorAtom = atom1;
263 >              donor->donatedHydrogen = atom2;
264 >              hBondDonors_.push_back( donor );
265              }
266            }
267          }
268        }
269 <    }          
269 >    }
270    }
271 <
271 >  
272    RealType Molecule::getMass() {
273      StuntDouble* sd;
274      std::vector<StuntDouble*>::iterator i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines