Re: [gmx-users] Shift electrostatic summation

2009-07-06 Thread Mark Abraham

Shuangxing Dai wrote:

Dear all,

  I was trying to modify the Shift option of electrostatic summation. 
Mainly I want to modify the formulas of this electrostatic summation. 
 From the manual page 69, the modified non-bonded interactions, the 
formulas about Shift is there. In the file /src/gmxlib/shift_util.c, 
there are these formulas. So is this the only file for Shift? Since I 
have added some printf lines to this file, I do not see the result when 
I recompile and use Shift. I doubt whether this function was called to 
do Shift.  Or is there any other file related with the Shift method and 
I need to change?


It won't be called... the routines in src/gmxlib/nonbonded/xxx are used.

The easiest way to experiment with changes to (nonbonded) interactions 
is to use table potentials. See various sections of the manual.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


[gmx-users] Shift electrostatic summation

2009-07-06 Thread Shuangxing Dai
Dear all,
  I was trying to modify the Shift option of electrostatic summation. Mainly
I want to modify the formulas of this electrostatic summation. From the
manual page 69, the modified non-bonded interactions, the formulas about
Shift is there. In the file /src/gmxlib/shift_util.c, there are these
formulas. So is this the only file for Shift? Since I have added some printf
lines to this file, I do not see the result when I recompile and use Shift.
I doubt whether this function was called to do Shift.  Or is there any other
file related with the Shift method and I need to change?
Thanks in advance.
-- 
Shuangxing Dai
___
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Re: [gmx-users] Shift Electrostatic Summation

2009-04-14 Thread Shuangxing Dai
Thank you for your advice and sorry for the misinterpretation. The N is the 
total number of the system and E^Mad_tot is the total energy for the system. 
The outer loop sums over all the ions and the inner one sums over the 
neighbours in the cut-off radius. So it is difficult to decompose this total 
energy to the summation of pair potential since the self energy part is not 
easy to decompose.

I will follow your advice. Thanks again.
Shuangxing Dai
- Original Message - 
From: "Mark Abraham" 

To: "Discussion list for GROMACS users" 
Sent: 14 April, 2009 10:21 PM
Subject: Re: [gmx-users] Shift Electrostatic Summation



Shuangxing Dai wrote:


- Original Message - From: "Mark Abraham" 


To: "Discussion list for GROMACS users" 
Sent: 14 April, 2009 8:01 PM
Subject: Re: [gmx-users] Shift Electrostatic Summation



Shuangxing Dai wrote:
Thank you for your help. Yes, when I found the user define part for 
electrostatics, I hope I can use this part since the analytic form of 
my potential is known. However, since there is a self energy term exist 
and then the whole energy cannot be decomposed to pair interactions 
because I cannot specify how much to each pair since the number of 
neighbours is unkown. That is why I am confused. So I still need an new 
electrostatic summation similiar to shift, not just a new pair 
interaction.


The number of neighbours is known at run-time. However, I still don't 
see why this matters - see 
http://www.gromacs.org/pipermail/gmx-users/2009-March/040830.html
OK, the self energy is assigned for each ion. If I want to decompose the 
potential form of total energy to summation of pair potential, I should 
devide the self term by number of neighbours and assigned to each pair. 
So I cannot use user define potential for my problem.


You can use a user potential if the dependence of the force and/or 
potential on r and N is sufficiently separable. The number of neighbours 
is known inside the inner nonbonded loops, because they're looping over 
the neighbours of each particle. So you merely do a table lookup before or 
after some function of N is applied to some function of r. Thus the only 
work you'd need to do is to construct the correct form of tables, and add 
in the arithmetic concerning N.


Per my advice in that previous thread, you should read and understand the 
code for the nonbonded kernel for a straight cutoff, compare that with 
non-table-lookup Ewald, and compare that with table-lookup Ewald. Also 
heed the advice Berk gave you.


You've still never explained why N in the formula in that previous thread 
is the number of neighbours of a given particle, not the number of 
particles in the system - but that's your problem.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the www 
interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php 


___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-14 Thread David van der Spoel

Shuangxing Dai wrote:
Thank you for your help. Yes, when I found the user define part for 
electrostatics, I hope I can use this part since the analytic form of my 
potential is known. However, since there is a self energy term exist and 
then the whole energy cannot be decomposed to pair interactions because 
I cannot specify how much to each pair since the number of neighbours is 
unkown. That is why I am confused. So I still need an new electrostatic 
summation similiar to shift, not just a new pair interaction.


And I cannot understand/find how the force for Shift electrostatic 
summation is calculated in force.c since there is no formula for force 
found. Or I find the wrong place? And if I want to modify the force 
formula for Shift, where is it?


This is because we use tables internally for this as well. The tables 
are generated in tables.c.
However you may want to look at the self energy correction routines for 
shift functions (I think it is called shift_util.c).


Decomposing energy is a very tricky business, and in most cases does not 
give you any meaningful results.



Thank you for your help.
Shuangxing Dai
- Original Message - From: "Mark Abraham" 
To: "Discussion list for GROMACS users" 
Sent: 14 April, 2009 12:46 AM
Subject: Re: [gmx-users] Shift Electrostatic Summation



Shuangxing Dai wrote:

Hi, all,
I was wondering to modify Shift electrostatic summation to a new 
one. The origin Shift form in Gromacs is like 1/r-1/Rc (Rc is 
cut-off), I need to modify to erfc(alpha*r)/r-erfc(alpha*Rc)/Rc, and 
the original long-range correction of Shift in code shift_util.c is 
q^2/(2*Rc) ( something like that ), I need to 
q^2*(erfc(alpha*Rc)/(2*Rc)+alpha/sqrt(pi)). So question is:
How the force to Shift was calculated? Gromacs use the 
differentiation to energy, got the force formula, then calculated the 
force? Or just use the numerical differentiation to the energy and 
got it? If is the latter one, I do not need to modify the force 
calculation.


GROMACS uses exclusively analytic rather than numerical forces. 
Probably table lookups as used for PME are the technique you will want 
to implement. You won't need to change any code if your functions are 
suitably continuous functions of r and constant parameters. See the 
tabulated potentials section in the manual.


And also, the alpha for Ewald summation, is there an option or 
parameters to adjust this value?


Yes - see the Ewald section of the manual. Also search the mailing 
list, as this has been discussed several times.


Hi, Mark and Berk, if I want do modify shift electrostatic summation 
as I want, what other files or place do I need to modify, except 
shift_util.c and force.c?


Don't - use table lookups.

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before 
posting!
Please don't post (un)subscribe requests to the list. Use the www 
interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php 


___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the www 
interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php



--
David van der Spoel, Ph.D., Professor of Biology
Molec. Biophys. group, Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205. Fax: +4618511755.
sp...@xray.bmc.uu.sesp...@gromacs.org   http://folding.bmc.uu.se
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-14 Thread Mark Abraham

Shuangxing Dai wrote:


- Original Message - From: "Mark Abraham" 
To: "Discussion list for GROMACS users" 
Sent: 14 April, 2009 8:01 PM
Subject: Re: [gmx-users] Shift Electrostatic Summation



Shuangxing Dai wrote:
Thank you for your help. Yes, when I found the user define part for 
electrostatics, I hope I can use this part since the analytic form of 
my potential is known. However, since there is a self energy term 
exist and then the whole energy cannot be decomposed to pair 
interactions because I cannot specify how much to each pair since the 
number of neighbours is unkown. That is why I am confused. So I still 
need an new electrostatic summation similiar to shift, not just a new 
pair interaction.


The number of neighbours is known at run-time. However, I still don't 
see why this matters - see 
http://www.gromacs.org/pipermail/gmx-users/2009-March/040830.html
OK, the self energy is assigned for each ion. If I want to decompose the 
potential form of total energy to summation of pair potential, I should 
devide the self term by number of neighbours and assigned to each pair. 
So I cannot use user define potential for my problem.


You can use a user potential if the dependence of the force and/or 
potential on r and N is sufficiently separable. The number of neighbours 
is known inside the inner nonbonded loops, because they're looping over 
the neighbours of each particle. So you merely do a table lookup before 
or after some function of N is applied to some function of r. Thus the 
only work you'd need to do is to construct the correct form of tables, 
and add in the arithmetic concerning N.


Per my advice in that previous thread, you should read and understand 
the code for the nonbonded kernel for a straight cutoff, compare that 
with non-table-lookup Ewald, and compare that with table-lookup Ewald. 
Also heed the advice Berk gave you.


You've still never explained why N in the formula in that previous 
thread is the number of neighbours of a given particle, not the number 
of particles in the system - but that's your problem.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-14 Thread Shuangxing Dai


- Original Message - 
From: "Mark Abraham" 

To: "Discussion list for GROMACS users" 
Sent: 14 April, 2009 8:01 PM
Subject: Re: [gmx-users] Shift Electrostatic Summation



Shuangxing Dai wrote:
Thank you for your help. Yes, when I found the user define part for 
electrostatics, I hope I can use this part since the analytic form of my 
potential is known. However, since there is a self energy term exist and 
then the whole energy cannot be decomposed to pair interactions because I 
cannot specify how much to each pair since the number of neighbours is 
unkown. That is why I am confused. So I still need an new electrostatic 
summation similiar to shift, not just a new pair interaction.


The number of neighbours is known at run-time. However, I still don't see 
why this matters - see 
http://www.gromacs.org/pipermail/gmx-users/2009-March/040830.html
OK, the self energy is assigned for each ion. If I want to decompose the 
potential form of total energy to summation of pair potential, I should 
devide the self term by number of neighbours and assigned to each pair. So I 
cannot use user define potential for my problem.


And I cannot understand/find how the force for Shift electrostatic 
summation is calculated in force.c since there is no formula for force 
found. Or I find the wrong place? And if I want to modify the force 
formula for Shift, where is it?


Look in the nonbonded kernels - like I said in the above post and 
previously.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the www 
interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php 


___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-14 Thread Mark Abraham

Shuangxing Dai wrote:
Thank you for your help. Yes, when I found the user define part for 
electrostatics, I hope I can use this part since the analytic form of my 
potential is known. However, since there is a self energy term exist and 
then the whole energy cannot be decomposed to pair interactions because 
I cannot specify how much to each pair since the number of neighbours is 
unkown. That is why I am confused. So I still need an new electrostatic 
summation similiar to shift, not just a new pair interaction.


The number of neighbours is known at run-time. However, I still don't 
see why this matters - see 
http://www.gromacs.org/pipermail/gmx-users/2009-March/040830.html


And I cannot understand/find how the force for Shift electrostatic 
summation is calculated in force.c since there is no formula for force 
found. Or I find the wrong place? And if I want to modify the force 
formula for Shift, where is it?


Look in the nonbonded kernels - like I said in the above post and 
previously.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-14 Thread Shuangxing Dai
Thank you for your help. Yes, when I found the user define part for 
electrostatics, I hope I can use this part since the analytic form of my 
potential is known. However, since there is a self energy term exist and 
then the whole energy cannot be decomposed to pair interactions because I 
cannot specify how much to each pair since the number of neighbours is 
unkown. That is why I am confused. So I still need an new electrostatic 
summation similiar to shift, not just a new pair interaction.


And I cannot understand/find how the force for Shift electrostatic summation 
is calculated in force.c since there is no formula for force found. Or I 
find the wrong place? And if I want to modify the force formula for Shift, 
where is it?

Thank you for your help.
Shuangxing Dai
- Original Message - 
From: "Mark Abraham" 

To: "Discussion list for GROMACS users" 
Sent: 14 April, 2009 12:46 AM
Subject: Re: [gmx-users] Shift Electrostatic Summation



Shuangxing Dai wrote:

Hi, all,
I was wondering to modify Shift electrostatic summation to a new one. 
The origin Shift form in Gromacs is like 1/r-1/Rc (Rc is cut-off), I need 
to modify to erfc(alpha*r)/r-erfc(alpha*Rc)/Rc, and the original 
long-range correction of Shift in code shift_util.c is q^2/(2*Rc) ( 
something like that ), I need to 
q^2*(erfc(alpha*Rc)/(2*Rc)+alpha/sqrt(pi)). So question is:
How the force to Shift was calculated? Gromacs use the differentiation to 
energy, got the force formula, then calculated the force? Or just use the 
numerical differentiation to the energy and got it? If is the latter one, 
I do not need to modify the force calculation.


GROMACS uses exclusively analytic rather than numerical forces. Probably 
table lookups as used for PME are the technique you will want to 
implement. You won't need to change any code if your functions are 
suitably continuous functions of r and constant parameters. See the 
tabulated potentials section in the manual.


And also, the alpha for Ewald summation, is there an option or parameters 
to adjust this value?


Yes - see the Ewald section of the manual. Also search the mailing list, 
as this has been discussed several times.


Hi, Mark and Berk, if I want do modify shift electrostatic summation as I 
want, what other files or place do I need to modify, except shift_util.c 
and force.c?


Don't - use table lookups.

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the www 
interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php 


___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-13 Thread Mark Abraham

Shuangxing Dai wrote:

Hi, all,
I was wondering to modify Shift electrostatic summation to a new 
one. The origin Shift form in Gromacs is like 1/r-1/Rc (Rc is cut-off), 
I need to modify to erfc(alpha*r)/r-erfc(alpha*Rc)/Rc, and the original 
long-range correction of Shift in code shift_util.c is q^2/(2*Rc) ( 
something like that ), I need to 
q^2*(erfc(alpha*Rc)/(2*Rc)+alpha/sqrt(pi)). So question is:
How the force to Shift was calculated? Gromacs use the differentiation 
to energy, got the force formula, then calculated the force? Or just use 
the numerical differentiation to the energy and got it? If is the latter 
one, I do not need to modify the force calculation.


GROMACS uses exclusively analytic rather than numerical forces. Probably 
table lookups as used for PME are the technique you will want to 
implement. You won't need to change any code if your functions are 
suitably continuous functions of r and constant parameters. See the 
tabulated potentials section in the manual.


And also, the alpha for Ewald summation, is there an option or 
parameters to adjust this value?


Yes - see the Ewald section of the manual. Also search the mailing list, 
as this has been discussed several times.


Hi, Mark and Berk, if I want do modify shift electrostatic summation as 
I want, what other files or place do I need to modify, except 
shift_util.c and force.c?


Don't - use table lookups.

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Shift Electrostatic Summation

2009-04-13 Thread David van der Spoel

Shuangxing Dai wrote:

Hi, all,
I was wondering to modify Shift electrostatic summation to a new 
one. The origin Shift form in Gromacs is like 1/r-1/Rc (Rc is cut-off), 
I need to modify to erfc(alpha*r)/r-erfc(alpha*Rc)/Rc, and the original 
long-range correction of Shift in code shift_util.c is q^2/(2*Rc) ( 
something like that ), I need to 
q^2*(erfc(alpha*Rc)/(2*Rc)+alpha/sqrt(pi)). So question is:
How the force to Shift was calculated? Gromacs use the differentiation 
to energy, got the force formula, then calculated the force? Or just use 
the numerical differentiation to the energy and got it? If is the latter 
one, I do not need to modify the force calculation.
And also, the alpha for Ewald summation, is there an option or 
parameters to adjust this value?
Hi, Mark and Berk, if I want do modify shift electrostatic summation as 
I want, what other files or place do I need to modify, except 
shift_util.c and force.c?

Shuangxing Dai


It would be wise to test everything with a table look up. Much easier, 
and the better performance than analytical potentials.







___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php



--
David van der Spoel, Ph.D., Professor of Biology
Molec. Biophys. group, Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205. Fax: +4618511755.
sp...@xray.bmc.uu.sesp...@gromacs.org   http://folding.bmc.uu.se
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


[gmx-users] Shift Electrostatic Summation

2009-04-13 Thread Shuangxing Dai
Hi, all,
I was wondering to modify Shift electrostatic summation to a new one. The 
origin Shift form in Gromacs is like 1/r-1/Rc (Rc is cut-off), I need to modify 
to erfc(alpha*r)/r-erfc(alpha*Rc)/Rc, and the original long-range correction of 
Shift in code shift_util.c is q^2/(2*Rc) ( something like that ), I need to 
q^2*(erfc(alpha*Rc)/(2*Rc)+alpha/sqrt(pi)). So question is:
How the force to Shift was calculated? Gromacs use the differentiation to 
energy, got the force formula, then calculated the force? Or just use the 
numerical differentiation to the energy and got it? If is the latter one, I do 
not need to modify the force calculation.
And also, the alpha for Ewald summation, is there an option or parameters to 
adjust this value?
Hi, Mark and Berk, if I want do modify shift electrostatic summation as I want, 
what other files or place do I need to modify, except shift_util.c and force.c?
Shuangxing Dai___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php