Changeset b70721


Ignore:
Timestamp:
Oct 30, 2009, 9:05:30 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:
b21a64
Parents:
46ea3b
git-author:
Frederik Heber <heber@…> (10/30/09 08:30:57)
git-committer:
Frederik Heber <heber@…> (10/30/09 09:05:30)
Message:

New class BondGraph.

Location:
src
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r46ea3b rb70721  
    22ATOMHEADER = atom.hpp atom_atominfo.hpp atom_bondedparticle.hpp atom_bondedparticleinfo.hpp atom_graphnode.hpp atom_graphnodeinfo.hpp atom_particleinfo.hpp atom_trajectoryparticle.hpp atom_trajectoryparticleinfo.hpp
    33
    4 SOURCE = analysis_correlation.cpp ${ATOMSOURCE} bond.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
    5 HEADER = analysis_correlation.hpp ${ATOMHEADER} bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp graph.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
     4SOURCE = analysis_correlation.cpp ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
     5HEADER = analysis_correlation.hpp ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp graph.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
    66
    77BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
  • src/atom_bondedparticle.cpp

    r46ea3b rb70721  
    151151};
    152152
     153/** Checks whether there is a bond between \a this atom and the given \a *BondPartner.
     154 * \param *BondPartner atom to check for
     155 * \return true - bond exists, false - bond does not exist
     156 */
     157bool BondedParticle::IsBondedTo(BondedParticle * const BondPartner)
     158{
     159  bool status = false;
     160
     161  for (BondList::iterator runner = ListOfBonds.begin(); runner != ListOfBonds.end(); runner++) {
     162    status = status || ((*runner)->Contains(BondPartner));
     163  }
     164  return status;
     165};
     166
  • src/atom_bondedparticle.hpp

    r46ea3b rb70721  
    3939  bool RegisterBond(bond *Binder);
    4040  bool UnregisterBond(bond *Binder);
     41  bool IsBondedTo(BondedParticle * const BondPartner);
    4142  void UnregisterAllBond();
    4243  int CountBonds() const;
  • src/builder.cpp

    r46ea3b rb70721  
    5353#include "atom.hpp"
    5454#include "bond.hpp"
     55#include "bondgraph.hpp"
    5556#include "boundary.hpp"
    5657#include "config.hpp"
     
    840841          }
    841842          if (mol->first->next != mol->last) // if connect matrix is present already, redo it
    842             mol->CreateAdjacencyList((ofstream *)&cout, mol->BondDistance, configuration->GetIsAngstroem());
     843            mol->CreateAdjacencyList((ofstream *)&cout, mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    843844          // free memory
    844845          delete[](Elements);
     
    896897          cin >> bonddistance;
    897898          start = clock();
    898           mol->CreateAdjacencyList((ofstream *)&cout, bonddistance, configuration->GetIsAngstroem());
     899          mol->CreateAdjacencyList((ofstream *)&cout, bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    899900          end = clock();
    900901          cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     
    15551556                class StackClass<bond *> *BackEdgeStack = NULL;
    15561557                class StackClass<bond *> *LocalBackEdgeStack = NULL;
    1557                 mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr]), configuration.GetIsAngstroem());
     1558                mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    15581559                Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, BackEdgeStack);
    15591560                if (Subgraphs != NULL) {
     
    19121913                cout << Verbose(0) << "Creating connection matrix..." << endl;
    19131914                start = clock();
    1914                 mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr++]), configuration.GetIsAngstroem());
     1915                mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    19151916                cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
    19161917                if (mol->first->next != mol->last) {
  • src/molecule.hpp

    r46ea3b rb70721  
    3535class atom;
    3636class bond;
     37class BondedParticle;
     38class BondGraph;
    3739class element;
    3840class ForceMatrix;
     
    238240  /// Initialising routines in fragmentation
    239241  void CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *output);
    240   void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem);
     242  void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem, void (BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL);
    241243  int CorrectBondDegree(ofstream *out);
    242244  void OutputBondsList(ofstream *out);
  • src/molecule_graph.cpp

    r46ea3b rb70721  
    88#include "atom.hpp"
    99#include "bond.hpp"
     10#include "bondgraph.hpp"
    1011#include "config.hpp"
    1112#include "element.hpp"
     
    9293 * \param bonddistance length of linked cells (i.e. maximum minimal length checked)
    9394 * \param IsAngstroem whether coordinate system is gauged to Angstroem or Bohr radii
    94  */
    95 void molecule::CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem)
    96 {
    97 
     95 * \param *minmaxdistance function to give upper and lower bound on whether particle is bonded to some other
     96 * \param *BG BondGraph with the member function above or NULL, if just standard covalent should be used.
     97 */
     98void molecule::CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem, void (BondGraph::*minmaxdistance)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG)
     99{
    98100  atom *Walker = NULL;
    99101  atom *OtherWalker = NULL;
    100102  atom **AtomMap = NULL;
    101103  int n[NDIM];
    102   double distance, MinDistance, MaxDistance;
     104  double MinDistance, MaxDistance;
    103105  LinkedCell *LC = NULL;
     106  bool free_BG = false;
     107
     108  if (BG == NULL) {
     109    BG = new BondGraph(IsAngstroem);
     110    free_BG = true;
     111  }
    104112
    105113  BondDistance = bonddistance; // * ((IsAngstroem) ? 1. : 1./AtomicLengthToAngstroem);
     
    146154                          OtherWalker = AtomMap[(*OtherRunner)->nr];
    147155                          //*out << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    148                           MinDistance = OtherWalker->type->CovalentRadius + Walker->type->CovalentRadius;
    149                           MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    150                           MaxDistance = MinDistance + BONDTHRESHOLD;
    151                           MinDistance -= BONDTHRESHOLD;
    152                           distance = OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size);
    153                           if ((OtherWalker->father->nr > Walker->father->nr) && (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance)) { // create bond if distance is smaller
     156                          (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
     157                          const double distance = OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size);
     158                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
     159                          if ((OtherWalker->father->nr > Walker->father->nr) && (status)) { // create bond if distance is smaller
    154160                            //*out << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
    155161                            AddBond(Walker->father, OtherWalker->father, 1); // also increases molecule::BondCount
     
    176182    *out << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl;
    177183  *out << Verbose(0) << "End of CreateAdjacencyList." << endl;
     184  if (free_BG)
     185    delete(BG);
    178186}
    179187;
  • src/unittests/Makefile.am

    r46ea3b rb70721  
    2020AnalysisPairCorrelationUnitTest_LDADD = ../libmolecuilder.a
    2121
    22 BondGraphUnitTest_SOURCES = ../bondgraph.cpp ../bondgraph.hpp bondgraphunittest.cpp bondgraphunittest.hpp
     22BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp
    2323BondGraphUnitTest_LDADD = ../libmolecuilder.a
    2424
Note: See TracChangeset for help on using the changeset viewer.