From 6eb5f3a18697db422640c3fcec1e6b9b3f1e180f Mon Sep 17 00:00:00 2001 From: JFL Date: Tue, 22 Oct 2024 15:06:18 +0200 Subject: [PATCH] synch --- include/Species.h | 3 ++- src/DFT.cpp | 6 ++++-- src/FMT_Species_EOS.cpp | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/Species.h b/include/Species.h index 3d2a81b..9b67d5d 100644 --- a/include/Species.h +++ b/include/Species.h @@ -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 @@ -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); diff --git a/src/DFT.cpp b/src/DFT.cpp index f89e6e2..39731dd 100644 --- a/src/DFT.cpp +++ b/src/DFT.cpp @@ -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; @@ -255,7 +255,9 @@ double DFT::calculateFreeEnergyAndDerivatives_internal_(bool onlyFex) double F = 0; for(long I=0;Idfex(I, fmt_); - F_eos_ += F*dV; + F_eos_ += F*dV; + + eos_species->calculateForce(&fmt_); } } F += F_eos_; diff --git a/src/FMT_Species_EOS.cpp b/src/FMT_Species_EOS.cpp index 3cc86a1..f4f8ab8 100644 --- a/src/FMT_Species_EOS.cpp +++ b/src/FMT_Species_EOS.cpp @@ -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; @@ -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)