Changeset 5d5550 for src/Actions
- Timestamp:
- Aug 16, 2014, 3:52:30 PM (10 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:
- 343c5a
- Parents:
- a1d1dd
- git-author:
- Frederik Heber <heber@…> (07/18/14 17:45:45)
- git-committer:
- Frederik Heber <heber@…> (08/16/14 15:52:30)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAction.cpp
ra1d1dd r5d5550 42 42 #include "Fragmentation/Exporters/ExportGraph_ToFiles.hpp" 43 43 #include "Fragmentation/Exporters/ExportGraph_ToJobs.hpp" 44 #include "Fragmentation/Exporters/SaturatedBond.hpp" 44 45 #include "Fragmentation/Exporters/SaturatedFragment.hpp" 46 #include "Fragmentation/Exporters/SaturationDistanceMaximizer.hpp" 45 47 #include "Fragmentation/Fragmentation.hpp" 46 48 #include "Fragmentation/Graph.hpp" … … 264 266 // create global saturation positions map 265 267 SaturatedFragment::GlobalSaturationPositions_t globalsaturationpositions; 268 { 269 // go through each atom 270 for (World::AtomSelectionConstIterator iter = world.beginAtomSelection(); 271 iter != world.endAtomSelection(); ++iter) { 272 const atom * const _atom = iter->second; 273 274 // skip hydrogens if treated special 275 const enum HydrogenTreatment treatment = params.HowtoTreatHydrogen.get() ? ExcludeHydrogen : IncludeHydrogen; 276 if ((treatment == ExcludeHydrogen) && (_atom->getType()->getAtomicNumber() == 1)) { 277 LOG(4, "DEBUG: Skipping hydrogen atom " << *_atom); 278 continue; 279 } 280 281 // get the valence 282 unsigned int NumberOfPoints = _atom->getElement().getNoValenceOrbitals(); 283 LOG(3, "DEBUG: There are " << NumberOfPoints 284 << " places to fill in in total for this atom " << *_atom << "."); 285 286 // check whether there are any bonds with degree larger than 1 287 unsigned int SumOfDegrees = 0; 288 bool PresentHigherBonds = false; 289 const BondList &bondlist = _atom->getListOfBonds(); 290 for (BondList::const_iterator bonditer = bondlist.begin(); 291 bonditer != bondlist.end(); ++bonditer) { 292 SumOfDegrees += (*bonditer)->getDegree(); 293 PresentHigherBonds |= (*bonditer)->getDegree() > 1; 294 } 295 296 // check whether there are alphas to maximize the hydrogens distances 297 SaturationDistanceMaximizer::position_bins_t position_bins; 298 { 299 // gather all bonds and convert to SaturatedBonds 300 SaturationDistanceMaximizer::PositionContainers_t CutBonds; 301 for (BondList::const_iterator bonditer = bondlist.begin(); 302 bonditer != bondlist.end(); ++bonditer) { 303 CutBonds.push_back( 304 SaturatedBond::ptr(new SaturatedBond(*(bonditer->get()), *_atom) ) 305 ); 306 } 307 SaturationDistanceMaximizer maximizer(CutBonds); 308 if (PresentHigherBonds) { 309 // then find best alphas 310 maximizer(); 311 } else { 312 // if no higher order bonds, we simply gather the scaled positions 313 } 314 position_bins = maximizer.getAllPositionBins(); 315 LOG(4, "DEBUG: Positions for atom " << *_atom << " are " << position_bins); 316 } 317 318 // convert into the desired entry in the map 319 SaturatedFragment::SaturationsPositionsPerNeighbor_t positions_per_neighbor; 320 { 321 BondList::const_iterator bonditer = bondlist.begin(); 322 SaturationDistanceMaximizer::position_bins_t::const_iterator biniter = 323 position_bins.begin(); 324 325 for (;bonditer != bondlist.end(); ++bonditer, ++biniter) { 326 const atom * const OtherAtom = (*bonditer)->GetOtherAtom(_atom); 327 std::pair< 328 SaturatedFragment::SaturationsPositionsPerNeighbor_t::iterator, 329 bool 330 > inserter; 331 // check whether we treat hydrogen special 332 if ((treatment == ExcludeHydrogen) && (OtherAtom->getType()->getAtomicNumber() == 1)) { 333 // if hydrogen, forget rescaled position and use original one 334 inserter = 335 positions_per_neighbor.insert( 336 std::make_pair( 337 OtherAtom->getId(), 338 SaturatedFragment::SaturationsPositions_t( 339 1, OtherAtom->getPosition() - _atom->getPosition()) 340 ) 341 ); 342 } else { 343 inserter = 344 positions_per_neighbor.insert( 345 std::make_pair( 346 OtherAtom->getId(), 347 SaturatedFragment::SaturationsPositions_t( 348 biniter->begin(), 349 biniter->end()) 350 ) 351 ); 352 } 353 // if already pressent, add to this present list 354 ASSERT (inserter.second, 355 "FragmentationAction::performCall() - other atom " 356 +toString(*OtherAtom)+" already present?"); 357 } 358 // bonditer follows nicely 359 ASSERT( biniter == position_bins.end(), 360 "FragmentationAction::performCall() - biniter is out of step, it still points at bond " 361 +toString(*biniter)+"."); 362 } 363 // and insert 364 globalsaturationpositions.insert( 365 std::make_pair( _atom->getId(), 366 positions_per_neighbor 367 )); 368 } 369 } 266 370 267 371 {
Note:
See TracChangeset
for help on using the changeset viewer.