当前位置: 首页>>代码示例>>C++>>正文


C++ Vec3::Dptr方法代码示例

本文整理汇总了C++中Vec3::Dptr方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec3::Dptr方法的具体用法?C++ Vec3::Dptr怎么用?C++ Vec3::Dptr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vec3的用法示例。


在下文中一共展示了Vec3::Dptr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Action_NoImage_Center

//using dist for no image 
// and kernel for when we use solute molecule center
void Action_Closest::Action_NoImage_Center(Frame&, double maxD)
{
	double Dist;
	int solventMol;

	AtomMask::const_iterator solute_atom;
	Iarray::const_iterator solvent_atom;

	Vec3 maskCenter = frmIn.VGeometricCenter( distanceMask_ );
	for (solventMol=0; solventMol < NsolventMolecules_; solventMol++) {  //standard loop 
		SolventMols_[solventMol].D = maxD;
		for (solvent_atom = SolventMols_[solventMol].solventAtoms.begin();
			solvent_atom != SolventMols_[solventMol].solventAtoms.end(); ++solvent_atom)
		{

			//main dist2_noImage code
			double *a1 = maskCenter.Dptr(); //center of solute molecule
			double *a2 = frmIn.XYZ(*solvent_atom);

			double x = a1[0] - a2[0];
			double y = a1[1] - a2[1];
			double z = a1[2] - a2[2];

			Dist = (x*x + y*y + z*z);

			if (Dist < SolventMols_[solventMol].D) 
				SolventMols_[solventMol].D = Dist;
		}
	}

}
开发者ID:amit56r,项目名称:cpptraj-closest,代码行数:33,代码来源:action_noImage.cpp

示例2: Action_NoImage

//pulling out the dist control statement
void Action_Closest::Action_NoImage(Frame& frmIn,double maxD)
{
  double Dist;
  int solventMol;
  AtomMask::const_iterator solute_atom;
  Iarray::const_iterator solvent_atom;
    // Loop over all solvent molecules in original frame
  if (useMaskCenter_) {
    Vec3 maskCenter = frmIn.VGeometricCenter( distanceMask_ );
    for (solventMol=0; solventMol < NsolventMolecules_; solventMol++) {
      SolventMols_[solventMol].D = maxD;
      for (solvent_atom = SolventMols_[solventMol].solventAtoms.begin();
           solvent_atom != SolventMols_[solventMol].solventAtoms.end(); ++solvent_atom)
      {

        Dist = DIST2_NoImage( maskCenter.Dptr(),
                      frmIn.XYZ(*solvent_atom));
        //printf("DIST  = %f\n", Dist);
	if (Dist < SolventMols_[solventMol].D) 
          SolventMols_[solventMol].D = Dist;
      }
    }
  } else {
    for (solventMol=0; solventMol < NsolventMolecules_; solventMol++) {
      if (debug_ > 1)
        mprintf("DEBUG: Calculating distance for molecule %i\n", solventMol);
      // Set the initial minimum distance for this solvent mol to be the
      // max possible distance.
      SolventMols_[solventMol].D = maxD;
      // Calculate distance between each atom in distanceMask and atoms in solvent Mask
      for (solvent_atom = SolventMols_[solventMol].solventAtoms.begin();
           solvent_atom != SolventMols_[solventMol].solventAtoms.end(); ++solvent_atom)
      {
        for (solute_atom = distanceMask_.begin(); 
             solute_atom != distanceMask_.end(); ++solute_atom)
        {
          Dist = DIST2_NoImage(frmIn.XYZ(*solute_atom),
                       frmIn.XYZ(*solvent_atom));
          //printf("no center DIST  = %f\n", Dist);
	if (Dist < SolventMols_[solventMol].D) 
            SolventMols_[solventMol].D = Dist;
          if (debug_ > 2)
            mprintf("DEBUG: SolvMol %i, soluteAtom %i, solventAtom %i, D= %f, minD= %f\n",
                    solventMol, *solute_atom, *solvent_atom, Dist,
                    sqrt(SolventMols_[solventMol].D));
        }
      }
      if (debug_ > 1) mprintf("DEBUG:\tMol %8i minD= %lf\n",solventMol, SolventMols_[solventMol].D);
    } // END for loop over solventMol
  }

}
开发者ID:amit56r,项目名称:cpptraj-closest,代码行数:53,代码来源:Action_Closest.cpp

示例3: DoAction

/** Find the minimum distance between atoms in distanceMask and each 
  * solvent Mask.
  */
Action_Closest::RetType Action_Closest::DoAction(int frameNum, Frame& frmIn) {
  int solventMol; 
  double Dist, maxD;
  Matrix_3x3 ucell, recip;
  AtomMask::const_iterator solute_atom;
  Iarray::const_iterator solvent_atom;

  if (image_.ImagingEnabled()) {
    frmIn.BoxCrd().ToRecip(ucell, recip);
    // Calculate max possible imaged distance
    maxD = frmIn.BoxCrd().BoxX() + frmIn.BoxCrd().BoxY() + 
           frmIn.BoxCrd().BoxZ();
    maxD *= maxD;
  } else {
    // If not imaging, set max distance to an arbitrarily large number
    maxD = DBL_MAX;
  }

  // Loop over all solvent molecules in original frame
  if (useMaskCenter_) {
    Vec3 maskCenter = frmIn.VGeometricCenter( distanceMask_ );
    for (solventMol=0; solventMol < NsolventMolecules_; solventMol++) {
      SolventMols_[solventMol].D = maxD;
      for (solvent_atom = SolventMols_[solventMol].solventAtoms.begin();
           solvent_atom != SolventMols_[solventMol].solventAtoms.end(); ++solvent_atom)
      {
        Dist = DIST2( maskCenter.Dptr(),
                      frmIn.XYZ(*solvent_atom), image_.ImageType(),
                      frmIn.BoxCrd(), ucell, recip);
        if (Dist < SolventMols_[solventMol].D) 
          SolventMols_[solventMol].D = Dist;
      }
    }
  } else {
    for (solventMol=0; solventMol < NsolventMolecules_; solventMol++) {
      if (debug_ > 1)
        mprintf("DEBUG: Calculating distance for molecule %i\n", solventMol);
      // Set the initial minimum distance for this solvent mol to be the
      // max possible distance.
      SolventMols_[solventMol].D = maxD;
      // Calculate distance between each atom in distanceMask and atoms in solvent Mask
      for (solvent_atom = SolventMols_[solventMol].solventAtoms.begin();
           solvent_atom != SolventMols_[solventMol].solventAtoms.end(); ++solvent_atom)
      {
        for (solute_atom = distanceMask_.begin(); 
             solute_atom != distanceMask_.end(); ++solute_atom)
        {
          Dist = DIST2(frmIn.XYZ(*solute_atom),
                       frmIn.XYZ(*solvent_atom), image_.ImageType(), 
                       frmIn.BoxCrd(), ucell, recip);
          if (Dist < SolventMols_[solventMol].D) 
            SolventMols_[solventMol].D = Dist;
          if (debug_ > 2)
            mprintf("DEBUG: SolvMol %i, soluteAtom %i, solventAtom %i, D= %f, minD= %f\n",
                    solventMol, *solute_atom, *solvent_atom, Dist,
                    sqrt(SolventMols_[solventMol].D));
        }
      }
      if (debug_ > 1) mprintf("DEBUG:\tMol %8i minD= %lf\n",solventMol, SolventMols_[solventMol].D);
    } // END for loop over solventMol
  }

  // Sort distances
  std::sort( SolventMols_.begin(), SolventMols_.end(), moldist_cmp() );
  // Add first closestWaters solvent atoms to stripMask
  std::vector<MolDist>::iterator solventend = SolventMols_.begin() + closestWaters_;
  for ( std::vector<MolDist>::const_iterator solvent = SolventMols_.begin();
                                             solvent != solventend;
                                           ++solvent ) 
  {
    solvent_atom = solvent->mask.begin();
    mprintf("\tMol= %8i  Atom= %8i  Dist= %10.4f\n", solvent->mol,
            *solvent_atom + 1, sqrt( solvent->D ));
  }

  return Action_Closest::OK;
}
开发者ID:amit56r,项目名称:cpptraj-closest,代码行数:80,代码来源:Action_Closest.cpp


注:本文中的Vec3::Dptr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。