Example #1
0
/** 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;
}