void pspParticle::setup(pspParticleSystem* ms, int ind){ mySystem = ms; systemsManager = mySystem->getSystemsManager(); myConcertRoom = systemsManager->getConcertRoom(); speakers = myConcertRoom->getSpeakers(); index = ind; sendOsc = true; specificSetup(); }
bool MicroCanonicalMD::setup(ForceField& my_force_field, SnapShotManager * ssm, const Options& my_options) { // First check whether the force field is valid. If not, then it is useless // to do anything here. if (!my_force_field.isValid()) { // The setup has failed for some reason. Output an error message. Log.error() << "MicroCanonicalMD::setup: setup failed because the force field was not valid!" << std::endl; valid_ = false; return false; } // call the base class setup method valid_ = MolecularDynamics::setup(my_force_field, ssm, my_options); if (!valid_) return false; // call the specific Setup valid_ = specificSetup(); return valid_; }
// setup methods bool EnergyMinimizer::setup(ForceField& force_field) { // Default: no snapshot manager available snapshot_ = 0; // store the specified force field force_field_ = &force_field; valid_ = force_field_->isValid(); if (!valid_) { Log.error() << "EnergyMinimizer: The force field of the energy minimizer is not valid! " << "Check the definition and initialization of the force field! " << endl; return valid_; } // Compute cutlo_ float epsilon = 1.; float eps = 1.; while (1. + eps > 1.) { epsilon = eps; eps /= 2.; } cutlo_ = sqrt(std::numeric_limits<float>::min()/epsilon); // Check options maximal_number_of_iterations_ = (Size)options.setDefaultInteger (EnergyMinimizer::Option::MAXIMAL_NUMBER_OF_ITERATIONS, (long)EnergyMinimizer::Default::MAXIMAL_NUMBER_OF_ITERATIONS); energy_output_frequency_ = (Size)options.setDefaultInteger (EnergyMinimizer::Option::ENERGY_OUTPUT_FREQUENCY, (long)EnergyMinimizer::Default::ENERGY_OUTPUT_FREQUENCY); snapshot_frequency_ = (Size)options.setDefaultInteger (EnergyMinimizer::Option::SNAPSHOT_FREQUENCY, (long)EnergyMinimizer::Default::SNAPSHOT_FREQUENCY); number_of_iterations_ = (Size)options.setDefaultInteger (EnergyMinimizer::Option::NUMBER_OF_ITERATION, (long)EnergyMinimizer::Default::NUMBER_OF_ITERATION); max_same_energy_ = (Size)options.setDefaultInteger (EnergyMinimizer::Option::MAX_SAME_ENERGY, (long) EnergyMinimizer::Default::MAX_SAME_ENERGY); energy_difference_bound_ = options.setDefaultReal (EnergyMinimizer::Option::ENERGY_DIFFERENCE_BOUND, EnergyMinimizer::Default::ENERGY_DIFFERENCE_BOUND); max_gradient_ = options.setDefaultReal (EnergyMinimizer::Option::MAX_GRADIENT, EnergyMinimizer::Default::MAX_GRADIENT); maximum_displacement_ = options.setDefaultReal (EnergyMinimizer::Option::MAXIMUM_DISPLACEMENT, EnergyMinimizer::Default::MAXIMUM_DISPLACEMENT); energy_update_counter_ = 0; force_update_counter_ = 0; // Minimizer-specific parts of the setup. valid_ = specificSetup(); if (!valid_) { Log.error() << "EnergyMinimizer::specificSetup failed!" << endl; } return valid_; }
// setup methods bool ForceField::setup(System& system) { unassigned_atoms_.clear(); number_of_errors_ = 0; // store the specified system system_ = &system; // Setup periodic boundary if (!periodic_boundary.setup()) { Log.error() << "setup of periodic boundary failed" << endl; return false; } // Update the use_selection_ flag. use_selection_ = (selection_enabled_ && system_->containsSelection()); // collect the atoms of the system in the atoms_vector_ collectAtoms_(system); Size old_size = (Size)atoms_.size(); // generate the vector of molecules if periodic boundary is enabled if (periodic_boundary.isEnabled()) { periodic_boundary.generateMoleculesVector(); } // force field specific parts bool success = false; try { success = specificSetup(); } catch(...) { } if (!success) { Log.error() << "Force Field specificSetup failed!" << endl; return false; } // If specificSetup cleared this array, it wants to tell us // that it had to change the system a bit (e.g. CHARMM replacing // hydrogens by united atoms). So, we have to recalculated the vector. if (atoms_.size() != old_size) { collectAtoms_(system); } // Call the setup method for each force field component. vector<ForceFieldComponent*>::iterator it; for (it = components_.begin(); (it != components_.end()) && success; ++it) { success = false; try { success = (*(*it)).setup(); } catch(...) { } if (!success) { Log.error() << "Force Field Component setup of " << (*it)->name_ << " failed!" << endl; } } // ????? update(); // Remember the setup time setup_time_stamp_.stamp(); // If the setup failed, our force field becomes invalid! valid_ = success; return success; }