AMBER Archive (2006)

Subject: Re: AMBER: Harmonic restraint along z-axis

From: Carlos Simmerling (
Date: Thu Jul 27 2006 - 11:15:18 CDT

I added this to the xconst routine for doing something similar,
you can use it as an example:

! add restraint to keep atom 1019 below 10.0 in the Y axis

#ifdef MPI
      if (mytaskid.eq.0) then
      ! force constant
        wt = 1.0
      ! atom 1019
        I3 = 3*I-3
        if (x(i3+2).gt.10.) then
            AY = X(I3+2)-(10.)
            WY = WT*AY
            EADD = WY*AY
            ECON = ECON+EADD
            F(I3+2) = F(I3+2)-(WY+WY)

Myunggi Yi wrote:

> Dear Amber user,
> I'd like to restrain some atoms at a certain value (z=5.0) along
> the z-axis with a harmonic potential during simulations.
> The source code is so complicated for me.
> Would you give me some draft or orientation for adding
> my own potential to the sander code?
The AMBER Mail Reflector
To post, send mail to
To unsubscribe, send "unsubscribe amber" to