From ba94eca5df9b3407e6fb109893480ca79cc815a7 Mon Sep 17 00:00:00 2001 From: Jim Lutsko Date: Fri, 8 Sep 2023 23:02:43 +0200 Subject: [PATCH] synch --- include/DFT_Factory.h | 2 +- include/Log.h | 2 +- src/DFT.cpp | 13 ++++++++----- src/Minimizer.cpp | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/DFT_Factory.h b/include/DFT_Factory.h index 3aa2308..7cdf2e8 100644 --- a/include/DFT_Factory.h +++ b/include/DFT_Factory.h @@ -277,7 +277,7 @@ class DFT_Factory ///////////////////////////////////////////////////// // Thermodynamics if(verbose_ && theLog_ != NULL) *theLog_ << myColor::GREEN << "#=================================" << myColor::RESET << endl; - if(verbose_ && theLog_ != NULL) *theLog_ << myColor::GREEN << "Thermodynamics:" << myColor::RESET << endl << endl; + if(verbose_ && theLog_ != NULL) *theLog_ << myColor::GREEN << "#Thermodynamics:" << myColor::RESET << endl << endl; xv_ = xl_ = xs1_ = xs2_ = -1; dft_->findSpinodal(1.0, 1e-4, xs1_, xs2_, 1e-8); diff --git a/include/Log.h b/include/Log.h index 1aa2f4e..6e76068 100644 --- a/include/Log.h +++ b/include/Log.h @@ -126,7 +126,7 @@ class Log: public std::ostream if(verbose) *this << "*****************************************************************" << endl; if(verbose) if(prog != NULL) *this << prog << " version " << Major << "." << Minor << endl; - if(verbose) *this << std::ctime(&now_time) << " " << endl; + if(verbose) *this << std::ctime(&now_time); // << " " << endl; if(verbose) *this << "#Using:\tLib " << PROJECT_NAME << endl << "\tversion: " << PROJECT_VER << endl << "\tgit revision: " << g_GIT_SHA1 << endl; diff --git a/src/DFT.cpp b/src/DFT.cpp index 05159b6..feed289 100644 --- a/src/DFT.cpp +++ b/src/DFT.cpp @@ -157,8 +157,8 @@ double DFT::calculateFreeEnergyAndDerivatives(bool onlyFex, bool H_dot_Force) // The following is used when we want to minimize L = (dF/dx_I)^2 = (F_I rho(x_I)')^2 = (F_I)^2 (rho(x_I)')^2 // In this case, the force is - // 0.5*dL/dx_J = F_I (rho(x_I)')^2 F_IJ rho(x_J)' + (F_J)^2 (2*rho(x_J)'*rho(x_J)'') - // = [F_I (rho(x_I)')^2 F_IJ + (F_I)^2 (2*rho(x_J)'')]*rho(x_J)' + // 0.5*dL/dx_J = F_I (rho(x_I)')^2 F_IJ rho(x_J)' + (F_J)^2 (rho(x_J)'*rho(x_J)'') + // = [F_I (rho(x_I)')^2 F_IJ + (F_I)^2 (rho(x_J)'')]*rho(x_J)' // Here, we calculate the term in square brackets because the last factor is added in the minimization routines. if(H_dot_Force) @@ -167,16 +167,19 @@ double DFT::calculateFreeEnergyAndDerivatives(bool onlyFex, bool H_dot_Force) if(s->is_mass_fixed()) throw std::runtime_error("Makes no sense to do H_dot_Force when mass is fixed"); DFT_Vec &dF = s->getDF(); + // HERE DFT_Vec dF_copy(dF); - s->convert_to_alias_deriv(dF); s->convert_to_alias_deriv(dF); // we need two factors of drho_dx - + // + DFT_Vec first_term(dF.size()); matrix_dot_v1(dF,first_term); - + + // HERE s->square_and_scale_with_d2rho_dx2(dF_copy); first_term += dF_copy; + // dF.set(first_term); s->endForceCalculation(); // Need to do this again to make sure that the boundaries are fixed, when demanded diff --git a/src/Minimizer.cpp b/src/Minimizer.cpp index 76d90de..386685f 100644 --- a/src/Minimizer.cpp +++ b/src/Minimizer.cpp @@ -310,7 +310,7 @@ double fireMinimizer2::step() if(backtracks_ >= 10) // new control of dt_max_ { stringstream s; - s << "Changinging dt_max_ from " << dt_max_ << " to " << min(dt_best_, 0.9*dt_max_) << endl; + s << "Changinging dt_max_ from " << dt_max_ << " to " << min(dt_best_, 0.9*dt_max_); reportMessage(s.str()); dt_max_ = min(dt_best_, 0.9*dt_max_); dt_best_ = 0;