[gmx-users] indexing atoms *Altering code

David van der Spoel spoel at xray.bmc.uu.se
Fri Dec 1 15:21:24 CET 2006

toma0052 wrote:
> Hi,
>      Thank you for the response.  Being that Fortran is much more my
> language of choice than C, I was wondering if someone could point me in the
> right direction as far as modifying the C code to do what I want.  It is my
> understanding that an mdrun begins by making a neighbor list, computing the
> forces, globally summing the forces, and then updating the positions and
> velocities.  So I am assuming that, just after globally summing the forces,
> I can run an if statement  over all of the solvent molecules testing
> whether their z-coordinate is within certain bounds, and if so, simply add
> Fsum = Fsum + Fext.  My question is, where do I do this?  Do I have to do
> it in multiple files?  Where are those files stored in Gromacs?  Is it the
> mdrun.h and force.h files that I need to modify?  Sorry if this should be
> obvious, but again, my C skills are not the best.
Go to src/mdlib/sim_util.c
Look at the code in function efield (electric field).
If your external force is just a function of the Z coord you can make a 
similar function that you call straight after the electric field 
function is called.

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://folding.bmc.uu.se

More information about the gromacs.org_gmx-users mailing list