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


C++ StuntDouble::setFrc方法代码示例

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


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

示例1: calcForces

  void ThermoIntegrationForceManager::calcForces(){
    Snapshot* curSnapshot;
    SimInfo::MoleculeIterator mi;
    Molecule* mol;
    Molecule::IntegrableObjectIterator ii;
    StuntDouble* sd;
    Vector3d frc;
    Vector3d trq;
    Mat3x3d tempTau;
    
    // perform the standard calcForces first
    ForceManager::calcForces();
    
    curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();

    // now scale forces and torques of all the sds
      
    for (mol = info_->beginMolecule(mi); mol != NULL; 
         mol = info_->nextMolecule(mi)) {

      for (sd = mol->beginIntegrableObject(ii); sd != NULL; 
           sd = mol->nextIntegrableObject(ii)) {

        frc = sd->getFrc();
        frc *= factor_;
        sd->setFrc(frc);
        
        if (sd->isDirectional()){
          trq = sd->getTrq();
          trq *= factor_;
          sd->setTrq(trq);
        }
      }
    }
    
    // set rawPotential to be the unmodulated potential
    lrPot_ = curSnapshot->getLongRangePotential();
    curSnapshot->setRawPotential(lrPot_);
    
    // modulate the potential and update the snapshot
    lrPot_ *= factor_;
    curSnapshot->setLongRangePotential(lrPot_);
    
    // scale the pressure tensor
    tempTau = curSnapshot->getStressTensor();
    tempTau *= factor_;
    curSnapshot->setStressTensor(tempTau);

    // now, on to the applied restraining potentials (if needed):
    RealType restPot_local = 0.0;
    RealType vHarm_local = 0.0;
    
    if (simParam->getUseRestraints()) {
      // do restraints from RestraintForceManager:
      restPot_local = doRestraints(1.0 - factor_);      
      vHarm_local = getUnscaledPotential();
    }
      
#ifdef IS_MPI
    RealType restPot;
    MPI::COMM_WORLD.Allreduce(&restPot_local, &restPot, 1, 
                              MPI::REALTYPE, MPI::SUM);
    MPI::COMM_WORLD.Allreduce(&vHarm_local, &vHarm_, 1, 
                              MPI::REALTYPE, MPI::SUM);         
    lrPot_ += restPot;
#else
    lrPot_ += restPot_local;
    vHarm_ = vHarm_local;
#endif

    // give the final values to stats
    curSnapshot->setLongRangePotential(lrPot_);
    curSnapshot->setRestraintPotential(vHarm_);
  }  
开发者ID:Patrick-Louden,项目名称:2.2,代码行数:74,代码来源:ThermoIntegrationForceManager.cpp


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