Changeset 3c349b


Ignore:
Timestamp:
Nov 3, 2009, 4:34:31 PM (15 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:
f4e1f5
Parents:
ae38fb
Message:

"not working parsed molecule into subgraph splitting"-BUG fixed, BugFinder branch can be closed.

  • config::Load() - atoms were not in the right order for MaxOrder-test (12). Hence, the BondFragmentAdjacency could not be parsed. Now, we just take the subgraphs as the association of each atom to a molecule, i.e. we make a list and then re-link each atom to its new connected subgraph molecule, which is returned as the MoleculeListClass.

other fixes:

Location:
src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/bondgraph.cpp

    rae38fb r3c349b  
    8484    return false;
    8585
    86   if (BondLengthMatrix == NULL) // no bond length matrix parsed?
     86  if (BondLengthMatrix == NULL) { // no bond length matrix parsed?
     87    SetMaxDistanceToMaxOfCovalentRadii(out, mol);
    8788    mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::CovalentMinMaxDistance, this);
    88   else
     89  } else
    8990    mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::BondLengthMatrixMinMaxDistance, this);
    9091
     
    105106};
    106107
    107 /** Determines the maximum of all element::CovalentRadius.
     108/** Determines the maximum of all element::CovalentRadius for elements present in \a *mol.
    108109 * \param *out output stream for debugging
    109  * \param *periode periodentafel with all elements.
     110 * \param *mol molecule with all atoms and their respective elements.
    110111 */
    111 double BondGraph::SetMaxDistanceToMaxOfCovalentRadii(ofstream * const out, const periodentafel * const periode)
     112double BondGraph::SetMaxDistanceToMaxOfCovalentRadii(ofstream * const out, const molecule * const mol)
    112113{
    113114  max_distance = 0.;
    114115
    115   element * Runner = periode->start;
    116   while (Runner->next != periode->end) {
     116  atom *Runner = mol->start;
     117  while (Runner->next != mol->end) {
    117118    Runner = Runner->next;
    118     if (Runner->CovalentRadius > max_distance)
    119       max_distance = Runner->CovalentRadius;
     119    if (Runner->type->CovalentRadius > max_distance)
     120      max_distance = Runner->type->CovalentRadius;
    120121  }
    121122  max_distance *= 2.;
  • TabularUnified src/bondgraph.hpp

    rae38fb r3c349b  
    3838  bool ConstructBondGraph(ofstream * const out, molecule * const mol);
    3939  double GetBondLength(int firstelement, int secondelement);
    40   double SetMaxDistanceToMaxOfCovalentRadii(ofstream * const out, const periodentafel * const periode);
     40  double SetMaxDistanceToMaxOfCovalentRadii(ofstream * const out, const molecule * const mol);
    4141
    4242  void BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
  • TabularUnified src/boundary.cpp

    rae38fb r3c349b  
    655655      volume += PyramidVolume;
    656656    }
    657   *out << Verbose(0) << "RESULT: The summed volume is " << setprecision(8)
     657  *out << Verbose(0) << "RESULT: The summed volume is " << setprecision(6)
    658658      << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."
    659659      << endl;
  • TabularUnified src/config.cpp

    rae38fb r3c349b  
    10511051  } else {
    10521052    cout << Verbose(0) << "Bond length table loading failed." << endl;
    1053     BG->SetMaxDistanceToMaxOfCovalentRadii((ofstream *)&cout, periode);
    10541053  }
    10551054
     
    10681067  delete(BackEdgeStack);
    10691068
    1070   // 6. dissect
    1071   atom ***ListOfLocalAtoms = NULL;
     1069  // 6. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
     1070  // the original one as parsed in)
     1071  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
     1072
     1073  // 6a. create array of molecules to fill
     1074  const int MolCount = Subgraphs->Count();
     1075  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
     1076  for (int i=0;i<MolCount;i++) {
     1077    molecules[i] = (molecule*) new molecule(periode);
     1078    molecules[i]->ActiveFlag = true;
     1079    MolList->insert(molecules[i]);
     1080  }
     1081
     1082  // 6b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
    10721083  int FragmentCounter = 0;
     1084  int *MolMap = Calloc<int>(mol->AtomCount, "config::Load() - *MolMap");
    10731085  MoleculeLeafClass *MolecularWalker = Subgraphs;
    10741086  atom *Walker = NULL;
    10751087  while (MolecularWalker->next != NULL) {
    10761088    MolecularWalker = MolecularWalker->next;
    1077     // fill the bond structure of the individually stored subgraphs (goes through whole chained list by itself)
    1078     MolecularWalker->FillBondStructureFromReference((ofstream *)&cout, mol, FragmentCounter, ListOfLocalAtoms, false);  // we don't want to keep the created ListOfLocalAtoms
    1079     FragmentCounter++;
    1080     MolecularWalker->Leaf->ActiveFlag = true;
    10811089    Walker = MolecularWalker->Leaf->start;
    10821090    while (Walker->next != MolecularWalker->Leaf->end) {
    10831091      Walker = Walker->next;
    1084       Walker->father = Walker;
     1092      MolMap[Walker->GetTrueFather()->nr] = FragmentCounter+1;
    10851093    }
    1086     MolList->insert(MolecularWalker->Leaf);
    1087     MolecularWalker->Leaf = NULL; // don't remove molecule when deleting MolecularWalker
     1094    FragmentCounter++;
     1095  }
     1096
     1097  // 6c. relocate atoms to new molecules and remove from Leafs
     1098  Walker = mol->start;
     1099  while (mol->start->next != mol->end) {
     1100    Walker = mol->start->next;
     1101    if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
     1102      cerr << "Index of atom " << *Walker << " is invalid!" << endl;
     1103      performCriticalExit();
     1104    }
     1105    FragmentCounter = MolMap[Walker->nr];
     1106    if (FragmentCounter != 0) {
     1107      cout << Verbose(3) << "Re-linking " << *Walker << "..." << endl;
     1108      unlink(Walker);
     1109      molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
     1110    } else {
     1111      cerr << "Atom " << *Walker << " not associated to molecule!" << endl;
     1112      performCriticalExit();
     1113    }
     1114  }
     1115  // 6d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds
     1116  // 6e. free Leafs
     1117  MolecularWalker = Subgraphs;
     1118  while (MolecularWalker->next != NULL) {
     1119    MolecularWalker = MolecularWalker->next;
    10881120    delete(MolecularWalker->previous);
    10891121  }
    10901122  delete(MolecularWalker);
    1091   for (int i=0;i<FragmentCounter;i++)
    1092     Free(&ListOfLocalAtoms[i]);
    1093   Free(&ListOfLocalAtoms);
     1123  delete(mol);
     1124  Free(&MolMap);
     1125  Free(&molecules);
    10941126  cout << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;
    1095 
    1096   // 6. free parsed in molecule
    1097   delete(mol);
    10981127
    10991128  delete(FileBuffer);
  • TabularUnified src/helpers.hpp

    rae38fb r3c349b  
    7171 * \paran *end end of chain list
    7272 * \param **Lookuptable pointer to return allocated lookup table (should be NULL on start)
    73  * \param count optional predetermined count for table (otherwise we set the count to highest true father id)
     73 * \param count optional predetermined size for table (otherwise we set the count to highest true father id)
    7474 * \return true - success, false - failure
    7575 */
     
    104104    status = false;
    105105  } else {
    106     for (int i=0;i<count;i++)
    107       LookupTable[i] = NULL;
    108106    Walker = start;
    109107    while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
  • TabularUnified src/molecule_fragmentation.cpp

    rae38fb r3c349b  
    641641    }
    642642  }
     643  *out << Verbose(2) << "CheckOrder is " << CheckOrder << "." << endl;
    643644  delete[](RootStack);
    644645  delete[](AtomMask);
  • TabularUnified src/molecule_graph.cpp

    rae38fb r3c349b  
    121121    removewithoutcheck(Binder);
    122122  }
     123  BondCount = 0;
    123124
    124125  // count atoms in molecule = dimension of matrix (also give each unique name and continuous numbering)
Note: See TracChangeset for help on using the changeset viewer.