Changeset 666e9e for src/Fragmentation


Ignore:
Timestamp:
May 7, 2016, 7:05:19 AM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, 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_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:
a9099d
Parents:
0ba27c9
git-author:
Frederik Heber <heber@…> (02/17/16 18:24:55)
git-committer:
Frederik Heber <heber@…> (05/07/16 07:05:19)
Message:

VMGFragmentController and FragmentationAutomationAction accept UseImplicitCharge.

  • this causes nuclei charges for the full solution to be taken from the ParticleRegistry that contains partial charges table and not the elementary charges.
Location:
src/Fragmentation/Automation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/VMGFragmentController.cpp

    r0ba27c9 r666e9e  
    4747#include "Jobs/VMGJob.hpp"
    4848#include "molecule.hpp"
     49#include "Potentials/Particles/Particle.hpp"
     50#include "Potentials/Particles/ParticleRegistry.hpp"
    4951#include "World.hpp"
    5052
     
    7779    const bool _DoPrintDebug,
    7880    const bool _OpenBoundaryConditions,
    79     const bool _DoSmearCharges)
     81    const bool _DoSmearCharges,
     82    const bool _UseImplicitCharges)
    8083{
    8184  std::vector<FragmentJob::ptr> jobs;
     
    110113  std::vector< std::vector<double> > positions;
    111114  std::vector<double> charges;
     115  const World &world = const_cast<const World &>(World::getInstance());
     116  const ParticleRegistry &registry = const_cast<const ParticleRegistry &>(ParticleRegistry::getInstance());
    112117  {
    113     const World::ConstAtomComposite &atoms = const_cast<const World &>(World::getInstance()).
    114         getAllAtoms();
     118    const World::ConstAtomComposite &atoms = world.getAllAtoms();
    115119    positions.reserve(atoms.size());
    116120    charges.reserve(atoms.size());
     
    118122    for (World::ConstAtomComposite::const_iterator iter = atoms.begin();
    119123        iter != atoms.end(); ++iter) {
     124      // set position for this atom
    120125      const Vector &pos = (*iter)->getPosition();
    121126      // convert positions to atomic length units
    122       for (size_t i=0;i<3;++i) position[i] = pos[i]/AtomicLengthToAngstroem;
    123       positions.push_back(position);
    124       int charge = (*iter)->getElement().getAtomicNumber();
    125       // subtract core electron charge from nuclei charge if only valence sampled
    126       if (_DoValenceOnly == MPQCData::DoSampleValenceOnly)
    127         charge -= getCoreElectrons(charge);
    128       charges.push_back((double)charge);
     127      for (size_t i=0;i<3;++i)
     128        position[i] = pos[i]/AtomicLengthToAngstroem;
     129
     130      // use partial charges ...
     131      const atomId_t atomid = (*iter)->getId();
     132      if ((!world.isAtomSelected(atomid)) && (_UseImplicitCharges)) {
     133        // ... for all unselected particles ...
     134        const std::string &symbol = (*iter)->getElement().getSymbol();
     135        if (registry.isPresentByName(symbol)) {
     136          // ... that are present in ParticleRegistry
     137          const Particle * const particle = registry.getByName(symbol);
     138          LOG(3, "DEBUG: Using implicit charge " << particle->charge << " for atom " << atomid);
     139          positions.push_back(position);
     140          charges.push_back(particle->charge);
     141        }
     142      } else {
     143        double charge = (*iter)->getElement().getAtomicNumber();
     144        // subtract core electron charge from nuclei charge if only valence sampled
     145        if (_DoValenceOnly == MPQCData::DoSampleValenceOnly)
     146          charge -= getCoreElectrons(charge);
     147        positions.push_back(position);
     148        charges.push_back((double)charge);
     149      }
    129150    }
    130151  }
  • src/Fragmentation/Automation/VMGFragmentController.hpp

    r0ba27c9 r666e9e  
    6464   *        boundary conditions
    6565   * \param _DoSmearCharges whether to smear out electronic charge distributions with bsplines or not
     66   * \param _UseImplicitCharges use implicit charges in potential storage if
     67   *            element is found
    6668   */
    6769  bool createLongRangeJobs(
     
    7577      const bool _DoPrintDebug,
    7678      const bool _OpenBoundaryConditions = false,
    77       const bool _DoSmearCharges = false);
     79      const bool _DoSmearCharges = false,
     80      const bool _UseImplicitCharges = false);
    7881
    7982  void waitforResults(const size_t NoExpectedResults)
Note: See TracChangeset for help on using the changeset viewer.