Adam's changes
[unres.git] / source / wham / src-restraints-PM / pinorm.f
1       double precision function pinorm(x)
2       implicit real*8 (a-h,o-z)
3 c                                                                      
4 c this function takes an angle (in radians) and puts it in the range of
5 c -pi to +pi.                                                         
6 c                                                                    
7       integer n                                                        
8       include 'COMMON.GEO'
9       n = x / dwapi
10       pinorm = x - n * dwapi
11       if ( pinorm .gt. pi ) then                                      
12          pinorm = pinorm - dwapi
13       else if ( pinorm .lt. - pi ) then                               
14          pinorm = pinorm + dwapi
15       end if                                                          
16       return                                                          
17       end