~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/pario/dra/capi.c

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if HAVE_CONFIG_H
2
 
#   include "config.h"
3
 
#endif
4
 
 
5
 
#if HAVE_STDIO_H
6
 
#   include <stdio.h>
7
 
#endif
8
 
#if HAVE_STDLIB_H
9
 
#   include <stdlib.h>
10
 
#endif
11
 
 
12
 
#include "dra.h"
13
 
#include "draf2c.h"
14
 
#include "drap.h"
15
 
#include "global.h"
16
 
#include "ga-papi.h"
17
 
 
18
 
static Integer _da_lo[MAXDIM], _da_hi[MAXDIM];
19
 
static Integer _da_dims[MAXDIM];
20
 
static Integer _da_reqdims[MAXDIM];
21
 
 
22
 
static Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
23
 
 
24
 
#ifdef USE_FAPI
25
 
#  define COPYC2F(carr, farr, n){\
26
 
    int i; for(i=0; i< (n); i++)(farr)[i]=(Integer)(carr)[i];} 
27
 
#  define COPYF2C(farr, carr, n){\
28
 
    int i; for(i=0; i< (n); i++)(carr)[i]=(int)(farr)[i];} 
29
 
#  define COPYF2C_DRA(farr, carr, n){\
30
 
    int i; for(i=0; i< (n); i++)(carr)[i]=(dra_size_t)(farr)[i];} 
31
 
#else
32
 
#  define COPYC2F(carr, farr, n){\
33
 
    int i; for(i=0; i< (n); i++)(farr)[n-i-1]=(Integer)(carr)[i];} 
34
 
#  define COPYF2C(farr, carr, n){\
35
 
    int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(int)(farr)[i];} 
36
 
#  define COPYF2C_DRA(farr, carr, n){\
37
 
    int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(dra_size_t)(farr)[i];} 
38
 
#define BASE_0
39
 
#endif
40
 
 
41
 
#define COPY(CAST,src,dst,n) {\
42
 
    int i; for(i=0; i< (n); i++)(dst)[i]=(CAST)(src)[i];} 
43
 
 
44
 
#ifdef BASE_0 
45
 
#  define COPYINDEX_C2F(carr, farr, n){\
46
 
    int i; for(i=0; i< (n); i++)(farr)[n-i-1]=(Integer)(carr)[i]+1;}
47
 
#  define COPYINDEX_F2C(farr, carr, n){\
48
 
    int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(int)(farr)[i] -1;}
49
 
#  define COPYINDEX_F2C_DRA(farr, carr, n){\
50
 
    int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(dra_size_t)(farr)[i] -1;}
51
 
#else
52
 
#  define COPYINDEX_F2C COPYF2C
53
 
#  define COPYINDEX_F2C_DRA COPYF2C_DRA
54
 
#  define COPYINDEX_C2F COPYC2F
55
 
#endif
56
 
 
57
 
int DRA_uses_fapi(void)
58
 
{
59
 
#ifdef USE_FAPI
60
 
    return 1;
61
 
#else
62
 
    return 0;
63
 
#endif
64
 
}
65
 
 
66
 
 
67
 
int NDRA_Create(int type, int ndim, dra_size_t dims[], char *name,
68
 
        char* filename, int mode, dra_size_t reqdims[], int *d_a)
69
 
{
70
 
    Integer ttype, nndim, dd_a, mmode; 
71
 
    logical st;
72
 
    if (ndim>MAXDIM) return 0;
73
 
 
74
 
    COPYC2F(dims, _da_dims, ndim);
75
 
    COPYC2F(reqdims, _da_reqdims, ndim);
76
 
    ttype = (Integer)type;
77
 
    nndim = (Integer)ndim;
78
 
    mmode = (Integer)mode;
79
 
 
80
 
    st = ndrai_create(&ttype, &nndim, _da_dims, name,
81
 
            filename, &mmode, _da_reqdims, &dd_a);
82
 
    *d_a = (int)dd_a;
83
 
    if(st==TRUE) return 1;
84
 
    else return 0;
85
 
}
86
 
 
87
 
int NDRA_Create_config(int type, int ndim, dra_size_t dims[], char *name,
88
 
        char* filename, int mode, dra_size_t reqdims[], int numfiles,
89
 
        int ioprocs, int *d_a)
90
 
{
91
 
    Integer ttype, nndim, dd_a, mmode;
92
 
    Integer nnumfiles, iioprocs;
93
 
    logical st;
94
 
    if (ndim>MAXDIM) return 0;
95
 
 
96
 
    COPYC2F(dims, _da_dims, ndim);
97
 
    COPYC2F(reqdims, _da_reqdims, ndim);
98
 
    ttype = (Integer)type;
99
 
    nndim = (Integer)ndim;
100
 
    mmode = (Integer)mode;
101
 
    nnumfiles = (Integer)numfiles;
102
 
    iioprocs = (Integer)ioprocs;
103
 
 
104
 
    st = ndrai_create_config(&ttype, &nndim, _da_dims, name,
105
 
            filename, &mmode, _da_reqdims, &nnumfiles, &iioprocs, &dd_a);
106
 
    *d_a = (int)dd_a;
107
 
    if(st==TRUE) return 1;
108
 
    else return 0;
109
 
}
110
 
 
111
 
int NDRA_Inquire(int d_a, int *type, int *ndim, dra_size_t dims[], char *name,
112
 
        char* filename)
113
 
{
114
 
    Integer  dd_a, ttype, nndim, status;
115
 
    dd_a = (Integer)d_a;
116
 
    status = ndrai_inquire(&dd_a, &ttype, &nndim, _da_dims, name, filename);
117
 
    COPYF2C_DRA(_da_dims, dims, nndim);
118
 
    *type = (int)ttype;
119
 
    *ndim = (int)nndim;
120
 
    return (int)status;
121
 
}
122
 
 
123
 
int NDRA_Write(int g_a, int d_a, int *request)
124
 
{
125
 
    Integer status, gg_a, dd_a, rrequest;
126
 
    gg_a = (Integer)g_a;
127
 
    dd_a = (Integer)d_a;
128
 
    rrequest = (Integer)*request;
129
 
    status = ndra_write_(&gg_a, &dd_a, &rrequest);
130
 
    *request = (int)rrequest;
131
 
    return (int)status;
132
 
}
133
 
 
134
 
int NDRA_Read(int g_a, int d_a, int *request)
135
 
{
136
 
    Integer status, gg_a, dd_a, rrequest;
137
 
    gg_a = (Integer)g_a;
138
 
    dd_a = (Integer)d_a;
139
 
    rrequest = (Integer)*request;
140
 
    status = ndra_read_(&gg_a, &dd_a, &rrequest);
141
 
    *request = (int)rrequest;
142
 
    return (int)status;
143
 
}
144
 
 
145
 
int NDRA_Write_section(logical transp, int g_a, int glo[], int ghi[],
146
 
        int d_a, dra_size_t dlo[], dra_size_t dhi[],
147
 
        int *request)
148
 
{
149
 
    Integer status;
150
 
    Integer ttransp, gg_a, dd_a, rrequest;
151
 
    Integer ndim;
152
 
    ttransp = (Integer)transp;
153
 
    gg_a = (Integer)g_a;
154
 
    ndim = pnga_ndim(gg_a);
155
 
    dd_a = (Integer)d_a;
156
 
    rrequest = (Integer)*request;
157
 
 
158
 
    COPYINDEX_C2F(glo, _ga_lo, ndim);
159
 
    COPYINDEX_C2F(ghi, _ga_hi, ndim);
160
 
    COPYINDEX_C2F(dlo, _da_lo, ndim);
161
 
    COPYINDEX_C2F(dhi, _da_hi, ndim);
162
 
    status = ndra_write_section_(&ttransp, &gg_a, _ga_lo, _ga_hi, &dd_a, _da_lo,
163
 
            _da_hi, &rrequest);
164
 
    *request = (int)rrequest;
165
 
    return (int)status;
166
 
}
167
 
 
168
 
int NDRA_Read_section(logical transp, int g_a, int glo[], int ghi[],
169
 
        int d_a, dra_size_t dlo[], dra_size_t dhi[], int *request)
170
 
{
171
 
    Integer status;
172
 
    Integer ttransp, gg_a, dd_a, rrequest;
173
 
    Integer ndim;
174
 
    ttransp = (Integer)transp;
175
 
    gg_a = (Integer)g_a;
176
 
    ndim = pnga_ndim(gg_a);
177
 
    dd_a = (Integer)d_a;
178
 
    rrequest = (Integer)*request;
179
 
 
180
 
    COPYINDEX_C2F(glo, _ga_lo, ndim);
181
 
    COPYINDEX_C2F(ghi, _ga_hi, ndim);
182
 
    COPYINDEX_C2F(dlo, _da_lo, ndim);
183
 
    COPYINDEX_C2F(dhi, _da_hi, ndim);
184
 
    status = ndra_read_section_(&ttransp, &gg_a, _ga_lo, _ga_hi, &dd_a, _da_lo,
185
 
            _da_hi, &rrequest);
186
 
    *request = (int)rrequest;
187
 
    return (int)status;
188
 
}
189
 
 
190
 
int DRA_Init(int max_arrays, double max_array_size,
191
 
        double total_disk_space, double max_memory)
192
 
{
193
 
    Integer mmax_arrays, status;
194
 
    DoublePrecision mmax_array_size, ttotal_disk_space, mmax_memory;
195
 
    mmax_arrays = (Integer)max_arrays;
196
 
    mmax_array_size = (DoublePrecision)max_array_size;
197
 
    ttotal_disk_space = (DoublePrecision)total_disk_space;
198
 
    mmax_memory = (DoublePrecision)max_memory;
199
 
    status = dra_init_(&mmax_arrays, &mmax_array_size,
200
 
            &ttotal_disk_space, &mmax_memory);
201
 
    return (int)status;
202
 
}
203
 
 
204
 
int DRA_Terminate()
205
 
{
206
 
    Integer status;
207
 
    status = dra_terminate_();
208
 
    return (int)status;
209
 
}
210
 
 
211
 
int DRA_Open(char* filename, int mode, int *d_a)
212
 
{
213
 
    Integer mmode, dd_a, status;
214
 
    mmode = (Integer)mode;
215
 
    status = drai_open(filename, &mmode, &dd_a);
216
 
    *d_a = (int)dd_a;
217
 
    return (int)status;
218
 
}
219
 
 
220
 
int DRA_Probe(int request, int *compl_status)
221
 
{
222
 
    Integer rrequest, ccompl_status, status;
223
 
    rrequest = (Integer)request;
224
 
    status = dra_probe_(&rrequest, &ccompl_status);
225
 
    *compl_status = (int)ccompl_status;
226
 
    return (int)status;
227
 
}
228
 
 
229
 
void DRA_Set_debug(logical flag)
230
 
{
231
 
    dra_set_debug_(&flag);
232
 
    return;
233
 
}
234
 
 
235
 
void DRA_Print_internals(int d_a)
236
 
{
237
 
    Integer dd_a;
238
 
    dd_a = (Integer)d_a;
239
 
    dra_print_internals_(&dd_a);
240
 
    return;
241
 
}
242
 
 
243
 
void DRA_Set_default_config(int numfiles, int numioprocs)
244
 
{
245
 
    Integer nfiles, nprocs;
246
 
    nfiles = (Integer)numfiles;
247
 
    nprocs = (Integer)numioprocs;
248
 
    dra_set_default_config_(&nfiles, &nprocs);
249
 
    return;
250
 
}
251
 
 
252
 
int DRA_Wait(int request)
253
 
{
254
 
    Integer rrequest, status;
255
 
    rrequest = (Integer)request;
256
 
    status = dra_wait_(&rrequest);
257
 
    return (int)status;
258
 
}
259
 
 
260
 
int DRA_Delete(int d_a)
261
 
{
262
 
    Integer dd_a, status;
263
 
    dd_a = (Integer)d_a;
264
 
    status = dra_delete_(&dd_a);
265
 
    return (int)status;
266
 
}
267
 
 
268
 
int DRA_Close(int d_a)
269
 
{
270
 
    Integer dd_a, status;
271
 
    dd_a = (Integer)d_a;
272
 
    status = dra_close_(&dd_a);
273
 
    return (int)status;
274
 
}
275
 
 
276
 
void DRA_Flick()
277
 
{
278
 
    dra_flick_();
279
 
}