Changeset f3bc5f for src/Fragmentation/SetValues/Fragment.hpp
- Timestamp:
- Nov 21, 2012, 10:03:24 AM (13 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, Candidate_v1.7.0, Candidate_v1.7.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:
- a0f8d3
- Parents:
- 184943
- git-author:
- Frederik Heber <heber@…> (08/10/12 08:21:49)
- git-committer:
- Frederik Heber <heber@…> (11/21/12 10:03:24)
- File:
-
- 1 edited
-
src/Fragmentation/SetValues/Fragment.hpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/SetValues/Fragment.hpp
r184943 rf3bc5f 18 18 #include <vector> 19 19 20 class FragmentTest; 21 20 22 class Fragment { 21 23 //!> grant ostream operator access 22 24 friend std::ostream & operator<<(std::ostream &ost, const Fragment &f); 25 //!> grant unit test access 26 friend class FragmentTest; 23 27 public: 24 typedef std::vector< std::vector<double> > positions_t; 28 typedef std::vector<double> position_t; 29 typedef std::vector< position_t > positions_t; 25 30 typedef std::vector< double > charges_t; 26 typedef std::pair< std::vector<double>, double> nucleus_t;31 typedef std::pair< position_t, double> nucleus_t; 27 32 typedef std::vector< nucleus_t > nuclei_t; 28 33 … … 44 49 * @param _charges given charges 45 50 */ 46 Fragment(const std::vector< std::vector<double> > &_positions, const std::vector< double >&_charges);51 Fragment(const positions_t &_positions, const charges_t &_charges); 47 52 48 53 /** Adding another fragment onto this one. … … 82 87 charges_t getCharges() const; 83 88 89 /** Equality operator. 90 * 91 * @param other other instance to check against 92 * @return true - both are equal, false - some nucleus_t differ 93 */ 94 bool operator==(const Fragment& other) const; 95 96 bool operator!=(const Fragment& other) const 97 { 98 return (!(*this == other)); 99 } 100 101 /** Creates type nucleus_t from given \a position and \a charge. 102 * 103 * @param position position of nucleus to create 104 * @param charge charge of nucleus to create 105 * @return nucleus with given \a position and \a charge 106 */ 107 static nucleus_t createNucleus(const position_t &position, const double charge); 108 109 /** Helper function to check whether two positions are equal. 110 * 111 * @param a first position 112 * @param b second position 113 * @return a equals b within numerical precision 114 */ 115 static bool isPositionEqual(const position_t &a, const position_t &b); 116 84 117 private: 85 /** Helper function that checks whether this nuclei is present.118 /** Helper function that checks whether this nuclei \b position is present. 86 119 * 87 120 * This operation is \f${\cal O}(n)\f$ … … 92 125 bool containsNuclei(const nucleus_t &n) const; 93 126 94 /** Seeks through all nuclei and removes matching oneif found.127 /** Seeks through all nuclei and removes one with matching \b position if found. 95 128 * 96 129 * @param n nuclei to remove … … 102 135 }; 103 136 137 /** Equality operator for two nuclei. 138 * 139 * @param a first nuclei 140 * @param b second nuclei 141 * @return true - both have same position and charge, false - either charge or position is different 142 */ 143 bool operator==(const Fragment::nucleus_t &a, const Fragment::nucleus_t &b); 144 145 std::ostream & operator<<(std::ostream &ost, const Fragment::nucleus_t &n); 146 104 147 std::ostream & operator<<(std::ostream &ost, const Fragment &f); 105 148
Note:
See TracChangeset
for help on using the changeset viewer.
