logical statement in fortran
I am trying to group set of data according some condition using FORTRAN code. The code is as below
Code:
gauche = 0.0 Code:
if ((0 > dihedral(i) < 120) .or. (-120 > dihedral(i) < 0)) then Thanks in advance |
In Fortran (and most other programming languages) comparison operators compare exactly two expressions. You have three expressions with two operators. Although yours is logical, Fortran does not support your form.
The correct way to express condition a > b < c in Fortran is Code:
(a > b .and. b < c) Code:
if (dihedral(i) > -120 .and. dihedral(i) < 120 .and. dihedral(i) /= 0) then |
Alternatively, you could use:
Code:
if ( abs(dihedral(i))<120. .and. dihedral(i)/=0. ) then |
Thank you.
It works now. Regards |
All times are GMT -5. The time now is 06:01 AM. |