Ignore:
Timestamp:
Mar 19, 2010, 1:29:01 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
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, 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:
e0b6fd
Parents:
80c63d
Message:

FIX: Made AtomCount a Cacheable so that the number of atoms in a molecule will always be correct

All unittests working.
All Complete testcases fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_fragmentation.cpp

    r80c63d rea7176  
    435435
    436436  // initialize mask list
    437   for(int i=AtomCount;i--;)
     437  for(int i=getAtomCount();i--;)
    438438    AtomMask[i] = false;
    439439
    440440  if (Order < 0) { // adaptive increase of BondOrder per site
    441     if (AtomMask[AtomCount] == true)  // break after one step
     441    if (AtomMask[getAtomCount()] == true)  // break after one step
    442442      return false;
    443443
     
    483483      }
    484484    }
    485     if ((Order == 0) && (AtomMask[AtomCount] == false))  // single stepping, just check
     485    if ((!Order) && (!AtomMask[getAtomCount()]))  // single stepping, just check
    486486      status = true;
    487487
     
    494494  }
    495495
    496   PrintAtomMask(AtomMask, AtomCount); // for debugging
     496  PrintAtomMask(AtomMask, getAtomCount()); // for debugging
    497497
    498498  return status;
     
    510510    return false;
    511511  }
    512   SortIndex = Malloc<int>(AtomCount, "molecule::CreateMappingLabelsToConfigSequence: *SortIndex");
    513   for(int i=AtomCount;i--;)
     512  SortIndex = Malloc<int>(getAtomCount(), "molecule::CreateMappingLabelsToConfigSequence: *SortIndex");
     513  for(int i=getAtomCount();i--;)
    514514    SortIndex[i] = -1;
    515515
     
    595595  MoleculeListClass *BondFragments = NULL;
    596596  int *SortIndex = NULL;
    597   int *MinimumRingSize = new int[AtomCount];
     597  int *MinimumRingSize = new int[getAtomCount()];
    598598  int FragmentCounter;
    599599  MoleculeLeafClass *MolecularWalker = NULL;
     
    623623
    624624  // create lookup table for Atom::nr
    625   FragmentationToDo = FragmentationToDo && CreateFatherLookupTable(ListOfAtoms, AtomCount);
     625  FragmentationToDo = FragmentationToDo && CreateFatherLookupTable(ListOfAtoms, getAtomCount());
    626626
    627627  // === compare it with adjacency file ===
     
    633633
    634634  // analysis of the cycles (print rings, get minimum cycle length) for each subgraph
    635   for(int i=AtomCount;i--;)
    636     MinimumRingSize[i] = AtomCount;
     635  for(int i=getAtomCount();i--;)
     636    MinimumRingSize[i] = getAtomCount();
    637637  MolecularWalker = Subgraphs;
    638638  FragmentCounter = 0;
     
    671671  // ===== 6b. prepare and go into the adaptive (Order<0), single-step (Order==0) or incremental (Order>0) cycle
    672672  KeyStack *RootStack = new KeyStack[Subgraphs->next->Count()];
    673   AtomMask = new bool[AtomCount+1];
    674   AtomMask[AtomCount] = false;
     673  AtomMask = new bool[getAtomCount()+1];
     674  AtomMask[getAtomCount()] = false;
    675675  FragmentationToDo = false;  // if CheckOrderAtSite just ones recommends fragmentation, we will save fragments afterwards
    676676  while ((CheckOrder = CheckOrderAtSite(AtomMask, ParsedFragmentList, Order, MinimumRingSize, configuration->configpath))) {
    677677    FragmentationToDo = FragmentationToDo || CheckOrder;
    678     AtomMask[AtomCount] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
     678    AtomMask[getAtomCount()] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
    679679    // ===== 6b. fill RootStack for each subgraph (second adaptivity check) =====
    680680    Subgraphs->next->FillRootStackForSubgraphs(RootStack, AtomMask, (FragmentCounter = 0));
     
    811811bool molecule::ParseOrderAtSiteFromFile(char *path)
    812812{
    813   unsigned char *OrderArray = Calloc<unsigned char>(AtomCount, "molecule::ParseOrderAtSiteFromFile - *OrderArray");
    814   bool *MaxArray = Calloc<bool>(AtomCount, "molecule::ParseOrderAtSiteFromFile - *MaxArray");
     813  unsigned char *OrderArray = Calloc<unsigned char>(getAtomCount(), "molecule::ParseOrderAtSiteFromFile - *OrderArray");
     814  bool *MaxArray = Calloc<bool>(getAtomCount(), "molecule::ParseOrderAtSiteFromFile - *MaxArray");
    815815  bool status;
    816816  int AtomNr, value;
     
    917917  atom *OtherFather = NULL;
    918918  atom *FatherOfRunner = NULL;
    919   Leaf->CountAtoms();
    920919
    921920#ifdef ADDHYDROGEN
     
    955954      eLog() << Verbose(1) << "Son " << (*iter)->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl;
    956955    }
    957     if ((LonelyFlag) && (Leaf->AtomCount > 1)) {
     956    if ((LonelyFlag) && (Leaf->getAtomCount() > 1)) {
    958957      Log() << Verbose(0) << *(*iter) << "has got bonds only to hydrogens!" << endl;
    959958    }
     
    975974molecule * molecule::StoreFragmentFromKeySet(KeySet &Leaflet, bool IsAngstroem)
    976975{
    977   atom **SonList = Calloc<atom*>(AtomCount, "molecule::StoreFragmentFromStack: **SonList");
     976  atom **SonList = Calloc<atom*>(getAtomCount(), "molecule::StoreFragmentFromStack: **SonList");
    978977  molecule *Leaf = World::get()->createMolecule();
    979978
     
    16021601  FragmentSearch.FragmentSet = new KeySet;
    16031602  FragmentSearch.Root = FindAtom(RootKeyNr);
    1604   FragmentSearch.ShortestPathList = Malloc<int>(AtomCount, "molecule::PowerSetGenerator: *ShortestPathList");
    1605   for (int i=AtomCount;i--;) {
     1603  FragmentSearch.ShortestPathList = Malloc<int>(getAtomCount(), "molecule::PowerSetGenerator: *ShortestPathList");
     1604  for (int i=getAtomCount();i--;) {
    16061605    FragmentSearch.ShortestPathList[i] = -1;
    16071606  }
     
    17071706  Vector Translationvector;
    17081707  //class StackClass<atom *> *CompStack = NULL;
    1709   class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount);
     1708  class StackClass<atom *> *AtomStack = new StackClass<atom *>(getAtomCount());
    17101709  bool flag = true;
    17111710
    17121711  Log() << Verbose(2) << "Begin of ScanForPeriodicCorrection." << endl;
    17131712
    1714   ColorList = Calloc<enum Shading>(AtomCount, "molecule::ScanForPeriodicCorrection: *ColorList");
     1713  ColorList = Calloc<enum Shading>(getAtomCount(), "molecule::ScanForPeriodicCorrection: *ColorList");
    17151714  while (flag) {
    17161715    // remove bonds that are beyond bonddistance
     
    17461745      Log() << Verbose(0) << endl;
    17471746      // apply to all atoms of first component via BFS
    1748       for (int i=AtomCount;i--;)
     1747      for (int i=getAtomCount();i--;)
    17491748        ColorList[i] = white;
    17501749      AtomStack->Push(Binder->leftatom);
Note: See TracChangeset for help on using the changeset viewer.