QMCPACK
MagnetizationDensityInput.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2023 QMCPACK developers.
6 //
7 // File developed by: Raymond Clay, rclay@sandia.gov, Sandia National Laboratories
8 //
9 // File created by: Raymond Clay, rclay@sandia.gov, Sandia National Laboratories
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef QMCPLUSPLUS_MAGNETIZATION_DENSITY_INPUT_H
14 #define QMCPLUSPLUS_MAGNETIZATION_DENSITY_INPUT_H
15 
16 #include "Configuration.h"
17 #include "OhmmsData/ParameterSet.h"
20 namespace qmcplusplus
21 {
22 class MagnetizationDensity;
23 
25 {
26 public:
27  enum class Integrator
28  {
29  SIMPSONS,
31  };
32  // Weird clang format issues with the following. Disable clang-format for now.
33  // clang-format off
34  inline static const std::unordered_map<std::string, std::any>
36  {"integrator-montecarlo", Integrator::MONTECARLO}};
37  // clang-format on
43  static constexpr int DIM = QMCTraits::DIM;
44 
45 public:
46  MagnetizationDensityInput(xmlNodePtr node);
47  /** default copy constructor
48  * This is required due to SDI being part of a variant used as a vector element.
49  */
51  PosType get_corner() const { return corner_; }
52  PosType get_center() const { return center_; }
53  PosType get_grid() const { return grid_real_; }
54  PosType get_dr() const { return dr_; }
55  bool get_corner_defined() const { return have_corner_; }
56  bool get_center_defined() const { return have_center_; }
57  int get_nsamples() const { return nsamples_; }
59  bool get_write_report() const { return write_report_; }
60  bool get_save_memory() const { return save_memory_; }
61 
63  {
67  size_t npoints;
68  };
69 
70  /** Derived parameters of SpinDensity
71  *
72  * These require the cell the SpinDensity is evaluated over,
73  * the caller (SpinDensityNew) either gets this from the input and
74  * passes it back or passes in the cell from the relevant ParticleSet.
75  *
76  */
78 
80  {
81  public:
82  /** parse time definition of input parameters */
84  {
85  // clang-format off
86  section_name = "MagnetizationDensity";
87  attributes = {"name", "type"};
88  parameters = {"integrator",
89  "corner", "center", "samples", "grid", "dr"
90  };
91  bools = {};
92  enums = {"integrator"};
93  strings = {"name", "type"};
94  multi_strings = {};
95  integers = {"samples"};
96  reals = {};
97  positions = {"center", "corner", "grid", "dr"};
98  required = {"name"};
99  // I'd much rather see the default defined in simple native c++ as below
100  // clang-format on
101  }
102  std::any assignAnyEnum(const std::string& name) const override;
103  void checkParticularValidity() override;
104  };
105 
106 private:
108  //Default Values
109  std::string myName_ = "MagnetizationDensityInput";
111  int nsamples_ = 9; //Number of grid points for spin quadrature, or samples for Monte Carlo.
112 
113  PosType corner_ = {0.0, 0.0, 0.0};
114  //These two are coupled. dr determines the grid, and visa versa.
115  PosType dr_ = {0.1, 0.1, 0.1};
116  PosType grid_real_ = {10, 10, 10};
117  PosType center_ = {0.0, 0.0, 0.0};
118  bool write_report_ = false;
119  bool save_memory_ = false;
120  /** these are necessary for calculateDerivedParameters
121  *
122  * If we are going to later write out a canonical input for
123  * this input then they are needed as well.
124  */
125  bool have_dr_ = false;
126  bool have_grid_ = false;
127  bool have_center_ = false;
128  bool have_corner_ = false;
129 };
130 
131 extern template bool InputSection::setIfInInput<qmcplusplus::MagnetizationDensityInput::Integrator>(
133  const std::string& tag);
134 
135 } // namespace qmcplusplus
136 #endif /* QMCPLUSPLUS_MAGNETIZATION_DENSITY_INPUT_H */
a class that defines a supercell in D-dimensional Euclean space.
std::unordered_set< std::string > strings
Definition: InputSection.h:67
std::unordered_set< std::string > reals
Definition: InputSection.h:72
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::unordered_set< std::string > parameters
Definition: InputSection.h:63
if(!okay) throw std xmlNodePtr node
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > ParticleLayout
Definition: Configuration.h:79
std::unordered_set< std::string > positions
Definition: InputSection.h:73
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
std::unordered_set< std::string > integers
Definition: InputSection.h:71
std::unordered_set< std::string > attributes
Definition: InputSection.h:62
bool have_dr_
these are necessary for calculateDerivedParameters
std::unordered_set< std::string > required
Definition: InputSection.h:65
DerivedParameters calculateDerivedParameters(const Lattice &lattice) const
Derived parameters of SpinDensity.
Particle traits to use UniformGridLayout for the ParticleLayout.
Definition: Configuration.h:77
MagnetizationDensityInputSection input_section_
std::any assignAnyEnum(const std::string &name) const override
Derived class overrides this to get proper assignment of scoped enum values.
std::unordered_set< std::string > multi_strings
Definition: InputSection.h:68
std::unordered_set< std::string > bools
Definition: InputSection.h:70
QTFull::RealType FullPrecRealType
Definition: Configuration.h:66
Magnetization density estimator for non-collinear spin calculations.
Input section provides basic parsing and a uniform method of access to the raw parsed input...
Definition: InputSection.h:37
void checkParticularValidity() override
Do validation for a particular subtype of InputSection Called by check_valid.
std::string section_name
"Name" of the input section, you must define this in the subtype and the ename, name, type, or method must match.
Definition: InputSection.h:57
std::unordered_set< std::string > enums
list of enum inputs which allow a finite set of strings to map to enum values The enum class types an...
Definition: InputSection.h:78
static const std::unordered_map< std::string, std::any > lookup_input_enum_value