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


C++ ActionSetup::Top方法代码示例

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


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

示例1: Setup

Action::RetType Action_DNAionTracker::Setup(ActionSetup& setup) {
  // Setup masks
  if (setup.Top().SetupIntegerMask( p1_ )) return Action::ERR; 
  if ( p1_.None() ) {
    mprinterr("Error: dnaiontracker: No atoms in mask1\n");
    return Action::ERR;
  }
  if (setup.Top().SetupIntegerMask( p2_ )) return Action::ERR;  
  if ( p2_.None() ) {
    mprinterr("Error: dnaiontracker: No atoms in mask2\n");
    return Action::ERR;
  }
  if (setup.Top().SetupIntegerMask( base_ )) return Action::ERR;  
  if ( base_.None() ) {
    mprinterr("Error: dnaiontracker: No atoms in mask3\n");
    return Action::ERR;
  }
  if (setup.Top().SetupIntegerMask( ions_ )) return Action::ERR;  
  if ( ions_.None() ) {
    mprinterr("Error: dnaiontracker: No atoms in mask4\n");
    return Action::ERR;
  }
  SetupImaging( setup.CoordInfo().TrajBox().Type() );
  mprintf("\tPhosphate1 Mask [%s] %i atoms.\n", p1_.MaskString(), p1_.Nselected());
  mprintf("\tPhosphate2 Mask [%s] %i atoms.\n", p2_.MaskString(), p2_.Nselected());
  mprintf("\t      Base Mask [%s] %i atoms.\n", base_.MaskString(), base_.Nselected());
  mprintf("\t      Ions Mask [%s] %i atoms.\n", ions_.MaskString(), ions_.Nselected());

  return Action::OK;
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:30,代码来源:Action_DNAionTracker.cpp

示例2: Setup

// Action_Unwrap::Setup()
Action::RetType Action_Unwrap::Setup(ActionSetup& setup) {
  // Ensure same number of atoms in current parm and ref parm
  if ( RefParm_!=0 ) {
    if ( setup.Top().Natom() != RefParm_->Natom() ) {
      mprinterr("Error: unwrap: # atoms in reference parm %s is not\n", RefParm_->c_str());
      mprinterr("Error:         equal to # atoms in parm %s\n", setup.Top().c_str());
      return Action::ERR;
    }
  }
  // Check box type
  if (setup.CoordInfo().TrajBox().Type()==Box::NOBOX) {
    mprintf("Error: unwrap: Parm %s does not contain box information.\n",
            setup.Top().c_str());
    return Action::ERR;
  }
  orthogonal_ = false;
  if (setup.CoordInfo().TrajBox().Type()==Box::ORTHO)
    orthogonal_ = true;

  // Setup atom pairs to be unwrapped.
  imageList_ = Image::CreatePairList(setup.Top(), imageMode_, maskExpression_);
  if (imageList_.empty()) {
    mprintf("Warning: Mask selects no atoms for topology '%s'.\n", setup.Top().c_str());
    return Action::SKIP;
  }
  mprintf("\tNumber of %ss to be unwrapped is %zu\n",
          Image::ModeString(imageMode_), imageList_.size()/2);

  // Use current parm as reference if not already set
  if (RefParm_ == 0)
    RefParm_ = setup.TopAddress();
  return Action::OK;
}
开发者ID:rmcgibbo,项目名称:cpptraj,代码行数:34,代码来源:Action_Unwrap.cpp

示例3: Setup

/** If the current parm does not match the target parm, deactivate. Otherwise
  * replace current parm with mapped parm.
  */
Action::RetType Action_AtomMap::Setup(ActionSetup& setup) {
    if (maponly_) {
        mprintf("    ATOMMAP: maponly was specified, not using atom map during traj read.\n");
        return Action::OK;
    }
    if (setup.Top().Pindex() != TgtFrame_->Top().Pindex() ||
            setup.Top().Natom() != TgtFrame_->Top().Natom())
    {
        mprintf("    ATOMMAP: Map for parm %s -> %s (%i atom).\n",TgtFrame_->Top().c_str(),
                RefFrame_->Top().c_str(), TgtFrame_->Top().Natom());
        mprintf("             Current parm %s (%i atom).\n",setup.Top().c_str(),
                setup.Top().Natom());
        mprintf("             Not using map for this parm.\n");
        return Action::SKIP;
    }
    if (rmsfit_) {
        mprintf("    ATOMMAP: rmsfit specified, %i atoms.\n",rmsRefFrame_.Natom());
        return Action::OK;
    }
    mprintf("    ATOMMAP: Map for parm %s -> %s (%i atom).\n",TgtFrame_->Top().c_str(),
            RefFrame_->Top().c_str(), TgtFrame_->Top().Natom());

    setup.SetTopology( newParm_ );

    return Action::MODIFY_TOPOLOGY;
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:29,代码来源:Action_AtomMap.cpp

示例4: HistSetup

/** Set up masks and properties for selected atoms. */
Action::RetType Action_Density::HistSetup(ActionSetup& setup) {
  properties_.clear();
  properties_.reserve( masks_.size() );

  for (std::vector<AtomMask>::iterator mask = masks_.begin();
                                       mask != masks_.end();
                                       mask++)
  {
    if (setup.Top().SetupIntegerMask(*mask) ) return Action::ERR;

    std::vector<double> property;

    for (AtomMask::const_iterator idx = mask->begin();
                                  idx != mask->end(); idx++)
    {
      const Atom& atom = setup.Top()[*idx];

      switch (property_) {
        case NUMBER   : property.push_back(1.0); break;
        case MASS     : property.push_back(atom.Mass() ); break;
        case CHARGE   : property.push_back(atom.Charge() ); break;
        case ELECTRON : property.push_back(atom.AtomicNumber() - atom.Charge() ); break;
      }
    }

    properties_.push_back(property);

    mprintf("\t");
    mask->BriefMaskInfo();
    mprintf("\n");
  }

  return Action::OK;  
}
开发者ID:Amber-MD,项目名称:cpptraj,代码行数:35,代码来源:Action_Density.cpp

示例5: Setup

/** Determine what atoms each mask pertains to for the current parm file.
  */
Action::RetType Action_LIE::Setup(ActionSetup& setup) {
  if (setup.Top().SetupIntegerMask( Mask1_ )) return Action::ERR;
  if (setup.Top().SetupIntegerMask( Mask2_ )) return Action::ERR;

  mprintf("\tLIE: %i Ligand Atoms, %i Surrounding Atoms\n",
          Mask1_.Nselected(), Mask2_.Nselected());

  if (setup.CoordInfo().TrajBox().Type() == Box::NOBOX) {
    mprinterr("Error: LIE: Must have explicit solvent system with box info\n");
    return Action::ERR;
  }

  if (Mask1_.None() || Mask2_.None()) {
    mprintf("Warning: LIE: One or both masks have no atoms.\n");
    return Action::SKIP;
  }

  if (SetupParms(setup.Top()))
    return Action::ERR;

  // Back up the parm
  CurrentParm_ = setup.TopAddress();

  return Action::OK;
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:27,代码来源:Action_LIE.cpp

示例6: Setup

/** For this to be valid the same # of atoms should be selected each time. */
Action::RetType Action_VelocityAutoCorr::Setup(ActionSetup& setup) {
  if (setup.Top().SetupIntegerMask( mask_ )) return Action::ERR;
  mask_.MaskInfo();
  if (mask_.None()) {
    mprintf("Warning: No atoms selected by mask.\n");
    return Action::SKIP;
  }
  // If using velocity info, check that it is present.
  if (useVelInfo_ && !setup.CoordInfo().HasVel()) {
    mprinterr("Error: 'usevelocity' specified but no velocity info assocated with %s\n",
              setup.Top().c_str());
    return Action::ERR;
  }
  // If we have already started recording velocities, check that the current 
  // number of selected atoms has remained the same.
  if (!Vel_.empty()) {
    if ((int)Vel_.size() != mask_.Nselected()) {
      mprinterr("Error: # of selected atoms %i has changed (previously %zu)\n",
                mask_.Nselected(), Vel_.size());
      return Action::ERR;
    }
  } else
    Vel_.resize( mask_.Nselected() );
  return Action::OK;
}
开发者ID:drroe,项目名称:cpptraj,代码行数:26,代码来源:Action_VelocityAutoCorr.cpp

示例7: Setup

// Action_MultiVector::Setup();
Action::RetType Action_MultiVector::Setup(ActionSetup& setup) {
  Range actualRange;
  // If range is empty (i.e. no resrange arg given) look through all 
  // solute residues.
  if (resRange_.Empty())
    actualRange = setup.Top().SoluteResidues();
  else {
    // If user range specified, create new range shifted by -1 since internal
    // resnums start from 0.
    actualRange = resRange_;
    actualRange.ShiftBy(-1);
  }
  // Exit if no residues specified
  if (actualRange.Empty()) {
    mprintf("Warning: No residues specified for %s\n",setup.Top().c_str());
    return Action::SKIP;
  }
  // Set default DataSet name if not specified.
  if (dsetname_.empty())
    dsetname_ = masterDSL_->GenerateDefaultName( "MVEC" );
  // Search for specified atom names in each residue in the range
  CrdIdx1_.clear();
  CrdIdx2_.clear();
  for (Range::const_iterator res = actualRange.begin(); res != actualRange.end(); ++res)
  {
    int atom1 = setup.Top().FindAtomInResidue( *res, name1_ );
    int atom2 = setup.Top().FindAtomInResidue( *res, name2_ );
    if (atom1 != -1 && atom2 != -1) {
      MetaData md(dsetname_, atom1+1);
      md.SetScalarMode( MetaData::M_VECTOR );
      if (ired_) md.SetScalarType( MetaData::IREDVEC );
      DataSet_Vector* ds = (DataSet_Vector*)masterDSL_->CheckForSet( md );
      if (ds == 0) {
        // Create DataSet
        ds = (DataSet_Vector*)masterDSL_->AddSet( DataSet::VECTOR, md );
        if (ds == 0) return Action::ERR;
        ds->SetLegend( "v" + setup.Top().AtomMaskName(atom1) + "->" +
                             setup.Top().AtomMaskName(atom2) );
        if (outfile_ != 0) outfile_->AddDataSet( ds );
      }
      data_.push_back( ds );
      CrdIdx1_.push_back( atom1 * 3 ); // Pre calc coordinate index
      CrdIdx2_.push_back( atom2 * 3 );
    } else if ((atom1==-1) != (atom2==-1)) {
      if (atom1==-1)
        mprintf("Warning: '%s' not found but '%s' found for residue %i.\n", 
                *name1_, *name2_, *res + 1);
      else // atom2==-1
        mprintf("Warning: '%s' not found but '%s' found for residue %i.\n",
                *name2_, *name1_, *res + 1);
    }
  }
  mprintf("\tSelected %zu vectors.\n", CrdIdx1_.size());
  for (std::vector<DataSet_Vector*>::const_iterator it = data_.begin();
                                                    it != data_.end(); ++it)
    mprintf("\t  %s\n", (*it)->legend());

  return Action::OK;
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:60,代码来源:Action_MultiVector.cpp

示例8: Setup

// Action_Principal::Setup()
Action::RetType Action_Principal::Setup(ActionSetup& setup) {
  if (setup.Top().SetupIntegerMask(mask_)) return Action::ERR;
  mask_.MaskInfo();
  if (mask_.None()) {
    mprintf("Warning: No atoms selected for %s [%s].\n",setup.Top().c_str(), mask_.MaskString());
    return Action::SKIP;
  }
  return Action::OK;
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:10,代码来源:Action_Principal.cpp

示例9: Setup

/** Set up solute and solvent masks. If no solvent mask was specified use 
  * solvent information in the current topology.
  */
Action::RetType Action_Watershell::Setup(ActionSetup& setup) {
  // Set up solute mask
  if (setup.Top().SetupIntegerMask( soluteMask_ )) return Action::ERR;
  if ( soluteMask_.None() ) {
    mprintf("Warning: No atoms in solute mask [%s].\n",soluteMask_.MaskString());
    return Action::SKIP;
  }
  // Set up solvent mask
  if (!solventmaskexpr_.empty()) {
    if (setup.Top().SetupIntegerMask( solventMask_ )) return Action::ERR;
  } else {
    solventMask_.ResetMask();
    for (Topology::mol_iterator mol = setup.Top().MolStart();
                                mol != setup.Top().MolEnd(); ++mol)
    {
      if ( mol->IsSolvent() )
        solventMask_.AddAtomRange( mol->BeginAtom(), mol->EndAtom() );
    }
  }
  if ( solventMask_.None() ) {
    if (!solventmaskexpr_.empty())
      mprintf("Warning: No solvent atoms selected by mask [%s]\n",
                solventmaskexpr_.c_str());
    else
      mprintf("Warning: No solvent atoms in topology %s\n",setup.Top().c_str());
    return Action::SKIP;
  }
  SetupImaging( setup.CoordInfo().TrajBox().Type() );
  // Create space for residues
# ifdef _OPENMP
  // Only re-allocate for larger # of residues
  if ( setup.Top().Nres() > NactiveResidues_ ) {
    if (activeResidues_thread_ != 0) {
      // Deallocate each thread
      for (int i = 0; i < NactiveResidues_; ++i)
        delete[] activeResidues_thread_[i];
    } else {
      // Initial thread allocation needed
      activeResidues_thread_ = new int*[ numthreads_ ];
    }
    // Allocate each thread
    for (int i = 0; i < numthreads_; ++i) {
      activeResidues_thread_[i] = new int[ setup.Top().Nres() ];
      std::fill( activeResidues_thread_[i], activeResidues_thread_[i] + setup.Top().Nres(), 0 );
    }
  }
  NactiveResidues_ = setup.Top().Nres();
# else
  activeResidues_.resize( setup.Top().Nres(), 0 );
# endif
  // Store current Parm
  CurrentParm_ = setup.TopAddress();
  return Action::OK;    
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:57,代码来源:Action_Watershell.cpp

示例10: Setup

/** Determine what atoms each mask pertains to for the current parm file.
  */
Action::RetType Action_ReplicateCell::Setup(ActionSetup& setup) {
  if (setup.Top().SetupIntegerMask( Mask1_ )) return Action::ERR;
  mprintf("\t%s (%i atoms)\n",Mask1_.MaskString(), Mask1_.Nselected());
  if (Mask1_.None()) {
    mprintf("Warning: One or both masks have no atoms.\n");
    return Action::SKIP;
  }
  // Set up imaging info for this parm
  image_.SetupImaging( setup.CoordInfo().TrajBox().Type() );
  if (!image_.ImagingEnabled()) {
    mprintf("Warning: Imaging cannot be performed for topology %s\n", setup.Top().c_str());
    return Action::SKIP;
  }
  // Create combined topology.
  if (combinedTop_.Natom() > 0) {
    // Topology already set up. Check that # atoms matches.
    if (Mask1_.Nselected() * ncopies_ != combinedTop_.Natom()) {
      mprintf("Warning: Unit cell can currently only be replicated for"
              " topologies with same # atoms.\n");
      return Action::SKIP;
    }
    // Otherwise assume top does not change.
  } else {
    // Set up topology and frame.
    Topology* stripParm = setup.Top().modifyStateByMask( Mask1_ );
    if (stripParm == 0) return Action::ERR;
    for (int cell = 0; cell != ncopies_; cell++)
      combinedTop_.AppendTop( *stripParm );
    combinedTop_.Brief("Combined parm:");
    delete stripParm;
    if (!parmfilename_.empty()) {
      ParmFile pfile;
      if (pfile.WriteTopology(combinedTop_, parmfilename_, ParmFile::UNKNOWN_PARM, 0)) {
        mprinterr("Error: Topology file %s not written.\n", parmfilename_.c_str());
        return Action::ERR;
      }
    }
    // Only coordinates for now. FIXME
    combinedFrame_.SetupFrameM(combinedTop_.Atoms());
    // Set up COORDS / output traj if necessary.
    if (coords_ != 0)
      coords_->CoordsSetup( combinedTop_, CoordinateInfo() );
    if (!trajfilename_.empty()) {
      if ( outtraj_.PrepareEnsembleTrajWrite(trajfilename_, trajArgs_,
                                             &combinedTop_, CoordinateInfo(),
                                             setup.Nframes(), TrajectoryFile::UNKNOWN_TRAJ,
                                             ensembleNum_) )
        return Action::ERR;
    }
  }

  return Action::OK;
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:55,代码来源:Action_ReplicateCell.cpp

示例11: Setup

/** Set angle up for this parmtop. Get masks etc.
  */
Action::RetType Action_Angle::Setup(ActionSetup& setup) {
  if (setup.Top().SetupIntegerMask(Mask1_)) return Action::ERR;
  if (setup.Top().SetupIntegerMask(Mask2_)) return Action::ERR;
  if (setup.Top().SetupIntegerMask(Mask3_)) return Action::ERR;
  mprintf("\t");
  Mask1_.BriefMaskInfo();
  Mask2_.BriefMaskInfo();
  Mask3_.BriefMaskInfo();
  mprintf("\n");
  if (Mask1_.None() || Mask2_.None() || Mask3_.None()) {
    mprintf("Warning: angle: One or more masks contain 0 atoms.\n");
    return Action::SKIP;
  }
  return Action::OK;  
}
开发者ID:jcr13,项目名称:cpptraj,代码行数:17,代码来源:Action_Angle.cpp

示例12: Setup

// Action_GridFreeEnergy::setup()
Action::RetType Action_GridFreeEnergy::Setup(ActionSetup& setup) {
  // Setup grid, checks box info.
  if (GridSetup( setup.Top(), setup.CoordInfo() )) return Action::ERR;

  // Setup mask
  if (setup.Top().SetupIntegerMask( mask_ ))
    return Action::ERR;
  mask_.MaskInfo();
  if (mask_.None()) {
    mprinterr("Warning: No atoms selected for parm %s\n", setup.Top().c_str());
    return Action::SKIP;
  }

  return Action::OK;
}
开发者ID:SAMAN-64,项目名称:cpptraj,代码行数:16,代码来源:Action_GridFreeEnergy.cpp

示例13: Setup

// Action_Outtraj::Setup()
Action::RetType Action_Outtraj::Setup(ActionSetup& setup) {
  if (!isActive_ || associatedParm_->Pindex() != setup.Top().Pindex()) {
    mprintf("\tOutput trajectory not active for topology '%s'\n", setup.Top().c_str());
    return Action::SKIP;
  }
  if (!isSetup_) { // TODO: Trajout IsOpen?
    if (outtraj_.SetupTrajWrite(setup.TopAddress(), setup.CoordInfo(), setup.Nframes()))
      return Action::ERR;
    mprintf("      "); //TODO this is a kludge; PrintInfo should be a string.
    outtraj_.PrintInfo(0);
    mprintf("\tHas %s\n", outtraj_.Traj().CoordInfo().InfoString().c_str());
    isSetup_ = true;
  }
  return Action::OK;
}
开发者ID:Amber-MD,项目名称:cpptraj,代码行数:16,代码来源:Action_Outtraj.cpp

示例14: DensitySetup

// Action_Density::DensitySetup()
Action::RetType Action_Density::DensitySetup(ActionSetup& setup) {
  // Total system density setup
  image_.SetupImaging( setup.CoordInfo().TrajBox().Type() );
  if (!image_.ImagingEnabled()) {
    mprintf("Warning: No unit cell information, total density cannot be calculated for '%s'\n",
            setup.Top().c_str());
    return Action::SKIP;
  }
  // delta_ will hold sum of masses
  delta_ = 0.0;
  for (int idx = 0; idx != setup.Top().Natom(); idx++)
    delta_ += setup.Top()[idx].Mass();
  mprintf("\tSum of masses is %g amu\n", delta_);

  return Action::OK;
}
开发者ID:Amber-MD,项目名称:cpptraj,代码行数:17,代码来源:Action_Density.cpp

示例15: Setup

/** Called every time the trajectory changes. Set up TgtMask for the new 
  * parmtop and allocate space for selected atoms from the Frame.
  */
Action::RetType Action_DistRmsd::Setup(ActionSetup& setup) {

  if ( setup.Top().SetupIntegerMask(TgtMask_) ) return Action::ERR;
  if ( TgtMask_.None() ) {
    mprintf("Warning: No atoms in mask.\n");
    return Action::SKIP;
  }
  // Allocate space for selected atoms in the frame. This will also put the
  // correct masses in based on the mask.
  SelectedTgt_.SetupFrameFromMask(TgtMask_, setup.Top().Atoms());

  if (refHolder_.SetupRef(setup.Top(), TgtMask_.Nselected(), "distrmsd"))
    return Action::ERR; 

  return Action::OK;
}
开发者ID:rmcgibbo,项目名称:cpptraj,代码行数:19,代码来源:Action_DistRmsd.cpp


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