why respa level for outer == kspace?

hi,

does anybody know the reason why run_style respa allows this:

run_style respa 2 2 pair 1 kspace 2

and this:

run_style respa 2 2 inner 1 5.0 6.0 outer 2

but not this:

run_style respa 3 2 2 inner 1 5.0 6.0 outer 2 kspace 3

it would be trivial to change the source code to allow it, but i
presume there is a reason for this choice and i am curious to learn
it.

thanks in advance,
     axel.

Not sure what the point of not putting
KSpace at the outer level would be,
since nothing is more outer?

Steve

Not sure what the point of not putting
KSpace at the outer level would be,
since nothing is more outer?

i *do* want to put kspace at the outermost level, but i want to it
less frequently than the outer non-bonded calculations.
as i wrote, it works fine, if i don't split non-bonded into inner and outer.

axel.

or to pose the question differently. is there are reason for not
having this change to src/respa.cpp ?

diff --git a/src/respa.cpp b/src/respa.cpp
index fcb592e..6f35d15 100644
--- a/src/respa.cpp
+++ b/src/respa.cpp
@@ -189,12 +189,12 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrat
   }
   if (level_pair == -1 && level_middle == -1) {
     if (level_inner < level_improper || level_outer < level_inner ||
- level_kspace != level_outer)
+ level_kspace < level_outer)
       error->all(FLERR,"Invalid order of forces within respa levels");
   }
   if (level_pair == -1 && level_middle >= 0) {
     if (level_inner < level_improper || level_middle < level_inner ||
- level_outer < level_inner || level_kspace != level_outer)
+ level_outer < level_inner || level_kspace < level_outer)
       error->all(FLERR,"Invalid order of forces within respa levels");
   }

outside of whitespace changes, this part of the code seems to be
unchanged since the original import into svn in 2006.

axel.

run_style respa 3 2 2 inner 1 5.0 6.0 outer 2 kspace 3

This command specifies 4 levels, and you are asking that
KSpace be at level 3, not the outermost 4. Am I
missing something?

Steve

run_style respa 3 2 2 inner 1 5.0 6.0 outer 2 kspace 3

This command specifies 4 levels, and you are asking that

sorry, but it doesn't. the numbers in the respa command are all 1
based not zero based.

KSpace be at level 3, not the outermost 4. Am I
missing something?

i am asking for 3 levels. level 1 being executed twice for every
evaluation of level 2
level 2 in turn being execute twice for every evaluation of level 3.

i'm assigning bond, angle, dihedral, improper and inner to level 1,
i'm skipping middle, assigning outer to level 2 and kspace to level 3,
which is the outermost level. but the code in respa.cpp doesn't allow
me to do the factor 2 between outer non-bonded a kspace. however,
i can run a factor 2 between pair and kspace, if i run all of pair together.

axel.

oops - I misread the doc page, that is 3 levels, not 4.

I think changing the test to level_kspace < level_outer
should be fine. Our thinking may have been that some
portion of the pairwise should be done with the KSpace
since they are complementary, but I don't think
it is a requirement. I see that the code will even
allow you to not put KSpace at the outermost level
(just throws a warning), which is what I thought you
were doing if there were 4 levels defined.

Steve

oops - I misread the doc page, that is 3 levels, not 4.

I think changing the test to level_kspace < level_outer
should be fine. Our thinking may have been that some
portion of the pairwise should be done with the KSpace
since they are complementary, but I don't think
it is a requirement. I see that the code will even

in fact, this kind of scheme is what people do in NAMD to get the best
performance.

allow you to not put KSpace at the outermost level
(just throws a warning), which is what I thought you
were doing if there were 4 levels defined.

that seems to be working fine, though.
i made some tests for that, too. e.g.:

using:

run_style respa 2 1 pair 1 kspace 1

run_style respa 2 1 pair 1 kspace 2

and

run_style verlet

all give identical trajectories for 100 MD steps

only

run_style respa 1 pair 1 kspace 1

doesn't work.

axel.