Re: [AMBER] 180 degrees of angle in AMBER 10

From: Jason Swails <>
Date: Thu, 4 Aug 2016 16:30:36 -0400

On Wed, Aug 3, 2016 at 4:07 PM, Pengzhi Zhang <>

> Dear AMBER users and Developers,
> I am using sander from AMBER10. I have a question regarding on treatment
> of 180 degree angle. I got wrong angle energy. From the ene.f code, I
> found that
> ct1 = max(-pt999,ct0)
> ct2 = min(pt999,ct1)
> cos (pi) is replaced by -0.999 instead of -1.
> Does anyone know why AMBER does this?

‚ÄčI suspect numerical stability. This ensures that the resulting argument
to arccos is well within the legal domain (-1 to 1), and that the resulting
angle is well within the typical range of trigonometric functions, but
still only off by a couple degrees of the "true" angle (at most) if the
actual cosine is -1 or 1.

‚ÄčTrig functions (and/or their inverses) are notorious for introducing
numerical instability into numerical computation in some pathological cases.

You can always try changing -pt999 to -1 and pt999 to 1 and see if you find
any problems. In practice, I find this unlikely to have any noticeable
effect on calculations.


Jason M. Swails
AMBER mailing list
Received on Thu Aug 04 2016 - 14:00:03 PDT
Custom Search