| 1 | /*
 | 
|---|
| 2 |  * VMGJob.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Jul 12, 2012
 | 
|---|
| 5 |  *      Author: heber
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #ifndef VMGJOB_HPP_
 | 
|---|
| 9 | #define VMGJOB_HPP_
 | 
|---|
| 10 | 
 | 
|---|
| 11 | 
 | 
|---|
| 12 | // include config.h
 | 
|---|
| 13 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 14 | #include <config.h>
 | 
|---|
| 15 | #endif
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #include "boost/serialization/export.hpp"
 | 
|---|
| 18 | #include "boost/serialization/vector.hpp"
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "JobMarket/Jobs/FragmentJob.hpp"
 | 
|---|
| 21 | #include "Jobs/Grid/SamplingGrid.hpp"
 | 
|---|
| 22 | 
 | 
|---|
| 23 | #include <vector>
 | 
|---|
| 24 | 
 | 
|---|
| 25 | /** This class encapsulates a VMG Job.
 | 
|---|
| 26 |  *
 | 
|---|
| 27 |  *  VMGJob calculates the long-range contribution that is missed out so far in the
 | 
|---|
| 28 |  *  MPQCJob where the SCF cycle is calculated. To this end
 | 
|---|
| 29 |  *
 | 
|---|
| 30 |  */
 | 
|---|
| 31 | class VMGJob : public FragmentJob
 | 
|---|
| 32 | {
 | 
|---|
| 33 | public:
 | 
|---|
| 34 |   /** Constructor for class VMGJob.
 | 
|---|
| 35 |    *
 | 
|---|
| 36 |    * @param _JobId id of the job
 | 
|---|
| 37 |    * @param _begin offset of the domain
 | 
|---|
| 38 |    * @param _size edge length of the cubic(!) domain
 | 
|---|
| 39 |    * @param _level level is \f$2^{\text{level}}\f$ grid points
 | 
|---|
| 40 |    * @param _sampled_input vector of sampled points of the grid as right-hand side
 | 
|---|
| 41 |    */
 | 
|---|
| 42 |   VMGJob(const JobId_t _JobId,
 | 
|---|
| 43 |       const SamplingGrid &density_grid,
 | 
|---|
| 44 |       const std::vector< std::vector< double > > &_particle_positions,
 | 
|---|
| 45 |       const std::vector< double > &_particle_charges);
 | 
|---|
| 46 |   virtual ~VMGJob();
 | 
|---|
| 47 | 
 | 
|---|
| 48 |   FragmentResult::ptr Work();
 | 
|---|
| 49 | 
 | 
|---|
| 50 | private:
 | 
|---|
| 51 |   void InitVMG();
 | 
|---|
| 52 | 
 | 
|---|
| 53 | private:
 | 
|---|
| 54 |   //!> sampled density required as input
 | 
|---|
| 55 |   const SamplingGrid density_grid;
 | 
|---|
| 56 |   //!> sampled potential as output of the job
 | 
|---|
| 57 |   SamplingGrid potential_grid;
 | 
|---|
| 58 |   //!> positions of all nuclei
 | 
|---|
| 59 |   const std::vector< std::vector< double > > particle_positions;
 | 
|---|
| 60 |   //!> charges of all nuclei
 | 
|---|
| 61 |   const std::vector< double > particle_charges;
 | 
|---|
| 62 | 
 | 
|---|
| 63 | private:
 | 
|---|
| 64 |   /** private default cstor for serialization only
 | 
|---|
| 65 |    */
 | 
|---|
| 66 |   VMGJob();
 | 
|---|
| 67 | 
 | 
|---|
| 68 |   friend class boost::serialization::access;
 | 
|---|
| 69 |   // serialization
 | 
|---|
| 70 |   template <typename Archive>
 | 
|---|
| 71 |   void serialize(Archive& ar, const unsigned int version)
 | 
|---|
| 72 |   {
 | 
|---|
| 73 |     ar & boost::serialization::base_object<FragmentJob>(*this);
 | 
|---|
| 74 |     ar & const_cast< SamplingGrid &>(density_grid);
 | 
|---|
| 75 |     ar & potential_grid;
 | 
|---|
| 76 |     ar & const_cast< std::vector< std::vector< double > > &>(particle_positions);
 | 
|---|
| 77 |     ar & const_cast< std::vector< double > &>(particle_charges);
 | 
|---|
| 78 |   }
 | 
|---|
| 79 | };
 | 
|---|
| 80 | 
 | 
|---|
| 81 | // we need to give this class a unique key for serialization
 | 
|---|
| 82 | // its is only serialized through its base class FragmentJob
 | 
|---|
| 83 | BOOST_CLASS_EXPORT_KEY(VMGJob)
 | 
|---|
| 84 | 
 | 
|---|
| 85 | #endif /* VMGJOB_HPP_ */
 | 
|---|