Ignore:
Timestamp:
Feb 27, 2013, 12:43:29 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:
da2d5c
Parents:
dbcc47
git-author:
Frederik Heber <heber@…> (12/18/12 12:39:10)
git-committer:
Frederik Heber <heber@…> (02/27/13 12:43:29)
Message:

Added virtual stream_to/from functions to SerializablePotential.

  • this allows overriding in SaturationPotential and hence printing/parsing of both contained types.
Location:
src/Potentials/Specifics
Files:
2 edited

Legend:

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

    rdbcc47 r3d2559  
    174174  params[angle_equilibrium_distance] = angle_params[PairPotential_Angle::equilibrium_distance];
    175175  return params;
     176}
     177
     178void SaturationPotential::stream_to(std::ostream &ost) const
     179{
     180  morse.stream_to(ost);
     181  ost << std::endl;
     182  angle.stream_to(ost);
     183}
     184
     185void SaturationPotential::stream_from(std::istream &ist)
     186{
     187  morse.stream_from(ist);
     188  ist >> ws;
     189  angle.stream_from(ist);
    176190}
    177191
     
    379393      "SaturationPotential::symmetrizeTypes() - failed to generate three types for angle.");
    380394  return types;
    381 }
    382 
    383 std::ostream& operator<<(std::ostream &ost, const SaturationPotential &potential)
    384 {
    385   ost << potential.morse;
    386   ost << potential.angle;
    387   return ost;
    388 }
    389 
    390 std::istream& operator>>(std::istream &ist, SaturationPotential &potential)
    391 {
    392   ist >> potential.morse;
    393   ist >> potential.angle;
    394   return ist;
    395395}
    396396
  • src/Potentials/Specifics/SaturationPotential.hpp

    rdbcc47 r3d2559  
    128128  { return ParameterNames; }
    129129
     130  /** Print parameters for both Morse and Angle potential.
     131   *
     132   * We override default parameter printing of SeralizablePotential
     133   * to print both parameters
     134   *
     135   * @param ost stream to print to
     136   */
     137  virtual void stream_to(std::ostream &ost) const;
     138
     139  /** Parse parameters for both Morse and Angle potential.
     140   *
     141   * We override default parameter parsing of SeralizablePotential
     142   * to parse both parameters
     143   *
     144   * @param ist stream to parse from
     145   */
     146  virtual void stream_from(std::istream &ist);
     147
    130148  /** States whether lower and upper boundaries should be used to constraint
    131149   * the parameter search for this function model.
     
    198216};
    199217
    200 /** Output operations stores .potentials line containing these parameters
    201  * coefficients and designations.
    202  *
    203  * \note We have to overrride this function in order to print both potentials
    204  * separately.
    205  *
    206  * \param ost output stream to print to
    207  * \param potential potential whose coefficients to print
    208  * \return output stream for concatenation
    209  */
    210 std::ostream& operator<<(std::ostream &ost, const SaturationPotential &potential);
    211 
    212 /** Input operation parses coefficients from a given line of a .potentials
    213  * file.
    214  *
    215  * \note We have to override this function in order to parse both potentials
    216  * separately.
    217  *
    218  * \param ist input stream to parse from
    219  * \param potential potential to set
    220  * \return input stream for concatenation
    221  */
    222 std::istream& operator>>(std::istream &ist, SaturationPotential &potential);
    223218
    224219#endif /* SATURATIONPOTENTIAL_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.