r12ia.h

00001 //
00002 // r12ia.h
00003 //
00004 // Copyright (C) 2002 Edward Valeev
00005 //
00006 // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
00007 // Maintainer: EV
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _chemistry_qc_mbptr12_r12ia_h
00029 #define _chemistry_qc_mbptr12_r12ia_h
00030 
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <vector>
00036 #include <util/ref/ref.h>
00037 #include <util/state/state.h>
00038 #include <util/state/statein.h>
00039 #include <util/state/stateout.h>
00040 #include <util/group/memory.h>
00041 
00042 using namespace std;
00043 
00044 namespace sc {
00045 
00047 
00070 class R12IntsAcc: virtual public SavableState {
00071 
00072     int num_te_types_;  // Number of types of integrals in a block (in R12 theories -- usually 3)
00073 
00074    protected:
00075     int ni_, nj_;
00076     int nx_, ny_;
00077     size_t nxy_;        // nx_ * ny_  - the number of integrals of one type in a block
00078     size_t blksize_;    // the same in bytes
00079     size_t blocksize_;  // hence the size of the block of num_te_types of integrals is blksize_ * num_te_types
00080     
00081     int next_orbital_;  // The first index of the next batch to be stored
00082     bool committed_;    // Whether all data has been written out and ready to be read
00083     bool active_;       // Whether ready to read data
00084 
00086     virtual int ntasks() const =0;
00088     virtual int taskid() const =0;
00090     void inc_next_orbital(int ni);
00091 
00092   public:
00093     R12IntsAcc(int num_te_types, int ni, int nj, int nx, int ny);
00094     R12IntsAcc(StateIn&);
00095     ~R12IntsAcc();
00096     void save_data_state(StateOut&);
00097 
00099     enum tbint_type { eri=0, r12=1, r12t1=2, r12t2=3};
00100     static const int max_num_te_types_ = 4;
00101 
00103     int num_te_types() const { return num_te_types_; };
00105     int ni() const { return ni_; }
00107     int nj() const { return nj_; }
00109     int nx() const { return nx_; }
00111     int ny() const { return ny_; }
00113     size_t blocksize() const { return blksize_; };
00115     int next_orbital() const;
00116 
00129     virtual void store_memorygrp(Ref<MemoryGrp>& mem, int ni, const size_t blksize = 0) =0;
00133     virtual void store_pair_block(int i, int j, double *ints)=0;
00135     virtual void commit();
00137     bool is_committed() { return committed_; }
00139     virtual void activate();
00141     virtual void deactivate();
00143     const bool is_active() { return active_; }
00145     virtual double* retrieve_pair_block(int i, int j, tbint_type oper_type) =0;
00147     virtual void release_pair_block(int i, int j, tbint_type oper_type) =0;
00149     virtual bool is_local(int i, int j) const =0;
00151     virtual bool is_avail(int i, int j) const =0;
00153     virtual bool has_access(int proc) const =0;
00157     int tasks_with_access(vector<int>& twa_map) const;
00159     virtual bool can_restart() const =0;
00160 };
00161 
00162 }
00163 
00164 #endif
00165 
00166 // Local Variables:
00167 // mode: c++
00168 // c-file-style: "CLJ"
00169 // End:

Generated at Mon Dec 3 23:23:40 2007 for MPQC 2.3.1 using the documentation package Doxygen 1.5.2.