Merge branch 'devel' into AFM
[unres.git] / source / wham / src-NEWSC-NEWCORR / pinorm.f
diff --git a/source/wham/src-NEWSC-NEWCORR/pinorm.f b/source/wham/src-NEWSC-NEWCORR/pinorm.f
new file mode 100644 (file)
index 0000000..91392bf
--- /dev/null
@@ -0,0 +1,17 @@
+      double precision function pinorm(x)
+      implicit real*8 (a-h,o-z)
+c                                                                      
+c this function takes an angle (in radians) and puts it in the range of
+c -pi to +pi.                                                         
+c                                                                    
+      integer n                                                        
+      include 'COMMON.GEO'
+      n = x / dwapi
+      pinorm = x - n * dwapi
+      if ( pinorm .gt. pi ) then                                      
+         pinorm = pinorm - dwapi
+      else if ( pinorm .lt. - pi ) then                               
+         pinorm = pinorm + dwapi
+      end if                                                          
+      return                                                          
+      end