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 program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_lib_libiwl_iwl_hpp_
29 #define _psi_src_lib_libiwl_iwl_hpp_
30 
31 #include <cstdio>
32 #include "psi4/libpsio/psio.hpp"
33 #include "config.h"
34 
35 namespace psi {
36 
37  class IWL {
38  int itap_; /* tape number for input file */
39  psio_address bufpos_; /* current page/offset */
40  int ints_per_buf_; /* integrals per buffer */
41  int bufszc_; /* buffer size in characters (bytes) */
42  double cutoff_; /* cutoff value for writing */
43  int lastbuf_; /* is this the last IWL buffer? 1=yes,0=no */
44  int inbuf_; /* how many ints in current buffer? */
45  int idx_; /* index of integral in current buffer */
46  Label *labels_; /* pointer to where integral values begin */
47  Value *values_; /* integral values */
51  bool keep_;
52 
53  public:
54 
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_; }
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,
81  int ntri, int erase, int printflg, std::string OutFileRMR);
82  static void write_one(PSIO *psio, int itap, const char *label, int ntri,
83  double *onel_ints);
84  static void read_two(PSIO *psio, int itap, double *ints, int *ioff,
85  int norbs, int nfzc, int nfzv, int printflg, std::string OutFileRMR);
86  static void write_two(PSIO *psio, int itap, int nbfso, double *ints,
87  int *ioff, double toler, int printflg, std::string OutFileRMR);
88 
89  int read(int target_pq, double *ints, int *ioff_lt, int *ioff_rt,
90  int mp2, int printflg, std::string OutFileRMR);
91  int read_all(double *ints, int *ioff_lt, int *ioff_rt, int no_pq_perm,
92  int *ioff, int printflg, std::string OutFileRMR);
93  int read_all2(double **ints, int *ioff_lt, int *ioff_rt, int no_pq_perm,
94  int *ioff, int printflg, std::string OutFileRMR);
95  int read_all_active(double *ints,
96  int *ioff_lt, int *ioff_rt, int no_pq_perm, int *ioff,
97  int fstact, int lstact, int printflg,std::string OutFileRMR);
98  int read_all_mp2r12a(double *ints, int *ioff_lt, int *ioff_rt,
99  int bra_ket_symm, int *ioff, int printflg, std::string OutFileRMR);
100  int read_array(int target_pq, double *ints, int *rlist, int *slist,
101  int *size, int *ioff, int printflg, std::string OutFileRMR);
102  int read_array2(double *ints, int *plist, int *qlist, int *rlist,
103  int *slist, int *size, int *ioff, int printflg, std::string OutFileRMR);
104 
105  void write(int p, int q, int pq, int pqsym,
106  double *arr, int rmax, int *ioff, int *orbsym,
107  int *firsti, int *lasti, int printflag,
108  std::string OutFileRMR);
109  void write_all(int nbfso, double *ints, int *ioff, int printflg,
110  std::string OutFileRMR);
111  void write_mp2(int p, int q, int pq,
112  int pqsym, double **arr, int rsym, int *firstr, int *lastr,
113  int *firsts, int *lasts, int *occ, int *vir, int *ioff,
114  int printflag, std::string OutFileRMR);
115  void write_mp2r12a(int p, int q, int pq, int pqsym, double **arr,
116  int rsym, int *firstr, int *lastr, int *firsts, int *lasts,
117  int *occ, int bra_ket_symm, int *ioff, int printflag,
118  std::string OutFileRMR);
119  void write_array(double *arr, int *p, int *q, int *r, int *s, long int size);
120  void write_array_SI(double *arr, short int *p, short int *q, short int *r,
121  short int *s, int size);
122  void write_array_SI_nocut(double *arr, short int *p, short int *q,
123  short int *r, short int *s, int size);
124  void write_array2(double *arr, int p, int q, int *rlist, int *slist,
125  int size, int printflag, std::string OutFileRMR);
126  void write_matrix(int ptr, int qtr, double **mat, int rfirst, int rlast,
127  int sfirst, int slast, int *reorder, int reorder_offset,
128  int printflag, int *ioff, std::string OutFileRMR);
129  void write_matrix2(int ptr, int qtr, double **mat, int rfirst, int rlast,
130  int sfirst, int slast, int *reorder, int reorder_offset,
131  int printflag, int *ioff, std::string OutFileRMR);
132  void write_value(int p, int q, int r, int s, double value, int printflag,
133  std::string OutFileRMR, int dirac);
134  void write_value_SI(short int p, short int q,
135  short int r, short int s, double value, int printflag,
136  std::string OutFileRMR, int dirac);
137 
138  void flush(int lastbuf);
139  void to_end();
140 
141  static void sort_buffer(IWL *Inbuf, IWL *Outbuf,
142  double *ints, int fpq, int lpq, int *ioff, int *ioff2,
143  int nbfso, int elbert, int intermediate, int no_pq_perm,
144  int qdim, int add, int printflg, std::string OutFileRMR);
145  static void sort_buffer_pk(IWL* inbuf, int out_tape, int is_exch,
146  double *ints, unsigned int fpq, unsigned int lpq,
147  int *so2ind, int *so2sym, int*pksymoff, int printflg,
148  std::string out);
149  };
150 
151 }
152 
153 #endif
int read(int target_pq, double *ints, int *ioff_lt, int *ioff_rt, int mp2, int printflg, std::string OutFileRMR)
Definition: buf_rd.cc:43
int bufszc_
Definition: iwl.hpp:41
psio_address & buffer_position()
Definition: iwl.hpp:61
int read_all_active(double *ints, int *ioff_lt, int *ioff_rt, int no_pq_perm, int *ioff, int fstact, int lstact, int printflg, std::string OutFileRMR)
Definition: buf_rd_all_act.cc:44
double dirac(double x,...)
dirac(...) = 0.0 for all x
Definition: utility.h:41
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:41
static void sort_buffer(IWL *Inbuf, IWL *Outbuf, double *ints, int fpq, int lpq, int *ioff, int *ioff2, int nbfso, int elbert, int intermediate, int no_pq_perm, int qdim, int add, int printflg, std::string OutFileRMR)
Definition: sortbuf.cc:53
Value * values()
Definition: iwl.hpp:69
int lastbuf_
Definition: iwl.hpp:43
short int Label
Definition: libiwl/config.h:33
void fetch()
Definition: buf_fetch.cc:39
void to_end()
Definition: buf_toend.cc:41
int itap_
Definition: iwl.hpp:38
PSIO * psio_
Definition: iwl.hpp:49
int & ints_per_buffer()
Definition: iwl.hpp:62
Definition: libpsio/config.h:64
void write_array_SI(double *arr, short int *p, short int *q, short int *r, short int *s, int size)
Definition: buf_wrt_arr_SI.cc:40
int ints_per_buf_
Definition: iwl.hpp:40
void write_array_SI_nocut(double *arr, short int *p, short int *q, short int *r, short int *s, int size)
Definition: buf_wrt_arr_SI_nocut.cc:40
void flush(int lastbuf)
Definition: buf_flush.cc:39
int & last_buffer()
Definition: iwl.hpp:65
int & index()
Definition: iwl.hpp:67
int read_array2(double *ints, int *plist, int *qlist, int *rlist, int *slist, int *size, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_rd_arr2.cc:43
int & buffer_count()
Definition: iwl.hpp:66
void write_all(int nbfso, double *ints, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_wrt_all.cc:40
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:44
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:40
IWL()
Definition: buf_init.cc:41
void init(PSIO *psio, int itap, double cutoff, int oldfile, int readflag)
Definition: buf_init.cc:61
void write_mp2(int p, int q, int pq, int pqsym, double **arr, int rsym, int *firstr, int *lastr, int *firsts, int *lasts, int *occ, int *vir, int *ioff, int printflag, std::string OutFileRMR)
Definition: buf_wrt_mp2.cc:40
void write_matrix2(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:97
int & buffer_size()
Definition: iwl.hpp:63
int idx_
Definition: iwl.hpp:45
Label * labels_
Definition: iwl.hpp:46
double cutoff_
Definition: iwl.hpp:42
~IWL()
Definition: buf_close.cc:42
int & itap()
Definition: iwl.hpp:60
bool keep_
Definition: iwl.hpp:51
int read_array(int target_pq, double *ints, int *rlist, int *slist, int *size, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_rd_arr.cc:44
void write_array(double *arr, int *p, int *q, int *r, int *s, long int size)
Definition: buf_wrt_arr.cc:40
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:40
bool & keep()
Definition: iwl.hpp:70
Label * labels()
Definition: iwl.hpp:68
void set_keep_flag(bool k)
Definition: iwl.hpp:74
int read_all2(double **ints, int *ioff_lt, int *ioff_rt, int no_pq_perm, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_rd_all.cc:119
static void write_one(PSIO *psio, int itap, const char *label, int ntri, double *onel_ints)
Definition: wrtone.cc:39
void write_mp2r12a(int p, int q, int pq, int pqsym, double **arr, int rsym, int *firstr, int *lastr, int *firsts, int *lasts, int *occ, int bra_ket_symm, int *ioff, int printflag, std::string OutFileRMR)
Definition: buf_wrt_mp2r12a.cc:40
void close()
Definition: buf_close.cc:47
Value * values_
Definition: iwl.hpp:47
static void sort_buffer_pk(IWL *inbuf, int out_tape, int is_exch, double *ints, unsigned int fpq, unsigned int lpq, int *so2ind, int *so2sym, int *pksymoff, int printflg, std::string out)
Definition: sortbuf.cc:288
void put()
Definition: buf_put.cc:39
static void read_two(PSIO *psio, int itap, double *ints, int *ioff, int norbs, int nfzc, int nfzv, int printflg, std::string OutFileRMR)
Definition: rdtwo.cc:43
int inbuf_
Definition: iwl.hpp:44
static void write_two(PSIO *psio, int itap, int nbfso, double *ints, int *ioff, double toler, int printflg, std::string OutFileRMR)
Definition: wrttwo.cc:40
double Value
Definition: libiwl/config.h:34
int read_all_mp2r12a(double *ints, int *ioff_lt, int *ioff_rt, int bra_ket_symm, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_rd_all_mp2r12a.cc:44
EXTERN int * ioff
Definition: ccresponse/globals.h:46
psio_address bufpos_
Definition: iwl.hpp:39
void write_value_SI(short int p, short int q, short int r, short int s, double value, int printflag, std::string OutFileRMR, int dirac)
Definition: buf_wrt_val_SI.cc:40
Definition: iwl.hpp:37
double & cutoff()
Definition: iwl.hpp:64
int read_all(double *ints, int *ioff_lt, int *ioff_rt, int no_pq_perm, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_rd_all.cc:45
void write_array2(double *arr, int p, int q, int *rlist, int *slist, int size, int printflag, std::string OutFileRMR)
Definition: buf_wrt_arr2.cc:40
Definition: psio.hpp:196