Ignore:
Timestamp:
Feb 2, 2016, 5:50:29 PM (9 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:
9ae11c
Parents:
d1831e (diff), 62d092 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'Enhancing_Interdistance' into Candidate_v1.5.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Jobs/WindowGrid_converter.cpp

    rd1831e r3690e4  
    5050
    5151#include "Fragmentation/Summation/SetValues/SamplingGrid.hpp"
     52#include "Jobs/ChargeSmearer.hpp"
    5253
    5354void WindowGrid_converter::addGridOntoWindow(
     
    178179    const SamplingGrid &grid,
    179180    const double prefactor,
    180     const bool OpenBoundaryConditions)
     181    const bool OpenBoundaryConditions,
     182    const bool DoSmearCharges)
    181183{
    182184#ifndef NDEBUG
     
    244246  }
    245247
     248  /// reset grid to zero everywhere
     249
    246250  VMG::Grid::iterator griditer = window.Iterators().Local().Begin();
    247251//  griditer.advance(pre_offset[0]*total[1]*total[2]);
     252  for(N[0]=0; N[0] < total[0]; ++N[0])
     253    for(N[1]=0; N[1] < total[1]; ++N[1])
     254      for(N[2]=0; N[2] < total[2]; ++N[2]) {
     255        ASSERT( griditer != window.Iterators().Local().End(),
     256            "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
     257        window(*griditer++) = 0.;
     258      }
     259
     260#ifndef NDEBUG
     261  ASSERT( griditer == window.Iterators().Local().End(),
     262      "InterfaceVMGJob::addWindowOntoGrid() - griditer is not at end of window.");
     263#endif
     264
     265  /// then apply charges onto grid
     266
     267  griditer = window.Iterators().Local().Begin();
     268  SamplingGrid::sampledvalues_t::const_iterator copyiter = grid.sampled_grid.begin();
     269  const ChargeSmearer &smearer = ChargeSmearer::getInstance();
     270  // NOTE: GridIterator::operator+=()'s implementation in vmg is broken. DON'T USE!
     271//  griditer += pre_offset[0] * total[1] * total[2];
    248272  for(N[0]=0; N[0] < pre_offset[0]; ++N[0])
    249273    for(N[1]=0; N[1] < total[1]; ++N[1])
     
    251275        ASSERT( griditer != window.Iterators().Local().End(),
    252276            "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
    253         window(*griditer++) = 0.;
    254       }
    255   SamplingGrid::sampledvalues_t::const_iterator copyiter = grid.sampled_grid.begin();
     277        griditer++;
     278      }
    256279  for(N[0]=0; N[0] < length[0]; ++N[0]) {
    257 //    griditer.advance(pre_offset[1]*total[2]);
     280//    griditer += pre_offset[1] * total[2];
    258281      for(N[1]=0; N[1] < pre_offset[1]; ++N[1])
    259282        for(N[2]=0; N[2] < total[2]; ++N[2]) {
    260283          ASSERT( griditer != window.Iterators().Local().End(),
    261284              "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
    262           window(*griditer++) = 0.;
     285          griditer++;
    263286        }
    264287    for(N[1]=0; N[1] < length[1]; ++N[1]) {
    265 //      griditer.advance(pre_offset[2]);
    266       for(N[2]=0; N[2] < pre_offset[2]; ++N[2])
    267         window(*griditer++) = 0.;
     288//      griditer += pre_offset[2];
     289      for(N[2]=0; N[2] < pre_offset[2]; ++N[2]) {
     290        griditer++;
     291      }
     292
    268293      for(N[2]=0; N[2] < length[2]; ++N[2]) {
    269294        ASSERT( griditer != window.Iterators().Local().End(),
     
    271296        ASSERT( copyiter != grid.sampled_grid.end(),
    272297            "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
    273         window(*griditer++) += prefactor*(*copyiter++);
    274       }
    275 //      griditer.advance(post_offset[2]);
     298        // either smear out charges or not.
     299        if (DoSmearCharges) {
     300          smearer(window, griditer++, prefactor*(*copyiter++));
     301        } else {
     302          window(*griditer++) += prefactor*(*copyiter++);
     303        }
     304      }
     305//      griditer += post_offset[2];
    276306      for(N[2]=0; N[2] < post_offset[2]; ++N[2]) {
    277307        ASSERT( griditer != window.Iterators().Local().End(),
    278308            "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
    279         window(*griditer++) = 0.;
     309        griditer++;
    280310      }
    281311    }
    282 //    griditer.advance(post_offset[1]*total[2]);
     312//    griditer += post_offset[1] * total[2];
    283313    for(N[1]=0; N[1] < post_offset[1]; ++N[1])
    284314      for(N[2]=0; N[2] < total[2]; ++N[2]) {
    285315        ASSERT( griditer != window.Iterators().Local().End(),
    286316            "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
    287         window(*griditer++) = 0.;
    288       }
    289   }
    290   //  griditer.advance(post_offset[0]*total[1]*total[2]);
     317        griditer++;
     318      }
     319  }
     320//  griditer += post_offset[0] * total[1] * total[2];
    291321  for(N[0]=0; N[0] < post_offset[0]; ++N[0])
    292322    for(N[1]=0; N[1] < total[1]; ++N[1])
     
    294324        ASSERT( griditer != window.Iterators().Local().End(),
    295325            "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
    296         window(*griditer++) = 0.;
     326        griditer++;
    297327      }
    298328#ifndef NDEBUG
     
    302332      "InterfaceVMGJob::addWindowOntoGrid() - copyiter is not at end of window.");
    303333#endif
    304 //  LOG(2, "DEBUG: Grid after adding other is " << grid << ".");
     334
     335  //  LOG(2, "DEBUG: Grid after adding other is " << grid << ".");
    305336}
Note: See TracChangeset for help on using the changeset viewer.