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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/gaf2c/gaf2c.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_STRING_H
6
 
#   include <string.h>
7
 
#endif
8
 
#if HAVE_STDIO_H
9
 
#   include <stdio.h>
10
 
#endif
11
 
 
12
 
#include "farg.h"
13
 
#include "message.h"
14
 
 
15
 
 
16
 
/**
17
 
 * Converts C strings to Fortran strings.
18
 
 *
19
 
 * @param cstring C buffer
20
 
 * @param fstring Fortran string
21
 
 * @param flength length of fstring
22
 
 */
23
 
void ga_c2fstring(char *cstring, char *fstring, int flength)
24
 
{
25
 
    int clength = strlen(cstring);
26
 
 
27
 
    /* remove terminal \n character if any */
28
 
    if(cstring[clength] == '\n') {
29
 
        clength--;
30
 
    }
31
 
 
32
 
    /* Truncate C string into Fortran string */
33
 
    if (clength > flength) {
34
 
        clength = (int)flength;
35
 
    }
36
 
 
37
 
    /* Copy characters over */
38
 
    flength -= clength;
39
 
    while (clength--) {
40
 
        *fstring++ = *cstring++;
41
 
    }
42
 
 
43
 
    /* Now terminate with blanks */
44
 
    while (flength--) {
45
 
        *fstring++ = ' ';
46
 
    }
47
 
}
48
 
 
49
 
 
50
 
/**
51
 
 * Converts Fortran strings to C strings.
52
 
 *
53
 
 * Strip trailing blanks from fstring and copy it to cstring,
54
 
 * truncating if necessary to fit in cstring, and ensuring that
55
 
 * cstring is NUL-terminated.
56
 
 *
57
 
 * @param fstring Fortran string
58
 
 * @param flength length of fstring
59
 
 * @param cstring C buffer
60
 
 * @param clength max length (including NUL) of cstring
61
 
 */
62
 
void ga_f2cstring(char *fstring, int flength, char *cstring, int clength)
63
 
{
64
 
    /* remove trailing blanks from fstring */
65
 
    while (flength-- && fstring[flength] == ' ') ;
66
 
 
67
 
    /* the postdecrement above went one too far */
68
 
    flength++;
69
 
 
70
 
    /* truncate fstring to cstring size */
71
 
    if (flength >= clength) {
72
 
        flength = clength - 1;
73
 
    }
74
 
 
75
 
    /* ensure that cstring is NUL-terminated */
76
 
    cstring[flength] = '\0';
77
 
 
78
 
    /* copy fstring to cstring */
79
 
    while (flength--) {
80
 
        cstring[flength] = fstring[flength];
81
 
    }
82
 
}
83
 
 
84
 
void ga_f2c_get_cmd_args(int *argc, char ***argv)
85
 
{
86
 
    Integer i=0;
87
 
    int iargc=F2C_IARGC();
88
 
    char **iargv=NULL;
89
 
 
90
 
    if (iargc > F2C_GETARG_ARGV_MAX) {
91
 
        printf("ga_f2c_get_cmd_args: too many cmd line args");
92
 
        armci_msg_abort(1);
93
 
    }
94
 
    iargv = malloc(sizeof(char*)*F2C_GETARG_ARGV_MAX);
95
 
    if (!iargv) {
96
 
        printf("ga_f2c_get_cmd_args: malloc iargv failed");
97
 
        armci_msg_abort(1);
98
 
    }
99
 
    for (i=0; i<iargc; i++) {
100
 
        char fstring[F2C_GETARG_ARGLEN_MAX];
101
 
        char cstring[F2C_GETARG_ARGLEN_MAX];
102
 
        F2C_GETARG(&i, fstring, F2C_GETARG_ARGLEN_MAX);
103
 
        ga_f2cstring(fstring, F2C_GETARG_ARGLEN_MAX,
104
 
                cstring, F2C_GETARG_ARGLEN_MAX);
105
 
        iargv[i] = strdup(cstring);
106
 
    }
107
 
    *argc = iargc;
108
 
    *argv = iargv;
109
 
}
110
 
 
111
 
 
112
 
#if NOFORT
113
 
 
114
 
/* To avoid missing symbols even though these should never be called. */
115
 
 
116
 
/**
117
 
 */
118
 
void F2C_GETARG(Integer *a, char *b, int c)
119
 
{
120
 
    printf("GA was built without support for Fortran.  You have attempted "
121
 
            "to retreive command line arguments from a Fortran program. "
122
 
            "Please recompile GA and avoid using --disable-f77");
123
 
    armci_msg_abort(1);
124
 
}
125
 
 
126
 
 
127
 
/**
128
 
 */
129
 
Integer F2C_IARGC()
130
 
{
131
 
    printf("GA was built without support for Fortran.  You have attempted "
132
 
            "to retreive command line arguments from a Fortran program. "
133
 
            "Please recompile GA and avoid using --disable-f77");
134
 
    armci_msg_abort(1);
135
 
    return 0;
136
 
}
137
 
 
138
 
#endif /* NOFORT */