Changeset e2925fd


Ignore:
Timestamp:
May 3, 2013, 9:46:45 AM (12 years ago)
Author:
Frederik Heber <heber@…>
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:
a86666
Parents:
5281ff
git-author:
Frederik Heber <heber@…> (04/05/13 15:09:16)
git-committer:
Frederik Heber <heber@…> (05/03/13 09:46:45)
Message:

Split long-range calculations into two parts to overcome E-N-potential problems.

The general problem is that smeared-out nuclei charges cannot interact with
electron charge densities as they always overlap, hence we always make a large
error. The idea then is - as the potential energy is symmetric both
densities - to flip from N-E to E-N, i.\,e. to take the electron potential and
evaluate at nuclei positions instead of smeared-out nuclei charges with
eletronic charge distribution. However, then we need to make two calculations
for the four contributions: E-E, E-N and N-N, N-E (=E-N).

  • new enums SampleParticles_t eventually tells InterfaceVMGJob whether to sample the nuclei charges onto the grid or not.
  • TreatGrid_t tells InterfaceVMGJob whether to actually add the electronic charge onto the grid (this was added but is actually not required anymore).
  • FragmentationAutomationAction::performCall() now creates twice as many long-range jobs. This requires two variables in VMGData for storing integrated long-range energy: electron_long, nuclei_long, as both calculations are combined into a single VMGData instance per fragment.
  • Summation of long-range contributions is split into three instead of formerly two parts: electron (E-E), nuclei (N-N), and mixed (E-N). This allows to easierly check their cancellation. This needs new member in fusion map and name in printKeyNames.
  • naturally, the enums have to be passed a long way: VMGFragmentController, VMGJob, VMGData.
  • VMGData now has serialization version 1 due to new entry.
  • we enhanced documentation in FragmentationLongRangeResults::operator()() of how and what is summed per level.
  • FIX: InterfaceVMGJob::ImportRightHandSide() subtracted grid instead of adding it. Now, we set correct sign of electron charge distribution in MPQC.
  • TESTFIX: Regression test AnalyseFragmentResults now has short- and long-range part. Long-range part is only diff'ed when the compiled code has the capabilities.
Files:
8 added
16 edited
6 moved

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp

    r5281ff re2925fd  
    388388    }
    389389  }
     390#else
     391  if (DoLongrange)
     392    ELOG(2, "File contains long-range information but long-range analysis capability not compiled in.");
    390393#endif
    391394
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    r5281ff re2925fd  
    153153    vmgcontroller.setPort(params.port.get());
    154154    const size_t NoJobs = shortrangedata.size()+full_sample.size();
    155     vmgcontroller.requestIds(NoJobs);
    156 
    157     // Phase Five: create VMGJobs
     155    vmgcontroller.requestIds(2*NoJobs);
     156
     157    // Phase Five a: create VMGJobs for electronic charge distribution
    158158    const size_t near_field_cells = params.near_field_cells.get();
    159159    const size_t interpolation_degree = params.interpolation_degree.get();
     
    163163        near_field_cells,
    164164        interpolation_degree,
     165        VMGFragmentController::DontSampleParticles,
     166        VMGFragmentController::DoTreatGrid,
    165167        params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly,
    166168        params.DoPrintDebug.get()))
    167       // can't use the summed up fragment due to saturation hydrogens
    168 //      summedChargeDensity.getFragment(),
    169169      return Action::failure;
    170170
    171     // Phase Six: calculate result
     171    // Phase Six a: calculate result
    172172    vmgcontroller.waitforResults(NoJobs);
    173173    vmgcontroller.getResults(longrangedata);
     
    175175        "FragmentationFragmentationAutomationAction::performCall() - number of MPQCresults+"
    176176        +toString(full_sample.size())+"="+toString(NoJobs)
    177         +" and VMGresults "+toString(longrangedata.size())+" don't match.");
     177        +" and first VMGresults "+toString(longrangedata.size())+" don't match.");
    178178    Exitflag += vmgcontroller.getExitflag();
     179
     180    {
     181      std::map<JobId_t, VMGData> longrangedata_both;
     182      // Phase Five b: create VMGJobs for nuclei charge distributions
     183      const size_t near_field_cells = params.near_field_cells.get();
     184      const size_t interpolation_degree = params.interpolation_degree.get();
     185      if (!vmgcontroller.createLongRangeJobs(
     186          shortrangedata,
     187          full_sample,
     188          near_field_cells,
     189          interpolation_degree,
     190          VMGFragmentController::DoSampleParticles,
     191          VMGFragmentController::DoTreatGrid,
     192          params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly,
     193          params.DoPrintDebug.get()))
     194        return Action::failure;
     195
     196      // Phase Six b: calculate result
     197      vmgcontroller.waitforResults(NoJobs);
     198      vmgcontroller.getResults(longrangedata_both);
     199      ASSERT( NoJobs == longrangedata_both.size(),
     200          "FragmentationFragmentationAutomationAction::performCall() - number of MPQCresults+"
     201          +toString(full_sample.size())+"="+toString(NoJobs)
     202          +" and second VMGresults "+toString(longrangedata_both.size())+" don't match.");
     203      Exitflag += vmgcontroller.getExitflag();
     204
     205      // go through either data and replace nuclei_long with contribution from both
     206      ASSERT( longrangedata.size() == longrangedata_both.size(),
     207          "FragmentationFragmentationAutomationAction::performCall() - longrange results have different sizes.");
     208      std::map<JobId_t, VMGData>::iterator destiter = longrangedata.begin();
     209      std::map<JobId_t, VMGData>::iterator srciter = longrangedata_both.begin();
     210      for (;destiter != longrangedata.end(); ++srciter, ++destiter)
     211        destiter->second.nuclei_long = srciter->second.nuclei_long;
     212    }
    179213  }
    180214
  • src/Fragmentation/Automation/VMGFragmentController.cpp

    r5281ff re2925fd  
    7171    const size_t near_field_cells,
    7272    const size_t interpolation_degree,
     73    const SampleParticles_t _SampleParticles,
     74    const TreatGrid_t _TreatGrid,
    7375    const MPQCData::DoValenceOnly_t _DoValenceOnly,
    7476    const bool _DoPrintDebug)
     
    8688        new VMGJob(
    8789            next_id,
    88             data.sampled_grid,
     90            _TreatGrid == DoTreatGrid ?
     91                data.sampled_grid :
     92                SamplingGrid(data.sampled_grid.begin, data.sampled_grid.end, data.sampled_grid.level),
    8993            data.positions,
    9094            data.charges,
    9195            near_field_cells,
    9296            interpolation_degree,
     97            _SampleParticles == DoSampleParticles,
    9398            _DoPrintDebug) );
    9499    jobs.push_back(testJob);
     
    122127      iter != full_sampled_grid.end();
    123128      ++iter) {
     129    const SamplingGrid &grid = *iter;
    124130    const JobId_t next_id = getAvailableId();
    125131    LOG(1, "INFO: Creating full VMGJob with " << *iter
     
    128134        new VMGJob(
    129135            next_id,
    130             *iter,
     136            _TreatGrid == DoTreatGrid ?
     137                grid :
     138                SamplingGrid(grid.begin, grid.end, grid.level),
    131139            positions,
    132140            charges,
    133141            near_field_cells,
    134142            interpolation_degree,
     143            _SampleParticles == DoSampleParticles,
    135144            _DoPrintDebug) );
    136145    jobs.push_back(testJob);
  • src/Fragmentation/Automation/VMGFragmentController.hpp

    r5281ff re2925fd  
    3939  {}
    4040
     41  //>! Enumerization of possible treatment of nuclei point charges.
     42  enum SampleParticles_t {
     43    DontSampleParticles=0,
     44    DoSampleParticles=1
     45  };
     46
     47  //>! Enumerization of possible treatment of electronic charge distribution on grid.
     48  enum TreatGrid_t {
     49    DontTreatGrid=0,
     50    DoTreatGrid=1
     51  };
     52
    4153  /** Creates the long range jobs from finished short-range jobs.
    4254   *
     
    4557   * \param near_field_cells radius of b-splines for interpolation charges onto grid
    4658   * \param interpolation_degree interpolation degree for newton interpolation from grid
     59   * \param _SampleParticles whether to add nuclei charges to vmg calculation.
     60   * \param _TreatGrid whether to add electron charge distribution to vmg calculation.
    4761   * \param _DoValenceOnly whether to neglect core electron and nuclei charges
    4862   * \param _DoPrintDebug whether we do print grid for debug visualization or not
     
    5367      const size_t near_field_cells,
    5468      const size_t interpolation_degree,
     69      const SampleParticles_t _SampleParticles,
     70      const TreatGrid_t _TreatGrid,
    5571      const MPQCData::DoValenceOnly_t _DoValenceOnly,
    5672      const bool _DoPrintDebug);
  • src/Fragmentation/Summation/Containers/FragmentationLongRangeResults.cpp

    r5281ff re2925fd  
    129129      boost::fusion::at_key<VMGDataFused::electron_longrange>(instance) = 0.;
    130130      boost::fusion::at_key<VMGDataFused::electron_shortrange>(instance) = 0.;
     131      boost::fusion::at_key<VMGDataFused::mixed_longrange>(instance) = 0.;
     132      boost::fusion::at_key<VMGDataFused::mixed_shortrange>(instance) = 0.;
    131133      boost::fusion::at_key<VMGDataFused::nuclei_longrange>(instance) = 0.;
    132134      boost::fusion::at_key<VMGDataFused::nuclei_shortrange>(instance) = 0.;
     
    136138    }
    137139    for (size_t level = 2; level <= MaxLevel; ++level) {
    138       // we have to fill in the remainder values in the LongRangeMap by hand
    139       // weight times correct charge density of the same level
     140      // We have calculated three different contributions: e-e, e-n+n-n, and n-n.
     141      // And we want to have e-e+e-n, n-n+n-e (where e-n = n-e).
     142      // For each of these three contributions we have a full solution and summed
     143      // up short range solutions.
     144
     145      // first we obtain the full e-e energy as potential times charge on the
     146      // respective level.
     147      // \note that sampled_potential starts at level 2 because we do not calculate
     148      // for level 1 as there saturated hydrogens are still present, leaving the
     149      // result to be nonsense.
    140150      const SamplingGrid &charge_weight =
    141151          boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused[level-1]);
    142152      SamplingGrid full_sample_solution = fullsolutionData[level-2].sampled_potential;
    143153      full_sample_solution *= charge_weight;
     154      double electron_solution_energy = full_sample_solution.integral();
     155
     156      // then we subtract the summed-up short-range e-e interaction energy from
     157      // the full solution.
    144158      const SamplingGrid &short_range_correction =
    145159          boost::fusion::at_key<VMGDataFused::sampled_potential>(Result_LongRange_fused[level-1]);
     160      double electron_short_range_energy = short_range_correction.integral();
    146161      full_sample_solution -= short_range_correction;
    147       double full_solution_energy = fullsolutionData[level-2].e_long;
    148       const double short_range_energy =
    149           boost::fusion::at_key<VMGDataFused::energy_long>(Result_LongRange_fused[level-1]);
    150       full_solution_energy -= short_range_energy;
    151 
    152       // multiply element-wise with charge distribution
     162      electron_solution_energy -= electron_short_range_energy;
     163      ASSERT( fabs(electron_solution_energy - full_sample_solution.integral()) < 1e-7,
     164          "FragmentationLongRangeResults::operator() - integral and energy are not exchangeable.");
     165
     166      // then, we obtain the e-n+n-n full solution in the same way
     167      double nuclei_solution_energy = fullsolutionData[level-2].nuclei_long;
     168      double nuclei_short_range_energy =
     169          boost::fusion::at_key<VMGDataFused::nuclei_long>(Result_LongRange_fused[level-1]);
     170      nuclei_solution_energy -= nuclei_short_range_energy;
     171
     172      // and also the e-n full solution
     173      double both_solution_energy = fullsolutionData[level-2].electron_long;
     174      double both_short_range_energy =
     175          boost::fusion::at_key<VMGDataFused::electron_long>(Result_LongRange_fused[level-1]);
     176      both_solution_energy -= both_short_range_energy;
     177
     178      // energies from interpolation at nuclei position has factor of 1/2 already
     179      electron_solution_energy *= .5;
     180      electron_short_range_energy *= .5;
     181
     182      // At last, we subtract e-n from n-n+e-n for full solution and short-range
     183      // correction.
     184      nuclei_solution_energy -= both_solution_energy;
     185      nuclei_short_range_energy -= both_short_range_energy;
     186
    153187      VMGDataLongRangeMap_t instance;
    154       boost::fusion::at_key<VMGDataFused::electron_longrange>(instance) = .5*full_sample_solution.integral();
     188      boost::fusion::at_key<VMGDataFused::electron_longrange>(instance) = electron_solution_energy;
    155189//      LOG(0, "Remaining long-range potential integral of level " << level << " is "
    156190//          << full_sample_solution.integral() << ".");
    157       boost::fusion::at_key<VMGDataFused::electron_shortrange>(instance) = .5*short_range_correction.integral();
     191      boost::fusion::at_key<VMGDataFused::electron_shortrange>(instance) = electron_short_range_energy;
    158192//      LOG(0, "Short-range correction potential integral of level " << level << " is "
    159193//          << short_range_correction.integral() << ".");
    160       boost::fusion::at_key<VMGDataFused::nuclei_longrange>(instance) = full_solution_energy;
     194      boost::fusion::at_key<VMGDataFused::mixed_longrange>(instance) = both_solution_energy;
    161195//      LOG(0, "Remaining long-range energy from potential integral of level " << level << " is "
    162196//          << full_solution_energy << ".");
    163       boost::fusion::at_key<VMGDataFused::nuclei_shortrange>(instance) = short_range_energy;
     197      boost::fusion::at_key<VMGDataFused::mixed_shortrange>(instance) = both_short_range_energy;
     198//      LOG(0, "Short-range correction energy from potential integral of level " << level << " is "
     199//          << short_range_energy << ".");
     200      boost::fusion::at_key<VMGDataFused::nuclei_longrange>(instance) = nuclei_solution_energy;
     201//      LOG(0, "Remaining long-range energy from potential integral of level " << level << " is "
     202//          << full_solution_energy << ".");
     203      boost::fusion::at_key<VMGDataFused::nuclei_shortrange>(instance) = nuclei_short_range_energy;
    164204//      LOG(0, "Short-range correction energy from potential integral of level " << level << " is "
    165205//          << short_range_energy << ".");
    166206      boost::fusion::at_key<VMGDataFused::total_longrange>(instance) =
    167           boost::fusion::at_key<VMGDataFused::electron_longrange>(instance) - full_solution_energy;
     207          boost::fusion::at_key<VMGDataFused::electron_longrange>(instance)
     208          + 2.*boost::fusion::at_key<VMGDataFused::mixed_longrange>(instance)
     209          + boost::fusion::at_key<VMGDataFused::nuclei_longrange>(instance);
    168210      boost::fusion::at_key<VMGDataFused::total_shortrange>(instance) =
    169           boost::fusion::at_key<VMGDataFused::electron_shortrange>(instance) - short_range_energy;
     211          boost::fusion::at_key<VMGDataFused::electron_shortrange>(instance)
     212          + 2.*boost::fusion::at_key<VMGDataFused::mixed_shortrange>(instance)
     213          + boost::fusion::at_key<VMGDataFused::nuclei_shortrange>(instance);
    170214      Result_LongRangeIntegrated_fused.push_back(instance);
    171215    }
  • src/Fragmentation/Summation/Containers/VMGData.cpp

    r5281ff re2925fd  
    4242VMGData::VMGData(const SamplingGridProperties &_props) :
    4343  sampled_potential(_props),
    44   e_long(0.)
     44  nuclei_long(0.),
     45  electron_long(0.)
    4546{}
    4647
     
    5051std::ostream & operator<<(std::ostream &ost, const VMGData &data)
    5152{
    52   ost << "Long-Range energy: " << data.e_long << std::endl;
     53  ost << "Nuclei long-Range energy: " << data.nuclei_long << std::endl;
     54  ost << "Electron long-Range energy: " << data.electron_long << std::endl;
    5355  return ost;
    5456}
  • src/Fragmentation/Summation/Containers/VMGData.hpp

    r5281ff re2925fd  
    4242  //!> sampled potential on the grid as output
    4343  SamplingGrid sampled_potential;
    44   //!> long-range contribution to energy
    45   double e_long;
     44  //!> nuclei long-range contribution to energy
     45  double nuclei_long;
     46  //!> electron long-range contribution to energy
     47  double electron_long;
    4648
    4749private:
     
    5254  {
    5355    ar & sampled_potential;
    54     ar & e_long;
     56    if (version > 0)
     57      ar & nuclei_long;
     58    ar & electron_long;
    5559  }
    5660};
     61
     62BOOST_CLASS_VERSION(VMGData, 1)
    5763
    5864std::ostream & operator<<(std::ostream &ost, const VMGData &data);
  • src/Fragmentation/Summation/Containers/VMGDataFused.hpp

    r5281ff re2925fd  
    2727  struct sampled_potential {};
    2828  struct energy_potential {};
    29   struct energy_long {};
     29  struct nuclei_long {};
     30  struct electron_long {};
    3031
    3132  // keys for longrange
     
    3536  struct nuclei_longrange {};
    3637  struct nuclei_shortrange {};
     38  struct mixed_longrange {};
     39  struct mixed_shortrange {};
    3740  struct total_longrange {};
    3841  struct total_shortrange {};
  • src/Fragmentation/Summation/Containers/VMGDataMap.hpp

    r5281ff re2925fd  
    3232    boost::fusion::pair<VMGDataFused::sampled_potential, SamplingGrid >,
    3333    boost::fusion::pair<VMGDataFused::energy_potential, double >,
    34     boost::fusion::pair<VMGDataFused::energy_long, double >
     34    boost::fusion::pair<VMGDataFused::nuclei_long, double >,
     35    boost::fusion::pair<VMGDataFused::electron_long, double >
    3536> VMGDataMap_t;
    3637
     
    3839    VMGDataFused::sampled_potential,
    3940    VMGDataFused::energy_potential,
    40     VMGDataFused::energy_long
     41    VMGDataFused::nuclei_long,
     42    VMGDataFused::electron_long
    4143> VMGDataVector_t;
    4244
     
    5153    boost::fusion::pair<VMGDataFused::electron_longrange, double >,
    5254    boost::fusion::pair<VMGDataFused::electron_shortrange, double >,
     55    boost::fusion::pair<VMGDataFused::mixed_longrange, double >,
     56    boost::fusion::pair<VMGDataFused::mixed_shortrange, double >,
    5357    boost::fusion::pair<VMGDataFused::nuclei_longrange, double >,
    5458    boost::fusion::pair<VMGDataFused::nuclei_shortrange, double >,
     
    6064    VMGDataFused::electron_longrange,
    6165    VMGDataFused::electron_shortrange,
     66    VMGDataFused::mixed_longrange,
     67    VMGDataFused::mixed_shortrange,
    6268    VMGDataFused::nuclei_longrange,
    6369    VMGDataFused::nuclei_shortrange,
  • src/Fragmentation/Summation/Containers/VMGData_printKeyNames.hpp

    r5281ff re2925fd  
    3636        (sampled_potential) \
    3737  (energy_potential) \
    38   (energy_long) \
     38  (nuclei_long) \
     39  (electron_long) \
    3940  (electron_longrange) \
    4041  (electron_shortrange) \
     42  (mixed_longrange) \
     43  (mixed_shortrange) \
    4144  (nuclei_longrange) \
    4245  (nuclei_shortrange) \
  • src/Fragmentation/Summation/Converter/DataConverter.hpp

    r5281ff re2925fd  
    9090    boost::fusion::at_key<VMGDataFused::sampled_potential>(instance) = extractedData.sampled_potential;
    9191    boost::fusion::at_key<VMGDataFused::energy_potential>(instance) = extractedData.sampled_potential.integral();
    92     boost::fusion::at_key<VMGDataFused::energy_long>(instance) = extractedData.e_long;
     92    boost::fusion::at_key<VMGDataFused::nuclei_long>(instance) = extractedData.nuclei_long;
     93    boost::fusion::at_key<VMGDataFused::electron_long>(instance) = extractedData.electron_long;
    9394    VMGData_fused.insert( std::make_pair(dataiter->first, instance) );
    9495  }
  • src/Jobs/InterfaceVMGJob.cpp

    r5281ff re2925fd  
    7171    vmg_float _box_end,
    7272    const int& near_field_cells,
     73    const ImportParticles_t _ImportParticles,
    7374    const bool _DoPrintDebug,
    7475    int coarseningSteps,
     
    8081  returndata(_returndata),
    8182  level(levelMax),
     83  ImportParticles(_ImportParticles),
    8284  DoPrintDebug(_DoPrintDebug)
    8385{
     
    134136      VMG::MG::GetFactory().GetObjectStorageVal<int>("PARTICLE_NEAR_FIELD_CELLS")));
    135137
    136   // create smeared-out particle charges on particle_grid via splines
    137   LOG(1, "INFO: Creating particle grid for " << particles.size() << " particles.");
    138   for (std::list<Particle::Particle>::iterator iter = particles.begin();
    139       iter != particles.end(); ++iter) {
    140     LOG(2, "DEBUG: Current particle is at " << (*iter).Pos()
    141         << " with charge " << (*iter).Charge() << ".");
    142     spl.SetSpline(particle_grid, *iter);
     138  if (ImportParticles == DoImportParticles) {
     139    // create smeared-out particle charges on particle_grid via splines
     140    LOG(1, "INFO: Creating particle grid for " << particles.size() << " particles.");
     141    for (std::list<Particle::Particle>::iterator iter = particles.begin();
     142        iter != particles.end(); ++iter) {
     143      LOG(2, "DEBUG: Current particle is at " << (*iter).Pos()
     144          << " with charge " << (*iter).Charge() << ".");
     145      spl.SetSpline(particle_grid, *iter);
     146    }
    143147  }
    144148
     
    155159      grid,
    156160      sampled_input,
    157       -1.);
     161      1.);
    158162
    159163  if (DoPrintDebug) {
     
    360364  comm.PrintStringOnce("E_total*:       %e", e_long + e_short_peak + e_short_spline - e_self);
    361365
    362   returndata.e_long = e;
     366  returndata.nuclei_long = e_long;
     367  returndata.electron_long = e_long;
    363368}
  • src/Jobs/InterfaceVMGJob.hpp

    r5281ff re2925fd  
    3636{
    3737public:
     38  enum ImportParticles_t {
     39    DontImportParticles=0,
     40    DoImportParticles=1,
     41  };
     42
    3843  InterfaceVMGJob(const SamplingGrid &_sampled_input,
    3944      VMGData &returndata,
     
    4651      vmg_float _box_end,
    4752      const int& near_field_cells,
     53      const ImportParticles_t _ImportParticles=DoImportParticles,
    4854      const bool _DoPrintDebug=false,
    4955      int coarseningSteps=0,
     
    7480  double box_end[3];
    7581
     82  //!> whether we import particles (true) or evaluate only
     83  const ImportParticles_t ImportParticles;
     84
    7685  //!> whether we do print grid for debug visualization or not
    7786  const bool DoPrintDebug;
  • src/Jobs/VMGJob.cpp

    r5281ff re2925fd  
    8383    const size_t _near_field_cells,
    8484    const size_t _interpolation_degree,
     85    const bool _DoImportParticles,
    8586    const bool _DoPrintDebug) :
    8687  FragmentJob(_JobId),
     
    9091  near_field_cells(_near_field_cells),
    9192  interpolation_degree(_interpolation_degree),
     93  DoImportParticles(_DoImportParticles),
     94  DoPrintDebug(_DoPrintDebug),
    9295  returndata(static_cast<const SamplingGridProperties &>(_density_grid)),
    93   particles(),
    94   DoPrintDebug(_DoPrintDebug)
     96  particles()
    9597{}
    9698
     
    99101  near_field_cells(3),
    100102  interpolation_degree(3),
    101   particles(),
    102   DoPrintDebug(false)
     103  DoImportParticles(true),
     104  DoPrintDebug(false),
     105  particles()
    103106{}
    104107
     
    220223      density_grid.end[0]-density_grid.begin[0],
    221224      near_field_cells,
     225      DoImportParticles ?
     226          VMGInterfaces::InterfaceVMGJob::DoImportParticles
     227          : VMGInterfaces::InterfaceVMGJob::DontImportParticles,
    222228      DoPrintDebug);
    223229  new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear);
  • src/Jobs/VMGJob.hpp

    r5281ff re2925fd  
    4242   * @param _interpolation_degree degree of interpolation polynomial for getting nuclei
    4343   *        potential from grid
     44   * @param _DoImportParticles whether we import particles (true) or evaluate only
    4445   * @param _DoPrintDebug whether we do print grid for debug visualization or not
    4546   */
     
    5051      const size_t _near_field_cells,
    5152      const size_t _interpolation_degree,
     53      const bool _DoImportParticles=true,
    5254      const bool _DoPrintDebug=false
    5355      );
     
    7274  //!> interpolation degree used in sampling the potential of the nuclei
    7375  const size_t interpolation_degree;
     76  //!> whether we import particles (true) or evaluate only
     77  const bool DoImportParticles;
    7478  //!> whether we do print grid for debug visualization or not
    7579  const bool DoPrintDebug;
     
    124128    ar & const_cast< size_t &>(near_field_cells);
    125129    ar & const_cast< size_t &>(interpolation_degree);
     130    ar & const_cast< bool &>(DoImportParticles);
    126131    ar & const_cast< bool &>(DoPrintDebug);
    127132    ar & returndata;
  • tests/regression/Fragmentation/AnalyseFragmentationResults/testsuite-fragmentation-analyse-fragment-results.at

    r5281ff re2925fd  
    1818### fragment the molecule and check the number of configs
    1919#
    20 # BondFragmentResults.dat is created like this:
    21 # ./molecuilder -i pre/alkane-3.pdb --change-box 20,0,20,0,0,20 --set-parser-parameters mpqc --parser-parameters "theory=CLHF;basis=6-31G;" --set-boundary-conditions Ignore Ignore Ignore --update-molecules --select-all-atoms --fragment-molecule BondFragment --DoSaturate 1 --ExcludeHydrogen 1 --distance 2. --order 6 --fragment-automation --DoLongrange 0 --server-address 127.0.0.1 --server-port 1026 --fragment-resultfile BondFragmentResults.dat
     20# BondFragmentShortRangeResults.dat is created like this:
     21# ./molecuilder -i pre/alkane-3.pdb --change-box 20,0,20,0,0,20 --set-parser-parameters mpqc --parser-parameters "theory=CLHF;basis=6-31G;" --set-boundary-conditions Ignore Ignore Ignore --update-molecules --select-all-atoms --fragment-molecule BondFragment --DoSaturate 1 --ExcludeHydrogen 1 --distance 2. --order 6 --fragment-automation --DoLongrange 0 --server-address 127.0.0.1 --server-port 1026 --fragment-resultfile BondFragmentShortRangeResults.dat
    2222
    23 AT_SETUP([Fragmentation - Analyse fragmentation results])
     23AT_SETUP([Fragmentation - Analyse short-range fragmentation results])
    2424AT_KEYWORDS([fragmentation analyse-fragment-results])
    2525
    26 file=BondFragmentResults.dat
     26file=BondFragmentShortRangeResults.dat
    2727AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/$file $file], 0)
    2828AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    2929AT_CHECK([../../molecuilder --analyse-fragment-results --fragment-resultfile $file], 0, [ignore], [ignore])
    30 AT_CHECK([output=BondFragment_Energy.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/$output], 0, [ignore], [ignore])
    31 AT_CHECK([output=BondFragment_Forces.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/$output], 0, [ignore], [ignore])
    32 AT_CHECK([output=BondFragment_Times.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/$output], 0, [ignore], [ignore])
    33 AT_CHECK([output=BondFragment_Eigenvalues.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/$output], 0, [ignore], [ignore])
    34 AT_CHECK([output=BondFragment_Eigenhistogram.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/$output], 0, [ignore], [ignore])
     30AT_CHECK([output=BondFragment_Energy.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/ShortRange/$output], 0, [ignore], [ignore])
     31AT_CHECK([output=BondFragment_Forces.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/ShortRange/$output], 0, [ignore], [ignore])
     32AT_CHECK([output=BondFragment_Times.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/ShortRange/$output], 0, [ignore], [ignore])
     33AT_CHECK([output=BondFragment_Eigenvalues.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/ShortRange/$output], 0, [ignore], [ignore])
     34AT_CHECK([output=BondFragment_Eigenhistogram.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/ShortRange/$output], 0, [ignore], [ignore])
    3535
    3636AT_CLEANUP
     37
     38#
     39# BondFragmentLongRangeResults.dat is created like this:
     40# ./molecuilder -i pre/alkane-3.pdb --change-box 20,0,20,0,0,20 --set-parser-parameters mpqc --parser-parameters "theory=CLHF;basis=6-31G;" --set-boundary-conditions Ignore Ignore Ignore --update-molecules --select-all-atoms --fragment-molecule BondFragment --DoSaturate 1 --ExcludeHydrogen 1 --distance 2. --order 6 --fragment-automation --DoLongrange 1 --DoValenceOnly 0 --grid-level 4 --near-field-cells 3 --server-address 127.0.0.1 --server-port 1026 --server-address 127.0.0.1 --server-port 1026 --fragment-resultfile BondFragmentLongRangeResults.dat
     41
     42AT_SETUP([Fragmentation - Analyse long-range fragmentation results])
     43AT_KEYWORDS([fragmentation analyse-fragment-results])
     44
     45file=BondFragmentLongRangeResults.dat
     46AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/$file $file], 0)
     47AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
     48AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/alkane-3.pdb --analyse-fragment-results --fragment-resultfile $file], 0, [ignore], [stderr])
     49AT_CHECK([output=BondFragment_Energy.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
     50AT_CHECK([output=BondFragment_Forces.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
     51AT_CHECK([output=BondFragment_Times.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
     52AT_CHECK([output=BondFragment_Eigenvalues.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
     53AT_CHECK([output=BondFragment_Eigenhistogram.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
     54AT_CHECK([grep "File contains long-range information" stderr], 0, [ignore], [ignore], [
     55        AT_CHECK([output=BondFragment_LongRangeEnergy.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
     56        ])
     57
     58AT_CLEANUP
Note: See TracChangeset for help on using the changeset viewer.