[gmx-developers] modifing nonbonded interactions

Mark Abraham Mark.Abraham at anu.edu.au
Sun Oct 19 05:13:55 CEST 2008

Nazish Hoda wrote:
> Hi Mark,
> I really appreciate your help.
> Let me first describe what I am planning to do.
> I want to implement a position dependent dielectric constant:
> \epsilon = \epsilon_near  r < r_1,
> \epsilon = \epsilon_far   r > r_1.

OK. While the simplest way to implement this is to modify the inner loop 
of the kernels to do such a comparison, this will severely hurt 
performance. If one was already dropping from the optimized kernels to a 
generic kernel, then the additional drop is probably not so severe, but 
I'd expect still noticeable.

Much better would be to hijack the twin-range cut-off machinery to 
create different groups of nonbonded interactions which get sent to 
unmodified nonbonded kernels with different epsilon values. This way the 
  distance test is done once per (charge-group) interaction during the 
neighbour-searching, and you get to keep the optimized kernels. See 
section 4.6.3 of the GROMACS 3.3 manual for some introductory information.

Better still would be to find that some other simulation code already 
has such a mechanism implemented.

> Regarding your suggestions, I now understand that I can force it not to 
> use the optimized subroutines. Though I did not undertand what David 
> means that I will be better served by using lookup tables; is he 
> referring to the numbering scheme for LJ, Coloumbic, and water optimized 
> functions, and how to use this information to refer to the correct 
> kernel functions?

They don't vary the kernels, that's the point. Once you supply a table, 
the table-lookup kernels will be used. See section 6.6 of the 3.3 
manual. Such an approach isn't useful to you, since you want what 
amounts to a different functional form depending on the value of r. This 
underscores why you should have been describing your objective, so that 
people trying to help you don't have to make shots in the dark - or 
ignore you until you ask a "right" question :-).


More information about the gromacs.org_gmx-developers mailing list