/** Set up bond arrays in a sorted list for easy access during loop
  * over all pairs of atoms. Only use bonds for which both atoms are in
  * the mask.
  */
void Action_CheckStructure::ProcessBondArray(BondArray const& Bonds, BondParmArray const& Parm,
                                         CharMask const& cMask)
{
  BondType BT;
  for (BondArray::const_iterator bnd = Bonds.begin(); bnd != Bonds.end(); ++bnd)
  {
    if ( cMask.AtomInCharMask(bnd->A1()) && cMask.AtomInCharMask(bnd->A2()) ) {
      if (bnd->Idx() < 0)
        mprintf("Warning: Bond parameters not present for atoms %i-%i, skipping.\n",
                bnd->A1()+1, bnd->A2()+1);
      else {
        BT.Req_off2_ = Parm[ bnd->Idx() ].Req() + bondoffset_;
        BT.Req_off2_ *= BT.Req_off2_; // Store squared values.
        BT.a1_ = bnd->A1();
        BT.a2_ = bnd->A2();
        bondList_.push_back(BT);
      }
    }
  }
}
Example #2
0
/** Check that at least 1 atom in the range is in Mask1 */
static inline void CheckRange(Image::PairType& atomPairs, CharMask const& MaskIn, 
                              int firstAtom, int lastAtom)
{
  bool rangeIsValid = false;
  for (int atom = firstAtom; atom < lastAtom; ++atom) {
    if (MaskIn.AtomInCharMask(atom)) {
      rangeIsValid = true;
      break;
    }
  }
  if (rangeIsValid) {
    atomPairs.push_back( firstAtom );
    atomPairs.push_back( lastAtom );
  }
}