added source code
[unres.git] / source / cluster / wham / src-M / proc_proc.c
1 #include <stdlib.h>
2 #include <math.h>
3
4 #ifdef CRAY
5 void PROC_PROC(long int *f, int *i)
6 #else
7 #ifdef LINUX
8 #ifdef PGI
9 void proc_proc_(long int *f, int *i)
10 #else
11 void proc_proc__(long int *f, int *i)
12 #endif
13 #endif
14 #ifdef SGI
15 void proc_proc_(long int *f, int *i)
16 #endif
17 #if defined(WIN) &&  !defined(WINIFL)
18 void _stdcall PROC_PROC(long int *f, int *i)
19 #endif
20 #ifdef WINIFL
21 void proc_proc(long int *f, int *i)
22 #endif
23 #if defined(AIX) || defined(WINPGI) 
24 void proc_proc(long int *f, int *i)
25 #endif
26 #endif
27
28 {
29 static long int NaNQ;
30 static long int NaNQm;
31
32 if(*i==-1)
33  {
34  NaNQ=*f;
35  NaNQm=0xffffffff;
36  return;
37  }
38 *i=0;
39 if(*f==NaNQ)
40  *i=1;
41 if(*f==NaNQm)
42  *i=1;
43 }
44
45 #ifdef CRAY
46 void PROC_CONV(char *buf, int *i, int n)
47 #endif
48 #ifdef LINUX
49 void proc_conv__(char *buf, int *i, int n)
50 #endif
51 #ifdef SGI
52 void proc_conv_(char *buf, int *i, int n)
53 #endif
54 #if defined(AIX) || defined(WINPGI)
55 void proc_conv(char *buf, int *i, int n)
56 #endif
57 #ifdef WIN
58 void _stdcall PROC_CONV(char *buf, int *i, int n)
59 #endif
60 {
61 int j;
62
63 sscanf(buf,"%d",&j);
64 *i=j;
65 return;
66 }
67
68 #ifdef CRAY
69 void PROC_CONV_R(char *buf, int *i, int n)
70 #endif
71 #ifdef LINUX
72 void proc_conv_r__(char *buf, int *i, int n)
73 #endif
74 #ifdef SGI
75 void proc_conv_r_(char *buf, int *i, int n)
76 #endif
77 #if defined(AIX) || defined(WINPGI)
78 void proc_conv_r(char *buf, int *i, int n)
79 #endif
80 #ifdef WIN
81 void _stdcall PROC_CONV_R(char *buf, int *i, int n)
82 #endif
83
84 {
85
86 /* sprintf(buf,"%d",*i); */
87
88 return;
89 }
90
91
92 #ifndef IMSL
93 #ifdef CRAY
94 void DSVRGP(int *n, double *tab1, double *tab2, int *itab)
95 #endif
96 #ifdef LINUX
97 void dsvrgp__(int *n, double *tab1, double *tab2, int *itab)
98 #endif
99 #ifdef SGI
100 void dsvrgp_(int *n, double *tab1, double *tab2, int *itab)
101 #endif
102 #if defined(AIX) || defined(WINPGI)
103 void dsvrgp(int *n, double *tab1, double *tab2, int *itab)
104 #endif
105 #ifdef WIN
106 void _stdcall DSVRGP(int *n, double *tab1, double *tab2, int *itab)
107 #endif
108 {
109 double t;
110 int i,j,k;
111
112 if(tab1 != tab2)
113  {
114  for(i=0; i<*n; i++)
115   tab2[i]=tab1[i];
116  }
117 k=0;
118 while(k<*n-1)
119  {
120  j=k;
121  t=tab2[k];
122  for(i=k+1; i<*n; i++)
123   if(t>tab2[i])
124    {
125    j=i;
126    t=tab2[i];
127    }
128  if(j!=k)
129   {
130   tab2[j]=tab2[k];
131   tab2[k]=t;
132   i=itab[j];
133   itab[j]=itab[k];
134   itab[k]=i;
135   }
136  k++;
137  }
138 }
139 #endif