Ignore:
Timestamp:
Feb 11, 2016, 8:07:11 AM (9 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:
eb6552
Parents:
df5b8c
git-author:
Frederik Heber <heber@…> (12/30/15 10:02:58)
git-committer:
Frederik Heber <heber@…> (02/11/16 08:07:11)
Message:

Removed molecules_deprecated from World and unnecessary includes of MoleculeListClass and all insert/erase.

  • this goes along the lines of removing "remove me when we don't need MoleculeCistClass anymore".
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/TextUI/TextWindow.cpp

    rdf5b8c r2affd1  
    5050#include "Actions/ActionQueue.hpp"
    5151#include "Actions/ActionTrait.hpp"
     52#include "Element/element.hpp"
     53#include "Element/periodentafel.hpp"
     54#include "molecule.hpp"
    5255#include "Parser/ChangeTracker.hpp"
    5356#include "Views/StreamStringView.hpp"
     
    5861#include "CodePatterns/Log.hpp"
    5962#include "CodePatterns/Verbose.hpp"
    60 
    61 // needed due to Enumerate()
    62 #include "MoleculeListClass.hpp"
    6363
    6464#include <iostream>
     
    7676  main_menu->reserveShortcut('q', "quit");
    7777
    78   moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,World::getInstance().getMolecules(),_1));
     78  moleculeView = new StreamStringView(boost::bind(&TextWindow::Enumerate,this,_1));
    7979  new DisplayMenuItem(main_menu->getMenuInstance(),moleculeView,"Molecule List");
    8080
     
    9999}
    100100
     101void TextWindow::Enumerate(std::ostream *out)
     102{
     103  periodentafel *periode = World::getInstance().getPeriode();
     104  std::vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
     105  std::map<atomicNumber_t,unsigned int> counts;
     106  double size=0;
     107  Vector Origin;
     108
     109  // header
     110  (*out) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;
     111  (*out) << "-----------------------------------------------" << endl;
     112  if (allmolecules.size() == 0)
     113    (*out) << "\tNone" << endl;
     114  else {
     115    Origin.Zero();
     116    for (std::vector<molecule *>::const_iterator ListRunner = allmolecules.begin();
     117        ListRunner != allmolecules.end(); ListRunner++) {
     118      // count atoms per element and determine size of bounding sphere
     119      size=0.;
     120      const molecule *MolRunner = *ListRunner;
     121      for (molecule::const_iterator iter = MolRunner->begin(); iter != MolRunner->end(); ++iter) {
     122        counts[(*iter)->getType()->getAtomicNumber()]++;
     123        if ((*iter)->DistanceSquared(Origin) > size)
     124          size = (*iter)->DistanceSquared(Origin);
     125      }
     126      // output Index, Name, number of atoms, chemical formula
     127      (*out) << (MolRunner->ActiveFlag ? "*" : " ") << MolRunner->IndexNr << "\t" << MolRunner->name << "\t\t" << MolRunner->getAtomCount() << "\t";
     128
     129      std::map<atomicNumber_t,unsigned int>::reverse_iterator iter;
     130      for(iter=counts.rbegin(); iter!=counts.rend();++iter){
     131        atomicNumber_t Z =(*iter).first;
     132        (*out) << periode->FindElement(Z)->getSymbol() << (*iter).second;
     133      }
     134      // Center and size
     135      Vector Center = MolRunner->DetermineCenterOfAll();
     136      (*out) << "\t" << Center << "\t" << sqrt(size) << endl;
     137    }
     138  }
     139}
     140
    101141TextWindow::~TextWindow()
    102142{
Note: See TracChangeset for help on using the changeset viewer.