From 42443d3f50484fcd89e0b839368ec77e3796543e Mon Sep 17 00:00:00 2001 From: Olivier Coulaud <Olivier.Coulaud@inria.fr> Date: Tue, 14 Jan 2014 20:46:51 +0100 Subject: [PATCH] Improvements for Ewal --- .../ScalFmm-PeriodicModel/periodicmodel.tex | 20 ++++++++++++++++++- Src/Files/FEwalLoader.hpp | 2 +- Src/Utils/FMath.cpp | 4 ++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Doc/Src_tex/ScalFmm-PeriodicModel/periodicmodel.tex b/Doc/Src_tex/ScalFmm-PeriodicModel/periodicmodel.tex index 9a9d3adfd..aca699ddd 100644 --- a/Doc/Src_tex/ScalFmm-PeriodicModel/periodicmodel.tex +++ b/Doc/Src_tex/ScalFmm-PeriodicModel/periodicmodel.tex @@ -118,6 +118,19 @@ can have a complexity reduced from O(n2) to O(n). But many physical problem could also have the need to compute periodic simulations. Many analytical methods have been developed but none of them is using the power of the FMM to compute the periodicity. +The potential at particle $x_i$ computed by ScalFMM code is given by +$$ +V(x_i) = \sum_{j=0,i\neq j}^{N}{\frac{q_j}{\|x_i-x_j\|}} +$$ +and the force on atom $x_i$ +$$ +f(x_i) = \sum_{j=0,i\neq j}^{N}{q_j\frac{x_i-x_j}{\|x_i-x_j\|^3}}. +$$ +Finally, the total energy of the system writes +$$ +U = \frac{1}{2}\sum_{i=0}^{N}{q_i V(x_i)}. +$$ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{State of the art} @@ -392,15 +405,20 @@ f(x_i) = -\frac{q_0^2}{4 \pi\epsilon_0 l_0^2} q_i \sum_{j=0,i\neq j}^{N}{q_j\fra $$ The Energy conversion factor is $\gamma_0 = \frac{q_0^2}{4 \pi\epsilon_0 l_0}/E_0 = 138935.4835$. The energy unit is in Joules and if you want $kcal mol^{-1}$ unit the the factor becomes $\gamma_0/418.400$. + + +To compare with the molecular dynamics code, the forces and the energy is multiplied by $C_{force}$ ($C_{energy}$ respectively). +\begin{center} \begin{tabular}{|l|c|c|c|c|c|} \hline & \multicolumn{2}{|c|}{Energy} & \multicolumn{2}{c|}{Force} \\ units& $kcal\, mol^{-1}$& & &\\ \hline $C_{energy}$& & & &\\ -$C_{force}$& & & &\\ +$C_{force}$& -138935.4835/418.400& & &\\ \hline \end{tabular} +\end{center} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Conclusion} A new approach has been proposed to compute a periodic FMM. diff --git a/Src/Files/FEwalLoader.hpp b/Src/Files/FEwalLoader.hpp index 0415d459c..43c9beeb6 100755 --- a/Src/Files/FEwalLoader.hpp +++ b/Src/Files/FEwalLoader.hpp @@ -189,7 +189,7 @@ public: else{ *inPhysicalValue = FReal(-0.41); *inIndex = HW; - std::cerr << "Atom type not defined"<< std::endl; + std::cerr << "Atom type not defined "<< type << std::endl; exit(-1); } } diff --git a/Src/Utils/FMath.cpp b/Src/Utils/FMath.cpp index 34c4394c3..b3252d9fa 100755 --- a/Src/Utils/FMath.cpp +++ b/Src/Utils/FMath.cpp @@ -16,8 +16,8 @@ #include "FMath.hpp" // Constant values -const FReal FMath::FPi = FReal(M_PI); -const FReal FMath::FTwoPi = FReal(2.0*M_PI); +const FReal FMath::FPi = FReal(M_PI); +const FReal FMath::FTwoPi = FReal(2.0*M_PI); const FReal FMath::FPiDiv2 = FReal(M_PI_2); const FReal FMath::Epsilon = FReal(0.00000000000000000001); -- GitLab