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  static void read_two(PSIO *psio, int itap, double *ints, int *ioff,
86  int norbs, int nfzc, int nfzv, int printflg, std::string OutFileRMR);
87  static void write_two(PSIO *psio, int itap, int nbfso, double *ints,
88  int *ioff, double toler, int printflg, std::string OutFileRMR);
89 
90  int read(int target_pq, double *ints, int *ioff_lt, int *ioff_rt,
91  int mp2, int printflg, std::string OutFileRMR);
92  int read_all(double *ints, int *ioff_lt, int *ioff_rt, int no_pq_perm,
93  int *ioff, int printflg, std::string OutFileRMR);
94  int read_all2(double **ints, int *ioff_lt, int *ioff_rt, int no_pq_perm,
95  int *ioff, int printflg, std::string OutFileRMR);
96  int read_all_active(double *ints,
97  int *ioff_lt, int *ioff_rt, int no_pq_perm, int *ioff,
98  int fstact, int lstact, int printflg,std::string OutFileRMR);
99  int read_all_mp2r12a(double *ints, int *ioff_lt, int *ioff_rt,
100  int bra_ket_symm, int *ioff, int printflg, std::string OutFileRMR);
101  int read_array(int target_pq, double *ints, int *rlist, int *slist,
102  int *size, int *ioff, int printflg, std::string OutFileRMR);
103  int read_array2(double *ints, int *plist, int *qlist, int *rlist,
104  int *slist, int *size, int *ioff, int printflg, std::string OutFileRMR);
105 
106  void write(int p, int q, int pq, int pqsym,
107  double *arr, int rmax, int *ioff, int *orbsym,
108  int *firsti, int *lasti, int printflag,
109  std::string OutFileRMR);
110  void write_all(int nbfso, double *ints, int *ioff, int printflg,
111  std::string OutFileRMR);
112  void write_mp2(int p, int q, int pq,
113  int pqsym, double **arr, int rsym, int *firstr, int *lastr,
114  int *firsts, int *lasts, int *occ, int *vir, int *ioff,
115  int printflag, std::string OutFileRMR);
116  void write_mp2r12a(int p, int q, int pq, int pqsym, double **arr,
117  int rsym, int *firstr, int *lastr, int *firsts, int *lasts,
118  int *occ, int bra_ket_symm, int *ioff, int printflag,
119  std::string OutFileRMR);
120  void write_array(double *arr, int *p, int *q, int *r, int *s, long int size);
121  void write_array_SI(double *arr, short int *p, short int *q, short int *r,
122  short int *s, int size);
123  void write_array_SI_nocut(double *arr, short int *p, short int *q,
124  short int *r, short int *s, int size);
125  void write_array2(double *arr, int p, int q, int *rlist, int *slist,
126  int size, int printflag, std::string OutFileRMR);
127  void write_matrix(int ptr, int qtr, double **mat, int rfirst, int rlast,
128  int sfirst, int slast, int *reorder, int reorder_offset,
129  int printflag, int *ioff, std::string OutFileRMR);
130  void write_matrix2(int ptr, int qtr, double **mat, int rfirst, int rlast,
131  int sfirst, int slast, int *reorder, int reorder_offset,
132  int printflag, int *ioff, std::string OutFileRMR);
133  void write_value(int p, int q, int r, int s, double value, int printflag,
134  std::string OutFileRMR, int dirac);
135  void write_value_SI(short int p, short int q,
136  short int r, short int s, double value, int printflag,
137  std::string OutFileRMR, int dirac);
138 
139  void flush(int lastbuf);
140  void to_end();
141 
142  static void sort_buffer(IWL *Inbuf, IWL *Outbuf,
143  double *ints, int fpq, int lpq, int *ioff, int *ioff2,
144  int nbfso, int elbert, int intermediate, int no_pq_perm,
145  int qdim, int add, int printflg, std::string OutFileRMR);
146  static void sort_buffer_pk(IWL* inbuf, int out_tape, int is_exch,
147  double *ints, unsigned int fpq, unsigned int lpq,
148  int *so2ind, int *so2sym, int*pksymoff, int printflg,
149  std::string out);
150  };
151 
152 }
153 
154 #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:44
int bufszc_
Definition: iwl.hpp:42
psio_address & buffer_position()
Definition: iwl.hpp:62
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:45
double dirac(double x,...)
dirac(...) = 0.0 for all x
Definition: utility.h:42
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
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:54
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()
Definition: buf_toend.cc:42
int itap_
Definition: iwl.hpp:39
PSIO * psio_
Definition: iwl.hpp:50
int & ints_per_buffer()
Definition: iwl.hpp:63
Definition: libpsio/config.h:65
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:41
int ints_per_buf_
Definition: iwl.hpp:41
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:41
void flush(int lastbuf)
Definition: buf_flush.cc:40
int & last_buffer()
Definition: iwl.hpp:66
int & index()
Definition: iwl.hpp:68
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:44
int & buffer_count()
Definition: iwl.hpp:67
void write_all(int nbfso, double *ints, int *ioff, int printflg, std::string OutFileRMR)
Definition: buf_wrt_all.cc:41
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:45
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:41
IWL()
Definition: buf_init.cc:42
void init(PSIO *psio, int itap, double cutoff, int oldfile, int readflag)
Definition: buf_init.cc:62
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:41
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:98
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
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:45
void write_array(double *arr, int *p, int *q, int *r, int *s, long int size)
Definition: buf_wrt_arr.cc:41
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
Label * labels()
Definition: iwl.hpp:69
void set_keep_flag(bool k)
Definition: iwl.hpp:75
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:120
static void write_one(PSIO *psio, int itap, const char *label, int ntri, double *onel_ints)
Definition: wrtone.cc:40
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:41
void close()
Definition: buf_close.cc:48
Value * values_
Definition: iwl.hpp:48
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:289
void put()
Definition: buf_put.cc:40
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:44
int inbuf_
Definition: iwl.hpp:45
static void write_two(PSIO *psio, int itap, int nbfso, double *ints, int *ioff, double toler, int printflg, std::string OutFileRMR)
Definition: wrttwo.cc:41
double Value
Definition: libiwl/config.h:35
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:45
EXTERN int * ioff
Definition: ccresponse/globals.h:47
psio_address bufpos_
Definition: iwl.hpp:40
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:41
Definition: iwl.hpp:38
double & cutoff()
Definition: iwl.hpp:65
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:46
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:41
Definition: psio.hpp:197