File: Maketest.c

package info (click to toggle)
openmx 3.2.4.dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 62,572 kB
  • ctags: 2,684
  • sloc: ansic: 130,666; python: 876; makefile: 560; xml: 63; perl: 18; sh: 4
file content (195 lines) | stat: -rw-r--r-- 5,468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/**********************************************************************
  Maketest.c:

     Maketest.c is a subroutine to generate *.out files which will be
     used to check whether OpenMX runs normally on many platforms or not.

  Log of Maketest.c:

     25/Oct/2004  Released by T.Ozaki

***********************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
/*  stat section */
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
/*  end stat section */
#include "openmx_common.h"
#include "Inputtools.h"
 
#ifdef nompi
#include "mimic_mpi.h"
#else
#include "mpi.h"
#endif


void Maketest(int argc, char *argv[]) 
{
  FILE *fp0,*fp1,*fp2;
  static int Num_DatFiles,i;

  static char fname0[YOUSO10];
  static char fname1[YOUSO10];
  static char fname_dat[YOUSO10];
  static char fname_dat2[YOUSO10];
  static char operate[800];

  printf("\n*******************************************************\n"); 
  printf("*******************************************************\n"); 
  printf(" Welcome to OpenMX  Ver. %s                            \n",Version_OpenMX); 
  printf(" Copyright (C), 2002-2007, T.Ozaki                     \n"); 
  printf(" OpenMX comes with ABSOLUTELY NO WARRANTY.             \n"); 
  printf(" This is free software, and you are welcome to         \n"); 
  printf(" redistribute it under the constitution of the GNU-GPL.\n");
  printf("*******************************************************\n"); 
  printf("*******************************************************\n\n\n"); 

  printf("\n");
  printf(" OpenMX is now in the mode in making of *.out files\n");
  printf(" which will be used to check whether OpenMX runs\n");
  printf(" normally on many platforms or not.\n");
  printf("\n");

  sprintf(operate,"ls input_example/*.dat > ls_dat000000");
  system(operate);

  sprintf(operate,"wc ls_dat000000 > ls_dat000001");
  system(operate);

  sprintf(fname0,"ls_dat000000");
  sprintf(fname1,"ls_dat000001");

  if ( ((fp0 = fopen(fname0,"r")) != NULL) &&
       ((fp1 = fopen(fname1,"r")) != NULL) )
    {

    fscanf(fp1,"%i",&Num_DatFiles);

    printf(" %2d dat files are found in the directory 'input_example'.\n\n\n",Num_DatFiles);

    for (i=0; i<Num_DatFiles; i++){
      fscanf(fp0,"%s",fname_dat);

      if      (argc==2)  sprintf(operate,"./openmx %s",fname_dat);
      else if (argc==3)  sprintf(operate,"%s %s",argv[2],fname_dat);

      system(operate);

      input_open(fname_dat);

      input_string("System.Name",fname_dat2,"default");

      sprintf(operate,"cp %s.out input_example/",fname_dat2);
      system(operate);
       
      input_close();
    }

    fclose(fp0);
    fclose(fp1);
  }
  else{
    printf("Could not find ls_dat000000 or ls_dat000001\n");
    exit(1);
  }

  sprintf(operate,"rm ls_dat000000");
  system(operate);

  sprintf(operate,"rm ls_dat000001");
  system(operate);

  printf("\n\n\n\n");
  printf("Generated out files are stored in the directory 'input_example'.\n\n\n");
}






void MaketestL(int argc, char *argv[]) 
{
  FILE *fp0,*fp1,*fp2;
  static int Num_DatFiles,i;
  static char fname0[YOUSO10];
  static char fname1[YOUSO10];
  static char fname_dat[YOUSO10];
  static char fname_dat2[YOUSO10];
  static char operate[800];

  printf("\n*******************************************************\n"); 
  printf("*******************************************************\n"); 
  printf(" Welcome to OpenMX                                     \n"); 
  printf(" Copyright (C), 2002, T.Ozaki                          \n"); 
  printf(" OpenMX comes with ABSOLUTELY NO WARRANTY.             \n"); 
  printf(" This is free software, and you are welcome to         \n"); 
  printf(" redistribute it under the constitution of the GNU-GPL.\n");
  printf("*******************************************************\n"); 
  printf("*******************************************************\n\n\n"); 

  printf("\n");
  printf(" OpenMX is now in the mode in making of *.out files\n");
  printf(" which will be used to check whether OpenMX normally runs\n");
  printf(" for relatively large systems on many platforms or not.\n");
  printf("\n");

  sprintf(operate,"ls large_example/*.dat > ls_dat000000");
  system(operate);

  sprintf(operate,"wc ls_dat000000 > ls_dat000001");
  system(operate);

  sprintf(fname0,"ls_dat000000");
  sprintf(fname1,"ls_dat000001");

  if ( ((fp0 = fopen(fname0,"r")) != NULL) &&
       ((fp1 = fopen(fname1,"r")) != NULL) )
    {

    fscanf(fp1,"%i",&Num_DatFiles);

    printf(" %2d dat files are found in the directory 'large_example'.\n\n\n",Num_DatFiles);

    for (i=0; i<Num_DatFiles; i++){
      fscanf(fp0,"%s",fname_dat);

      if      (argc==2)  sprintf(operate,"./openmx %s",fname_dat);
      else if (argc==3)  sprintf(operate,"%s %s",argv[2],fname_dat);

      system(operate);

      input_open(fname_dat);

      input_string("System.Name",fname_dat2,"default");

      sprintf(operate,"cp %s.out large_example/",fname_dat2);
      system(operate);
       
      input_close();
    }

    fclose(fp0);
    fclose(fp1);
  }
  else{
    printf("Could not find ls_dat000000 or ls_dat000001\n");
    exit(1);
  }

  sprintf(operate,"rm ls_dat000000");
  system(operate);

  sprintf(operate,"rm ls_dat000001");
  system(operate);

  printf("\n\n\n\n");
  printf("Generated out files are stored in the directory 'large_example'.\n\n\n");
}