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().

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.