Ignore:
Timestamp:
Nov 21, 2012, 10:03:24 AM (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:
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)
Message:

Added Fragment to MPQCData fusion maps and is used in FragmentationAutomationAction.

  • new helpers Fragment::getPositions() and ::getCharges().
  • SumUpChargeDensity() now also sums up a full Fragment.
  • the Fragment is used by createLongRangeJobs to extract required posittions and charges from.
Location:
src/Fragmentation/SetValues
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/SetValues/Fragment.cpp

    rc74fdb r184943  
    3838#include "Fragment.hpp"
    3939
     40#include <iostream>
     41
    4042#include "CodePatterns/Assert.hpp"
    4143
     
    4345{}
    4446
    45 Fragment::Fragment(positions_t &_positions, charges_t &_charges)
     47Fragment::Fragment(const positions_t &_positions, const charges_t &_charges)
    4648{
    4749  ASSERT( _positions.size() == _charges.size(),
     
    101103}
    102104
     105Fragment::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
     114Fragment::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
     123std::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
    103132template<> Fragment ZeroInstance<Fragment>()
    104133{
  • src/Fragmentation/SetValues/Fragment.hpp

    rc74fdb r184943  
    1515#endif
    1616
     17#include <iosfwd>
    1718#include <vector>
    1819
    1920class Fragment {
     21  //!> grant ostream operator access
     22  friend std::ostream & operator<<(std::ostream &ost, const Fragment &f);
    2023public:
    2124  typedef std::vector< std::vector<double> > positions_t;
     
    4144   * @param _charges given charges
    4245   */
    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);
    4447
    4548  /** Adding another fragment onto this one.
     
    6770  Fragment& operator-=(const Fragment &other);
    6871
     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
    6984private:
    7085  /** Helper function that checks whether this nuclei is present.
     
    87102};
    88103
     104std::ostream & operator<<(std::ostream &ost, const Fragment &f);
     105
    89106template<typename T> T ZeroInstance();
    90107template<> Fragment ZeroInstance<Fragment>();
Note: See TracChangeset for help on using the changeset viewer.