Changeset bd6bfa


Ignore:
Timestamp:
Jun 1, 2010, 7:28:15 AM (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:
acf800
Parents:
1b9321
Message:

Fixes after first,last removal.

  • BUGFIX: molecule::OutputGraphInfoPerBond() - had removal loop, not go-through-each-loop.
  • BUGFIX: MoleculeListClass::~MoleculeListClass() - did falsely destroy molecules too although this is done by World.
  • new function MoleculeListClass::erase() - handles signing off molecule as observer and removes from list.
  • FIX: MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs()
    • all molecules are removed from MoleculeListClass and also from World.
    • all bonds are removed, by going through all atoms of World.
    • molecule::getAtomCount() - calls doCountAtoms() which re-numbers and -labels atoms. This confused stuff.
  • TESTFIX: Molecules/6 and Molecules/7 had wrong (old) ordering in their test.conf
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/bondgraph.cpp

    r1b9321 rbd6bfa  
    8888{
    8989  Info FunctionInfo(__func__);
    90 bool status = true;
     90  bool status = true;
    9191
    9292  if (mol->empty()) // only construct if molecule is not empty
  • src/molecule.hpp

    r1b9321 rbd6bfa  
    380380  bool StoreForcesFile(char *path, int *SortIndex);
    381381  void insert(molecule *mol);
     382  void erase(molecule *mol);
    382383  molecule * ReturnIndex(int index);
    383384  bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
  • src/molecule_graph.cpp

    r1b9321 rbd6bfa  
    6767    performCriticalExit();
    6868  };
     69  doCountAtoms();
    6970
    7071  // skip header
     
    632633  DoLog(1) && (Log() << Verbose(1) << "Final graph info for each bond is:" << endl);
    633634  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    634     for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
     635    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
    635636      if ((*BondRunner)->leftatom == *AtomRunner) {
    636637        Binder = *BondRunner;
  • src/moleculelist.cpp

    r1b9321 rbd6bfa  
    4040MoleculeListClass::~MoleculeListClass()
    4141{
    42   DoLog(3) && (Log() << Verbose(3) << this << ": Freeing ListOfMolcules." << endl);
    43   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    44     DoLog(4) && (Log() << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl);
    45     world->destroyMolecule(*ListRunner);
    46   }
    47   DoLog(4) && (Log() << Verbose(4) << "Freeing ListOfMolecules." << endl);
     42  DoLog(4) && (Log() << Verbose(4) << "Clearing ListOfMolecules." << endl);
     43  for(MoleculeList::iterator MolRunner = ListOfMolecules.begin(); MolRunner != ListOfMolecules.end(); ++MolRunner)
     44    (*MolRunner)->signOff(this);
    4845  ListOfMolecules.clear(); // empty list
    4946};
     
    5148/** Insert a new molecule into the list and set its number.
    5249 * \param *mol molecule to add to list.
    53  * \return true - add successful
    5450 */
    5551void MoleculeListClass::insert(molecule *mol)
     
    5955  ListOfMolecules.push_back(mol);
    6056  mol->signOn(this);
     57};
     58
     59/** Erases a molecule from the list.
     60 * \param *mol molecule to add to list.
     61 */
     62void MoleculeListClass::erase(molecule *mol)
     63{
     64  OBSERVE;
     65  mol->signOff(this);
     66  ListOfMolecules.remove(mol);
    6167};
    6268
     
    742748void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration)
    743749{
     750  // 0a. remove all present molecules
     751  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
     752  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
     753    erase(*MolRunner);
     754    World::getInstance().destroyMolecule(*MolRunner);
     755  }
     756  // 0b. remove all bonds
    744757  molecule *mol = World::getInstance().createMolecule();
    745   bond *Binder = NULL;
    746   // 0. gather all atoms into single molecule
    747   for (MoleculeList::iterator MolRunner = ListOfMolecules.begin(); !ListOfMolecules.empty(); MolRunner = ListOfMolecules.begin()) {
    748     // shift all atoms to new molecule
    749     for (molecule::iterator iter = (*MolRunner)->begin(); (*MolRunner)->empty(); iter = (*MolRunner)->begin()) {
    750       DoLog(3) && (Log() << Verbose(3) << "Re-linking " << (*iter) << "..." << endl);
    751       (*iter)->father = (*iter);
    752       mol->AddAtom((*iter));    // counting starts at 1
    753       (*MolRunner)->erase(iter);
    754     }
    755     // remove all bonds
    756     for(molecule::iterator AtomRunner = (*MolRunner)->begin(); AtomRunner != (*MolRunner)->end(); ++AtomRunner)
    757       for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
    758         delete(*BondRunner);
    759     // remove the molecule
    760     World::getInstance().destroyMolecule(*MolRunner);
    761     ListOfMolecules.erase(MolRunner);
     758  vector <atom *> allatoms = World::getInstance().getAllAtoms();
     759  for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
     760    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
     761      delete(*BondRunner);
     762    mol->AddAtom(*AtomRunner);
    762763  }
    763764
     
    816817  // 4c. relocate atoms to new molecules and remove from Leafs
    817818  for (molecule::iterator iter = mol->begin(); !mol->empty(); iter = mol->begin()) {
    818     if (((*iter)->nr <0) || ((*iter)->nr >= mol->getAtomCount())) {
    819       DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << **iter << " is invalid!" << endl);
     819    const int count = mol->getAtomCount();
     820    if (((*iter)->nr <0) || ((*iter)->nr >= count)) {
     821      DoeLog(0) && (eLog()<< Verbose(0) << "Index " << (*iter)->nr << " of atom " << **iter << " in molecule of " << count << " atoms is invalid!" << endl);
    820822      performCriticalExit();
    821823    }
    822     FragmentCounter = MolMap[(*iter)->nr];
    823     if (FragmentCounter != 0) {
     824    const int Index = MolMap[(*iter)->nr];
     825    if (Index != 0) {
    824826      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << **iter << "..." << endl);
    825       molecules[FragmentCounter-1]->AddAtom((*iter));    // counting starts at 1
     827      molecules[Index-1]->AddAtom((*iter));    // counting starts at 1
    826828      mol->erase(iter);
    827829    } else {
  • tests/regression/Molecules/6/post/test.conf

    r1b9321 rbd6bfa  
    7171Ion_Type2       3       6       1.0     3       3       12.01100000000  Carbon  C
    7272#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
    73 Ion_Type2_1     10.782085945    4.275186040     4.535886037     0 # molecule nr 0
    74 Ion_Type2_2     9.532785963     5.158586027     4.535886037     0 # molecule nr 1
    75 Ion_Type2_3     8.283585982     4.275186040     4.535886037     0 # molecule nr 2
    76 Ion_Type1_1     10.782085945    3.645886050     3.645886050     0 # molecule nr 3
    77 Ion_Type1_2     10.782085945    3.645886050     5.425886024     0 # molecule nr 4
    78 Ion_Type1_3     11.672039608    4.904536878     4.535886037     0 # molecule nr 5
    79 Ion_Type1_4     9.532785963     5.787886018     3.645886050     0 # molecule nr 6
    80 Ion_Type1_5     9.532785963     5.787886018     5.425886024     0 # molecule nr 7
    81 Ion_Type1_6     7.393632318     4.904536877     4.535886037     0 # molecule nr 8
    82 Ion_Type1_7     8.283585982     3.645886050     3.645886050     0 # molecule nr 9
    83 Ion_Type1_8     8.283585982     3.645886050     5.425886024     0 # molecule nr 10
     73Ion_Type1_1     10.782085945    3.645886050     3.645886050     0 # molecule nr 0
     74Ion_Type1_2     10.782085945    3.645886050     5.425886024     0 # molecule nr 1
     75Ion_Type1_3     11.672039608    4.904536878     4.535886037     0 # molecule nr 2
     76Ion_Type1_4     9.532785963     5.787886018     3.645886050     0 # molecule nr 3
     77Ion_Type1_5     9.532785963     5.787886018     5.425886024     0 # molecule nr 4
     78Ion_Type1_6     7.393632318     4.904536877     4.535886037     0 # molecule nr 5
     79Ion_Type1_7     8.283585982     3.645886050     3.645886050     0 # molecule nr 6
     80Ion_Type1_8     8.283585982     3.645886050     5.425886024     0 # molecule nr 7
     81Ion_Type2_1     10.782085945    4.275186040     4.535886037     0 # molecule nr 8
     82Ion_Type2_2     9.532785963     5.158586027     4.535886037     0 # molecule nr 9
     83Ion_Type2_3     8.283585982     4.275186040     4.535886037     0 # molecule nr 10
  • tests/regression/Molecules/7/post/test.conf

    r1b9321 rbd6bfa  
    7171Ion_Type2       3       6       1.0     3       3       12.01100000000  Carbon  C
    7272#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
    73 Ion_Type2_1     1.782085945     15.275186040    15.535886037    0 # molecule nr 0
    74 Ion_Type2_2     0.532785963     16.158586027    15.535886037    0 # molecule nr 1
    75 Ion_Type2_3     19.283585982    15.275186040    15.535886037    0 # molecule nr 2
    76 Ion_Type1_1     1.782085945     14.645886050    14.645886050    0 # molecule nr 3
    77 Ion_Type1_2     1.782085945     14.645886050    16.425886024    0 # molecule nr 4
    78 Ion_Type1_3     2.672039608     15.904536878    15.535886037    0 # molecule nr 5
    79 Ion_Type1_4     0.532785963     16.787886018    14.645886050    0 # molecule nr 6
    80 Ion_Type1_5     0.532785963     16.787886018    16.425886024    0 # molecule nr 7
    81 Ion_Type1_6     18.393632318    15.904536877    15.535886037    0 # molecule nr 8
    82 Ion_Type1_7     19.283585982    14.645886050    14.645886050    0 # molecule nr 9
    83 Ion_Type1_8     19.283585982    14.645886050    16.425886024    0 # molecule nr 10
     73Ion_Type1_1     1.782085945     14.645886050    14.645886050    0 # molecule nr 0
     74Ion_Type1_2     1.782085945     14.645886050    16.425886024    0 # molecule nr 1
     75Ion_Type1_3     2.672039608     15.904536878    15.535886037    0 # molecule nr 2
     76Ion_Type1_4     0.532785963     16.787886018    14.645886050    0 # molecule nr 3
     77Ion_Type1_5     0.532785963     16.787886018    16.425886024    0 # molecule nr 4
     78Ion_Type1_6     18.393632318    15.904536877    15.535886037    0 # molecule nr 5
     79Ion_Type1_7     19.283585982    14.645886050    14.645886050    0 # molecule nr 6
     80Ion_Type1_8     19.283585982    14.645886050    16.425886024    0 # molecule nr 7
     81Ion_Type2_1     1.782085945     15.275186040    15.535886037    0 # molecule nr 8
     82Ion_Type2_2     0.532785963     16.158586027    15.535886037    0 # molecule nr 9
     83Ion_Type2_3     19.283585982    15.275186040    15.535886037    0 # molecule nr 10
Note: See TracChangeset for help on using the changeset viewer.