Changeset 174f8b


Ignore:
Timestamp:
Oct 17, 2013, 7:24:25 AM (11 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:
958312
Parents:
16893f
git-author:
Frederik Heber <heber@…> (09/28/13 09:20:46)
git-committer:
Frederik Heber <heber@…> (10/17/13 07:24:25)
Message:

Extending QtFragmentList to show value and contribution of summed results.

Location:
src/UIElements/Views/Qt4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/QtFragmentList.cpp

    r16893f r174f8b  
    4141
    4242#include "CodePatterns/MemDebug.hpp"
     43
     44#include "CodePatterns/Log.hpp"
    4345
    4446#include "Descriptors/AtomIdDescriptor.hpp"
     
    5355
    5456const int QtFragmentList::COLUMNCOUNT = COLUMNTYPES_MAX;
    55 const char *QtFragmentList::COLUMNNAMES[QtFragmentList::COLUMNCOUNT]={"Number","KeySet","Formula","Energy"};
     57const char *QtFragmentList::COLUMNNAMES[QtFragmentList::COLUMNCOUNT]={"Number","KeySet","Formula","Energy value","Energy contribution"};
    5658
    5759QtFragmentList::QtFragmentList(QWidget * _parent) :
     
    6567        setHeaderLabels(header);
    6668
    67         setSelectionMode( SingleSelection );
     69        setSelectionMode( MultiSelection );
    6870
    6971        dirty = true;
     
    9597  clear();
    9698  clearing = false;
    97   //emit changed(); doesn't work!?!
     99  emit changed(); // doesn't work!?!
    98100}
    99101
     
    112114  const IndexSetContainer keysets(fragments.getKeySets());
    113115  const FragmentationResultContainer::shortrangedata_t &shortrange = fragments.getShortRangeResults();
     116  const FragmentationShortRangeResults::summedshortrange_t &summedshortrange = fragments.getShortRangeSummedResults();
    114117  IndexSetContainer::Container_t::const_iterator keyiter = keysets.getContainer().begin();
    115118  FragmentationResultContainer::shortrangedata_t::const_iterator resultiter = shortrange.begin();
     
    131134          ++indexiter) {
    132135        const atom *_atom = World::getInstance().getAtom(AtomById(*indexiter));
    133         formula.addElements(_atom->getElementNo(), 1);
     136        if (_atom != NULL)
     137          formula.addElements(_atom->getElementNo(), 1);
     138        else
     139          ELOG(2, "QtFragmentList::refill() - Could not find id " << *indexiter << " for formula.");
    134140      }
    135141      output << formula.toString();
    136142      treeItem->setText(FORMULA, QString(output.str().c_str()));
    137143    }
    138     {
    139       std::stringstream output;
    140       output << resultiter->second.energies.total;
    141       treeItem->setText(ENERGY, QString(output.str().c_str()));
     144    if (summedshortrange.empty()) {
     145      {
     146        std::stringstream output;
     147        output << resultiter->second.energies.total;
     148        treeItem->setText(ENERGYVALUE, QString(output.str().c_str()));
     149      }
     150      {
     151        std::stringstream output;
     152        output << "";
     153        treeItem->setText(ENERGYCONTRIBUTION, QString(output.str().c_str()));
     154      }
     155    } else {
     156      FragmentationShortRangeResults::summedshortrange_t::const_iterator sumresiter =
     157          summedshortrange.find(*keyiter);
     158      ASSERT( sumresiter != summedshortrange.end(),
     159          "QtFragmentList::refill() - "+toString(*keyiter)+" not present in summed results.");
     160      {
     161        std::stringstream output;
     162        output << sumresiter->second.first.energies.total;
     163        treeItem->setText(ENERGYVALUE, QString(output.str().c_str()));
     164      }
     165      {
     166        std::stringstream output;
     167        output << sumresiter->second.second.energies.total;
     168        treeItem->setText(ENERGYCONTRIBUTION, QString(output.str().c_str()));
     169      }
    142170    }
    143171    FragmentSelection.push_back(treeItem->isSelected());
     
    167195{
    168196  //std::cout << "rowSelected\n";
     197  // unselect
     198  for (int i=0;i<topLevelItemCount();++i) {
     199    QTreeWidgetItem *item = topLevelItem(i);
     200    bool newSelection = item->isSelected();
     201    if (newSelection != FragmentSelection[i]){
     202      // get the keyset and select the specific atoms
     203      if (!newSelection)
     204        for (IndexSet::const_iterator iter = indexsets[i].begin();
     205            iter != indexsets[i].end();
     206            ++iter)
     207          World::getInstance().unselectAtom(*iter);
     208    }
     209  }
     210  // select all
    169211  for (int i=0;i<topLevelItemCount();++i) {
    170212    QTreeWidgetItem *item = topLevelItem(i);
     
    173215      FragmentSelection[i] = newSelection;
    174216      // get the keyset and select the specific atoms
    175       for (IndexSet::const_iterator iter = indexsets[i].begin();
    176           iter != indexsets[i].end();
    177           ++iter)
    178         if (newSelection)
     217      if (newSelection)
     218        for (IndexSet::const_iterator iter = indexsets[i].begin();
     219            iter != indexsets[i].end();
     220            ++iter)
    179221          World::getInstance().selectAtom(*iter);
    180         else
    181           World::getInstance().unselectAtom(*iter);
    182222    }
    183223  }
  • src/UIElements/Views/Qt4/QtFragmentList.hpp

    r16893f r174f8b  
    3737
    3838  static const int COLUMNCOUNT;
    39   enum {NUMBER,KEYSET,FORMULA,ENERGY,COLUMNTYPES_MAX} COLUMNTYPES;
     39  enum {NUMBER,KEYSET,FORMULA,ENERGYVALUE,ENERGYCONTRIBUTION,COLUMNTYPES_MAX} COLUMNTYPES;
    4040  static const char *COLUMNNAMES[];
    4141
Note: See TracChangeset for help on using the changeset viewer.