Ignore:
Timestamp:
Oct 19, 2014, 5:08:50 PM (10 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:
0ea063
Parents:
98d166
git-author:
Frederik Heber <heber@…> (09/12/14 07:39:58)
git-committer:
Frederik Heber <heber@…> (10/19/14 17:08:50)
Message:

Extracted ParsePotentialsAction from FitCompoundPotentialAction.

Location:
src/Actions/PotentialAction
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Actions/PotentialAction/FitCompoundPotentialAction.cpp

    r98d166 rf1eabd  
    4949#include "Fragmentation/Homology/HomologyGraph.hpp"
    5050#include "Fragmentation/Summation/SetValues/Fragment.hpp"
    51 #include "Potentials/Exceptions.hpp"
    52 #include "Potentials/PotentialDeserializer.hpp"
    53 #include "Potentials/PotentialFactory.hpp"
    54 #include "Potentials/PotentialRegistry.hpp"
    5551#include "Potentials/PotentialTrainer.hpp"
    5652#include "Potentials/SerializablePotential.hpp"
     
    6561
    6662ActionState::ptr PotentialFitCompoundPotentialAction::performCall() {
    67   // fragment specifies the homology fragment to use
    68   SerializablePotential::ParticleTypes_t fragmentnumbers =
    69       PotentialTrainer::getNumbersFromElements(params.fragment.get());
    70 
    71   // either charges and a potential is specified or a file
    72   if (boost::filesystem::exists(params.potential_file.get())) {
    73     std::ifstream returnstream(params.potential_file.get().string().c_str());
    74     if (returnstream.good()) {
    75       try {
    76         PotentialDeserializer deserialize(returnstream);
    77         deserialize();
    78       } catch (SerializablePotentialMissingValueException &e) {
    79         if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e))
    80           STATUS("Missing value when parsing information for potential "+*key+".");
    81         else
    82           STATUS("Missing value parsing information for potential with unknown key.");
    83         return Action::failure;
    84       } catch (SerializablePotentialIllegalKeyException &e) {
    85         if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e))
    86           STATUS("Illegal key parsing information for potential "+*key+".");
    87         else
    88           STATUS("Illegal key parsing information for potential with unknown key.");
    89         return Action::failure;
    90       }
    91     } else {
    92       STATUS("Failed to parse from "+params.potential_file.get().string()+".");
    93       return Action::failure;
    94     }
    95     returnstream.close();
    96 
    97     LOG(0, "STATUS: I'm training now a set of potentials parsed from "
    98         << params.potential_file.get().string() << " on a fragment "
    99         << fragmentnumbers << " on data from World's homologies.");
    100 
    101   } else {
    102       STATUS("No existing potential file given!");
    103       return Action::failure;
    104   }
    105 
    106   // parse homologies into container
     63  // get homologies container
    10764  HomologyContainer &homologies = World::getInstance().getHomologies();
    10865
     
    11875  }
    11976
     77  // fragment specifies the homology fragment to use
     78  SerializablePotential::ParticleTypes_t fragmentnumbers =
     79      PotentialTrainer::getNumbersFromElements(params.fragment.get());
     80
    12081  // then we ought to pick the right HomologyGraph ...
    12182  const HomologyGraph graph =
     
    12990  }
    13091
    131   // training
     92  // next we use the set of homologous fragments for training from the present potentials
    13293  PotentialTrainer trainer;
    13394  const bool status = trainer(
  • TabularUnified src/Actions/PotentialAction/FitCompoundPotentialAction.def

    r98d166 rf1eabd  
    1717#include "Parameters/Validators/STLVectorValidator.hpp"
    1818#include "Parameters/Validators/Specific/ElementValidator.hpp"
    19 #include "Parameters/Validators/Specific/FilePresentValidator.hpp"
    2019#include "Parameters/Validators/Specific/FileSuffixValidator.hpp"
    2120#include "Parameters/Validators/Specific/PotentialTypeValidator.hpp"
     
    3130#define paramvalids \
    3231(DummyValidator<boost::filesystem::path>()) \
    33 (FilePresentValidator() && FileSuffixValidator("potentials")) \
     32(FileSuffixValidator("potentials")) \
    3433(STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \
    3534(PositiveValidator<unsigned int>()) \
Note: See TracChangeset for help on using the changeset viewer.