[gmx-users] Adding external field to selected atoms

Mark Abraham mark.j.abraham at gmail.com
Thu Dec 8 17:06:28 CET 2016


Hi,

On Tue, Dec 6, 2016 at 4:44 PM Bappa Ghosh <ab54741 at gmail.com> wrote:

> Dear users,
> I am trying to add an external field which will add some extra force to my
> simulation system for selected atoms.
> For that, I was following the "patching mdrun" exercise in
> http://www.gromacs.org/Developer_Zone/Programming_Guide/Patching_mdrun.
>
> There it tells to replace the function calc_f_el in
> gmx/src/mdlib/sim_util.c as follows-
>
> for(i=start; (i<start+homenr); i++) {
>   if (x[i][ZZ] < box[ZZ][ZZ]/2) {
>    Ext[ZZ] = FIELDFAC*Ex[ZZ].a[0]*2*x[i][ZZ]/box[ZZ][ZZ];
>   }
>   else {
>    Ext[ZZ] = FIELDFAC*Ex[ZZ].a[0]*(1- 2*x[i][ZZ]/box[ZZ][ZZ]);
>   }
>   f[i][ZZ] += charge[i]*Ext[ZZ];
> }
>
> in order to add an external electric field along Z variable of the box.
>
> My questions are-
> 1. What are the variables *"start" *and *"homenr" *mean ?
>

Domains have responsibility for home atoms, but have information for a
large number of atoms with which they interact. start and homenr delimit
the range for which this domain has responsibility.


> 2. In order to add force by the external field to selected atoms, is there
> any way to select atoms from the simulation system ( may be from the
> index.ndx file ) which can be included here ?
>

There are normal .mdp options for user-defined index groups that you can
access inside modified versions of the code. e.g.
http://manual.gromacs.org/documentation/2016/user-guide/mdp-options.html#user-defined-thingies.
I would look at code for e.g. group-wise center-of-mass-motion removal to
see how to use these data structures.

Mark


> Thank you in advance.
>
>
> Best regards,
> Bappa Ghosh
> --
> Gromacs Users mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>


More information about the gromacs.org_gmx-users mailing list