Skip to content

Commit

Permalink
synch
Browse files Browse the repository at this point in the history
  • Loading branch information
JFL committed Oct 22, 2024
1 parent 1f583f1 commit 6eb5f3a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion include/Species.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ class FMT_Species_EOS : public FMT_Species
double get_bulk_d2dfex_deta2(double x, const void *param) const;

double get_bulk_ddfex_dx(double x, const void *param) const {return get_bulk_ddfex_deta(x,param)*(M_PI*pow(D_EOS_*hsd_,3))/6;}
double get_bulk_d2dfex_dx2(double x, const void *param) const {return get_bulk_d2dfex_deta2(x,param)*((M_PI*pow(D_EOS_*hsd_,3))/6)*((M_PI*pow(D_EOS_*hsd_,3))/6);}


// Evaluate EOS free energy functional at point I
Expand All @@ -647,7 +648,7 @@ class FMT_Species_EOS : public FMT_Species

virtual void calculateFundamentalMeasures(bool needsTensor);
virtual void set_fundamental_measure_derivatives(long pos, FundamentalMeasures &fm, void* param = NULL);
virtual void calculateForce(bool needsTensor, void *param = NULL);
void calculateForce(void *param);

void add_second_derivative(const DFT_FFT &v, DFT_Vec &d2F, const void *param);

Expand Down
6 changes: 4 additions & 2 deletions src/DFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ double DFT::real_space_dcf(double r, double x) const
{
double hsd1 = e->get_eos_hsd();
if(r < hsd1)
dcf -= (M_PI/12)*(r-hsd1)*(r-hsd1)*(r+2*hsd1)*e->get_bulk_ddfex_dx(x, fmt_);
dcf -= (M_PI/12)*(r-hsd1)*(r-hsd1)*(r+2*hsd1)*e->get_bulk_d2dfex_dx2(x, fmt_);
}

return dcf;
Expand Down Expand Up @@ -255,7 +255,9 @@ double DFT::calculateFreeEnergyAndDerivatives_internal_(bool onlyFex)
double F = 0;
for(long I=0;I<Ntot;I++)
F += eos_species->dfex(I, fmt_);
F_eos_ += F*dV;
F_eos_ += F*dV;

eos_species->calculateForce(&fmt_);
}
}
F += F_eos_;
Expand Down
7 changes: 4 additions & 3 deletions src/FMT_Species_EOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ void FMT_Species_EOS::set_fundamental_measure_derivatives(long pos, FundamentalM
eos_weighted_density_[0].Set_dPhi(pos,get_bulk_ddfex_deta(x, param));
}

void FMT_Species_EOS::calculateForce(bool needsTensor, void *param)
void FMT_Species_EOS::calculateForce(void *param)
{
FMT_Species::calculateForce(needsTensor);
// if(!no_fmt)
// FMT_Species::calculateForce(needsTensor);

if(eos_.isNull()) return;

Expand All @@ -137,7 +138,7 @@ void FMT_Species_EOS::calculateForce(bool needsTensor, void *param)

dF_local.do_fourier_2_real();
dF_local.Real().MultBy(dV);
addToForce(dF_local.cReal());
addToForce(dF_local.cReal());
}

// For this we need sum_J sum_K dV (d2dfex(K)/deta(K) deta(K)) w_eta(K-I) w_eta(K-J)v(J)
Expand Down

0 comments on commit 6eb5f3a

Please sign in to comment.