Changeset 5e99bc
- Timestamp:
- Aug 25, 2010, 1:37:01 PM (15 years ago)
- 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:
- 1f8337
- Parents:
- e95a59
- git-author:
- Tillmann Crueger <crueger@…> (08/25/10 13:22:11)
- git-committer:
- Tillmann Crueger <crueger@…> (08/25/10 13:37:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AtomSet.hpp
re95a59 r5e99bc 59 59 template<class Function> 60 60 void transformNodes(Function f); 61 double totalTemperatureAtStep(unsigned int i) const;62 61 double totalMass() const; 62 double totalTemperatureAtStep(unsigned int step) const; 63 Vector totalMomentumAtStep(unsigned int step) const; 63 64 64 65 private: … … 74 75 template<class T> 75 76 struct valueSum { 76 valueSum(T (atom::*_f)() const ) :77 valueSum(T (atom::*_f)() const,T startValue) : 77 78 f(_f), 78 value( 0)79 value(startValue) 79 80 {} 80 81 T operator+(atom *atom){ 81 82 return value + (atom->*f)(); 82 83 } 83 T operator=( double_value){84 T operator=(T _value){ 84 85 value = _value; 85 86 return value; … … 91 92 template<class T> 92 93 struct stepValueSum { 93 stepValueSum(unsigned int _step, T (atom::*_f)(unsigned int) const ) :94 stepValueSum(unsigned int _step, T (atom::*_f)(unsigned int) const,T startValue) : 94 95 step(_step), 95 96 f(_f), 96 value( 0)97 value(startValue) 97 98 {} 98 99 T operator+(atom *atom){ 99 100 return value + (atom->*f)(step); 100 101 } 101 T operator=( double_value){102 T operator=(T _value){ 102 103 value = _value; 103 104 return value; … … 125 126 126 127 template<class Set> 127 inline double AtomSetMixin<Set>::total TemperatureAtStep(unsigned int step) const{128 return accumulate(this->begin(),this->end(), stepValueSum<double>(step,&atom::getKineticEnergy)).value;128 inline double AtomSetMixin<Set>::totalMass() const{ 129 return accumulate(this->begin(),this->end(),valueSum<double>(&atom::getMass,0)).value; 129 130 } 130 131 131 132 template<class Set> 132 inline double AtomSetMixin<Set>::totalMass() const{ 133 return accumulate(this->begin(),this->end(),valueSum<double>(&atom::getMass)).value; 133 inline double AtomSetMixin<Set>::totalTemperatureAtStep(unsigned int step) const{ 134 return accumulate(this->begin(),this->end(),stepValueSum<double>(step,&atom::getKineticEnergy,0)).value; 135 } 136 137 template<class Set> 138 inline Vector AtomSetMixin<Set>::totalMomentumAtStep(unsigned int step) const{ 139 return accumulate(this->begin(),this->end(),stepValueSum<Vector>(step,&atom::getMomentum,Vector())).value; 134 140 } 135 141
Note:
See TracChangeset
for help on using the changeset viewer.