update new files
[unres.git] / source / unres / src-HCD-5D / pinorm.f
1       double precision function pinorm(x)
2       implicit none
3       double precision x
4 c                                                                      
5 c this function takes an angle (in radians) and puts it in the range of
6 c -pi to +pi.                                                         
7 c                                                                    
8       integer n                                                        
9       include 'COMMON.GEO'
10       n = x / dwapi
11       pinorm = x - n * dwapi
12       if ( pinorm .gt. pi ) then                                      
13          pinorm = pinorm - dwapi
14       else if ( pinorm .lt. - pi ) then                               
15          pinorm = pinorm + dwapi
16       end if                                                          
17       return                                                          
18       end