Changeset a8961d
- Timestamp:
- Jun 21, 2017, 8:01:27 AM (8 years ago)
- Branches:
- IndependentFragmentGrids_Sole_NN_Calculation
- Parents:
- 3fb9ab
- git-author:
- Frederik Heber <heber@…> (08/19/16 05:27:39)
- git-committer:
- Frederik Heber <frederik.heber@…> (06/21/17 08:01:27)
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp
r3fb9ab ra8961d 392 392 value.potential_distribution = 393 393 boost::fusion::at_key<VMGDataFused::both_sampled_potential>(potentialiter->second.second); // contributions 394 // // and re-average to zero (integral is times volume_element which we don't need here) 395 // const double sum = 396 // std::accumulate( 397 // value.potential_distribution.sampled_grid.begin(), 398 // value.potential_distribution.sampled_grid.end(), 399 // 0.); 400 // const double offset = sum/(double)value.potential_distribution.sampled_grid.size(); 401 // for (SamplingGrid::sampledvalues_t::iterator iter = value.potential_distribution.sampled_grid.begin(); 402 // iter != value.potential_distribution.sampled_grid.end(); 403 // ++iter) 404 // *iter -= offset; 394 value.potential_distribution += 395 boost::fusion::at_key<VMGDataFused::sampled_potential>(potentialiter->second.second); // contributions 396 // and re-average to zero (integral is times volume_element which we don't need here) 397 const double sum = 398 std::accumulate( 399 value.potential_distribution.sampled_grid.begin(), 400 value.potential_distribution.sampled_grid.end(), 401 0.); 402 const double offset = sum/(double)value.potential_distribution.sampled_grid.size(); 403 for (SamplingGrid::sampledvalues_t::iterator iter = value.potential_distribution.sampled_grid.begin(); 404 iter != value.potential_distribution.sampled_grid.end(); 405 ++iter) 406 *iter -= offset; 405 407 #else 406 408 ELOG(2, "Long-range information in homology desired but long-range analysis capability not compiled in."); -
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r3fb9ab ra8961d 170 170 ) 171 171 { 172 ASSERT( _shortrangedata.size() == _longrangedata.size(), 173 "calculateNucleiNucleiLongRangeContribution() - shortrange and longrange data have inequal size."); 172 // we assume here that the fragmentjobs in short- and longrange case are in the 173 // same order and that the full jobs per level are appended to the end of 174 // longrangedata 174 175 std::map<JobId_t, VMGData>::iterator longrangeiter = _longrangedata.begin(); 175 176 std::map<JobId_t, MPQCData>::const_iterator iter = _shortrangedata.begin(); … … 178 179 VMGData &longrange_data = longrangeiter->second; 179 180 // set long-range contributions to zero 181 const double old_energy = longrange_data.nuclei_long; 180 182 longrange_data.nuclei_long = 0.; 181 183 longrange_data.forces.clear(); 182 longrange_data.forces.resize(data.positions.size(), FragmentForces::force_t( 3,0.));184 longrange_data.forces.resize(data.positions.size(), FragmentForces::force_t(NDIM,0.)); 183 185 longrange_data.hasForces = true; 184 186 // go through positions and evaluate sum naively … … 206 208 const Vector otherposition((*otherpositer)[0], (*otherpositer)[1], (*otherpositer)[2]); 207 209 const Vector distance = position - otherposition; 208 const double inv sqrdist = 1./distance.Norm();209 const double factor = (*otherchargeiter)*inv sqrdist*invsqrdist*invsqrdist;210 const double invdist = 1./distance.Norm(); 211 const double factor = (*otherchargeiter)*invdist*invdist*invdist; 210 212 (*forceiter)[0] = factor*distance[0]; 211 213 (*forceiter)[1] = factor*distance[1]; 212 214 (*forceiter)[2] = factor*distance[2]; 213 longrange_data.nuclei_long += 0.5*(*chargeiter)*(*otherchargeiter)*invsqrdist; 214 } 215 } 215 longrange_data.nuclei_long += 0.5*(*chargeiter)*(*otherchargeiter)*invdist; 216 } 217 } 218 LOG(2, "DEBUG: fragment #" << longrangeiter->first << ": old is " << old_energy 219 << ", new is " << longrange_data.nuclei_long); 216 220 } 217 221 } … … 423 427 interpolation_degree, 424 428 VMGFragmentController::DoSampleParticles, 425 VMGFragmentController::Do TreatGrid,429 VMGFragmentController::DontTreatGrid, 426 430 params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly, 427 431 params.DoPrintDebug.get(), … … 468 472 destiter->second.both_sampled_potential = srciter->second.sampled_potential; 469 473 destiter->second.nuclei_long = srciter->second.nuclei_long; 470 destiter->second.forces = srciter->second.forces;471 destiter->second.hasForces = srciter->second.hasForces;474 destiter->second.forces += srciter->second.forces; 475 destiter->second.hasForces &= srciter->second.hasForces; 472 476 } 473 477 } -
src/Fragmentation/Summation/Containers/FragmentationLongRangeResults.cpp
r3fb9ab ra8961d 121 121 Result_perIndexSet_Grid); 122 122 123 // multiply each short-range potential with the respective charge123 // multiply each short-range e-e potential with the respective charge 124 124 std::map<JobId_t,MPQCData>::const_iterator mpqciter = fragmentData.begin(); 125 125 std::map<JobId_t,VMGData>::iterator vmgiter = longrangeData.begin(); … … 214 214 #endif 215 215 216 // then, we obtain the e-n+n-n full solution in the same way216 // then, we obtain the n-n full solution directly 217 217 double nuclei_solution_energy = fullsolutionData[level-1].nuclei_long; 218 218 double nuclei_short_range_energy = … … 229 229 electron_solution_energy *= .5; 230 230 electron_short_range_energy *= .5; 231 232 // At last, we subtract e-n from n-n+e-n for full solution and short-range233 // correction.234 nuclei_solution_energy -= both_solution_energy;235 nuclei_short_range_energy -= both_short_range_energy;236 231 237 232 VMGDataLongRangeMap_t instance; -
src/Jobs/InterfaceVMGJob.cpp
r3fb9ab ra8961d 116 116 117 117 Grid& grid = multigrid(multigrid.MaxLevel()); 118 grid.Clear();119 //grid.ClearBoundary(); // we don't have a boundary under periodic boundary conditions118 // grid.Clear(); 119 // grid.ClearBoundary(); // we don't have a boundary under periodic boundary conditions 120 120 121 121 // print debugging info on grid size … … 393 393 comm.PrintOnce(Debug, "E_total*: %e", e_long + e_short_peak + e_short_spline - e_self); 394 394 395 returndata.nuclei_long = e _long;396 returndata.electron_long = e_long; 395 returndata.nuclei_long = e; // nuclei needs self-energy subtracted, ... 396 returndata.electron_long = e_long; // charge grid gets only long-range interaction 397 397 398 398 // calculate residual
Note:
See TracChangeset
for help on using the changeset viewer.