Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
interactionTerm.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef INTERACTION_TERM_H_INCLUDED
24 #define INTERACTION_TERM_H_INCLUDED
25 
26 #include <csl.h>
27 #include "quantumField.h"
28 #include "scalarField.h"
29 #include "vectorField.h"
30 #include "fermionicField.h"
31 
32 namespace mty {
33 
34 
51 
52  public:
53 
54  using permutation = std::vector<std::pair<csl::Index, csl::Index>>;
55 
57 
66  inline static bool abbreviateFactors = false;
67 
68  public:
69 
71 
72  InteractionTerm& operator=(InteractionTerm const&);
73 
74  InteractionTerm() = default;
75 
76  InteractionTerm(InteractionTerm&&) = default;
77 
78  InteractionTerm& operator=(InteractionTerm&&) = default;
79 
80  InteractionTerm copy() const;
81 
83  std::vector<QuantumField> const& t_content);
84 
86  bool copy = true);
87 
88  public:
89 
90  static void fillContent(
91  csl::Expr const &prod,
92  std::vector<mty::QuantumField> &fields
93  );
94 
95  static std::vector<TermType>
96  createAndDispatch(csl::Expr const& expression);
97 
98  bool hasSameContent(InteractionTerm const& other) const;
99 
100  bool hasSameContent(std::vector<mty::QuantumField> const &fields) const;
101 
107  size_t size() const;
108 
109  size_t nTerms() const;
110 
111  void clear();
112 
118  csl::Expr getTerm() const;
119 
120  csl::Expr getGlobalFactor() const;
121 
122  csl::Expr getTotalFactor() const;
123 
124  csl::Expr getMass() const;
125 
131  std::vector<QuantumField>& getContent();
132 
138  std::vector<QuantumField> const& getContent() const;
139 
149  std::vector<Particle> getParticles() const;
150 
161  std::vector<QuantumFieldParent*> getParticlesInfo() const;
162 
171  size_t count(QuantumFieldParent* particle) const;
172 
182  size_t getExponent(csl::Expr const& parameter) const;
183 
204  csl::Expr getFieldProduct() const;
205 
223 
241 
242  csl::Tensor getPoint() const;
243 
244  void setPoint(csl::Tensor const& newPoint);
245 
263  bool contains(const QuantumFieldParent* p) const;
264 
282  bool containsWeakly(const QuantumFieldParent* p) const;
283 
301  bool contains(mty::Particle const &p) const {
302  return contains(p.get());
303  }
304 
322  bool containsWeakly(mty::Particle const &p) const {
323  return containsWeakly(p.get());
324  }
325 
341  bool containsExactly(const QuantumFieldParent* p) const;
342 
358  bool containsExactly(mty::Particle const &p) const {
359  return containsExactly(p.get());
360  }
361 
371  bool operator==(const InteractionTerm& other) const;
372 
382  bool operator==(const csl::Expr& other) const;
383 
384  friend
385  std::ostream& operator<<(std::ostream & out,
386  InteractionTerm const& term);
387 
388  private:
389 
390  bool gatherFieldContent(csl::Expr const& expr,
391  size_t multiplicity,
392  csl::IndexStructure const& derivativeStructure);
393 
394  void gatherFieldContent();
395 
396  static
397  bool containsQuantumField(csl::Expr const& expr);
398 
399  std::pair<csl::Expr, csl::IndexStructure> buildContent(
400  QuantumField expr,
401  csl::IndexStructure const& structure);
402 
403  static
404  void recallIndices(permutation & perm,
405  csl::IndexStructure const& old,
406  csl::IndexStructure const& structure);
407 
408  void gatherFactorsAndSymmetries();
409 
410  void gatherSymmetries(csl::Expr const& sum);
411 
412  static
413  bool areSimilarField(QuantumField const& A,
414  QuantumField const& B);
415 
416  static
417  bool areSimilarContent(
418  std::vector<QuantumField> const &A,
419  std::vector<QuantumField> const &B
420  );
421 
422  static
423  csl::Expr applyPermutation(permutation const& perm,
424  csl::Expr const& init,
425  std::map<csl::Index, csl::Index>& constraints);
426 
427  private:
428 
434 
438  std::vector<QuantumField> content;
439 
440  bool forcedContent = false;
441 
442  csl::Expr globalFactor = CSL_1;
443 
444  permutation globalPermutation;
445 
446  csl::vector_expr factors;
447 
448  std::vector<permutation> permutations;
449 };
450 
451 }
452 
453 #endif
std::vector< Particle > getParticles() const
Returns the set of different interacting particles.
Definition: interactionTerm.cpp:296
size_t count(QuantumFieldParent *particle) const
Counts, in the content, how many particles are of a given species.
Definition: interactionTerm.cpp:307
static bool abbreviateFactors
Options telling if factors (constants etc.) must be abbreviated or not. Default is false...
Definition: interactionTerm.h:66
bool contains(const QuantumFieldParent *p) const
Tells if the interaction term contains a given field.
Definition: interactionTerm.cpp:393
csl::Expr getFieldProduct() const
Returns the product of bare fields with only free indices.
Definition: interactionTerm.cpp:421
bool containsWeakly(mty::Particle const &p) const
Tells if the interaction term contains a given field or only a part of it.
Definition: interactionTerm.h:322
This class inherits from std::shared_ptr<QuantumFieldParent> and should be used instead of direct Qua...
Definition: quantumField.h:1409
Namespace of MARTY.
Definition: 2HDM.h:31
csl::Expr getFullExpression() const
Returns the full expression of the interaction term.
Definition: interactionTerm.cpp:443
size_t size() const
Returns the number of interacting fields.
Definition: interactionTerm.cpp:210
Contains the implementation of the Scalar boson in MARTY.
std::vector< QuantumFieldParent * > getParticlesInfo() const
Returns the set of different interacting particles.
Definition: interactionTerm.cpp:339
bool containsExactly(mty::Particle const &p) const
Tells if the interaction term contains exactly a given field.
Definition: interactionTerm.h:358
std::vector< QuantumField > & getContent()
Returns a reference to the field content of the interaction.
Definition: interactionTerm.cpp:286
std::vector< QuantumField > content
Quantum fields in the interactions.
Definition: interactionTerm.h:438
csl::Expr getTerm() const
Returns the symbolic expression corresponding to the interaction.
Definition: interactionTerm.cpp:242
bool containsExactly(const QuantumFieldParent *p) const
Tells if the interaction term contains exactly a given field.
Definition: interactionTerm.cpp:412
bool operator==(const InteractionTerm &other) const
Equality operator, compares the symbolic expressions.
Definition: interactionTerm.cpp:455
Class deriving from csl::TensorFieldElement, may enter expressions. In contrary to QuantumFieldParent...
Definition: quantumField.h:1614
csl::Expr applyFactorAndSymmetriesOn(csl::Expr const &init) const
Applies all factors and symmetries on a field product to recover the full interaction term properties...
Definition: interactionTerm.cpp:350
Contains implementations for fermion (Weyl, Dirac, Majorana) for MARTY.
Contains vector particles of MARTY: vector and gauge bosons, and the field strength object...
bool containsWeakly(const QuantumFieldParent *p) const
Tells if the interaction term contains a given field or only a part of it.
Definition: interactionTerm.cpp:402
Base class for parents of QuantumField objects.
Definition: quantumField.h:152
Interaction term (in the Lagrangian) in MARTY.
Definition: interactionTerm.h:50
size_t getExponent(csl::Expr const &parameter) const
Returns the exponent associated to a given coupling in the interaction term.
Definition: interactionTerm.cpp:317
Contains QuantumField and QuantumFieldParent, basic objects handling quantum fields as csl expression...
bool contains(mty::Particle const &p) const
Tells if the interaction term contains a given field.
Definition: interactionTerm.h:301
csl::Expr term
Initial expression defining the interaction (symbolic Lagrangian term).
Definition: interactionTerm.h:433