Psi4
iwl.hpp
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _psi_src_lib_libiwl_iwl_hpp_
30 #define _psi_src_lib_libiwl_iwl_hpp_
31 
32 #include <cstdio>
33 #include "psi4/libpsio/psio.hpp"
34 #include "config.h"
35 
36 namespace psi {
37 
38  class IWL {
39  int itap_; /* tape number for input file */
40  psio_address bufpos_; /* current page/offset */
41  int ints_per_buf_; /* integrals per buffer */
42  int bufszc_; /* buffer size in characters (bytes) */
43  double cutoff_; /* cutoff value for writing */
44  int lastbuf_; /* is this the last IWL buffer? 1=yes,0=no */
45  int inbuf_; /* how many ints in current buffer? */
46  int idx_; /* index of integral in current buffer */
47  Label *labels_; /* pointer to where integral values begin */
48  Value *values_; /* integral values */
52  bool keep_;
53 
54  public:
55 
56  IWL();
57  IWL(PSIO *psio, int itap, double cutoff, int oldfile, int readflag);
58  ~IWL();
59 
60  // Accessor functions to data
61  int& itap() { return itap_; }
63  int& ints_per_buffer() { return ints_per_buf_; }
64  int& buffer_size() { return bufszc_; }
65  double& cutoff() { return cutoff_; }
66  int& last_buffer() { return lastbuf_; }
67  int& buffer_count() { return inbuf_; }
68  int& index() { return idx_; }
69  Label* labels() { return labels_; }
70  Value* values() { return values_; }
71  bool& keep() { return keep_; }
72 
73  void init(PSIO *psio, int itap, double cutoff, int oldfile, int readflag);
74 
75  void set_keep_flag(bool k) { keep_ = k; }
76  void close();
77 
78  void fetch();
79  void put();
80 
81  static void read_one(PSIO *psio, int itap, const char *label, double *ints,
82  int ntri, int erase, int printflg, std::string OutFileRMR);
83  static void write_one(PSIO *psio, int itap, const char *label, int ntri,
84  double *onel_ints);
85 
86  int read(int target_pq, double *ints, int *ioff_lt, int *ioff_rt,
87  int mp2, int printflg, std::string OutFileRMR);
88 
89  void write(int p, int q, int pq, int pqsym,
90  double *arr, int rmax, int *ioff, int *orbsym,
91  int *firsti, int *lasti, int printflag,
92  std::string OutFileRMR);
93  void write_matrix(int ptr, int qtr, double **mat, int rfirst, int rlast,
94  int sfirst, int slast, int *reorder, int reorder_offset,
95  int printflag, int *ioff, std::string OutFileRMR);
96  void write_value(int p, int q, int r, int s, double value, int printflag,
97  std::string OutFileRMR, int dirac);
98 
99  void flush(int lastbuf);
100  void to_end();
101 
102  };
103 
104 }
105 
106 #endif
int read(int target_pq, double *ints, int *ioff_lt, int *ioff_rt, int mp2, int printflg, std::string OutFileRMR)
static void write_one(PSIO *psio, int itap, const char *label, int ntri, double *onel_ints)
Definition: wrtone.cc:55
int bufszc_
Definition: iwl.hpp:42
psio_address & buffer_position()
Definition: iwl.hpp:62
static void read_one(PSIO *psio, int itap, const char *label, double *ints, int ntri, int erase, int printflg, std::string OutFileRMR)
Definition: rdone.cc:42
Value * values()
Definition: iwl.hpp:70
int lastbuf_
Definition: iwl.hpp:44
short int Label
Definition: libiwl/config.h:34
void fetch()
Definition: buf_fetch.cc:40
void to_end()
int itap_
Definition: iwl.hpp:39
PSIO * psio_
Definition: iwl.hpp:50
void write_matrix(int ptr, int qtr, double **mat, int rfirst, int rlast, int sfirst, int slast, int *reorder, int reorder_offset, int printflag, int *ioff, std::string OutFileRMR)
Definition: buf_wrt_mat.cc:73
int & ints_per_buffer()
Definition: iwl.hpp:63
Definition: libpsio/config.h:63
int ints_per_buf_
Definition: iwl.hpp:41
void flush(int lastbuf)
Definition: buf_flush.cc:40
int & last_buffer()
Definition: iwl.hpp:66
int & index()
Definition: iwl.hpp:68
int & buffer_count()
Definition: iwl.hpp:67
IWL()
Definition: buf_init.cc:44
void init(PSIO *psio, int itap, double cutoff, int oldfile, int readflag)
Definition: buf_init.cc:64
int & buffer_size()
Definition: iwl.hpp:64
int idx_
Definition: iwl.hpp:46
Label * labels_
Definition: iwl.hpp:47
double cutoff_
Definition: iwl.hpp:43
~IWL()
Definition: buf_close.cc:43
int & itap()
Definition: iwl.hpp:61
bool keep_
Definition: iwl.hpp:52
void write_value(int p, int q, int r, int s, double value, int printflag, std::string OutFileRMR, int dirac)
Definition: buf_wrt_val.cc:41
bool & keep()
Definition: iwl.hpp:71
void write(int p, int q, int pq, int pqsym, double *arr, int rmax, int *ioff, int *orbsym, int *firsti, int *lasti, int printflag, std::string OutFileRMR)
Definition: buf_wrt.cc:53
Label * labels()
Definition: iwl.hpp:69
void set_keep_flag(bool k)
Definition: iwl.hpp:75
void close()
Definition: buf_close.cc:48
Value * values_
Definition: iwl.hpp:48
void put()
Definition: buf_put.cc:40
int inbuf_
Definition: iwl.hpp:45
double Value
Definition: libiwl/config.h:35
EXTERN int * ioff
Definition: ccresponse/globals.h:48
psio_address bufpos_
Definition: iwl.hpp:40
Definition: iwl.hpp:38
double & cutoff()
Definition: iwl.hpp:65
Definition: psio.hpp:197