Example #1
0
// Action_MultiVector::DoAction()
Action::RetType Action_MultiVector::DoAction(int frameNum, ActionFrame& frm) {
  for (unsigned int nv = 0; nv < CrdIdx1_.size(); ++nv) {
    Vec3 CXYZ( frm.Frm().CRD( CrdIdx1_[nv] ) );
    Vec3 VXYZ( frm.Frm().CRD( CrdIdx2_[nv] ) );
    VXYZ -= CXYZ;
    data_[nv]->AddVxyz(VXYZ, CXYZ);
  }

  return Action::OK;
}
// Action_MultiVector::DoAction()
Action::RetType Action_MultiVector::DoAction(int frameNum, Frame* currentFrame, 
                                               Frame** frameAddress)
{
  for (unsigned int nv = 0; nv < CrdIdx1_.size(); ++nv) {
    Vec3 CXYZ( currentFrame->CRD( CrdIdx1_[nv] ) );
    Vec3 VXYZ( currentFrame->CRD( CrdIdx2_[nv] ) );
    VXYZ -= CXYZ;
    data_[nv]->AddVxyz(VXYZ, CXYZ);
  }

  return Action::OK;
}
Example #3
0
void Action_Vector::Dipole(Frame const& currentFrame) {
  Vec3 VXYZ(0.0, 0.0, 0.0);
  Vec3 CXYZ(0.0, 0.0, 0.0);
  double total_mass = 0;
  for (AtomMask::const_iterator atom = mask_.begin();
                                atom != mask_.end(); ++atom)
  {
    double mass = (*CurrentParm_)[*atom].Mass();
    total_mass += mass;
    Vec3 XYZ = currentFrame.XYZ( *atom );
    CXYZ += ( XYZ * mass );
    double charge = (*CurrentParm_)[*atom].Charge();
    XYZ *= charge;
    VXYZ += ( XYZ );
  }
  CXYZ /= total_mass;
  Vec_->AddVxyz( VXYZ, CXYZ );
}