File: AtomToMoleculeTransfer.h

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (239 lines) | stat: -rw-r--r-- 5,735 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// A class for defining transfer operations molecular centers of mass (centroid), dipole moments, quadrupole moments

#ifndef ATOM_TO_MOLECULE_TRANSFER_H
#define ATOM_TO_MOLECULE_TRANSFER_H

#include <set>

// ATC_Method headers
#include "TransferOperator.h"
#include "MoleculeSet.h"
#include "PaqAtcUtility.h"

namespace ATC {

  // forward declarations
  class ATC_Method;

  /**
  * @class PerMoleculeQuantity
  *
  */

  template <typename T>
  class PerMoleculeQuantity : public DenseMatrixTransfer<T> {

  public:

  PerMoleculeQuantity(ATC_Method * atc):DenseMatrixTransfer<T>(), atc_(atc) {};

  virtual ~PerMoleculeQuantity() {};

  protected:

  /** utility object for atc information */
  ATC_Method * atc_;

  private:

  //do not define
  PerMoleculeQuantity();

  };


  /**
  *  @class  AtomtoSmallMoleculeTransfer
  *  @brief  Class for defining objects to transfer total mass or charge of a molecule
  */
  template <typename T>
  class AtomToSmallMoleculeTransfer : public PerMoleculeQuantity<T> {

  public:

    //constructor
    // had to define all functions in header, not sure why (JAT, 12/14/11)
    AtomToSmallMoleculeTransfer(ATC_Method * atc, PerAtomQuantity<T> * source, SmallMoleculeSet * smallMoleculeSet)  :
      PerMoleculeQuantity<T>(atc),
      source_(source),
    smallMoleculeSet_(smallMoleculeSet)
    {
      source_->register_dependence(this);
      smallMoleculeSet_->register_dependence(this);
    };

  //destructor
  virtual ~AtomToSmallMoleculeTransfer()
    {
      source_->remove_dependence(this);
      smallMoleculeSet_->remove_dependence(this);
    };

  //  apply transfer operator
  void reset_quantity() const
  {
    const DenseMatrix<T> & sourceMatrix(source_->quantity());
    int nLocalMol = smallMoleculeSet_->local_molecule_count();
    (this->quantity_).reset(nLocalMol,sourceMatrix.nCols());
    for (int i = 0;  i < nLocalMol ; i++) {
      const std::set<int> & atomsLocalMolArray =  smallMoleculeSet_->atoms_by_local_molecule(i);
      std::set<int>::const_iterator atomsLocalMolID;
      for (atomsLocalMolID = atomsLocalMolArray.begin(); atomsLocalMolID!= atomsLocalMolArray.end();atomsLocalMolID++) {
        for (int j = 0; j < sourceMatrix.nCols(); j++){
          (this->quantity_)(i,j) += sourceMatrix(*atomsLocalMolID,j);
        }
      }
    }
  };

  protected:

  // pointer to source atomic quantity data
  PerAtomQuantity<T> * source_;
  // pointer to molecule data
  SmallMoleculeSet  * smallMoleculeSet_;

  private:

  // do not define
  AtomToSmallMoleculeTransfer();

  };

  /**
   *  @class SmallMoleculeCentroid
   *  @brief  Class for defining objects to transfer molecular centroid (center of mass)
   */


  class SmallMoleculeCentroid : public AtomToSmallMoleculeTransfer<double> {

  public:

  //constructor
  SmallMoleculeCentroid(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions);

  //destructor
  virtual ~SmallMoleculeCentroid();

  // apply transfer operator
  virtual void reset_quantity() const;

  protected:

  // pointer to source atomic quantity date : positions of atoms in a molecule
  PerAtomQuantity<double> * atomPositions_;

  private:

  //do not define
  SmallMoleculeCentroid();

  };

  /**
   *  @class SmallMoleculeDipoleMoment
   *  @brief  Class for defining objects to transfer molecular dipole moments
   */

  class SmallMoleculeDipoleMoment : public SmallMoleculeCentroid {

  public:

  //constructor
  SmallMoleculeDipoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);

  //destructor
  virtual ~SmallMoleculeDipoleMoment();

  // apply transfer operator
  virtual void reset_quantity() const;

  protected:

  //pointer to the centroid data
  SmallMoleculeCentroid * centroid_;

  private:

  //do not define
  SmallMoleculeDipoleMoment();

};

  /**
   *  @class  AtomToFeTransfer
   *  @brief  Class for defining objects to transfer molecular quadrupole moments
   */


  class SmallMoleculeQuadrupoleMoment : public SmallMoleculeCentroid {

  public:

  //constructor
  SmallMoleculeQuadrupoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);

  //destructor
  virtual ~SmallMoleculeQuadrupoleMoment();

  //apply transfer operator
  virtual void reset_quantity() const;

  protected:

  //pointer to the centroid data
  SmallMoleculeCentroid * centroid_;

  private:

  //do not define
  SmallMoleculeQuadrupoleMoment();

  };

    /**
   *  @class  MotfShapeFunctionRestriction
   *  @brief  Class for defining objects that transfer atomistic quantities to FE using shape functions
   *          (implements restrict_volumetric_quantity)
   */

  class MotfShapeFunctionRestriction : public MatToMatTransfer<double> {

  public:

    // constructor
    MotfShapeFunctionRestriction(PerMoleculeQuantity<double> * source,
                                 SPAR_MAN * shapeFunction);

    // destructor
    virtual ~MotfShapeFunctionRestriction();

    /** apply transfer operator */
    virtual void reset_quantity() const;

  protected:

    /** reference to shape function matrix */
    SPAR_MAN * shapeFunction_;

    /** persistent workspace */


    mutable DENS_MAT _workspace_;

    /** applies restriction operation on this processor */
    virtual void local_restriction(const DENS_MAT & sourceMatrix,
                                   const SPAR_MAT & shapeFunctionMatrix) const;

  private:

    // do not define
    MotfShapeFunctionRestriction();

  };

}
#endif