a suggestion regarding tip4p version of kspace styles

Dear all,

A student in my lab was facing some strange results when doing a TIP4P
water simulation. We realized he was not using the pppm/tip4p kspace
style in conjunction with a tip4p/long pair style.

While the manual is very clear about that point (although it is not
mentioned explicitly on the pair_lj.html page of the manual, but only
on the kspace_style.html page and in the howto section), everybody can
make mistakes and therefore I was wondering if it would be possible
for LAMMPS to issue a Warning in such a situation.

In fact, since I can't think of a situation where one would want to
use a tip4p/long pair-style, but not use the corresponding tip4p
kspace style, it could be even better to issue an Error and stop
lammps from producing unphysical results.

Another possibility would be that lammps would somehow automatically
switch on the TIP4P version of the required kspace style, when a
tip4p/long pair style is used...

What do you think?

Best regards,

dear laurent,

this is a very good suggestion. thanks. indeed, i think this should be
a hard error with termination like in the change shown below. if you
look at the code below the patched area, the opposite test is made
(check for tip4p pair style when in a tip4p pppm style and there is a
hard error).


diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp
index 5f3f8ce..4d45ef2 100644
--- a/src/KSPACE/pppm.cpp
+++ b/src/KSPACE/pppm.cpp
@@ -211,6 +211,11 @@ void PPPM::init()
     error->all(FLERR,"KSpace style is incompatible with Pair style");
   cutoff = *p_cutoff;

+ // a TIP4P pair style requires a matching long-range solver
+ if (!tip4pflag && force->pair->tip4pflag)
+ error->all(FLERR,"Using a TIP4P pair style without a "
+ "compatible kspace style");