C++ mpi module for stochmagnet_main Package
SM_Material.h
1 #ifndef SM_Material_H
2 #define SM_Material_H
3 
4 //super class header
5 #include "SM_Object.h"
6 
7 //constant header
8 #include "SM_Constants.h"
9 
10 //array utilities functions header
11 #include "functions_array.h"
12 
13 //crystal struature of the material
14 #include "SM_CrystalStructure.h"
15 
61 class SM_Material : public SM_Object {
62 
63  //attributes
64 private :
65 
66  //physical variables
67  //==================
68 
69 
70 
71  //atomic spin moment in Mu_B factor
72  tReal mMu_s;
73  //atomic spin moment in unit of internal system
74  tReal mMu_s_SIU;
75 
76  //exchange energy factor
77  tReal mJ;
78 
79  //dmi energy factor
80  std::array<tReal,SM_Constants::DIM> mD;
81 
82  //spin wave MF correction
83  tReal mEpsilon;
84 
85 
86  //crystal type
87  tFlag mCrystalType;
88 
89  //anisotropy energy factor
90  tReal mK;
91 
92  //anisotropy direction
93  std::valarray<tReal> mU;
94 
95 
96  //name of the material
97  tString mName;
98 
99  //crystal structure
100  CORE_UniquePointer<SM_CrystalStructure> mCrystalStructure;
101 
102  //Characteristic variables
103  //==========================
104 
105 
106  //characteristic energy in joules : \f$ \bar e = \mu_0 . \mu_s^2 a^{-3} \f$
107  tReal mCEnergy;
108  //characteristic field in T : \f$ \bar h = \mu_0 . \mu_s a^{-3} \f$
109  tReal mCField;
110  //characteritisc time in s : \f$ \bar t=\frac{a^3}{\gamma.\mu_0.\mu_s} \f$
111  tReal mCTime;
112 
113  //characteristic adimensionized Heisenberg coefficient : \f$ e_{exc}^i= - \tilde J \sum_{j \neq i} . <S_i,S_j> \f$
114  tReal mCJ;
115  //characteristic adimensionized DMI coefficient : \f$ e_{dmi}^i= - \tilde D \sum_{j \neq i} . S_i \wedge S_j \f$
116  std::array<tReal,SM_Constants::DIM> mCD;
117  //characteristic adimenzionized Anisotropy coefficient : \f$ e_{ani}^i= \tilde K . \Phi_U(S_i) \f$
118  tReal mCK;
119  //characteristic adimensionized dipolar coefficient : \f$ e_{dip}^i= -\frac{\tilde E_{dip}. \mu_s^2 }{4.\pi} . \sum_{j\neq i} F(S_i,S_j,r_{ij}) \f$
120  tReal mCEdip;
121  //characteristic adimensionied energy derivative factor \f$ h = -\frac{1}{\tilde \mu_s} \frac{\partial e}{\partial S} \f$ where \f$ E= \bar e e \f$ and \f$ H= \bar h h \f$
122  tReal mCDe;
123 
124 public:
125  // CONSTRUCTORS
128  SM_Material(void);
129 
130 
131  // DESTRUCTORS
134  virtual ~SM_Material(void);
135 
136 public :
137 
138  //Instance building
139  //=================
140 
141 
142 
143 
144  //MEMORY
145 
159  virtual tMemSize getMemorySize() const {
160  return sizeof(*this)+getContentsMemorySize();
161  }
162 
171  virtual tMemSize getContentsMemorySize() const {
172  tMemSize mem=SM_Object::getContentsMemorySize();
173  mem+=mU.size()*sizeof(tReal);
174  mem+=mCD.size()*sizeof(tReal);
175  mem+=mD.size()*sizeof(tReal);
176  return mem;
177  }
178  //Instance building
179  //=================
180 
184  inline static CORE_UniquePointer<SM_Material> New() {
185  return CORE_UniquePointer<SM_Material>(new SM_Material(),SM_Material::Delete());
186  }
187  //SET & GET methods
188 
192  inline void setCrystalStructure(CORE_UniquePointer<SM_CrystalStructure> cStructure) {
193  mCrystalStructure=std::move(cStructure);
194  }
198  inline const SM_CrystalStructure& getCrystalStructure() const {
199  return *mCrystalStructure.get();
200  }
205  return *mCrystalStructure.get();
206  }
210  inline tBoolean hasCrystalStructure() const {
211  return (mCrystalStructure.get()!=null);
212  }
213 
214 
215 
216  //set & get methods
217 public:
220  inline void setName(const tString& name) {
221  mName=name;
222  }
223 
226  inline const tString& getName() const {
227  return mName;
228  }
229 
230 
231 
232 
236  inline void setAtomicSpinMoment(const tReal& mu_s) {
237  mMu_s=mu_s;
238  }
242  inline const tReal& getAtomicSpinMoment() const {
243  return mMu_s;
244  }
248  inline const tReal& getAtomicSpinMoment_SIU() const {
249  return mMu_s_SIU;
250  }
251 
255  inline void setAnisotropyType(const tFlag& crystalType) {
256  mCrystalType=crystalType;
257  }
261  inline const tFlag& getAnisotropyType() const {
262  return mCrystalType;
263  }
264 
268  inline void setAnisotropyEnergyFactor(const tReal& k) {
269  mK=k;
270  }
274  inline const tReal& getAnisotropyEnergyFactor() const {
275  return mK;
276  }
277 
281  inline void setAnisotropyDirections(const std::array<tReal,SM_Constants::DIM*SM_Constants::DIM>& U) {
282  mU.resize(U.size());
283  const tReal *iU=U.data();
284  for(auto& Uk:mU) {
285  Uk=(*iU);
286  iU++;
287  }
288  }
292  inline void setAnisotropyDirections(const std::vector<tReal>& U) {
293  mU.resize(U.size());
294  tReal *iU=&mU[0];
295  for(const auto& Uk:U) {
296  (*iU)=Uk;
297  iU++;
298  }
299  }
303  inline const std::valarray<tReal>& getAnisotropyDirections() const {
304  return mU;
305  }
306 
310  inline void setExchangeEnergyFactor(const tReal& J) {
311  mJ=J;
312  }
316  inline const tReal& getExchangeEnergyFactor() const {
317  return mJ;
318  }
319 
323  inline void setDMIEnergyFactor(const std::array<tReal,SM_Constants::DIM>& D) {
324  mD=D;
325  }
329  inline const std::array<tReal,SM_Constants::DIM>& getDMIEnergyFactor() const {
330  return mD;
331  }
332 
335  inline void setSpinWaveMFCorrection(const tReal& eps) {
336  mEpsilon=eps;
337  }
340  inline const tReal& getSpinWaveMFCorrection() const {
341  return mEpsilon;
342  }
343 
349  void computeCharacteristicValues(const tBoolean& isAdimensionized);
350 
351 
355  inline const tReal& getCharacteristicTime() const {
356  return mCTime;
357  }
361  inline const tReal& getCharacteristicEnergy() const {
362  return mCEnergy;
363  }
367  inline const tReal& getCharacteristicField() const {
368  return mCField;
369  }
370 
371 
375  inline const tReal& getAdimensionizedExchangeEnergyFactor() const {
376  return mCJ;
377  }
378 
382  inline const std::array<tReal,SM_Constants::DIM>& getAdimensionizedDMIEnergyFactor() const {
383  return mCD;
384  }
385 
389  inline const tReal& getAdimensionizedAnisotropyEnergyFactor() const {
390  return mCK;
391  }
395  inline const tReal& getAdimensionizedDipolarEnergyFactor() const {
396  return mCEdip;
397  }
401  inline const tReal& getAdimensionizedDerivativeEnergyFactor() const {
402  return mCDe;
403  }
404 
405 
406 public:
407 
411  virtual tString toString() const override;
412 };
413 
414 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
This class decribe a crystal structure.
Definition: SM_CrystalStructure.h:30
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61
virtual ~SM_Material(void)
destroy
Definition: SM_Material.cpp:40
const tReal & getExchangeEnergyFactor() const
get the exchange energy
Definition: SM_Material.h:316
const tReal & getSpinWaveMFCorrection() const
get the spin wave MF correction
Definition: SM_Material.h:340
const std::valarray< tReal > & getAnisotropyDirections() const
get the anisotropy directions
Definition: SM_Material.h:303
void setName(const tString &name)
set the name of the material
Definition: SM_Material.h:220
static CORE_UniquePointer< SM_Material > New()
build a new instance of a Grid3D
Definition: SM_Material.h:184
void setAnisotropyDirections(const std::array< tReal, SM_Constants::DIM *SM_Constants::DIM > &U)
set the anisotropy directions
Definition: SM_Material.h:281
void setAnisotropyDirections(const std::vector< tReal > &U)
set the anisotropy directions
Definition: SM_Material.h:292
const tReal & getCharacteristicField() const
get the characteristic field in T
Definition: SM_Material.h:367
virtual tString toString() const override
turn the class into a string representation
Definition: SM_Material.cpp:138
SM_Material(void)
create a materialclass
Definition: SM_Material.cpp:3
const tReal & getAtomicSpinMoment() const
get the atomic spin moment in unit of Bohr magneton
Definition: SM_Material.h:242
const tReal & getAdimensionizedDerivativeEnergyFactor() const
get the characteristic dipolar energy factor
Definition: SM_Material.h:401
void setExchangeEnergyFactor(const tReal &J)
set the exchange energy
Definition: SM_Material.h:310
const SM_CrystalStructure & getCrystalStructure() const
get the crystal structure
Definition: SM_Material.h:198
const tReal & getAnisotropyEnergyFactor() const
get the anisotropy energy
Definition: SM_Material.h:274
const std::array< tReal, SM_Constants::DIM > & getAdimensionizedDMIEnergyFactor() const
get the characteristic DMI energy factor
Definition: SM_Material.h:382
void setSpinWaveMFCorrection(const tReal &eps)
set the spin wave MF correction
Definition: SM_Material.h:335
const tString & getName() const
get the name of the material
Definition: SM_Material.h:226
void setAtomicSpinMoment(const tReal &mu_s)
set the atomic spin moment in unit of Bohr magneton
Definition: SM_Material.h:236
const tReal & getCharacteristicTime() const
get the characteristic time in s
Definition: SM_Material.h:355
const tReal & getCharacteristicEnergy() const
get the characteristic energy in J
Definition: SM_Material.h:361
const tReal & getAdimensionizedDipolarEnergyFactor() const
get the characteristic dipolar energy factor
Definition: SM_Material.h:395
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_Material.h:171
void setAnisotropyType(const tFlag &crystalType)
set anisotropy type
Definition: SM_Material.h:255
const std::array< tReal, SM_Constants::DIM > & getDMIEnergyFactor() const
get the DMI energy
Definition: SM_Material.h:329
tBoolean hasCrystalStructure() const
return true if the material has a crystal structure
Definition: SM_Material.h:210
void setDMIEnergyFactor(const std::array< tReal, SM_Constants::DIM > &D)
set the DMI energy
Definition: SM_Material.h:323
const tReal & getAdimensionizedExchangeEnergyFactor() const
get the characteristic exchange energy factor
Definition: SM_Material.h:375
void computeCharacteristicValues(const tBoolean &isAdimensionized)
compute the characteristic values
Definition: SM_Material.cpp:43
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_Material.h:159
const tFlag & getAnisotropyType() const
get anisotropy type
Definition: SM_Material.h:261
void setAnisotropyEnergyFactor(const tReal &k)
set the anisotropy energy
Definition: SM_Material.h:268
const tReal & getAdimensionizedAnisotropyEnergyFactor() const
get the characteristic anisotropy energy factor
Definition: SM_Material.h:389
SM_CrystalStructure & getCrystalStructure()
get the crystal structure
Definition: SM_Material.h:204
void setCrystalStructure(CORE_UniquePointer< SM_CrystalStructure > cStructure)
set the crystal structure
Definition: SM_Material.h:192
const tReal & getAtomicSpinMoment_SIU() const
get the atomic moment in international sytem unit : J.T^{-1}
Definition: SM_Material.h:248
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36