~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/lib/libchkpt/felement.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
  \file
 
3
  \ingroup CHKPT
 
4
*/
 
5
 
 
6
#include <cstdlib>
 
7
#include <psifiles.h>
 
8
#include <libpsio/psio.hpp>
 
9
extern "C" {
 
10
#include <libchkpt/chkpt.h>
 
11
}
 
12
#include <libchkpt/chkpt.hpp>
 
13
 
 
14
using namespace psi;
 
15
 
 
16
char **Chkpt::rd_felement(void)
 
17
{
 
18
        char **label;
 
19
        int nallatom, i;
 
20
        psio_address ptr;
 
21
        char *keyword;
 
22
        keyword = build_keyword("Full atom labels");
 
23
 
 
24
        nallatom = rd_nallatom();
 
25
 
 
26
        label = (char **)malloc(nallatom*sizeof(const char*));
 
27
        for(i=0; i < nallatom; i++) 
 
28
                label[i] = (char *) malloc(MAX_ELEMNAME*sizeof(char));
 
29
 
 
30
        ptr = PSIO_ZERO;
 
31
        for(i=0; i < nallatom; i++)
 
32
                psio->read(PSIF_CHKPT, keyword, (char *) label[i], 
 
33
                                        MAX_ELEMNAME*sizeof(char), ptr, &ptr);
 
34
 
 
35
        free(keyword);
 
36
        return label;
 
37
}
 
38
 
 
39
void Chkpt::wt_felement(char ** const label)
 
40
{
 
41
        int nallatom, i;
 
42
        psio_address ptr;
 
43
        char *keyword;
 
44
        keyword = build_keyword("Full atom labels");
 
45
 
 
46
        nallatom = rd_nallatom();
 
47
 
 
48
        ptr = PSIO_ZERO;
 
49
        for(i=0; i < nallatom; i++)
 
50
                psio->write(PSIF_CHKPT, keyword, (char *) label[i], 
 
51
                                        MAX_ELEMNAME*sizeof(char), ptr, &ptr);
 
52
 
 
53
        free(keyword);
 
54
}
 
55
 
 
56
extern "C" {
 
57
/*!
 
58
** chkpt_rd_felement():  Reads in element labels including dummy atoms
 
59
**
 
60
**   takes no arguments.
 
61
**
 
62
**   returns: char **label element label matrix
 
63
** \ingroup CHKPT
 
64
*/
 
65
        char **chkpt_rd_felement(void)
 
66
        {
 
67
                return _default_chkpt_lib_->rd_felement();
 
68
        }
 
69
 
 
70
/*!
 
71
** chkpt_wt_felement():  Writes out element labels including dummy atoms
 
72
**
 
73
** arguments: 
 
74
**   \param label = element label matrix.
 
75
**
 
76
** returns: none
 
77
** \ingroup CHKPT
 
78
*/
 
79
        void chkpt_wt_felement(char ** const label)
 
80
        {
 
81
                _default_chkpt_lib_->wt_felement(label);
 
82
        }
 
83
}