Changeset 4792ab for src/Actions
- Timestamp:
- Aug 9, 2013, 2:20:37 PM (11 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:
- 1413f4
- Parents:
- af4318
- git-author:
- Frederik Heber <heber@…> (08/05/13 08:02:55)
- git-committer:
- Frederik Heber <heber@…> (08/09/13 14:20:37)
- Location:
- src/Actions/FragmentationAction
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FitPotentialAction.cpp
raf4318 r4792ab 254 254 FunctionApproximation approximator(data, *model); 255 255 if (model->isBoxConstraint() && approximator.checkParameterDerivatives()) { 256 double l2error = std::numeric_limits<double>:: infinity();256 double l2error = std::numeric_limits<double>::max(); 257 257 // seed with current time 258 258 srand((unsigned)time(0)); 259 for (unsigned int runs=0; runs < params.best_of_howmany.get(); ++runs) { 259 unsigned int runs=0; 260 // threshold overrules max_runs 261 const double threshold = params.threshold.get(); 262 const unsigned int max_runs = (threshold >= 1.) ? 263 (params.best_of_howmany.isSet() ? params.best_of_howmany.get() : 1) : 0; 264 LOG(1, "INFO: Maximum runs is " << max_runs << " and threshold set to " << threshold << "."); 265 do { 260 266 // generate new random initial parameter values 261 267 model->setParametersToRandomInitialValues(data); … … 273 279 << " has better error of " << l2error << "."); 274 280 } 275 } 281 } while (( ++runs < max_runs) || (l2error > threshold)); 276 282 // reset parameters from best fit 277 283 model->setParameters(bestparams); -
src/Actions/FragmentationAction/FitPotentialAction.def
raf4318 r4792ab 12 12 13 13 #include "Parameters/Validators/DummyValidator.hpp" 14 #include "Parameters/Validators/GenericValidators.hpp" 14 15 #include "Parameters/Validators/Ops_Validator.hpp" 15 16 #include "Parameters/Validators/RangeValidator.hpp" … … 23 24 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 24 25 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 25 #define paramtypes (boost::filesystem::path)(std::string)(boost::filesystem::path)(std::vector<const element *>)(std::vector<const element *>)(unsigned int) 26 #define paramtokens ("training-file")("potential-type")("potential-file")("potential-charges")("fragment-charges")("take-best-of") 27 #define paramdescriptions ("optional file to write training data to")("potential type to fit")("potential file specifying multiple potentials to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations") 28 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3)) 29 #define paramreferences (training_file)(potentialtype)(potential_file)(charges)(fragment)(best_of_howmany) 26 #define paramtypes (boost::filesystem::path)(std::string)(boost::filesystem::path)(std::vector<const element *>)(std::vector<const element *>)(unsigned int)(double) 27 #define paramtokens ("training-file")("potential-type")("potential-file")("potential-charges")("fragment-charges")("take-best-of")("set-threshold") 28 #define paramdescriptions ("optional file to write training data to")("potential type to fit")("potential file specifying multiple potentials to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold") 29 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.)) 30 #define paramreferences (training_file)(potentialtype)(potential_file)(charges)(fragment)(best_of_howmany)(threshold) 30 31 #define paramvalids \ 31 32 (DummyValidator<boost::filesystem::path>()) \ … … 34 35 (STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator())) \ 35 36 (STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \ 36 (RangeValidator< unsigned int>(1,99)) 37 (PositiveValidator<unsigned int>()) \ 38 (PositiveValidator<double>()) 37 39 38 40 #undef statetypes
Note:
See TracChangeset
for help on using the changeset viewer.