Changeset 086070 for src/Potentials


Ignore:
Timestamp:
Feb 24, 2013, 12:57:26 PM (12 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
4ffbb7
Parents:
c92c0d
git-author:
Frederik Heber <heber@…> (11/25/12 20:01:48)
git-committer:
Frederik Heber <heber@…> (02/24/13 12:57:26)
Message:

Moved all setParameters() from header files into module.

  • also each now assert that setParameters() equal getParameters().
Location:
src/Potentials/Specifics
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp

    rc92c0d r086070  
    105105  params[h] = _h;
    106106  params[offset] = _offset;
     107}
     108
     109void ManyBodyPotential_Tersoff::setParameters(const parameters_t &_params)
     110{
     111  const size_t paramsDim = _params.size();
     112  ASSERT( paramsDim <= getParameterDimension(),
     113      "ManyBodyPotential_Tersoff::setParameters() - we need not more than "
     114      +toString(getParameterDimension())+" parameters.");
     115  for (size_t i=0; i< paramsDim; ++i)
     116    params[i] = _params[i];
     117
     118#ifndef NDEBUG
     119  parameters_t check_params(getParameters());
     120  check_params.resize(paramsDim); // truncate to same size
     121  ASSERT( check_params == _params,
     122      "ManyBodyPotential_Tersoff::setParameters() - failed, mismatch in to be set "
     123      +toString(_params)+" and set "+toString(check_params)+" params.");
     124#endif
    107125}
    108126
  • src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp

    rc92c0d r086070  
    1717#include <cmath>
    1818#include <limits>
    19 
    20 #include "CodePatterns/Assert.hpp"
    2119
    2220#include "Potentials/EmpiricalPotential.hpp"
     
    279277   * \param _params given set of parameters
    280278   */
    281   void setParameters(const parameters_t &_params)
    282   {
    283     ASSERT( _params.size() <= getParameterDimension(),
    284         "ManyBodyPotential_Tersoff::setParameters() - we need not more than "
    285         +toString(getParameterDimension())+" parameters.");
    286     for (size_t i=0; i< _params.size(); ++i)
    287       params[i] = _params[i];
    288   }
     279  void setParameters(const parameters_t &_params);
    289280
    290281  /** Getter for parameters as required by FunctionModel interface.
  • src/Potentials/Specifics/PairPotential_Angle.cpp

    rc92c0d r086070  
    5656  params[equilibrium_distance] = _equilibrium_distance;
    5757  params[energy_offset] = _energy_offset;
     58}
     59
     60void PairPotential_Angle::setParameters(const parameters_t &_params)
     61{
     62  const size_t paramsDim = _params.size();
     63  ASSERT( paramsDim <= getParameterDimension(),
     64      "PairPotential_Angle::setParameters() - we need not more than "
     65      +toString(getParameterDimension())+" parameters.");
     66  for(size_t i=0;i<paramsDim;++i)
     67    params[i] = _params[i];
     68
     69#ifndef NDEBUG
     70  parameters_t check_params(getParameters());
     71  check_params.resize(paramsDim); // truncate to same size
     72  ASSERT( check_params == _params,
     73      "PairPotential_Angle::setParameters() - failed, mismatch in to be set "
     74      +toString(_params)+" and set "+toString(check_params)+" params.");
     75#endif
    5876}
    5977
     
    144162    }
    145163    default:
     164      return PairPotential_Angle::results_t(1, 0.);
    146165      break;
    147166  }
    148 
    149   return PairPotential_Angle::results_t(1, 0.);
    150167}
  • src/Potentials/Specifics/PairPotential_Angle.hpp

    rc92c0d r086070  
    4949   * \param _params given set of parameters
    5050   */
    51   void setParameters(const parameters_t &_params)
    52   {
    53     ASSERT( _params.size() <= getParameterDimension(),
    54         "PairPotential_Angle::setParameters() - we need not more than "
    55         +toString(getParameterDimension())+" parameters.");
    56     for(size_t i=0;i<_params.size();++i)
    57       params[i] = _params[i];
    58   }
     51  void setParameters(const parameters_t &_params);
    5952
    6053  /** Getter for parameters as required by FunctionModel interface.
  • src/Potentials/Specifics/PairPotential_Harmonic.cpp

    rc92c0d r086070  
    5656  params[equilibrium_distance] = _equilibrium_distance;
    5757  params[energy_offset] = _energy_offset;
     58}
     59
     60void PairPotential_Harmonic::setParameters(const parameters_t &_params)
     61{
     62  const size_t paramsDim = _params.size();
     63  ASSERT( paramsDim <= getParameterDimension(),
     64      "PairPotential_Harmonic::setParameters() - we need not more than "
     65      +toString(getParameterDimension())+" parameters.");
     66  for(size_t i=0;i<paramsDim;++i)
     67    params[i] = _params[i];
     68
     69#ifndef NDEBUG
     70  parameters_t check_params(getParameters());
     71  check_params.resize(paramsDim); // truncate to same size
     72  ASSERT( check_params == _params,
     73      "PairPotential_Harmonic::setParameters() - failed, mismatch in to be set "
     74      +toString(_params)+" and set "+toString(check_params)+" params.");
     75#endif
    5876}
    5977
  • src/Potentials/Specifics/PairPotential_Harmonic.hpp

    rc92c0d r086070  
    4949   * \param _params given set of parameters
    5050   */
    51   void setParameters(const parameters_t &_params)
    52   {
    53     ASSERT( _params.size() <= getParameterDimension(),
    54         "PairPotential_Harmonic::setParameters() - we need not more than "
    55         +toString(getParameterDimension())+" parameters.");
    56     for(size_t i=0;i<_params.size();++i)
    57       params[i] = _params[i];
    58   }
     51  void setParameters(const parameters_t &_params);
    5952
    6053  /** Getter for parameters as required by FunctionModel interface.
  • src/Potentials/Specifics/PairPotential_Morse.cpp

    rc92c0d r086070  
    6060  params[dissociation_energy] = _dissociation_energy;
    6161  params[energy_offset] = _energy_offset;
     62}
     63
     64void PairPotential_Morse::setParameters(const parameters_t &_params)
     65{
     66  const size_t paramsDim = _params.size();
     67  ASSERT( paramsDim <= getParameterDimension(),
     68      "PairPotential_Morse::setParameters() - we need not more than "
     69      +toString(getParameterDimension())+" parameters.");
     70  for(size_t i=0;i<paramsDim;++i)
     71    params[i] = _params[i];
     72
     73#ifndef NDEBUG
     74  parameters_t check_params(getParameters());
     75  check_params.resize(paramsDim); // truncate to same size
     76  ASSERT( check_params == _params,
     77      "PairPotential_Morse::setParameters() - failed, mismatch in to be set "
     78      +toString(_params)+" and set "+toString(check_params)+" params.");
     79#endif
    6280}
    6381
  • src/Potentials/Specifics/PairPotential_Morse.hpp

    rc92c0d r086070  
    5050   * \param _params given set of parameters
    5151   */
    52   void setParameters(const parameters_t &_params)
    53   {
    54     ASSERT( _params.size() <= getParameterDimension(),
    55         "PairPotential_Morse::setParameters() - we need not more than "
    56         +toString(getParameterDimension())+" parameters.");
    57     for(size_t i=0;i<_params.size();++i)
    58       params[i] = _params[i];
    59   }
     52  void setParameters(const parameters_t &_params);
    6053
    6154  /** Getter for parameters as required by FunctionModel interface.
Note: See TracChangeset for help on using the changeset viewer.