Merge branch 'devel' into AFM
[unres.git] / source / unres / src_MD-NEWSC / proc_proc.c
diff --git a/source/unres/src_MD-NEWSC/proc_proc.c b/source/unres/src_MD-NEWSC/proc_proc.c
new file mode 100644 (file)
index 0000000..d77c5a4
--- /dev/null
@@ -0,0 +1,139 @@
+#include <stdlib.h>
+#include <math.h>
+
+#ifdef CRAY
+void PROC_PROC(long int *f, int *i)
+#else
+#ifdef LINUX
+#ifdef PGI
+void proc_proc_(long int *f, int *i)
+#else
+void proc_proc__(long int *f, int *i)
+#endif
+#endif
+#ifdef SGI
+void proc_proc_(long int *f, int *i)
+#endif
+#if defined(WIN) &&  !defined(WINIFL)
+void _stdcall PROC_PROC(long int *f, int *i)
+#endif
+#ifdef WINIFL
+void proc_proc(long int *f, int *i)
+#endif
+#if defined(AIX) || defined(WINPGI) 
+void proc_proc(long int *f, int *i)
+#endif
+#endif
+
+{
+static long int NaNQ;
+static long int NaNQm;
+
+if(*i==-1)
+ {
+ NaNQ=*f;
+ NaNQm=0xffffffff;
+ return;
+ }
+*i=0;
+if(*f==NaNQ)
+ *i=1;
+if(*f==NaNQm)
+ *i=1;
+}
+
+#ifdef CRAY
+void PROC_CONV(char *buf, int *i, int n)
+#endif
+#ifdef LINUX
+void proc_conv__(char *buf, int *i, int n)
+#endif
+#ifdef SGI
+void proc_conv_(char *buf, int *i, int n)
+#endif
+#if defined(AIX) || defined(WINPGI)
+void proc_conv(char *buf, int *i, int n)
+#endif
+#ifdef WIN
+void _stdcall PROC_CONV(char *buf, int *i, int n)
+#endif
+{
+int j;
+
+sscanf(buf,"%d",&j);
+*i=j;
+return;
+}
+
+#ifdef CRAY
+void PROC_CONV_R(char *buf, int *i, int n)
+#endif
+#ifdef LINUX
+void proc_conv_r__(char *buf, int *i, int n)
+#endif
+#ifdef SGI
+void proc_conv_r_(char *buf, int *i, int n)
+#endif
+#if defined(AIX) || defined(WINPGI)
+void proc_conv_r(char *buf, int *i, int n)
+#endif
+#ifdef WIN
+void _stdcall PROC_CONV_R(char *buf, int *i, int n)
+#endif
+
+{
+
+/* sprintf(buf,"%d",*i); */
+
+return;
+}
+
+
+#ifndef IMSL
+#ifdef CRAY
+void DSVRGP(int *n, double *tab1, double *tab2, int *itab)
+#endif
+#ifdef LINUX
+void dsvrgp__(int *n, double *tab1, double *tab2, int *itab)
+#endif
+#ifdef SGI
+void dsvrgp_(int *n, double *tab1, double *tab2, int *itab)
+#endif
+#if defined(AIX) || defined(WINPGI)
+void dsvrgp(int *n, double *tab1, double *tab2, int *itab)
+#endif
+#ifdef WIN
+void _stdcall DSVRGP(int *n, double *tab1, double *tab2, int *itab)
+#endif
+{
+double t;
+int i,j,k;
+
+if(tab1 != tab2)
+ {
+ for(i=0; i<*n; i++)
+  tab2[i]=tab1[i];
+ }
+k=0;
+while(k<*n-1)
+ {
+ j=k;
+ t=tab2[k];
+ for(i=k+1; i<*n; i++)
+  if(t>tab2[i])
+   {
+   j=i;
+   t=tab2[i];
+   }
+ if(j!=k)
+  {
+  tab2[j]=tab2[k];
+  tab2[k]=t;
+  i=itab[j];
+  itab[j]=itab[k];
+  itab[k]=i;
+  }
+ k++;
+ }
+}
+#endif