Action::RetType Action_DNAionTracker::Setup(Topology* currentParm, Topology** parmAddress) { // Setup masks if (currentParm->SetupIntegerMask( p1_ )) return Action::ERR; if ( p1_.None() ) { mprinterr("Error: dnaiontracker: No atoms in mask1\n"); return Action::ERR; } if (currentParm->SetupIntegerMask( p2_ )) return Action::ERR; if ( p2_.None() ) { mprinterr("Error: dnaiontracker: No atoms in mask2\n"); return Action::ERR; } if (currentParm->SetupIntegerMask( base_ )) return Action::ERR; if ( base_.None() ) { mprinterr("Error: dnaiontracker: No atoms in mask3\n"); return Action::ERR; } if (currentParm->SetupIntegerMask( ions_ )) return Action::ERR; if ( ions_.None() ) { mprinterr("Error: dnaiontracker: No atoms in mask4\n"); return Action::ERR; } SetupImaging( currentParm->BoxType() ); 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; }
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; }
/** 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; }
/** Determine what atoms each mask pertains to for the current parm file. * Imaging is checked for in Action::Setup. */ Action::RetType Action_Distance::Setup(Topology* currentParm, Topology** parmAddress) { if (currentParm->SetupIntegerMask( Mask1_ )) return Action::ERR; if (currentParm->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: distance: One or both masks have no atoms.\n"); return Action::ERR; } // Set up imaging info for this parm SetupImaging( currentParm->BoxType() ); if (ImagingEnabled()) mprintf(", imaged"); else mprintf(", imaging off"); mprintf(".\n"); return Action::OK; }