~ubuntu-branches/ubuntu/utopic/nwchem/utopic

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/pario/dra/dra2arviz.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 "ga.h"
14
 
#include "macommon.h"
15
 
#include "macdecls.h"
16
 
#include "mp3.h"
17
 
 
18
 
#define ERROR(msg,code){printf("ERROR:%s\n",(msg)); fflush(stdout); exit(1);}
19
 
 
20
 
#define BUFSIZE 8000000
21
 
int main(int argc, char **argv)
22
 
{
23
 
    int heap=400000, stack=400000;
24
 
    int me, nproc;
25
 
    int max_arrays=2;
26
 
    double max_sz=1e8, max_disk=2e8, max_mem=1e6;
27
 
    int d_a, mode=DRA_R;
28
 
    int g_a,rows,cols;
29
 
    char name[1024], fname[1024];
30
 
    logical transp=0;
31
 
    int reqid;
32
 
    int i,ilo,ihi,jlo,jhi,type,ndim,glo[2],ghi[2],gld[1],gdims[2];
33
 
    dra_size_t dlo[2],dhi[2],ddims[2];
34
 
    size_t size, nitems;
35
 
    void *ptr;
36
 
 
37
 
    if(argc!=6){
38
 
        printf("Usage: dra2arviz <dra_filename> <ilo> <ihi> <jlo> <jhi>\n");
39
 
        printf("       dra_filename is the meta-file name for disk resident array\n");
40
 
        printf("       [ilo:ihi, jlo:jhi]  array section to read\n\n\n");
41
 
        return(1);
42
 
    }
43
 
 
44
 
    MP_INIT(argc,argv);
45
 
    MP_MYID(&me);
46
 
    MP_PROCS(&nproc);
47
 
 
48
 
    heap /= nproc;
49
 
    stack /= nproc;
50
 
    if(! MA_init((Integer)MT_F_DBL, stack, heap))
51
 
        GA_Error("MA_init failed",stack+heap); /* initialize memory allocator*/
52
 
    GA_Initialize();                         /* initialize GA */
53
 
 
54
 
    if(nproc != 1)ERROR("Error: does not run in parallel",nproc);
55
 
 
56
 
    if(DRA_Init(max_arrays, max_sz, max_disk, max_mem))
57
 
        ERROR("initialization failed",0);
58
 
 
59
 
    if(DRA_Open(argv[1], mode, &d_a)) ERROR("dra_open failed",0);
60
 
 
61
 
    ilo = atoi(argv[2]); ihi = atoi(argv[3]);
62
 
    jlo = atoi(argv[4]); jhi = atoi(argv[5]);
63
 
    dlo[0] = ilo;
64
 
    dlo[1] = jlo;
65
 
    dhi[0] = ihi;
66
 
    dhi[1] = jhi;
67
 
    rows = ihi - ilo +1; 
68
 
    cols = jhi - jlo +1; 
69
 
    glo[0] = 0;
70
 
    glo[1] = 0;
71
 
    ghi[0] = rows-1;
72
 
    ghi[1] = cols-1;
73
 
    gdims[0] = rows;
74
 
    gdims[1] = cols;
75
 
 
76
 
    if(NDRA_Inquire(d_a, &type, &ndim, ddims, name, fname))
77
 
        ERROR("dra_inquire failed",0);
78
 
 
79
 
    switch (type) {
80
 
        case  MT_F_INT:  size = sizeof(Integer); break;
81
 
        case  MT_F_DBL:  size = sizeof(DoublePrecision); break;
82
 
        case  MT_F_DCPL:  size = sizeof(DoubleComplex); break;
83
 
        default: ERROR("type not supported",type);
84
 
    }
85
 
 
86
 
    g_a = NGA_Create(type, 2, gdims, "temp", NULL);
87
 
 
88
 
    if(NDRA_Read_section(transp, g_a, glo, ghi,
89
 
                d_a, dlo, dhi, &reqid))
90
 
        ERROR("dra_read_section failed",0);
91
 
 
92
 
    if(DRA_Wait(reqid)) ERROR("dra_wait failed",0);
93
 
 
94
 
    NGA_Access(g_a, glo, ghi, &ptr, gld);
95
 
 
96
 
    if(gld[0] != rows) ERROR("ld != rows",gld[0]); 
97
 
 
98
 
    fwrite("OK\n",1,3,stdout);
99
 
    nitems = (size_t)rows;
100
 
    /* write data by columns */
101
 
    for(i=0; i<cols; i++){
102
 
        if(type == MT_F_DBL)
103
 
            fwrite(ptr,size,nitems,stdout);
104
 
        else if(type == MT_F_DCPL)
105
 
            fwrite(ptr,size,nitems,stdout);
106
 
        else
107
 
            fwrite(ptr,size,nitems,stdout);
108
 
    }
109
 
    fflush(stdout);
110
 
 
111
 
    GA_Destroy(g_a);
112
 
 
113
 
    GA_Terminate();
114
 
    MP_FINALIZE();
115
 
    return 0;
116
 
}