Ignore:
Timestamp:
May 27, 2010, 10:46:54 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:
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/analysis_bonds.cpp

    r8f215d ra7b761b  
    2626  Mean = 0.;
    2727
    28   atom *Walker = mol->start;
    2928  int AtomCount = 0;
    30   while (Walker->next != mol->end) {
    31     Walker = Walker->next;
    32     const int count = Walker->ListOfBonds.size();
     29  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     30    const int count = (*iter)->ListOfBonds.size();
    3331    if (Max < count)
    3432      Max = count;
     
    5856
    5957  int AtomNo = 0;
    60   atom *Walker = mol->start;
    61   while (Walker->next != mol->end) {
    62     Walker = Walker->next;
    63     if (Walker->type == type1)
    64       for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++)
    65         if ((*BondRunner)->GetOtherAtom(Walker)->type == type2) {
     58  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     59    if ((*iter)->type == type1)
     60      for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++)
     61        if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) {
    6662          const double distance = (*BondRunner)->GetDistanceSquared();
    6763          if (Min > distance)
     
    126122int CountHydrogenBridgeBonds(MoleculeListClass *molecules, element * InterfaceElement = NULL)
    127123{
    128   atom *Walker = NULL;
    129   atom *Runner = NULL;
    130124  int count = 0;
    131125  int OtherHydrogens = 0;
     
    133127  bool InterfaceFlag = false;
    134128  bool OtherHydrogenFlag = true;
    135   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
    136     Walker = (*MolWalker)->start;
    137     while (Walker->next != (*MolWalker)->end) {
    138       Walker = Walker->next;
    139       for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); MolRunner++) {
    140         Runner = (*MolRunner)->start;
    141         while (Runner->next != (*MolRunner)->end) {
    142           Runner = Runner->next;
    143           if ((Walker->type->Z  == 8) && (Runner->type->Z  == 8)) {
     129  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); ++MolWalker) {
     130    molecule::iterator Walker = (*MolWalker)->begin();
     131    for(;Walker!=(*MolWalker)->end();++Walker){
     132      for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); ++MolRunner) {
     133        molecule::iterator Runner = (*MolRunner)->begin();
     134        for(;Runner!=(*MolRunner)->end();++Runner){
     135          if (((*Walker)->type->Z  == 8) && ((*Runner)->type->Z  == 8)) {
    144136            // check distance
    145             const double distance = Runner->x.DistanceSquared(Walker->x);
     137            const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
    146138            if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
    147139              // on other atom(Runner) we check for bond to interface element and
     
    151143              OtherHydrogens = 0;
    152144              InterfaceFlag = (InterfaceElement == NULL);
    153               for (BondList::const_iterator BondRunner = Runner->ListOfBonds.begin(); BondRunner != Runner->ListOfBonds.end(); BondRunner++) {
    154                 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Runner);
     145              for (BondList::const_iterator BondRunner = (*Runner)->ListOfBonds.begin(); BondRunner != (*Runner)->ListOfBonds.end(); BondRunner++) {
     146                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
    155147                // if hydrogen, check angle to be greater(!) than 30 degrees
    156148                if (OtherAtom->type->Z == 1) {
    157                   const double angle = CalculateAngle(&OtherAtom->x, &Runner->x, &Walker->x);
     149                  const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x);
    158150                  OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
    159151                  Otherangle += angle;
     
    176168              if (InterfaceFlag && OtherHydrogenFlag) {
    177169                // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule
    178                 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
    179                   atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker);
     170                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
     171                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
    180172                  if (OtherAtom->type->Z == 1) {
    181173                    // check angle
    182                     if (CheckHydrogenBridgeBondAngle(Walker, OtherAtom, Runner)) {
    183                       DoLog(1) && (Log() << Verbose(1) << Walker->getName() << ", " << OtherAtom->getName() << " and " << Runner->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &Walker->x, &Runner->x)*(180./M_PI) << "." << endl);
     174                    if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) {
     175                      DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &(*Walker)->x, &(*Runner)->x)*(180./M_PI) << "." << endl);
    184176                      count++;
    185177                      break;
     
    205197int CountBondsOfTwo(MoleculeListClass * const molecules, const element * const first, const element * const second)
    206198{
    207   atom *Walker = NULL;
    208199  int count = 0;
    209200
    210201  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
    211     Walker = (*MolWalker)->start;
    212     while (Walker->next != (*MolWalker)->end) {
    213       Walker = Walker->next;
    214       if ((Walker->type == first) || (Walker->type == second)) {  // first element matches
    215         for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
    216           atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker);
    217           if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (Walker->nr < OtherAtom->nr)) {
     202    molecule::iterator Walker = (*MolWalker)->begin();
     203    for(;Walker!=(*MolWalker)->end();++Walker){
     204      atom * theAtom = *Walker;
     205      if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
     206        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
     207          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
     208          if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) {
    218209            count++;
    219210            DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
     
    240231  bool MatchFlag[2];
    241232  bool result = false;
    242   atom *Walker = NULL;
    243233  const element * ElementArray[2];
    244234  ElementArray[0] = first;
     
    246236
    247237  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
    248     Walker = (*MolWalker)->start;
    249     while (Walker->next != (*MolWalker)->end) {
    250       Walker = Walker->next;
    251       if (Walker->type == second) {  // first element matches
     238    molecule::iterator Walker = (*MolWalker)->begin();
     239    for(;Walker!=(*MolWalker)->end();++Walker){
     240      atom *theAtom = *Walker;
     241      if (theAtom->type == second) {  // first element matches
    252242        for (int i=0;i<2;i++)
    253243          MatchFlag[i] = false;
    254         for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
    255           atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker);
     244        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
     245          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    256246          for (int i=0;i<2;i++)
    257247            if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
Note: See TracChangeset for help on using the changeset viewer.