Ignore:
Timestamp:
Dec 19, 2012, 3:26:11 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:
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)
Message:

Extended LevMartester to fit a Tersoff potential to the first order fragments.

  • this required adding a globalid to argument_t for the triplefunction to work, i.e. in order to get at possible neighbouring atoms and their distances. This requires some global information.
  • TESTFIX: We don't need static variable CurrentConfiguration in ManyBodyPotential_TersoffTest anymore as we have the index to the current configuration now stored in each argument_t.
Location:
src/Potentials/Specifics/unittests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.cpp

    rbc55c9 reb1efe  
    6565
    6666ManyBodyPotential_TersoffTest::configurations_t ManyBodyPotential_TersoffTest::configurations;
    67 ManyBodyPotential_TersoffTest::configuration_t *ManyBodyPotential_TersoffTest::CurrentConfiguration = NULL;
    6867
    6968/** This function looks up all distances ik and jk to a given ij and
     
    7372triplefunction(const argument_t &arguments, const double cutoff)
    7473{
     74  const ManyBodyPotential_TersoffTest::configuration_t &CurrentConfiguration =
     75      ManyBodyPotential_TersoffTest::configurations[arguments.globalid];
    7576  std::vector<FunctionModel::arguments_t> result;
    7677  // go through current configuration and gather all other distances
    7778  ManyBodyPotential_TersoffTest::configuration_t::const_iterator firstiter =
    78       ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();
     79      CurrentConfiguration.begin();
    7980  std::advance(firstiter, arguments.indices.first);
    8081  ManyBodyPotential_TersoffTest::configuration_t::const_iterator seconditer =
    81       ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();
     82      CurrentConfiguration.begin();
    8283  std::advance(seconditer, arguments.indices.second);
    8384  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();
    8687      ++iter) {
    8788    // skip k==i and k==j
     
    9293    args[0].distance = firstiter->distance(*iter);
    9394    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)
    10297    );
     98    args[0].globalid = arguments.globalid;
    10399    // jk
    104100    args[1].distance = seconditer->distance(*iter);
    105101    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)
    114104    );
     105    args[1].globalid = arguments.globalid;
    115106    result.push_back(args);
    116107  }
     
    276267{
    277268  configurations.clear();
    278   CurrentConfiguration = NULL;
    279269}
    280270
     
    292282  const_cast<double &>(tersoff.S) = 2.1;
    293283  for (size_t index = 0; index < configurations.size(); ++index) {
    294     CurrentConfiguration = &(configurations[index]);
     284    const configuration_t &CurrentConfiguration = configurations[index];
    295285    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) {
    298288        if (i == j)
    299289          continue;
    300290        argument_t arg;
    301291        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
    303294        FunctionModel::arguments_t args(1,arg);
    304295        const ManyBodyPotential_Tersoff::results_t res = tersoff(args);
  • src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.hpp

    rbc55c9 reb1efe  
    4545      typedef std::vector<configuration_t> configurations_t;
    4646      static configurations_t configurations;
    47       static configuration_t *CurrentConfiguration;
    4847private:
    4948      FunctionModel::parameters_t params;
Note: See TracChangeset for help on using the changeset viewer.