本文整理汇总了C++中ActionSetup类的典型用法代码示例。如果您正苦于以下问题:C++ ActionSetup类的具体用法?C++ ActionSetup怎么用?C++ ActionSetup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionSetup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: Setup
/** Set angle up for this parmtop. Get masks etc.
*/
Action::RetType Action_Esander::Setup(ActionSetup& setup) {
if (currentParm_ != 0 && currentParm_->Pindex() != setup.Top().Pindex())
{
mprintf("Warning: Current topology is %i:%s but reference is %i:%s. Skipping.\n",
setup.Top().Pindex(), setup.Top().c_str(),
currentParm_->Pindex(), currentParm_->c_str());
return Action::SKIP;
}
// Check for LJ terms
if (!setup.Top().Nonbond().HasNonbond())
{
mprinterr("Error: Topology '%s' does not have non-bonded parameters.\n", setup.Top().c_str());
return Action::ERR;
}
// If reference specified, init now. Otherwise using first frame.
if (currentParm_ != 0 ) {
if ( InitForRef() ) return Action::ERR;
} else
currentParm_ = setup.TopAddress();
// If saving of forces is requested, make sure CoordinateInfo has force.
if (save_forces_) {
cInfo_ = setup.CoordInfo();
cInfo_.SetForce( true );
newFrame_.SetupFrameV( setup.Top().Atoms(), cInfo_ );
setup.SetCoordInfo( &cInfo_ );
ret_ = Action::MODIFY_COORDS;
return Action::MODIFY_TOPOLOGY;
}
ret_ = Action::OK;
return Action::OK;
}
示例9: Setup
// Action_Outtraj::Setup()
Action::RetType Action_Outtraj::Setup(ActionSetup& setup) {
if (associatedParm_->Pindex() != setup.Top().Pindex())
return Action::SKIP;
if (!isSetup_) { // TODO: Trajout IsOpen?
if (outtraj_.SetupTrajWrite(setup.TopAddress(), setup.CoordInfo(), setup.Nframes()))
return Action::ERR;
outtraj_.PrintInfo(0);
isSetup_ = true;
}
return Action::OK;
}
示例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;
}
示例11: Setup
// Action_CheckStructure::Setup()
Action::RetType Action_CheckStructure::Setup(ActionSetup& setup) {
CurrentParm_ = setup.TopAddress();
if (SeparateSetup( setup.Top(), setup.CoordInfo().TrajBox().Type(),bondcheck_ ))
return Action::ERR;
// Print imaging info for this parm
if (bondcheck_)
mprintf("\tChecking %u bonds.\n", bondList_.size());
if (image_.ImagingEnabled())
mprintf("\tImaging on.\n");
else
mprintf("\timaging off.\n");
return Action::OK;
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: 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;
}