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-2018 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 PSI_API 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  IWL();
56  IWL(PSIO *psio, int itap, double cutoff, int oldfile, int readflag);
57  ~IWL();
58 
59  // Accessor functions to data
60  int &itap() { return itap_; }
61  psio_address &buffer_position() { return bufpos_; }
62  int &ints_per_buffer() { return ints_per_buf_; }
63  int &buffer_size() { return bufszc_; }
64  double &cutoff() { return cutoff_; }
65  int &last_buffer() { return lastbuf_; }
66  int &buffer_count() { return inbuf_; }
67  int &index() { return idx_; }
68  Label *labels() { return labels_; }
69  Value *values() { return values_; }
70  bool &keep() { return keep_; }
71 
72  void init(PSIO *psio, int itap, double cutoff, int oldfile, int readflag);
73 
74  void set_keep_flag(bool k) { keep_ = k; }
75  void close();
76 
77  void fetch();
78  void put();
79 
80  static void read_one(PSIO *psio, int itap, const char *label, double *ints, int ntri, int erase, int printflg,
81  std::string OutFileRMR);
82  static void write_one(PSIO *psio, int itap, const char *label, int ntri, double *onel_ints);
83 
84  int read(int target_pq, double *ints, int *ioff_lt, int *ioff_rt, int mp2, int printflg, std::string OutFileRMR);
85 
86  void write(int p, int q, int pq, int pqsym, double *arr, int rmax, int *ioff, int *orbsym, int *firsti, int *lasti,
87  int printflag, std::string OutFileRMR);
88  void write_matrix(int ptr, int qtr, double **mat, int rfirst, int rlast, int sfirst, int slast, int *reorder,
89  int reorder_offset, int printflag, int *ioff, std::string OutFileRMR);
90  void write_value(int p, int q, int r, int s, double value, int printflag, std::string OutFileRMR, int dirac);
91 
92  void flush(int lastbuf);
93  void to_end();
94 };
95 }
96 
97 #endif
int bufszc_
Definition: iwl.hpp:42
psio_address & buffer_position()
Definition: iwl.hpp:61
Value * values()
Definition: iwl.hpp:69
int lastbuf_
Definition: iwl.hpp:44
short int Label
Definition: libiwl/config.h:34
int itap_
Definition: iwl.hpp:39
PSIO * psio_
Definition: iwl.hpp:50
int & ints_per_buffer()
Definition: iwl.hpp:62
Definition: libpsio/config.h:65
int ints_per_buf_
Definition: iwl.hpp:41
int & last_buffer()
Definition: iwl.hpp:65
int & index()
Definition: iwl.hpp:67
int & buffer_count()
Definition: iwl.hpp:66
int & buffer_size()
Definition: iwl.hpp:63
int idx_
Definition: iwl.hpp:46
Label * labels_
Definition: iwl.hpp:47
double cutoff_
Definition: iwl.hpp:43
int & itap()
Definition: iwl.hpp:60
bool keep_
Definition: iwl.hpp:52
bool & keep()
Definition: iwl.hpp:70
Label * labels()
Definition: iwl.hpp:68
void set_keep_flag(bool k)
Definition: iwl.hpp:74
Value * values_
Definition: iwl.hpp:48
#define PSI_API
Definition: pragma.h:155
int inbuf_
Definition: iwl.hpp:45
double Value
Definition: libiwl/config.h:35
EXTERN int * ioff
Definition: cc/ccresponse/globals.h:48
psio_address bufpos_
Definition: iwl.hpp:40
Definition: iwl.hpp:38
double & cutoff()
Definition: iwl.hpp:64
Definition: psio.hpp:195