Changeset 2e9486 for src


Ignore:
Timestamp:
Dec 19, 2012, 3:25:54 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:
56c5de4
Parents:
ca8d82
git-author:
Frederik Heber <heber@…> (10/08/12 21:30:38)
git-committer:
Frederik Heber <heber@…> (12/19/12 15:25:54)
Message:

FIX: Tersoff must sum potential over every of the arguments.

File:
1 edited

Legend:

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

    rca8d82 r2e9486  
    111111{
    112112//  Info info(__func__);
    113   const argument_t &r_ij = arguments[0];
    114   const double cutoff = function_cutoff(r_ij.distance);
    115   const double result = (cutoff == 0.) ?
    116       0. :
    117       cutoff * (
    118           function_prefactor(
    119               alpha,
    120               function_eta(r_ij))
    121           * function_smoother(
    122               params[A],
    123               params[lambda],
    124               r_ij.distance)
    125           +
    126           function_prefactor(
    127               params[beta],
    128               function_zeta(r_ij))
    129           * function_smoother(
    130               -params[B],
    131               params[mu],
    132               r_ij.distance)
    133       );
     113  double result = 0.;
     114  for(arguments_t::const_iterator argiter = arguments.begin();
     115      argiter != arguments.end();
     116      ++argiter) {
     117    const argument_t &r_ij = *argiter;
     118    const double cutoff = function_cutoff(r_ij.distance);
     119    const double temp = (cutoff == 0.) ?
     120        0. :
     121        cutoff * (
     122            function_prefactor(
     123                alpha,
     124                function_eta(r_ij))
     125            * function_smoother(
     126                params[A],
     127                params[lambda],
     128                r_ij.distance)
     129            +
     130            function_prefactor(
     131                params[beta],
     132                function_zeta(r_ij))
     133            * function_smoother(
     134                -params[B],
     135                params[mu],
     136                r_ij.distance)
     137        );
     138    result += temp;
     139  }
    134140//  LOG(2, "DEBUG: operator()(" << r_ij.distance << ") = " << result);
    135141  return std::vector<result_t>(1, result);
     
    153159//  Info info(__func__);
    154160//  ASSERT( arguments.size() == 1,
    155 //      "PairPotential_Harmonic::parameter_derivative() - requires exactly one argument.");
    156   const argument_t &r_ij = arguments[0];
     161//      "ManyBodyPotential_Tersoff::parameter_derivative() - requires exactly one argument.");
     162  double result = 0.;
     163  for(arguments_t::const_iterator argiter = arguments.begin();
     164      argiter != arguments.end();
     165      ++argiter) {
     166    const argument_t &r_ij = *argiter;
    157167  switch (index) {
    158168//    case R:
    159169//    {
    160 //      const double result = 0.;
    161 //      return results_t(1, result);
     170//      result += 0.;
    162171//      break;
    163172//    }
    164173//    case S:
    165174//    {
    166 //      const double result = 0.;
    167 //      return results_t(1, result);
     175//      result += 0.;
    168176//      break;
    169177//    }
     
    171179    {
    172180      const double cutoff = function_cutoff(r_ij.distance);
    173       const double result = (cutoff == 0.) ?
     181      result += (cutoff == 0.) ?
    174182          0. :
    175183          cutoff *
     
    188196//              params[mu],
    189197//              r_ij.distance);
    190       return results_t(1, result);
    191198      break;
    192199    }
     
    194201    {
    195202      const double cutoff = function_cutoff(r_ij.distance);
    196       const double result = (cutoff == 0.) ?
     203      result += (cutoff == 0.) ?
    197204          0. :
    198205          cutoff * function_prefactor(
     
    210217//              params[mu],
    211218//              r_ij.distance)/params[B];
    212       return results_t(1, result);
    213219      break;
    214220    }
     
    216222    {
    217223      const double cutoff = function_cutoff(r_ij.distance);
    218       const double result = (cutoff == 0.) ?
     224      result += (cutoff == 0.) ?
    219225          0. :
    220226          -r_ij.distance * cutoff *
     
    226232                  params[lambda],
    227233                  r_ij.distance);
    228       return results_t(1, result);
    229234      break;
    230235    }
     
    232237    {
    233238      const double cutoff = function_cutoff(r_ij.distance);
    234       const double result = (cutoff == 0.) ?
     239      result += (cutoff == 0.) ?
    235240          0. :
    236241          -r_ij.distance * cutoff *(
     
    243248              r_ij.distance)
    244249      );
    245       return results_t(1, result);
    246250      break;
    247251    }
    248252//    case lambda3:
    249253//    {
    250 //      const double result = 0.;
    251 //      return results_t(1, result);
     254//      result += 0.;
    252255//      break;
    253256//    }
     
    257260//          pow(alpha*function_eta(r_ij), params[n]);
    258261//      const double cutoff = function_cutoff(r_ij.distance);
    259 //      const double result = (cutoff == 0.) || (alpha == 0. )?
     262//      result += (cutoff == 0.) || (alpha == 0. )?
    260263//          0. :
    261264//          function_smoother(
     
    266269//          / (1. + temp)
    267270//          ;
    268 //      return results_t(1, result);
    269271//      break;
    270272//    }
    271273//    case chi:
    272274//    {
    273 //      const double result = 0.;
    274 //      return results_t(1, result);
     275//      result += 0.;
    275276//      break;
    276277//    }
    277278//    case omega:
    278279//    {
    279 //      const double result = 0.;
    280 //      return results_t(1, result);
     280//      result += 0.;
    281281//      break;
    282282//    }
     
    286286          pow(params[beta]*function_zeta(r_ij), params[n]);
    287287      const double cutoff = function_cutoff(r_ij.distance);
    288       const double result = (cutoff == 0.) || (params[beta] == 0. )?
     288      result += (cutoff == 0.) || (params[beta] == 0. )?
    289289          0. : cutoff *
    290290          function_smoother(
     
    299299          / (1. + temp)
    300300          ;
    301       return results_t(1, result);
    302301      break;
    303302    }
     
    307306          pow(params[beta]*function_zeta(r_ij), params[n]);
    308307      const double cutoff = function_cutoff(r_ij.distance);
    309       const double result = (cutoff == 0.) ?
     308      result += (cutoff == 0.) ?
    310309          0. : .5 * cutoff *
    311310          function_smoother(
     
    320319              /(params[n]*(1.+temp)))
    321320          ;
    322       return results_t(1, result);
    323321      break;
    324322    }
     
    331329          pow(zeta, params[n]-1.) * pow(params[beta],params[n]);
    332330      const double cutoff = function_cutoff(r_ij.distance);
    333       const double result = (cutoff == 0.) ?
     331      const double tempres = (cutoff == 0.) ?
    334332          0. : cutoff *
    335333          function_smoother(
     
    342340           * (-1.) * temp / (1.+temp*zeta);
    343341      double factor = function_derivative_c(r_ij);
    344       return results_t(1, result*factor);
     342      result += tempres*factor;
    345343      break;
    346344    }
     
    351349          pow(zeta, params[n]-1.) * pow(params[beta],params[n]);
    352350      const double cutoff = function_cutoff(r_ij.distance);
    353       const double result = (cutoff == 0.) ?
     351      const double tempres = (cutoff == 0.) ?
    354352          0. : cutoff *
    355353          function_smoother(
     
    362360           * (-1.) * temp / (1.+temp*zeta);
    363361      double factor = function_derivative_d(r_ij);
    364       return results_t(1, result*factor);
     362      result += tempres*factor;
    365363      break;
    366364    }
     
    371369          pow(zeta, params[n]-1.) * pow(params[beta],params[n]);
    372370      const double cutoff = function_cutoff(r_ij.distance);
    373       const double result = (cutoff == 0.) ?
     371      const double tempres = (cutoff == 0.) ?
    374372          0. : cutoff *
    375373          function_smoother(
     
    382380           * (-1.) * temp / (1.+temp*zeta);
    383381      double factor = function_derivative_h(r_ij);
    384       return results_t(1, result*factor);
     382      result += tempres*factor;
    385383      break;
    386384    }
     
    388386      break;
    389387  }
    390   return results_t(1, 0.);
     388  }
     389  return results_t(1,-result);
    391390}
    392391
Note: See TracChangeset for help on using the changeset viewer.