Ignore:
Timestamp:
May 27, 2010, 10:46:54 AM (15 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, 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:
1024cb
Parents:
8f215d (diff), 05a97c (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 'MoleculeStartEndSwitch' into StructureRefactoring

Conflicts:

molecuilder/src/Helpers/Assert.cpp
molecuilder/src/Helpers/Assert.hpp
molecuilder/src/Legacy/oldmenu.cpp
molecuilder/src/Makefile.am
molecuilder/src/Patterns/Cacheable.hpp
molecuilder/src/Patterns/Observer.cpp
molecuilder/src/Patterns/Observer.hpp
molecuilder/src/analysis_correlation.cpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule.hpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/ObserverTest.cpp
molecuilder/src/unittests/ObserverTest.hpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Legacy/oldmenu.cpp

    r8f215d ra7b761b  
    423423void oldmenu::RemoveAtoms(molecule *mol)
    424424{
    425   atom *first, *second;
     425  atom *second;
    426426  int axis;
    427427  double tmp1, tmp2;
     
    446446      break;
    447447    case 'b':
    448       second = mol->AskAtom("Enter number of atom as reference point: ");
    449       Log() << Verbose(0) << "Enter radius: ";
    450       cin >> tmp1;
    451       first = mol->start;
    452       second = first->next;
    453       while(second != mol->end) {
    454         first = second;
    455         second = first->next;
    456         if (first->x.DistanceSquared(second->x) > tmp1*tmp1) // distance to first above radius ...
    457           mol->RemoveAtom(first);
     448      {
     449        second = mol->AskAtom("Enter number of atom as reference point: ");
     450        Log() << Verbose(0) << "Enter radius: ";
     451        cin >> tmp1;
     452        molecule::iterator runner;
     453        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
     454          runner = iter++;
     455          if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...
     456            mol->RemoveAtom((*runner));
     457        }
    458458      }
    459459      break;
     
    465465      Log() << Verbose(0) << "Upper boundary: ";
    466466      cin >> tmp2;
    467       first = mol->start;
    468       second = first->next;
    469       while(second != mol->end) {
    470         first = second;
    471         second = first->next;
    472         if ((first->x[axis] < tmp1) || (first->x[axis] > tmp2)) {// out of boundary ...
    473           //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    474           mol->RemoveAtom(first);
     467      molecule::iterator runner;
     468      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
     469        runner = iter++;
     470        if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...
     471          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
     472          mol->RemoveAtom((*runner));
    475473        }
    476474      }
     
    515513        min[i] = 0.;
    516514
    517       second = mol->start;
    518       while ((second->next != mol->end)) {
    519         second = second->next; // advance
    520         Z = second->type->Z;
     515      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     516        Z = (*iter)->type->Z;
    521517        tmp1 = 0.;
    522         if (first != second) {
    523           x = first->x - second->x;
     518        if (first != (*iter)) {
     519          x = first->x - (*iter)->x;
    524520          tmp1 = x.Norm();
    525521        }
    526522        if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
    527         //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;
     523        //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << ((*iter)->nr << ": " << tmp1 << " a.u." << endl;
    528524      }
    529525      for (int i=MAX_ELEMENTS;i--;)
     
    754750    Log() << Verbose(0) << "State the factor: ";
    755751    cin >> faktor;
    756 
    757     mol->CountAtoms(); // recount atoms
    758     if (mol->AtomCount != 0) {  // if there is more than none
    759       count = mol->AtomCount;  // is changed becausing of adding, thus has to be stored away beforehand
     752    if (mol->getAtomCount() != 0) {  // if there is more than none
     753      count = mol->getAtomCount();  // is changed becausing of adding, thus has to be stored away beforehand
    760754      Elements = new const element *[count];
    761755      vectors = new Vector *[count];
    762756      j = 0;
    763       first = mol->start;
    764       while (first->next != mol->end) { // make a list of all atoms with coordinates and element
    765         first = first->next;
    766         Elements[j] = first->type;
    767         vectors[j] = &first->x;
     757      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     758        Elements[j] = (*iter)->type;
     759        vectors[j] = &(*iter)->x;
    768760        j++;
    769761      }
     
    10241016    return;
    10251017  }
    1026   atom *Walker = mol->start;
    10271018
    10281019  // generate some KeySets
    10291020  Log() << Verbose(0) << "Generating KeySets." << endl;
    1030   KeySet TestSets[mol->AtomCount+1];
     1021  KeySet TestSets[mol->getAtomCount()+1];
    10311022  i=1;
    1032   while (Walker->next != mol->end) {
    1033     Walker = Walker->next;
     1023  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    10341024    for (int j=0;j<i;j++) {
    1035       TestSets[j].insert(Walker->nr);
     1025      TestSets[j].insert((*iter)->nr);
    10361026    }
    10371027    i++;
     
    10391029  Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
    10401030  KeySetTestPair test;
    1041   test = TestSets[mol->AtomCount-1].insert(Walker->nr);
    1042   if (test.second) {
    1043     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1031  molecule::const_iterator iter = mol->begin();
     1032  if (iter != mol->end()) {
     1033    test = TestSets[mol->getAtomCount()-1].insert((*iter)->nr);
     1034    if (test.second) {
     1035      Log() << Verbose(1) << "Insertion worked?!" << endl;
     1036    } else {
     1037      Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
     1038    }
    10441039  } else {
    1045     Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
    1046   }
    1047   TestSets[mol->AtomCount].insert(mol->end->previous->nr);
    1048   TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr);
     1040    eLog() << Verbose(1) << "No atoms to test double insertion." << endl;
     1041  }
    10491042
    10501043  // constructing Graph structure
     
    10541047  // insert KeySets into Subgraphs
    10551048  Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
    1056   for (int j=0;j<mol->AtomCount;j++) {
     1049  for (int j=0;j<mol->getAtomCount();j++) {
    10571050    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
    10581051  }
    10591052  Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;
    10601053  GraphTestPair test2;
    1061   test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
     1054  test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.)));
    10621055  if (test2.second) {
    10631056    Log() << Verbose(1) << "Insertion worked?!" << endl;
Note: See TracChangeset for help on using the changeset viewer.