Skip to content

Commit

Permalink
synch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Lutsko committed Sep 8, 2023
1 parent 1f0ef75 commit ba94eca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/DFT_Factory.h
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/Log.h
Expand Up @@ -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;
Expand Down
13 changes: 8 additions & 5 deletions src/DFT.cpp
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Minimizer.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit ba94eca

Please sign in to comment.