Changeset fdc567


Ignore:
Timestamp:
Oct 10, 2016, 12:34:32 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Fix_FitPartialCharges
Children:
eb40e3
Parents:
213f9d
Message:

Extracted PartialNucleiChargeFitter::calculateResiduum().

Location:
src/Potentials
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/PartialNucleiChargeFitter.cpp

    r213f9d rfdc567  
    305305}
    306306
     307VectorContent PartialNucleiChargeFitter::calculateResiduum()
     308{
     309  // need to reconstruct matrix as it was overwritten by SVD
     310  if (PotentialFromCharges == NULL)
     311    constructMatrix();
     312
     313  // calculate residual vector
     314  VectorContent residuum = (*PotentialFromCharges) * (*PartialCharges) - SampledPotential;
     315
     316  return residuum;
     317}
     318
    307319double PartialNucleiChargeFitter::operator()()
    308320{
     
    327339  LOG(2, "DEBUG: Norm of right-hand side is " << SampledPotential.Norm());
    328340
    329   // need to reconstruct matrix as it was overwritten by SVD
    330   constructMatrix();
    331 
    332   // calculate residual vector
    333   VectorContent residuum = (*PotentialFromCharges) * (*PartialCharges) - SampledPotential;
     341  // calculate residuum (force matrix reconstruction)
     342  delete PotentialFromCharges;
     343  VectorContent residuum = calculateResiduum();
    334344
    335345#ifndef NDEBUG
  • src/Potentials/PartialNucleiChargeFitter.hpp

    r213f9d rfdc567  
    105105   charges_t getSolutionAsCharges_t() const;
    106106
     107   /** Helper function to construct the discretized Coulomb operator for the
     108    * nuclei charges.
     109    *
     110    */
    107111   void writeMatrix();
     112
     113   /** Setter for solution as charges_t
     114    *
     115    * \param _charges solution vector x as type charges_t
     116    */
     117   void setCharges(const charges_t &_charges) const;
     118
     119   /** Calculates the residuum for the currently set charges.
     120    *
     121    * \return residual for every charge
     122    */
     123   VectorContent calculateResiduum();
    108124
    109125private:
Note: See TracChangeset for help on using the changeset viewer.