| [d2a0f6d] | 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" | 
|---|
| [fbf143] | 21 | #include "Fragmentation/Summation/SetValues/SamplingGrid.hpp" | 
|---|
|  | 22 | #include "Fragmentation/Summation/Containers/VMGData.hpp" | 
|---|
| [d2a0f6d] | 23 |  | 
|---|
|  | 24 | #include <vector> | 
|---|
|  | 25 |  | 
|---|
|  | 26 | /** This class encapsulates a VMG Job. | 
|---|
|  | 27 | * | 
|---|
|  | 28 | *  VMGJob calculates the long-range contribution that is missed out so far in the | 
|---|
|  | 29 | *  MPQCJob where the SCF cycle is calculated. To this end | 
|---|
|  | 30 | * | 
|---|
|  | 31 | */ | 
|---|
|  | 32 | class VMGJob : public FragmentJob | 
|---|
|  | 33 | { | 
|---|
|  | 34 | public: | 
|---|
|  | 35 | /** Constructor for class VMGJob. | 
|---|
|  | 36 | * | 
|---|
|  | 37 | * @param _JobId id of the job | 
|---|
| [065574] | 38 | * @param _density_grid sampled electron charge density from short-range solutions | 
|---|
|  | 39 | * @param _particle_positions position per nuclei | 
|---|
|  | 40 | * @param _particle_charges charges per nuclei | 
|---|
|  | 41 | * @param _near_field_cells number of grid-points used to smear our nuclei charge | 
|---|
| [cd2591] | 42 | * @param _interpolation_degree degree of interpolation polynomial for getting nuclei | 
|---|
|  | 43 | *        potential from grid | 
|---|
| [e2925fd] | 44 | * @param _DoImportParticles whether we import particles (true) or evaluate only | 
|---|
| [b6b21a] | 45 | * @param _DoPrintDebug whether we do print grid for debug visualization or not | 
|---|
| [17e4fd] | 46 | * @param _OpenBoundaryConditions whether we have open (true) boundary conditions or periodic (false) | 
|---|
|  | 47 | * @param _DoSmearCharges whether to smear out electronic charge distributions with bsplines or not | 
|---|
| [d2a0f6d] | 48 | */ | 
|---|
| [d12d621] | 49 | VMGJob(const JobId_t _JobId, | 
|---|
| [cd77fc] | 50 | const SamplingGrid &density_grid, | 
|---|
|  | 51 | const std::vector< std::vector< double > > &_particle_positions, | 
|---|
| [065574] | 52 | const std::vector< double > &_particle_charges, | 
|---|
| [cd2591] | 53 | const size_t _near_field_cells, | 
|---|
| [b6b21a] | 54 | const size_t _interpolation_degree, | 
|---|
| [e2925fd] | 55 | const bool _DoImportParticles=true, | 
|---|
| [ee9018] | 56 | const bool _DoPrintDebug=false, | 
|---|
| [17e4fd] | 57 | const bool _OpenBoundaryConditions=false, | 
|---|
|  | 58 | const bool _DoSmearCharges=false | 
|---|
| [cd2591] | 59 | ); | 
|---|
| [d2a0f6d] | 60 | virtual ~VMGJob(); | 
|---|
|  | 61 |  | 
|---|
|  | 62 | FragmentResult::ptr Work(); | 
|---|
|  | 63 |  | 
|---|
| [e9cfc4] | 64 | private: | 
|---|
|  | 65 | void InitVMG(); | 
|---|
|  | 66 |  | 
|---|
| [a82602] | 67 | void InitVMGArrays(); | 
|---|
|  | 68 |  | 
|---|
| [d2a0f6d] | 69 | private: | 
|---|
| [28c025] | 70 | //!> sampled density required as input | 
|---|
|  | 71 | const SamplingGrid density_grid; | 
|---|
| [cd77fc] | 72 | //!> positions of all nuclei | 
|---|
|  | 73 | const std::vector< std::vector< double > > particle_positions; | 
|---|
|  | 74 | //!> charges of all nuclei | 
|---|
|  | 75 | const std::vector< double > particle_charges; | 
|---|
| [065574] | 76 | //!> near field cells used in smearing out core charge density | 
|---|
|  | 77 | const size_t near_field_cells; | 
|---|
| [cd2591] | 78 | //!> interpolation degree used in sampling the potential of the nuclei | 
|---|
|  | 79 | const size_t interpolation_degree; | 
|---|
| [e2925fd] | 80 | //!> whether we import particles (true) or evaluate only | 
|---|
|  | 81 | const bool DoImportParticles; | 
|---|
| [b6b21a] | 82 | //!> whether we do print grid for debug visualization or not | 
|---|
|  | 83 | const bool DoPrintDebug; | 
|---|
| [ee9018] | 84 | //!> whether we have open (true) boundary conditions or periodic (false) | 
|---|
|  | 85 | const bool OpenBoundaryConditions; | 
|---|
| [17e4fd] | 86 | //!> whether to smear out electronic charge distributions with bsplines or not | 
|---|
|  | 87 | const bool DoSmearCharges; | 
|---|
| [d2a0f6d] | 88 |  | 
|---|
| [2bc560] | 89 | private: | 
|---|
|  | 90 | //!> temporary instance to hold return data | 
|---|
|  | 91 | VMGData returndata; | 
|---|
|  | 92 |  | 
|---|
| [e089fb] | 93 | /** This structure stores particle values per particle. | 
|---|
|  | 94 | * | 
|---|
|  | 95 | * \note This structure contains temporary information needed during solving | 
|---|
|  | 96 | * with VMG. | 
|---|
|  | 97 | * \warning It is specifically not serialized! | 
|---|
|  | 98 | * | 
|---|
|  | 99 | */ | 
|---|
|  | 100 | struct particle_arrays { | 
|---|
|  | 101 | particle_arrays(); | 
|---|
|  | 102 | ~particle_arrays(); | 
|---|
|  | 103 |  | 
|---|
|  | 104 | /** Initializes arrays. | 
|---|
|  | 105 | * | 
|---|
|  | 106 | * @param _num_particles size of array per dimension | 
|---|
|  | 107 | */ | 
|---|
|  | 108 | void init(const size_t _num_particles); | 
|---|
|  | 109 |  | 
|---|
|  | 110 | //!> number of particles | 
|---|
|  | 111 | size_t num_particles; | 
|---|
|  | 112 | //!> forces array | 
|---|
|  | 113 | double *f; | 
|---|
|  | 114 | //!> position array | 
|---|
|  | 115 | double *x; | 
|---|
|  | 116 | //!> potential array | 
|---|
|  | 117 | double *p; | 
|---|
|  | 118 | //!> charge array | 
|---|
|  | 119 | double *q; | 
|---|
|  | 120 | } particles; | 
|---|
| [a82602] | 121 |  | 
|---|
| [d2a0f6d] | 122 | private: | 
|---|
|  | 123 | /** private default cstor for serialization only | 
|---|
|  | 124 | */ | 
|---|
|  | 125 | VMGJob(); | 
|---|
|  | 126 |  | 
|---|
|  | 127 | friend class boost::serialization::access; | 
|---|
|  | 128 | // serialization | 
|---|
|  | 129 | template <typename Archive> | 
|---|
|  | 130 | void serialize(Archive& ar, const unsigned int version) | 
|---|
|  | 131 | { | 
|---|
|  | 132 | ar & boost::serialization::base_object<FragmentJob>(*this); | 
|---|
| [28c025] | 133 | ar & const_cast< SamplingGrid &>(density_grid); | 
|---|
| [cd77fc] | 134 | ar & const_cast< std::vector< std::vector< double > > &>(particle_positions); | 
|---|
|  | 135 | ar & const_cast< std::vector< double > &>(particle_charges); | 
|---|
| [065574] | 136 | ar & const_cast< size_t &>(near_field_cells); | 
|---|
| [cd2591] | 137 | ar & const_cast< size_t &>(interpolation_degree); | 
|---|
| [e2925fd] | 138 | ar & const_cast< bool &>(DoImportParticles); | 
|---|
| [b6b21a] | 139 | ar & const_cast< bool &>(DoPrintDebug); | 
|---|
| [f6c19d] | 140 | ar & const_cast< bool &>(OpenBoundaryConditions); | 
|---|
| [17e4fd] | 141 | ar & const_cast< bool &>(DoSmearCharges); | 
|---|
| [2bc560] | 142 | ar & returndata; | 
|---|
| [d2a0f6d] | 143 | } | 
|---|
|  | 144 | }; | 
|---|
|  | 145 |  | 
|---|
|  | 146 | // we need to give this class a unique key for serialization | 
|---|
|  | 147 | // its is only serialized through its base class FragmentJob | 
|---|
|  | 148 | BOOST_CLASS_EXPORT_KEY(VMGJob) | 
|---|
|  | 149 |  | 
|---|
|  | 150 | #endif /* VMGJOB_HPP_ */ | 
|---|