# [gmx-users] Switching off Coulombs for a charge group.

Pradip Kumar Biswas p.biswas at csuohio.edu
Thu Nov 18 20:37:03 CET 2004

```Thank you very much David.  I have to set myself within your first
alternative. Your last alternative of setting the corresponding charges
to zero in the input will not help me as I want the Coul & vdw forces
be calculated for those charges but I only want to suppress energy for
the coulomb arising from those charges. I realize (?) that there are
three copies of the array chargeA[i] in t_mdatoms.
for i=0; <md->nr; i++
the first one extends from 0 to md->nr-1
the 2nd one extends from md->nr to 2*md->nr-1
the 3rd one extends from 2*md->nr to 3*md->nr-1

Am I making a mistake here? I didn't find any segmentation fault when I
set the corresponding charges in all the three arrays to zero.

Can you please tell me the idea behind the three copies? That means are
they there for the calculation of energy from arrays-1&2 and
calculation of force from arrays-1&3; or something like that?  Thanking
you again in advance.

Best regards,

On Nov 18, 2004, at 1:56 PM, David wrote:

> On Thu, 2004-11-18 at 13:37 -0500, Pradip Kumar Biswas wrote:
>> Hi,
>> Can anyone please tell me what's the best way in Gromacs to switch-off
>> all the Coulomb interactions related to a particular charge group?
>>
>> I tried with setting the corresponding charges in the chargeA arrays
>> to
>> zero
>> by setting the following lines in a loop before going to "do_fnbf()":
>>
>> md->chargeA[i]  = 0 ;
>> md->chargeA[i+md->nr]  = 0 ;
>> md->chargeA[i+2*md->nr]  = 0 ;
>>
> you'd probably rather write
> md->chargeA[i]  = 0 ;
> md->chargeA[i+1]  = 0 ;
> md->chargeA[i+2]  = 0 ;
>
> Since md->nr is the length of the array your code would generate a
> segmentation violation.
>
> Alternatively you could set the charges to zero in the input.
>
>> when [i] correspond to the desired charge.
>>
>> Can anyone suggest me how this setting inside Gromacs can jeopardize
>> anything else that I cannot see at this moment?
>> Thanking you in advance.
>>
>> CSU, Ohio.
>>
>> _______________________________________________
>> gmx-users mailing list
>> gmx-users at gromacs.org
>> http://www.gromacs.org/mailman/listinfo/gmx-users
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-users-request at gromacs.org.
> --
> David.
> _______________________________________________________________________
> _
> David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
> Dept. of Cell and Molecular Biology, Uppsala University.
> Husargatan 3, Box 596,          75124 Uppsala, Sweden
> phone:  46 18 471 4205          fax: 46 18 511 755
> spoel at xray.bmc.uu.se    spoel at gromacs.org
> http://xray.bmc.uu.se/~spoel
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +
>
> _______________________________________________
> gmx-users mailing list
> gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
>

```