Changeset 184943 for src/Fragmentation/SetValues
- Timestamp:
- Nov 21, 2012, 10:03:24 AM (12 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:
- f3bc5f
- Parents:
- c74fdb
- git-author:
- Frederik Heber <heber@…> (08/08/12 13:36:24)
- git-committer:
- Frederik Heber <heber@…> (11/21/12 10:03:24)
- Location:
- src/Fragmentation/SetValues
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/SetValues/Fragment.cpp
rc74fdb r184943 38 38 #include "Fragment.hpp" 39 39 40 #include <iostream> 41 40 42 #include "CodePatterns/Assert.hpp" 41 43 … … 43 45 {} 44 46 45 Fragment::Fragment( positions_t &_positions,charges_t &_charges)47 Fragment::Fragment(const positions_t &_positions, const charges_t &_charges) 46 48 { 47 49 ASSERT( _positions.size() == _charges.size(), … … 101 103 } 102 104 105 Fragment::positions_t Fragment::getPositions() const 106 { 107 positions_t positions; 108 for (nuclei_t::const_iterator iter = nuclei.begin(); 109 iter != nuclei.end(); ++iter) 110 positions.push_back(iter->first); 111 return positions; 112 } 113 114 Fragment::charges_t Fragment::getCharges() const 115 { 116 charges_t charges; 117 for (nuclei_t::const_iterator iter = nuclei.begin(); 118 iter != nuclei.end(); ++iter) 119 charges.push_back(iter->second); 120 return charges; 121 } 122 123 std::ostream & operator<<(std::ostream &ost, const Fragment &f) 124 { 125 size_t NucleiCounter = 1; 126 for (Fragment::nuclei_t::const_iterator iter = f.nuclei.begin(); 127 iter != f.nuclei.end(); ++iter) 128 ost << NucleiCounter++ << "\t" << iter->first << " with charge " << iter->second << std::endl; 129 return ost; 130 } 131 103 132 template<> Fragment ZeroInstance<Fragment>() 104 133 { -
src/Fragmentation/SetValues/Fragment.hpp
rc74fdb r184943 15 15 #endif 16 16 17 #include <iosfwd> 17 18 #include <vector> 18 19 19 20 class Fragment { 21 //!> grant ostream operator access 22 friend std::ostream & operator<<(std::ostream &ost, const Fragment &f); 20 23 public: 21 24 typedef std::vector< std::vector<double> > positions_t; … … 41 44 * @param _charges given charges 42 45 */ 43 Fragment( std::vector< std::vector<double> > &_positions,std::vector< double > &_charges);46 Fragment(const std::vector< std::vector<double> > &_positions, const std::vector< double > &_charges); 44 47 45 48 /** Adding another fragment onto this one. … … 67 70 Fragment& operator-=(const Fragment &other); 68 71 72 /** Getter for all stored positions. 73 * 74 * @return vector of positions 75 */ 76 positions_t getPositions() const; 77 78 /** Getter for all stored charges. 79 * 80 * @return vector of charges 81 */ 82 charges_t getCharges() const; 83 69 84 private: 70 85 /** Helper function that checks whether this nuclei is present. … … 87 102 }; 88 103 104 std::ostream & operator<<(std::ostream &ost, const Fragment &f); 105 89 106 template<typename T> T ZeroInstance(); 90 107 template<> Fragment ZeroInstance<Fragment>();
Note:
See TracChangeset
for help on using the changeset viewer.