Changeset b4f72c for src/Fragmentation
- Timestamp:
- Dec 3, 2012, 9:50:01 AM (12 years ago)
- 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:
- 2ab6b6
- Parents:
- dcbb5d
- git-author:
- Frederik Heber <heber@…> (09/20/12 13:44:17)
- git-committer:
- Frederik Heber <heber@…> (12/03/12 09:50:01)
- Location:
- src/Fragmentation
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Exporters/ExportGraph_ToFiles.cpp
rdcbb5d rb4f72c 54 54 * 55 55 * @param _graph instance of Graph containing keyset of each fragment 56 * @param _mol molecule as reference57 */ 58 ExportGraph_ToFiles::ExportGraph_ToFiles(const Graph &_graph, molecule *&_mol,const enum HydrogenSaturation _saturation) :56 * @param saturation whether to saturate dangling bonds with hydrogen or not 57 */ 58 ExportGraph_ToFiles::ExportGraph_ToFiles(const Graph &_graph, const enum HydrogenSaturation _saturation) : 59 59 ExportGraph(_graph), 60 mol(_mol),61 60 BondFragments(World::getPointer()), 62 61 saturation(_saturation) … … 107 106 // store force index reference file 108 107 { 109 SortIndex_t SortIndex (mol);108 SortIndex_t SortIndex; 110 109 BondFragments.StoreForcesFile(prefix, SortIndex); 111 110 } … … 113 112 // store keysets file 114 113 TotalGraph.StoreKeySetFile(prefix); 115 116 {117 // store Adjacency file118 std::string filename = prefix + ADJACENCYFILE;119 mol->StoreAdjacencyToFile(filename);120 }121 114 122 115 // store Hydrogen saturation correction file … … 137 130 LOG(2, "DEBUG: Fragment No." << (*runner).second.first << " with TEFactor " 138 131 << (*runner).second.second << "."); 139 BondFragments.insert(StoreFragmentFromKeySet( mol,test, World::getInstance().getConfig()));132 BondFragments.insert(StoreFragmentFromKeySet(test, World::getInstance().getConfig())); 140 133 ++count; 141 134 } … … 147 140 * First creates the minimal set of atoms from the KeySet, then creates the bond structure from the complete 148 141 * molecule and adds missing hydrogen where bonds were cut. 149 * \param *mol reference molecule150 142 * \param &Leaflet pointer to KeySet structure 151 143 * \param IsAngstroem whether we have Ansgtroem or bohrradius 152 144 * \return pointer to constructed molecule 153 145 */ 154 molecule * ExportGraph_ToFiles::StoreFragmentFromKeySet( molecule *mol,KeySet &Leaflet, bool IsAngstroem)146 molecule * ExportGraph_ToFiles::StoreFragmentFromKeySet(KeySet &Leaflet, bool IsAngstroem) 155 147 { 156 148 Info info(__func__); … … 158 150 molecule *Leaf = World::getInstance().createMolecule(); 159 151 160 StoreFragmentFromKeySet_Init( mol,Leaf, Leaflet, SonList);152 StoreFragmentFromKeySet_Init(Leaf, Leaflet, SonList); 161 153 // create the bonds between all: Make it an induced subgraph and add hydrogen 162 154 // LOG(2, "Creating bonds from father graph (i.e. induced subgraph creation)."); 163 CreateInducedSubgraphOfFragment( mol,Leaf, SonList, IsAngstroem);155 CreateInducedSubgraphOfFragment(Leaf, SonList, IsAngstroem); 164 156 165 157 //Leaflet->Leaf->ScanForPeriodicCorrection(out); … … 168 160 169 161 /** Initializes some value for putting fragment of \a *mol into \a *Leaf. 170 * \param *mol total molecule171 162 * \param *Leaf fragment molecule 172 163 * \param &Leaflet pointer to KeySet structure … … 174 165 * \return number of atoms in fragment 175 166 */ 176 int ExportGraph_ToFiles::StoreFragmentFromKeySet_Init(molecule * mol, molecule *Leaf, KeySet &Leaflet, ListOfLocalAtoms_t &SonList)167 int ExportGraph_ToFiles::StoreFragmentFromKeySet_Init(molecule *Leaf, KeySet &Leaflet, ListOfLocalAtoms_t &SonList) 177 168 { 178 169 atom *FatherOfRunner = NULL; 179 170 180 171 // first create the minimal set of atoms from the KeySet 172 World &world = World::getInstance(); 181 173 int size = 0; 182 174 for(KeySet::const_iterator runner = Leaflet.begin(); runner != Leaflet.end(); runner++) { 183 FatherOfRunner = mol->FindAtom((*runner)); // find the id175 FatherOfRunner = world.getAtom(AtomById(*runner)); // find the id 184 176 SonList.insert( std::make_pair(FatherOfRunner->getNr(), Leaf->AddCopyAtom(FatherOfRunner) ) ); 185 177 size++; … … 189 181 190 182 /** Creates an induced subgraph out of a fragmental key set, adding bonds and hydrogens (if treated specially). 191 * \param *out output stream for debugging messages192 * \param *mol total molecule193 183 * \param *Leaf fragment molecule 194 184 * \param IsAngstroem whether we have Ansgtroem or bohrradius 195 * \param SonList list which atom of \a *Leaf is a son of which atom in \a *mol196 */ 197 void ExportGraph_ToFiles::CreateInducedSubgraphOfFragment(molecule * mol, molecule *Leaf, ListOfLocalAtoms_t &SonList, bool IsAngstroem)185 * \param SonList list which atom of \a *Leaf is another atom's son 186 */ 187 void ExportGraph_ToFiles::CreateInducedSubgraphOfFragment(molecule *Leaf, ListOfLocalAtoms_t &SonList, bool IsAngstroem) 198 188 { 199 189 bool LonelyFlag = false; -
src/Fragmentation/Exporters/ExportGraph_ToFiles.hpp
rdcbb5d rb4f72c 22 22 23 23 class ListOfLocalAtoms_t; 24 class molecule; 24 25 25 26 /** ExportGraph_ToFiles implements an ExportGraph as storing all fragmentary … … 29 30 { 30 31 public: 31 ExportGraph_ToFiles(const Graph &_graph, molecule *&_mol,const enum HydrogenSaturation _saturation);32 ExportGraph_ToFiles(const Graph &_graph, const enum HydrogenSaturation _saturation); 32 33 virtual ~ExportGraph_ToFiles(); 33 34 … … 45 46 46 47 void prepareMolecule(); 47 molecule * StoreFragmentFromKeySet( molecule *mol,KeySet &Leaflet, bool IsAngstroem);48 int StoreFragmentFromKeySet_Init(molecule * mol, molecule *Leaf, KeySet &Leaflet, ListOfLocalAtoms_t &SonList);49 void CreateInducedSubgraphOfFragment(molecule * mol, molecule *Leaf, ListOfLocalAtoms_t &SonList, bool IsAngstroem);48 molecule * StoreFragmentFromKeySet(KeySet &Leaflet, bool IsAngstroem); 49 int StoreFragmentFromKeySet_Init(molecule *Leaf, KeySet &Leaflet, ListOfLocalAtoms_t &SonList); 50 void CreateInducedSubgraphOfFragment(molecule *Leaf, ListOfLocalAtoms_t &SonList, bool IsAngstroem); 50 51 51 52 private: 52 //!> molecule as reference53 molecule *mol;54 53 //!> internal list of created molecules 55 54 MoleculeListClass BondFragments; -
src/Fragmentation/Fragmentation.cpp
rdcbb5d rb4f72c 163 163 LOG(1, "STATUS: We have created " << TotalGraph.size() << " fragments."); 164 164 165 { 166 // store Adjacency file 167 std::string filename = prefix + ADJACENCYFILE; 168 mol->StoreAdjacencyToFile(filename); 169 } 170 165 171 // store adaptive orders into file 166 172 StoreOrderAtSiteFile(prefix); -
src/Fragmentation/Graph.cpp
rdcbb5d rb4f72c 64 64 * \param *counter keyset counter that gets increased 65 65 */ 66 void Graph::InsertGraph( Graph &graph, int *counter)66 void Graph::InsertGraph(const Graph &graph, int &counter) 67 67 { 68 68 GraphTestPair testGraphInsert; 69 69 70 for(Graph:: iterator runner = graph.begin(); runner != graph.end(); runner++) {71 testGraphInsert = insert(GraphPair ((*runner).first,pair<int,double>( (*counter)++,((*runner).second).second))); // store fragment number and current factor70 for(Graph::const_iterator runner = graph.begin(); runner != graph.end(); runner++) { 71 testGraphInsert = insert(GraphPair ((*runner).first,pair<int,double>(++counter,((*runner).second).second))); // store fragment number and current factor 72 72 if (testGraphInsert.second) { 73 LOG(2, "INFO: KeySet " << (*counter)-1 << " successfully inserted.");73 LOG(2, "INFO: KeySet " << counter-1 << " successfully inserted."); 74 74 } else { 75 LOG(2, "INFO: KeySet " << (*counter)-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first);75 LOG(2, "INFO: KeySet " << counter-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first); 76 76 ((*(testGraphInsert.first)).second).second += (*runner).second.second; 77 77 LOG(2, "INFO: New factor is " << (*(testGraphInsert.first)).second.second << "."); -
src/Fragmentation/Graph.hpp
rdcbb5d rb4f72c 30 30 ~Graph(); 31 31 32 void InsertGraph( Graph &graph, int *counter);32 void InsertGraph(const Graph &graph, int &counter); 33 33 34 34 bool ParseKeySetFile(std::string &path); -
src/Fragmentation/SortIndex.cpp
rdcbb5d rb4f72c 46 46 {} 47 47 48 /** Constructor for SortIndex from the internal numbering in a molecule.49 *50 * \param *mol molecule to place in the internal index51 */52 SortIndex_t::SortIndex_t(const molecule *mol)53 {54 int AtomNo = 0;55 for(molecule::const_iterator iter=mol->begin();iter!=mol->end();++iter){56 #ifndef NDEBUG57 std::pair<index_t::iterator, bool> inserter =58 #endif59 index.insert( std::make_pair((*iter)->getNr(), AtomNo) );60 ASSERT( inserter.second,61 "SortIndex_t::SortIndex_t() - index "+toString((*iter)->getNr())+" already present.");62 ++AtomNo;63 }64 }65 66 48 67 49 int SortIndex_t::find(atomId_t id) const 68 50 { 69 index_t::const_iterator iter = index.find(id); 70 if (iter == index.end()) 71 return -1; 72 else 73 return iter->second; 51 return id; 74 52 } -
src/Fragmentation/SortIndex.hpp
rdcbb5d rb4f72c 28 28 public: 29 29 SortIndex_t(); 30 SortIndex_t(const molecule *mol);31 30 32 31 int find(atomId_t id) const; -
src/Fragmentation/fragmentation_helpers.cpp
rdcbb5d rb4f72c 102 102 for(int i=0;i<NumLevels;i++) { 103 103 if (FragmentLowerOrdersList[RootNr][i] != NULL) { 104 FragmentList.InsertGraph((*FragmentLowerOrdersList[RootNr][i]), &counter);104 FragmentList.InsertGraph((*FragmentLowerOrdersList[RootNr][i]), counter); 105 105 } 106 106 }
Note:
See TracChangeset
for help on using the changeset viewer.