Changeset ed9da4 for src/Fragmentation


Ignore:
Timestamp:
Oct 26, 2012, 1:24:01 PM (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:
d4d7a1
Parents:
f7307f
git-author:
Frederik Heber <heber@…> (09/07/12 10:22:35)
git-committer:
Frederik Heber <heber@…> (10/26/12 13:24:01)
Message:

Replaced OrderArray and MaxArray arrays in Fragmentation::ParseOrderAtSiteFromFile().

Location:
src/Fragmentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Fragmentation.cpp

    rf7307f red9da4  
    577577bool Fragmentation::ParseOrderAtSiteFromFile(std::string &path)
    578578{
    579   unsigned char *OrderArray = new unsigned char[mol->getAtomCount()];
    580   bool *MaxArray = new bool[mol->getAtomCount()];
     579  typedef unsigned char order_t;
     580  typedef std::map<atomId_t, order_t> OrderArray_t;
     581  OrderArray_t OrderArray;
     582  AtomMask_t MaxArray;
    581583  bool status;
    582584  int AtomNr, value;
    583585  string line;
    584586  ifstream file;
    585 
    586   for(int i=0;i<mol->getAtomCount();i++) {
    587     OrderArray[i] = 0;
    588     MaxArray[i] = false;
    589   }
    590587
    591588  LOG(1, "Begin of ParseOrderAtSiteFromFile");
     
    600597        OrderArray[AtomNr] = value;
    601598        file >> value;
    602         MaxArray[AtomNr] = value;
     599        MaxArray.setValue(AtomNr, (bool)value);
    603600        //LOG(2, "AtomNr " << AtomNr << " with order " << (int)OrderArray[AtomNr] << " and max order set to " << (int)MaxArray[AtomNr] << ".");
    604601      }
     
    609606    for(molecule::iterator iter=mol->begin();iter!=mol->end();++iter){
    610607      (*iter)->AdaptiveOrder = OrderArray[(*iter)->getNr()];
    611       (*iter)->MaxOrder = MaxArray[(*iter)->getNr()];
     608      (*iter)->MaxOrder = MaxArray.isTrue((*iter)->getNr());
    612609    }
    613610    //SetAtomValueToIndexedArray( OrderArray, &atom::getNr(), &atom::AdaptiveOrder );
     
    620617    status = false;
    621618  }
    622   delete[](OrderArray);
    623   delete[](MaxArray);
    624619
    625620  LOG(1, "End of ParseOrderAtSiteFromFile");
  • src/Fragmentation/Mask.hpp

    rf7307f red9da4  
    6969  }
    7070
     71  /** Sets bit associated to \a id to a specific boolean value.
     72   *
     73   * @param id id to set or unset
     74   * @param value bit giving whether to set or unset
     75   */
     76  void setValue(const T id, bool value) {
     77    if (value)
     78      setTrue(id);
     79    else
     80      setFalse(id);
     81  }
     82
    7183  /** Use in printing the bit mask bit by bit.
    7284   *
Note: See TracChangeset for help on using the changeset viewer.