Ignore:
Timestamp:
Feb 2, 2010, 11:38:06 AM (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:
7ba324
Parents:
9fe36b (diff), 2ededc2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'MenuRefactoring' into QT4Refactoring

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/builder.cpp
molecuilder/src/unittests/Makefile.am

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    r9fe36b rb8d1aeb  
    44 *
    55 */
     6
     7#include <cstring>
    68
    79#include "atom.hpp"
     
    405407  input.open(line.c_str());
    406408  if (input == NULL) {
    407     eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
    408     performCriticalExit();
     409    Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
    409410    return false;
    410411  }
     
    743744/** Dissects given \a *mol into connected subgraphs and inserts them as new molecules but with old atoms into \a this.
    744745 * \param *out output stream for debugging
    745  * \param *mol molecule with atoms to dissect
     746 * \param *periode periodentafel
    746747 * \param *configuration config with BondGraph
    747748 */
    748 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(molecule * const mol, config * const configuration)
    749 {
     749void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration)
     750{
     751  molecule *mol = new molecule(periode);
     752  atom *Walker = NULL;
     753  atom *Advancer = NULL;
     754  bond *Binder = NULL;
     755  bond *Stepper = NULL;
     756  // 0. gather all atoms into single molecule
     757  for (MoleculeList::iterator MolRunner = ListOfMolecules.begin(); !ListOfMolecules.empty(); MolRunner = ListOfMolecules.begin()) {
     758    // shift all atoms to new molecule
     759    Advancer = (*MolRunner)->start->next;
     760    while (Advancer != (*MolRunner)->end) {
     761      Walker = Advancer;
     762      Advancer = Advancer->next;
     763      Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl;
     764      unlink(Walker);
     765      Walker->father = Walker;
     766      mol->AddAtom(Walker);    // counting starts at 1
     767    }
     768    // remove all bonds
     769    Stepper = (*MolRunner)->first->next;
     770    while (Stepper != (*MolRunner)->last) {
     771      Binder = Stepper;
     772      Stepper = Stepper->next;
     773      delete(Binder);
     774    }
     775    // remove the molecule
     776    delete(*MolRunner);
     777    ListOfMolecules.erase(MolRunner);
     778  }
     779
    750780  // 1. dissect the molecule into connected subgraphs
    751781  configuration->BG->ConstructBondGraph(mol);
     
    763793  // 4a. create array of molecules to fill
    764794  const int MolCount = Subgraphs->next->Count();
     795  char number[MAXSTRINGSIZE];
    765796  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
    766797  for (int i=0;i<MolCount;i++) {
    767798    molecules[i] = (molecule*) new molecule(mol->elemente);
    768799    molecules[i]->ActiveFlag = true;
     800    strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE);
     801    if (MolCount > 1) {
     802      sprintf(number, "-%d", i+1);
     803      strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     804    }
     805    cout << "MolName is " << molecules[i]->name << endl;
    769806    insert(molecules[i]);
    770807  }
     
    774811  int *MolMap = Calloc<int>(mol->AtomCount, "config::Load() - *MolMap");
    775812  MoleculeLeafClass *MolecularWalker = Subgraphs;
    776   atom *Walker = NULL;
     813  Walker = NULL;
    777814  while (MolecularWalker->next != NULL) {
    778815    MolecularWalker = MolecularWalker->next;
     
    803840    }
    804841  }
    805   // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds, but we have to remove them from first..last list
    806   bond *Binder = mol->first;
     842  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
     843  Binder = mol->first;
    807844  while (mol->first->next != mol->last) {
    808845    Binder = mol->first->next;
Note: See TracChangeset for help on using the changeset viewer.