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

« back to all changes in this revision

Viewing changes to src/lib/libchkpt/e_labeled.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 <cstdio>
 
7
#include <cstring>
 
8
#include <cstdlib>
 
9
#include <psifiles.h>
 
10
#include <libpsio/psio.hpp>
 
11
extern "C" {
 
12
#include <libchkpt/chkpt.h>
 
13
}
 
14
#include <libchkpt/chkpt.hpp>
 
15
 
 
16
using namespace psi;
 
17
 
 
18
double Chkpt::rd_e_labeled(const char *label)
 
19
{
 
20
        char *s;
 
21
        double E;
 
22
 
 
23
        s = (char *) malloc((strlen(label)+3)*sizeof(char));
 
24
        strcpy(s,"::");
 
25
        strcat(s,label);
 
26
 
 
27
        psio->read_entry(PSIF_CHKPT, s, (char *) &E, sizeof(double));
 
28
 
 
29
        free(s);
 
30
        return E;
 
31
}
 
32
 
 
33
void Chkpt::wt_e_labeled(const char *label, double E)
 
34
{
 
35
        char *s;
 
36
 
 
37
        s = (char *) malloc((strlen(label)+3)*sizeof(char));
 
38
        strcpy(s,"::");
 
39
        strcat(s,label);
 
40
 
 
41
        psio->write_entry(PSIF_CHKPT, s, (char *) &E, sizeof(double));
 
42
        free(s);
 
43
}
 
44
 
 
45
extern "C" {
 
46
/*!
 
47
** chkpt_rd_e_labeled(): Reads in an energy with a given label
 
48
**
 
49
**  arguments: 
 
50
**   \param char * label
 
51
**
 
52
**  returns: double E, the energy
 
53
**  \ingroup CHKPT
 
54
*/
 
55
        double chkpt_rd_e_labeled(const char *label)
 
56
        {
 
57
                double E;
 
58
                E = _default_chkpt_lib_->rd_e_labeled(label);
 
59
                return E;
 
60
        }
 
61
 
 
62
/*!
 
63
** chkpt_wt_e_labeled(): Write an energy along with a label
 
64
**
 
65
**  arguments: 
 
66
**   \param char *label, the label
 
67
**   \param double E, the energy
 
68
**
 
69
**  returns: none
 
70
**  \ingroup CHKPT
 
71
*/
 
72
        void chkpt_wt_e_labeled(const char *label, double E)
 
73
        {
 
74
                _default_chkpt_lib_->wt_e_labeled(label, E);
 
75
        }
 
76
}