Ignore:
Timestamp:
Mar 1, 2011, 10:16:39 AM (14 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:
72d90e
Parents:
5309ba
git-author:
Frederik Heber <heber@…> (02/18/11 10:42:01)
git-committer:
Frederik Heber <heber@…> (03/01/11 10:16:39)
Message:

Made BondGraph an instance of World, removed from config.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/CommandAction/BondLengthTableAction.cpp

    r5309ba rf71baf  
    4545  DoLog(0) && (Log() << Verbose(0) << "Using " << params.BondGraphFileName << " as bond length table." << endl);
    4646  config *configuration = World::getInstance().getConfig();
    47   BondGraph *OldBG;
    48   if (configuration->BG != NULL) {
    49     OldBG = configuration->BG;
    50     DoLog(0) && (Log() << Verbose(0) << "There is a bond length table already present." << endl);
    51   }
    52   configuration->BG = new BondGraph(configuration->GetIsAngstroem());
     47  BondGraph *OldBG = World::getInstance().getBondGraph();
     48
     49  BondGraph *BG = new BondGraph(configuration->GetIsAngstroem());
    5350  if ((!params.BondGraphFileName.empty())
    5451      && boost::filesystem::exists(params.BondGraphFileName)) {
    5552    std::ifstream input(params.BondGraphFileName.string().c_str());
    56     if ((input.good()) && (configuration->BG->LoadBondLengthTable(input))) {
     53    if ((input.good()) && (BG->LoadBondLengthTable(input))) {
    5754      DoLog(0) && (Log() << Verbose(0) << "Bond length table parsed successfully." << endl);
    5855      input.close();
    59       return Action::state_ptr(new CommandBondLengthTableState(*OldBG, params));
     56      CommandBondLengthTableState *state = new CommandBondLengthTableState(*OldBG, params);
     57      World::getInstance().setBondGraph(BG);  // Changes OldBG, hence have to copy beforehand
     58      return Action::state_ptr(state);
    6059    } else {
    6160      DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table parsing failed." << endl);
    6261      input.close();
    63       configuration->BG = new BondGraph(*OldBG);
    6462      return Action::failure;
    6563    }
    6664  } else {
    6765    DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    68     configuration->BG = new BondGraph(*OldBG);
    6966    return Action::failure;
    7067  }
     
    7471  CommandBondLengthTableState *state = assert_cast<CommandBondLengthTableState*>(_state.get());
    7572
    76   config *configuration = World::getInstance().getConfig();
    77   BondGraph *OldBG = new BondGraph(*configuration->BG);
    78   configuration->BG = new BondGraph(state->OldBG);
     73  BondGraph *OldBG = World::getInstance().getBondGraph();
     74  CommandBondLengthTableState *restate = new CommandBondLengthTableState(*OldBG, params);
     75  World::getInstance().setBondGraph(new BondGraph(state->OldBG));  // Changes OldBG, hence have to copy beforehand
    7976
    80   return Action::state_ptr(new CommandBondLengthTableState(*OldBG,params));
     77  return Action::state_ptr(restate);
    8178}
    8279
     
    8481  CommandBondLengthTableState *state = assert_cast<CommandBondLengthTableState*>(_state.get());
    8582
    86   config *configuration = World::getInstance().getConfig();
    87   BondGraph *OldBG = new BondGraph(*configuration->BG);
    88   configuration->BG = new BondGraph(state->OldBG);
     83  BondGraph *OldBG = World::getInstance().getBondGraph();
     84  CommandBondLengthTableState *restate = new CommandBondLengthTableState(*OldBG, params);
     85  World::getInstance().setBondGraph(new BondGraph(state->OldBG));  // Changes OldBG, hence have to copy beforehand
    8986
    90   return Action::state_ptr(new CommandBondLengthTableState(*OldBG,params));
     87  return Action::state_ptr(restate);
    9188}
    9289
Note: See TracChangeset for help on using the changeset viewer.