[gmx-users] Adding external field to selected atoms

Bappa Ghosh ab54741 at gmail.com
Tue Dec 6 06:44:02 CET 2016


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 ?
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 ?

Thank you in advance.


Best regards,
Bappa Ghosh


More information about the gromacs.org_gmx-users mailing list