本文整理汇总了C++中ActionSetup::CoordInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionSetup::CoordInfo方法的具体用法?C++ ActionSetup::CoordInfo怎么用?C++ ActionSetup::CoordInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionSetup
的用法示例。
在下文中一共展示了ActionSetup::CoordInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例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
/** 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;
}
示例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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: Setup
// Action_Center::Setup()
Action::RetType Action_Center::Setup(ActionSetup& setup) {
if ( setup.Top().SetupIntegerMask(Mask_) ) return Action::ERR;
Mask_.MaskInfo();
if (Mask_.None()) {
mprintf("Warning: Mask contains 0 atoms.\n");
return Action::SKIP;
}
if (centerMode_ == BOXCTR && setup.CoordInfo().TrajBox().Type()==Box::NOBOX) {
mprintf("Warning: Box center specified but no box information.\n");
return Action::SKIP;
}
return Action::OK;
}
示例13: 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;
}
示例14: Setup
// Action_NativeContacts::Setup()
Action::RetType Action_NativeContacts::Setup(ActionSetup& setup) {
// Setup potential contact lists for this topology
if (SetupContactLists( setup.Top(), Frame()))
return Action::SKIP;
mprintf("\t%zu potential contact sites for '%s'\n", Mask1_.Nselected(), Mask1_.MaskString());
if (Mask2_.MaskStringSet())
mprintf("\t%zu potential contact sites for '%s'\n", Mask2_.Nselected(), Mask2_.MaskString());
// Set up imaging info for this parm
image_.SetupImaging( setup.CoordInfo().TrajBox().Type() );
if (image_.ImagingEnabled())
mprintf("\tImaging enabled.\n");
else
mprintf("\tImaging disabled.\n");
CurrentParm_ = setup.TopAddress();
return Action::OK;
}
示例15: Setup
/** Determine what atoms each mask pertains to for the current parm file.
* Imaging is checked for in Action::Setup.
*/
Action::RetType Action_Distance::Setup(ActionSetup& setup) {
if (setup.Top().SetupIntegerMask( Mask1_ )) return Action::ERR;
if (setup.Top().SetupIntegerMask( Mask2_ )) return Action::ERR;
mprintf("\t%s (%i atoms) to %s (%i atoms)",Mask1_.MaskString(), Mask1_.Nselected(),
Mask2_.MaskString(),Mask2_.Nselected());
if (Mask1_.None() || Mask2_.None()) {
mprintf("\nWarning: 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(", imaged");
else
mprintf(", imaging off");
mprintf(".\n");
return Action::OK;
}