Changeset 5f697c for molecuilder
- Timestamp:
- Oct 30, 2009, 9:05:30 AM (16 years ago)
- Children:
- b84ab4
- Parents:
- bc8155
- git-author:
- Frederik Heber <heber@…> (10/30/09 08:30:57)
- git-committer:
- Frederik Heber <heber@…> (10/30/09 09:05:30)
- Location:
- molecuilder/src
- Files:
-
- 4 added
- 7 edited
-
Makefile.am (modified) (1 diff)
-
atom_bondedparticle.cpp (modified) (1 diff)
-
atom_bondedparticle.hpp (modified) (1 diff)
-
bondgraph.cpp (added)
-
bondgraph.hpp (added)
-
builder.cpp (modified) (5 diffs)
-
molecule.hpp (modified) (2 diffs)
-
molecule_graph.cpp (modified) (4 diffs)
-
unittests/Makefile.am (modified) (1 diff)
-
unittests/bondgraphunittest.cpp (added)
-
unittests/bondgraphunittest.hpp (added)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Makefile.am
rbc8155 r5f697c 2 2 ATOMHEADER = 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 3 3 4 SOURCE = analysis_correlation.cpp ${ATOMSOURCE} bond.cpp bo undary.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.cpp5 HEADER = analysis_correlation.hpp ${ATOMHEADER} bond.hpp bo undary.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.hpp4 SOURCE = 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 5 HEADER = 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 6 6 7 7 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) -
molecuilder/src/atom_bondedparticle.cpp
rbc8155 r5f697c 151 151 }; 152 152 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 */ 157 bool 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 -
molecuilder/src/atom_bondedparticle.hpp
rbc8155 r5f697c 39 39 bool RegisterBond(bond *Binder); 40 40 bool UnregisterBond(bond *Binder); 41 bool IsBondedTo(BondedParticle * const BondPartner); 41 42 void UnregisterAllBond(); 42 43 int CountBonds() const; -
molecuilder/src/builder.cpp
rbc8155 r5f697c 53 53 #include "atom.hpp" 54 54 #include "bond.hpp" 55 #include "bondgraph.hpp" 55 56 #include "boundary.hpp" 56 57 #include "config.hpp" … … 840 841 } 841 842 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); 843 844 // free memory 844 845 delete[](Elements); … … 896 897 cin >> bonddistance; 897 898 start = clock(); 898 mol->CreateAdjacencyList((ofstream *)&cout, bonddistance, configuration->GetIsAngstroem() );899 mol->CreateAdjacencyList((ofstream *)&cout, bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 899 900 end = clock(); 900 901 cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; … … 1555 1556 class StackClass<bond *> *BackEdgeStack = NULL; 1556 1557 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); 1558 1559 Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, BackEdgeStack); 1559 1560 if (Subgraphs != NULL) { … … 1912 1913 cout << Verbose(0) << "Creating connection matrix..." << endl; 1913 1914 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); 1915 1916 cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl; 1916 1917 if (mol->first->next != mol->last) { -
molecuilder/src/molecule.hpp
rbc8155 r5f697c 35 35 class atom; 36 36 class bond; 37 class BondedParticle; 38 class BondGraph; 37 39 class element; 38 40 class ForceMatrix; … … 238 240 /// Initialising routines in fragmentation 239 241 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); 241 243 int CorrectBondDegree(ofstream *out); 242 244 void OutputBondsList(ofstream *out); -
molecuilder/src/molecule_graph.cpp
rbc8155 r5f697c 8 8 #include "atom.hpp" 9 9 #include "bond.hpp" 10 #include "bondgraph.hpp" 10 11 #include "config.hpp" 11 12 #include "element.hpp" … … 92 93 * \param bonddistance length of linked cells (i.e. maximum minimal length checked) 93 94 * \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 */ 98 void molecule::CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem, void (BondGraph::*minmaxdistance)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG) 99 { 98 100 atom *Walker = NULL; 99 101 atom *OtherWalker = NULL; 100 102 atom **AtomMap = NULL; 101 103 int n[NDIM]; 102 double distance,MinDistance, MaxDistance;104 double MinDistance, MaxDistance; 103 105 LinkedCell *LC = NULL; 106 bool free_BG = false; 107 108 if (BG == NULL) { 109 BG = new BondGraph(IsAngstroem); 110 free_BG = true; 111 } 104 112 105 113 BondDistance = bonddistance; // * ((IsAngstroem) ? 1. : 1./AtomicLengthToAngstroem); … … 146 154 OtherWalker = AtomMap[(*OtherRunner)->nr]; 147 155 //*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 154 160 //*out << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl; 155 161 AddBond(Walker->father, OtherWalker->father, 1); // also increases molecule::BondCount … … 176 182 *out << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl; 177 183 *out << Verbose(0) << "End of CreateAdjacencyList." << endl; 184 if (free_BG) 185 delete(BG); 178 186 } 179 187 ; -
molecuilder/src/unittests/Makefile.am
rbc8155 r5f697c 20 20 AnalysisPairCorrelationUnitTest_LDADD = ../libmolecuilder.a 21 21 22 BondGraphUnitTest_SOURCES = ../bondgraph.cpp ../bondgraph.hppbondgraphunittest.cpp bondgraphunittest.hpp22 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp 23 23 BondGraphUnitTest_LDADD = ../libmolecuilder.a 24 24
Note:
See TracChangeset
for help on using the changeset viewer.
