Changeset 82034f1 for src/Actions
- Timestamp:
- Sep 14, 2016, 6:43:46 PM (8 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
- Children:
- 291ad9
- Parents:
- 964c63
- git-author:
- Frederik Heber <heber@…> (08/18/16 08:55:21)
- git-committer:
- Frederik Heber <heber@…> (09/14/16 18:43:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r964c63 r82034f1 152 152 return result; 153 153 } 154 155 156 #ifdef HAVE_JOBMARKET 157 /** This performs a direct sum calculation for the nuclei-nuclei interaction energy 158 * and forces for each fragment contained in \a shortrangedata. 159 * 160 * Results are (re)placed in \a _longrangedata. 161 * 162 * \warning This is only valid for fully open boundary conditions. 163 * 164 * \param _shortrangedata containing information on position and charges per fragment 165 * \param _longrangedata containing energy and forces on return 166 */ 167 static void calculateNucleiNucleiLongRangeContribution( 168 const std::map<JobId_t, MPQCData> &_shortrangedata, 169 std::map<JobId_t, VMGData>& _longrangedata 170 ) 171 { 172 ASSERT( _shortrangedata.size() == _longrangedata.size(), 173 "calculateNucleiNucleiLongRangeContribution() - shortrange and longrange data have inequal size."); 174 std::map<JobId_t, VMGData>::iterator longrangeiter = _longrangedata.begin(); 175 std::map<JobId_t, MPQCData>::const_iterator iter = _shortrangedata.begin(); 176 for (;iter != _shortrangedata.end(); ++iter, ++longrangeiter) { 177 const MPQCData &data = iter->second; 178 VMGData &longrange_data = longrangeiter->second; 179 // set long-range contributions to zero 180 longrange_data.nuclei_long = 0.; 181 longrange_data.forces.clear(); 182 longrange_data.forces.resize(data.positions.size(), FragmentForces::force_t(3,0.)); 183 longrange_data.hasForces = true; 184 // go through positions and evaluate sum naively 185 ASSERT( data.positions.size() == data.charges.size(), 186 "calculateNucleiNucleiLongRangeContribution() - positions and charges differ in size."); 187 std::vector< std::vector<double> >::const_iterator positer = data.positions.begin(); 188 std::vector< double >::const_iterator chargeiter = data.charges.begin(); 189 FragmentForces::iterator forceiter = longrange_data.forces.begin(); 190 for (; (positer != data.positions.end()) && (chargeiter != data.charges.end()); 191 ++positer, ++chargeiter, ++forceiter) { 192 ASSERT( positer->size() == NDIM, 193 "calculateNucleiNucleiLongRangeContribution() - position " 194 +toString(std::distance(data.positions.begin(), positer))+" has not 3 components."); 195 const Vector position((*positer)[0], (*positer)[1], (*positer)[2]); 196 197 std::vector< std::vector<double> >::const_iterator otherpositer = data.positions.begin(); 198 std::vector< double >::const_iterator otherchargeiter = data.charges.begin(); 199 for (; (otherpositer != data.positions.end()) && (otherchargeiter != data.charges.end()); 200 ++otherpositer, ++otherchargeiter) { 201 if ((positer == otherpositer) || (chargeiter == otherchargeiter)) 202 continue; 203 ASSERT( otherpositer->size() == NDIM, 204 "calculateNucleiNucleiLongRangeContribution() - other position " 205 +toString(std::distance(data.positions.begin(), otherpositer))+" has not 3 components."); 206 const Vector otherposition((*otherpositer)[0], (*otherpositer)[1], (*otherpositer)[2]); 207 const Vector distance = position - otherposition; 208 const double invsqrdist = 1./distance.Norm(); 209 const double factor = (*otherchargeiter)*invsqrdist*invsqrdist*invsqrdist; 210 (*forceiter)[0] = factor*distance[0]; 211 (*forceiter)[1] = factor*distance[1]; 212 (*forceiter)[2] = factor*distance[2]; 213 longrange_data.nuclei_long += 0.5*(*chargeiter)*(*otherchargeiter)*invsqrdist; 214 } 215 } 216 } 217 } 218 #endif 154 219 155 220 ActionState::ptr FragmentationFragmentationAutomationAction::performCall() { … … 387 452 Exitflag += vmgcontroller.getExitflag(); 388 453 454 // now replace nuclei-nuclei contribution with values from direct summation (is exact for 455 // open boundary conditions 456 // 457 // NOTE: We need to calculate both_sampled_potential for fitting partial charges, 458 // nowhere else is this quantity needed. 459 //if (OpenBoundaryConditions) 460 // calculateNucleiNucleiLongRangeContribution(shortrangedata, longrangedata_both); 461 389 462 // go through either data and replace nuclei_long with contribution from both 390 463 ASSERT( longrangedata.size() == longrangedata_both.size(),
Note:
See TracChangeset
for help on using the changeset viewer.