Changeset eb1efe for src/Potentials/Specifics
- Timestamp:
- Dec 19, 2012, 3:26:11 PM (12 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:
- f48ad3
- Parents:
- bc55c9
- git-author:
- Frederik Heber <heber@…> (10/05/12 14:02:07)
- git-committer:
- Frederik Heber <heber@…> (12/19/12 15:26:11)
- Location:
- src/Potentials/Specifics/unittests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.cpp
rbc55c9 reb1efe 65 65 66 66 ManyBodyPotential_TersoffTest::configurations_t ManyBodyPotential_TersoffTest::configurations; 67 ManyBodyPotential_TersoffTest::configuration_t *ManyBodyPotential_TersoffTest::CurrentConfiguration = NULL;68 67 69 68 /** This function looks up all distances ik and jk to a given ij and … … 73 72 triplefunction(const argument_t &arguments, const double cutoff) 74 73 { 74 const ManyBodyPotential_TersoffTest::configuration_t &CurrentConfiguration = 75 ManyBodyPotential_TersoffTest::configurations[arguments.globalid]; 75 76 std::vector<FunctionModel::arguments_t> result; 76 77 // go through current configuration and gather all other distances 77 78 ManyBodyPotential_TersoffTest::configuration_t::const_iterator firstiter = 78 ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();79 CurrentConfiguration.begin(); 79 80 std::advance(firstiter, arguments.indices.first); 80 81 ManyBodyPotential_TersoffTest::configuration_t::const_iterator seconditer = 81 ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();82 CurrentConfiguration.begin(); 82 83 std::advance(seconditer, arguments.indices.second); 83 84 for (ManyBodyPotential_TersoffTest::configuration_t::const_iterator iter = 84 ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();85 iter != ManyBodyPotential_TersoffTest::CurrentConfiguration->end();85 CurrentConfiguration.begin(); 86 iter != CurrentConfiguration.end(); 86 87 ++iter) { 87 88 // skip k==i and k==j … … 92 93 args[0].distance = firstiter->distance(*iter); 93 94 args[0].indices = std::make_pair( 94 std::distance( // enforce const_iterator return from begin() 95 const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>( 96 ManyBodyPotential_TersoffTest::CurrentConfiguration 97 )->begin(), firstiter), 98 std::distance( // enforce const_iterator return from begin() 99 const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>( 100 ManyBodyPotential_TersoffTest::CurrentConfiguration 101 )->begin(), iter) 95 std::distance(CurrentConfiguration.begin(), firstiter), 96 std::distance(CurrentConfiguration.begin(), iter) 102 97 ); 98 args[0].globalid = arguments.globalid; 103 99 // jk 104 100 args[1].distance = seconditer->distance(*iter); 105 101 args[1].indices = std::make_pair( 106 std::distance( // enforce const_iterator return from begin() 107 const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>( 108 ManyBodyPotential_TersoffTest::CurrentConfiguration 109 )->begin(), seconditer), 110 std::distance( // enforce const_iterator return from begin() 111 const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>( 112 ManyBodyPotential_TersoffTest::CurrentConfiguration 113 )->begin(), iter) 102 std::distance(CurrentConfiguration.begin(), seconditer), 103 std::distance(CurrentConfiguration.begin(), iter) 114 104 ); 105 args[1].globalid = arguments.globalid; 115 106 result.push_back(args); 116 107 } … … 276 267 { 277 268 configurations.clear(); 278 CurrentConfiguration = NULL;279 269 } 280 270 … … 292 282 const_cast<double &>(tersoff.S) = 2.1; 293 283 for (size_t index = 0; index < configurations.size(); ++index) { 294 CurrentConfiguration = &(configurations[index]);284 const configuration_t &CurrentConfiguration = configurations[index]; 295 285 double temp = 0.; 296 for (size_t i=0; i < CurrentConfiguration ->size(); ++i)297 for (size_t j=0; j < CurrentConfiguration ->size(); ++j) {286 for (size_t i=0; i < CurrentConfiguration.size(); ++i) 287 for (size_t j=0; j < CurrentConfiguration.size(); ++j) { 298 288 if (i == j) 299 289 continue; 300 290 argument_t arg; 301 291 arg.indices = std::make_pair(i,j); 302 arg.distance = (*CurrentConfiguration)[i].distance((*CurrentConfiguration)[j]); 292 arg.distance = CurrentConfiguration[i].distance(CurrentConfiguration[j]); 293 arg.globalid = index; // this is needed for the triplefunction to the configuration 303 294 FunctionModel::arguments_t args(1,arg); 304 295 const ManyBodyPotential_Tersoff::results_t res = tersoff(args); -
src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.hpp
rbc55c9 reb1efe 45 45 typedef std::vector<configuration_t> configurations_t; 46 46 static configurations_t configurations; 47 static configuration_t *CurrentConfiguration;48 47 private: 49 48 FunctionModel::parameters_t params;
Note:
See TracChangeset
for help on using the changeset viewer.