Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends
mty::ModelData Class Reference

The class ModelData contains all the necessary features to store and manipulate the content of a model. No model building (symmetry breaking, replacements etc) or computation are implemented in it. More...

#include <modelData.h>

Inheritance diagram for mty::ModelData:
[legend]

Public Member Functions

 ModelData ()
 Default constructor. More...
 
 ModelData (std::unique_ptr< Gauge > &&t_gauge)
 Constructor with one parameter. More...
 
 ModelData (std::unique_ptr< Gauge > &&t_gauge, std::unique_ptr< Flavor > &&t_flavor)
 Constructor with 2 parameters. More...
 
 ModelData (std::unique_ptr< Gauge > &&t_gauge, std::unique_ptr< Flavor > &&t_flavor, std::vector< Particle > &t_particles)
 Constructor with 3 parameters. More...
 
 ModelData (std::string const &nameFile)
 Creates a model from a model file (.json). More...
 
virtual ~ModelData ()
 Destructor.
 
 ModelData (ModelData &&other)=default
 Defaulted move constructor.
 
ModelDataoperator= (ModelData &&other)=default
 Defaulted move assignement operator.
 
 ModelData (ModelData const &other)=delete
 Defaulted copy constructor.
 
ModelDataoperator= (ModelData const &other)=delete
 Defaulted copy assignement operator.
 
void init (bool initGaugeTerms=true)
 Initializes the gauge once and for all. This function must be called after finishing the gauge, and before adding matter particles. Calling the constructors that take an already built gauge, this function is called automatically. Otherwise you have to call it. More...
 
void checkHermiticity ()
 Checks the hermiticity of the Lagrangian, i.e. checks if \( \mathcal{L}^\dagger = \mathcal{L} \). More...
 
virtual void saveModel (std::ostream &out, int indent=4)
 
void saveModelFunction (std::string_view name, std::ostream &out, int indent=0)
 
void saveModelFunctionWithRef (std::string_view name, std::ostream &out, int indent=0)
 
void saveModelFile (std::string_view name, std::string const &fileName)
 
Lagrangian const & getLagrangian () const
 Returns a const reference to the Lagrangian. More...
 
bool isEnableChecks () const
 
void setEnableChecks (bool t_enable)
 Sets enableChecks. More...
 
csl::Space const * getSpaceTime () const
 Returns a pointer to the space time of the mode (csl::Space). More...
 
mty::GaugegetGauge () const
 Returns a pointer to the model's gauge. More...
 
mty::FlavorgetFlavor () const
 Returns a pointer to the model's flavor. More...
 
std::vector< mty::Particle > const & getParticles () const
 Returns a const reference to the model's particles. More...
 
std::vector< mty::ParticlegetPhysicalParticles (std::function< bool(mty::Particle)> const &predicate=[](mty::Particle) { return true;}) const
 Returns a list of the physical particles in a model. More...
 
std::vector< mty::QuantumNumber > const & getQuantumNumbers () const
 Returns the list of quantum numbers. More...
 
std::vector< mty::QuantumNumber > & getQuantumNumbers ()
 Returns the list of quantum numbers. More...
 
std::vector< csl::Expr > const & getScalarCouplings () const
 Returns the scalar couplings (gauge coupling typically) of the model. More...
 
std::vector< csl::Tensor > const & getTensorCouplings () const
 Returns the tensor couplings (Yukawa coupling typically) of the model. More...
 
void setSpaceTime (csl::Space const *t_spaceTime)
 Sets the space time of the model. More...
 
void setGauge (std::unique_ptr< mty::Gauge > &&t_gauge)
 Sets the gauge of the model. More...
 
void addGaugedGroup (group::Type type, std::string_view name, int dim, csl::Expr const &coupling=nullptr)
 Adds a gauge group to the model. More...
 
void addGaugedGroup (group::Type type, std::string_view name, csl::Expr const &coupling=nullptr)
 Adds a gauge group to the model. More...
 
void addFlavorGroup (std::string_view name, int nFlavor, bool complexFields=true)
 Adds a flavor group to the model. More...
 
void setFlavor (std::unique_ptr< mty::Flavor > &&t_flavor)
 Sets the flavor of the model. More...
 
void addParticle (mty::Particle const &part, bool initializeTerms=true)
 Adds a particle to the model. More...
 
void addParticles (std::vector< mty::Particle > const &parts, bool initializeTerms=true)
 Adds a list of particles to the model. More...
 
void addParticlesIn (csl::Expr const &expr)
 
void removeParticle (mty::Particle const &part)
 Removes a particle from the model. More...
 
void removeParticles (std::vector< mty::Particle > const &parts)
 Removes particles from the model. More...
 
void removeParticle (std::string const &part)
 Removes a particle from the model. More...
 
void removeParticles (std::vector< std::string > const &parts)
 Removes particles from the model. More...
 
void addScalarCoupling (std::string_view t_name)
 Adds a scalar coupling constant in the model. More...
 
void addScalarCoupling (csl::Expr const &coupling)
 Adds a scalar coupling constant in the model. More...
 
void addTensorCoupling (csl::Parent const &tensorCoupling)
 Adds a tensor coupling constant in the model. More...
 
void addQuantumNumber (std::string_view name, std::vector< mty::Particle > const &fields, std::vector< int > const &values, bool conserved=true)
 Adds a new quantum number to a model, giving eigenvalues for particles also. More...
 
template<class FieldType >
void addQuantumNumber (std::string_view name, std::vector< FieldType > const &fields, std::vector< int > const &values, bool conserved=true)
 Adds a new quantum number to a model, giving eigenvalues for particles also. More...
 
template<class FieldType >
void addQuantumNumber (std::string_view name, std::initializer_list< FieldType > fields, std::vector< int > const &values, bool conserved=true)
 Adds a new quantum number to a model, giving eigenvalues for particles also. More...
 
void setQuantumNumbers (std::vector< mty::QuantumNumber > const &numbers)
 Sets the quantum numbers of the model. More...
 
bool findParticle (std::string_view t_name) const
 Searches a particle in the model. More...
 
bool findParticle (mty::Particle const &part) const
 Searches a particle in the model. More...
 
bool findParticle (mty::QuantumFieldParent const *part) const
 Searches a particle in the model. More...
 
bool findScalarCoupling (std::string_view t_name) const
 Searches a scalar coupling in the model. More...
 
bool findScalarCoupling (csl::Expr const &coupling) const
 Searches a scalar coupling in the model. More...
 
bool findTensorCoupling (std::string_view t_name) const
 Searches a tensor coupling in the model. More...
 
bool findTensorCoupling (csl::Parent const &coupling) const
 Searches a tensor coupling in the model. More...
 
bool findTensorCoupling (csl::AbstractParent const *coupling) const
 Searches a tensor coupling in the model. More...
 
mty::Group const * getGroup (std::string_view t_name) const
 Returns a Group (pointer to const) given its name. More...
 
mty::GroupgetGroup (std::string_view t_name)
 Returns a Group (pointer) given its name. More...
 
mty::Group const * getGroup (mty::FlavorGroup const *flavGroup) const
 Returns a Group (pointer to const) given its flavor group. More...
 
mty::GroupgetGroup (mty::FlavorGroup const *flavGroup)
 Returns a Group (pointer to const) given its flavor group. More...
 
mty::GaugedGroup const * getGaugedGroup (std::string_view t_name) const
 Returns a GaugedGroup (pointer to const) given its name. More...
 
mty::GaugedGroupgetGaugedGroup (std::string_view t_name)
 Returns a GaugedGroup (pointer) given its name. More...
 
mty::FlavorGroup const * getFlavorGroup (std::string_view t_name) const
 Returns a FlavorGroup (pointer) given its name. More...
 
mty::FlavorGroupgetFlavorGroup (std::string_view t_name)
 Returns a FlavorGroup (pointer) given its name. More...
 
std::vector< mty::ParticlegetParticles (std::initializer_list< std::string_view > names) const
 
mty::Particle getParticle (std::string_view t_name) const
 Returns a particle in the model given a name. More...
 
mty::Particle getParticle (mty::QuantumFieldParent const *field) const
 Returns a particle in the model given a pointer to QuantumFieldParent. More...
 
mty::Particle getParticle (mty::QuantumFieldParent const &field) const
 Returns a particle in the model given a QuantumFieldParent. More...
 
mty::Particle getParticle (mty::QuantumField const &field) const
 Returns a particle in the model given a QuantumField. More...
 
mty::Particle getParticle (csl::Expr const &field) const
 Returns a particle in the model given an expression. More...
 
csl::Expr getScalarCoupling (std::string_view t_name) const
 Returns a scalar coupling given its name. More...
 
csl::Tensor getTensorCoupling (std::string_view t_name) const
 Returns a tensor coupling given its name. More...
 
csl::Tensor getTensorCoupling (csl::Parent const &t_coupling) const
 Returns a tensor coupling. More...
 
template<class FieldType >
mty::GaugeIrrep getGaugeIrrep (FieldType &&field) const
 Returns the gauge representation of a field. More...
 
template<class GroupType , class FieldType >
mty::Irrep getGroupIrrep (FieldType &&field, GroupType &&group) const
 Returns the group representation of a field. More...
 
template<class GroupType , class FieldType >
csl::Expr getCharge (FieldType &&field, GroupType &&group) const
 Returns the charge representation of a field in a U(1) group. More...
 
template<class FieldType >
mty::FlavorIrrep getFlavorIrrep (FieldType &&field) const
 Returns the flavor representation of a field. More...
 
template<class FlavorType , class FieldType >
mty::Irrep getFlavorIrrep (FieldType &&field, FlavorType &&flavor) const
 Returns the flavor group representation of a field. More...
 
template<class GroupType , class FieldType >
csl::Space const * getVectorSpace (GroupType &&group, FieldType &&field) const
 Returns the vector space coresponding to the representation of a field in a given group. More...
 
template<class GroupType , class FieldType >
csl::Index generateIndex (GroupType &&group, FieldType &&field) const
 Returns an index coresponding to the representation of a field in a given group. More...
 
template<class GroupType >
csl::Index generateIndex (GroupType &&group) const
 Returns an index coresponding to the fundamental representation in a given group. More...
 
template<class GroupType , class FieldType >
std::vector< csl::IndexgenerateIndices (size_t nIndices, GroupType &&group, FieldType &&field) const
 Returns indices coresponding to the representation of a field in a given group. More...
 
template<class GroupType >
std::vector< csl::IndexgenerateIndices (size_t nIndices, GroupType &&group) const
 Returns indices coresponding to the fundamental representation in a given group. More...
 
template<class GroupType , class FieldType >
csl::Index generateIndex (std::string_view nameIndex, GroupType &&group, FieldType &&field) const
 Returns an index coresponding to the representation of a field in a given group. More...
 
template<class GroupType , class FieldType >
mty::Generator getGenerator (GroupType &&group, FieldType &&field) const
 Returns the generator coresponding to the representation of a field in a given group. More...
 
mty::QuantumNumber const & getQuantumNumber (std::string_view name) const
 Returns a quantum number (const reference) given its name. More...
 
mty::QuantumNumbergetQuantumNumber (std::string_view name)
 Returns a quantum number (reference) given its name. More...
 
void checkValidity (mty::Particle const &part) const
 Checks the validity of a particle when adding it to the model. More...
 
void checkValidity (mty::Lagrangian::TermType const &term) const
 Checks the validity of a term when adding it to the Lagrangian. More...
 
void addLagrangianTerm (csl::Expr const &term, bool addHermitic=false)
 Adds a lagrangian term to the model. More...
 
void addLagrangianTerm (mty::Lagrangian::TermType const &term, bool addHermitic=false)
 Adds a lagrangian term to the model. More...
 
template<class FieldType >
void addBosonicMass (FieldType &&field, std::string_view mass)
 Adds a bosonic mass term to the model. More...
 
template<class FieldType >
void addBosonicMass (FieldType &&field, csl::Expr const &mass)
 Adds a bosonic mass term to the model. More...
 
template<class FieldType1 , class FieldType2 >
void addFermionicMass (FieldType1 &&left, FieldType2 &&right, std::string_view mass)
 Adds a fermionic mass to the model. More...
 
template<class FieldType1 , class FieldType2 >
void addFermionicMass (FieldType1 &&left, FieldType2 &&right, csl::Expr const &mass)
 Adds a fermionic mass to the model. More...
 
template<class FieldType >
void addFermionicMass (FieldType &&diracFermion, std::string_view mass)
 Adds a fermionic mass to the model. More...
 
template<class FieldType >
void addFermionicMass (FieldType &&diracFermion, csl::Expr const &mass)
 Adds a fermionic mass to the model. More...
 
template<class FieldType >
void renameParticle (FieldType &&field, std::string_view newName)
 Renames a particle of the model. More...
 
void renameCoupling (std::string_view name, std::string_view newName)
 Renames a (scalar or tensor) coupling of the model. More...
 
void printSubPart (std::vector< std::string > const &particles, std::ostream &out=std::cout) const
 Prints a sub part of the Lagrangian including some particles. More...
 
void printSubPart (std::initializer_list< std::string > particles, std::ostream &out=std::cout) const
 Prints a sub part of the Lagrangian including some particles. More...
 
void printSubPart (std::string const &particle, std::ostream &out=std::cout) const
 Prints a sub part of the Lagrangian including some particles. More...
 

Static Public Attributes

static size_t nMomentums = 10
 Number of momenta instantiated for the model (10). With 5 maximum external legs, this is fairly safe.
 
static csl::Space const * defaultSpaceTime = &csl::Minkowski
 Default space-time for the model's particles. There is actually no support for another space that csl::Minkowski yet.
 
static int defaultQuantumNumber = 1
 Default quantum number for particles when not given. More...
 

Protected Member Functions

void initGaugedGroups (bool initGaugeTerms=true)
 Initializes gauge terms (gauge bosons, ghosts) and fixes the gauge. More...
 
void writeHeader (std::ostream &out, int indentSize, std::vector< csl::Parent > &defined)
 
void writeGauge (std::ostream &out, int indentSize, std::vector< csl::Parent > &defined)
 
void writeFlavor (std::ostream &out, int indentSize, std::vector< csl::Parent > &defined)
 
void writeMassAndWidth (std::ostream &out, int indentSize, std::vector< csl::Parent > &defined)
 
void writeParticles (std::ostream &out, int indentSize, std::vector< csl::Parent > &defined)
 
void writeDependencies (std::ostream &out, int indentSize, std::vector< csl::Parent > &defined, std::vector< csl::Expr > &kinetic, std::vector< csl::Expr > &mass, std::vector< csl::Expr > &interac)
 
void writeLagrangian (std::ostream &out, int indentSize, std::vector< csl::Expr > const &kinetic, std::vector< csl::Expr > const &mass, std::vector< csl::Expr > const &interac)
 
mty::GaugeIrrep doGetGaugeIrrep (mty::Particle const &part) const
 Actually returns the gauge representation of a particle. More...
 
mty::Irrep doGetGroupIrrep (mty::Particle const &part, mty::Group const *group) const
 Actually returns the group representation of a particle. More...
 
csl::Expr doGetCharge (mty::Particle const &particle, mty::Group const *group) const
 Actually returns the charge representation of a particle for a U(1) group. More...
 
mty::FlavorIrrep doGetFlavorIrrep (mty::Particle const &part) const
 Actually returns the flavor representation of a particle. More...
 
mty::Irrep doGetFlavorIrrep (mty::Particle const &part, mty::Group const *flavor) const
 Actually returns the flavor group representation of a particle. More...
 
csl::Space const * doGetVectorSpace (mty::Group const *group, mty::Particle const &irrep) const
 Actually returns the vector space corresponding to a particle's representation. More...
 
csl::Space const * doGetVectorSpace (mty::FlavorGroup const *group, mty::Particle const &irrep) const
 Actually returns the vector space corresponding to a particle's representation. More...
 
csl::Index doGenerateIndex (mty::Group const *group, mty::Particle const &fieldRep) const
 Actually returns a csl::Index corresponding to a particle's representation. More...
 
csl::Index doGenerateIndex (mty::Group const *group) const
 Actually returns a csl::Index corresponding to the fundamental representation of a given group. More...
 
csl::Index doGenerateIndex (std::string_view nameIndex, mty::Group const *group, mty::Particle const &fieldRep) const
 Actually returns a csl::Index corresponding to a particle's representation. More...
 
mty::Generator doGetGenerator (mty::Group const *group, mty::Particle const &fieldRep) const
 Actually returns a generator corresponding to a particle's representation. More...
 
void doAddBosonicMass (mty::Particle const &particle, std::string_view mass)
 
void doAddBosonicMass (mty::Particle const &particle, csl::Expr const &mass)
 
void doAddFermionicMass (mty::Particle const &left, mty::Particle const &right, std::string_view mass)
 
void doAddFermionicMass (mty::Particle const &left, mty::Particle const &right, csl::Expr const &mass)
 
void doAddFermionicMass (mty::Particle const &diracFermion, std::string_view mass)
 
void doAddFermionicMass (mty::Particle const &diracFermion, csl::Expr const &mass)
 
void doRenameParticle (mty::Particle const &part, std::string_view newName)
 Actually renames a particle. More...
 

Protected Attributes

mty::Lagrangian L
 Lagrangian of the model. More...
 
csl::Space const * spaceTime
 Space time for the model. More...
 
std::unique_ptr< mty::Gaugegauge
 Gauge of the model.
 
std::unique_ptr< mty::Flavorflavor
 Flavor of the model.
 
std::vector< mty::Particleparticles
 Particle content (including gauge bosons, ghosts etc) of the model. More...
 
std::vector< mty::QuantumNumberquantumNumbers
 List of quantum numbers in the model. More...
 
std::vector< csl::ExprscalarCouplings
 Lists of scalar couplings of the model. More...
 
std::vector< csl::TensortensorCouplings
 List of tensor couplings of the model. More...
 
bool gaugeLocked = false
 Boolean that tells if the gauge model is initilialized. More...
 
bool enableChecks = true
 Boolean telling if checks must be done with lagrangian terms added to the model (gauge representation, dispatching ...) More...
 

Friends

std::ostream & operator<< (std::ostream &out, ModelData const &model)
 Prints the model. More...
 

Detailed Description

The class ModelData contains all the necessary features to store and manipulate the content of a model. No model building (symmetry breaking, replacements etc) or computation are implemented in it.

This class contains the Lagrangian of the theory (all interaction, kinetic, and mass terms), the gauge, flavor symmetries, particles, quantum numbers, couplings, and momenta. It is really a container, owner of all the cited objects. In particular, deleting the ModelData will automatically delete the lagrangian, gauge, flavor. Particles are under shared ownership, so will be deleted only if there is no other reference to it in the program. Beware however than even particles cannot be used if the model is deleted as they will refer to a non-existing gauge / flavor.

Warning
ModelData instances (together with ModelBuilder and Model) should live at least as longer as any object that come from it, in particular particles, or expressions containing particles. To avoid any problem, define it as a static variable in the main function, or as a dynamically allocated variable deleted at the end of the main function.
See also
ModelBuilder, Model

Constructor & Destructor Documentation

◆ ModelData() [1/5]

mty::ModelData::ModelData ( )

Default constructor.

Instantiates a null flavor, and an empty gauge. This is a valid state and you can add gauge groups through addGaugedGroup().

◆ ModelData() [2/5]

mty::ModelData::ModelData ( std::unique_ptr< Gauge > &&  t_gauge)
explicit

Constructor with one parameter.

Instantiates a null flavor, and the gauge to t_gauge. Calling this constructor, the gauge you give to the model is no longer valid as the unique ownership is transfered to it. Using this constructor, the gauge is taken as is, and the model is initialized. It is in particular not possible to add gauged groups afterwards. If you want to add gauge groups through the addGaugedGroup() function, consider using the default constructor. Here is a code snippet that show how to use this constructor.

std::unique_ptr<mty::Gauge> gauge = makeGauge();
Model model(std::move(gauge));
// Here gauge is not valid anymore, model took the ownership
See also
init(), addGaugedGroup()
Parameters
t_gaugeGauge now owned by the Model.

◆ ModelData() [3/5]

mty::ModelData::ModelData ( std::unique_ptr< Gauge > &&  t_gauge,
std::unique_ptr< Flavor > &&  t_flavor 
)

Constructor with 2 parameters.

Instantiates the model with a gauge and a flavor. See the constructor with one parameter for more information. The constructor simply instantiates the flavor with t_flavor. Here is a code snippet that show how to use this constructor.

std::unique_ptr<mty::Gauge> gauge = makeGauge();
std::unique_ptr<mty::Flavor> flavor = makeFlavor();
Model model(std::move(gauge), std::move(flavor));
// Here gauge is not valid anymore, model took the ownership
// Here flavor is not valid anymore, model took the ownership
Parameters
t_gaugeGauge now owned by the Model.
t_flavorFlavor now owned by the Model.

◆ ModelData() [4/5]

mty::ModelData::ModelData ( std::unique_ptr< Gauge > &&  t_gauge,
std::unique_ptr< Flavor > &&  t_flavor,
std::vector< Particle > &  t_particles 
)

Constructor with 3 parameters.

Instantiates the model with a gauge, a flavor and a set of particles. See the constructor with two parameters for more information. The constructor simply adds particles. Those particles must have been created with the corresponding gauge and flavor. Covariant derivative and mass terms for the particles are added automatically. Here is a code snippet that show how to use this constructor.

std::unique_ptr<mty::Gauge> gauge = makeGauge();
std::unique_ptr<mty::Flavor> flavor = makeFlavor();
std::vector<mty::Particle> particles = makeParticles();
Model model(std::move(gauge), std::move(flavor), particles);
// Here gauge is not valid anymore, model took the ownership
// Here flavor is not valid anymore, model took the ownership
Parameters
t_gaugeGauge now owned by the Model.
t_flavorFlavor now owned by the Model.
t_particlesParticles to add to the Model after intializing the gauge and flavor.

◆ ModelData() [5/5]

mty::ModelData::ModelData ( std::string const &  nameFile)

Creates a model from a model file (.json).

See also
jsonToPhysics.h, JSONToHEP

Member Function Documentation

◆ addBosonicMass() [1/2]

template<class FieldType >
void mty::ModelData::addBosonicMass ( FieldType &&  field,
std::string_view  mass 
)

Adds a bosonic mass term to the model.

A bosonic mass term for a field \( \phi \) of mass \( m \) is of the form

\[ \mathcal{L}_M \ni \pm \eta m^2 \phi ^\dagger \phi \]

, with \( \eta = 1/2 \) if \( \phi ^\dagger = \phi\), \( \eta = 1 \) otherwise. For spin 1 particles, the sign is positive, and negative for spin 0 particles.

Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function.
Parameters
fieldField in the mass term (must be bosonic).
massName of the mass to add.

◆ addBosonicMass() [2/2]

template<class FieldType >
void mty::ModelData::addBosonicMass ( FieldType &&  field,
csl::Expr const &  mass 
)

Adds a bosonic mass term to the model.

A bosonic mass term for a field \( \phi \) of mass \( m \) is of the form

\[ \mathcal{L}_M \ni \pm \eta m^2 \phi ^\dagger \phi \]

, with \( \eta = 1/2 \) if \( \phi ^\dagger = \phi\), \( \eta = 1 \) otherwise. For spin 1 particles, the sign is positive, and negative for spin 0 particles. After the function call, the mass of the boson is set to the given mass \( m \), and any other mass term with $$$$ is suppressed.

Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function.
Parameters
fieldField in the mass term (must be bosonic).
massMass to add (must be scalar).

◆ addFermionicMass() [1/4]

template<class FieldType1 , class FieldType2 >
void mty::ModelData::addFermionicMass ( FieldType1 &&  left,
FieldType2 &&  right,
std::string_view  mass 
)

Adds a fermionic mass to the model.

This function adds a Weyl mass term for left and right. Considering two Weyl fermions \( \psi _L \) and \( \psi _R \), the mass term reads

\[ m\left(\psi _L^\dagger \psi _R + \psi _R^\dagger \psi _L\right). \]

After the function call, the mass of the two weyl fermions is set to the given mass \( m \), and any other mass term with \( \psi_ L \) or \( \psi _R \) is suppressed.

Template Parameters
FieldType1mty::Particle or any valid type for the getParticle() function.
FieldType2mty::Particle or any valid type for the getParticle() function.
Parameters
leftLeft-handed Weyl fermion.
rightRight-handed Weyl fermion.
massName of the mass for the fermion.

◆ addFermionicMass() [2/4]

template<class FieldType1 , class FieldType2 >
void mty::ModelData::addFermionicMass ( FieldType1 &&  left,
FieldType2 &&  right,
csl::Expr const &  mass 
)

Adds a fermionic mass to the model.

This function adds a Weyl mass term for left and right. Considering two Weyl fermions \( \psi _L \) and \( \psi _R \), the mass term reads

\[ m\left(\psi _L^\dagger \psi _R + \psi _R^\dagger \psi _L\right). \]

After the function call, the mass of the two weyl fermions is set to the given mass \( m \), and any other mass term with \( \psi_ L \) or \( \psi _R \) is suppressed.

Template Parameters
FieldType1mty::Particle or any valid type for the getParticle() function.
FieldType2mty::Particle or any valid type for the getParticle() function.
Parameters
leftLeft-handed Weyl fermion.
rightRight-handed Weyl fermion.
massMass for the fermion.

◆ addFermionicMass() [3/4]

template<class FieldType >
void mty::ModelData::addFermionicMass ( FieldType &&  diracFermion,
std::string_view  mass 
)

Adds a fermionic mass to the model.

This function adds a simple fermionic mass term for a particle, actually similar to a bosonic mass term replacing \( \phi ^* \) by ${}$. See addBosonicMass() for more details.

Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function.
Parameters
diracFermionDirac fermion.
massName of the mass for the fermion.

◆ addFermionicMass() [4/4]

template<class FieldType >
void mty::ModelData::addFermionicMass ( FieldType &&  diracFermion,
csl::Expr const &  mass 
)

Adds a fermionic mass to the model.

This function adds a simple fermionic mass term for a particle, actually similar to a bosonic mass term replacing \( \phi ^\dagger \) by ${}$. See addBosonicMass() for more details.

Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function.
Parameters
diracFermionDirac fermion.
massMass for the fermion.

◆ addFlavorGroup()

void mty::ModelData::addFlavorGroup ( std::string_view  name,
int  nFlavor,
bool  complexFields = true 
)

Adds a flavor group to the model.

For now, only SU(N) and SO(N) fundamental representations are enabled for flavor symmetries. For a flavor symmetry between N complex fields, The fundamental representation of SU(N) is created. For real fields, the fundamental representation of SO(N) is created.

Parameters
nameName of the flavor group
nFlavorNumber of flavors
complexFieldsBoolean (default = true) that tells if the fields are complex (SU(N) flavor) or not (SO(N) flavor).
See also
FlavorGroup, Flavor

◆ addGaugedGroup() [1/2]

void mty::ModelData::addGaugedGroup ( group::Type  type,
std::string_view  name,
int  dim,
csl::Expr const &  coupling = nullptr 
)

Adds a gauge group to the model.

This function allow to add a gauged group to the model, before initializing it (see init()) and adding matter particles. Given the type, the name, the dimension and (optionnaly) a coupling constant, the corresponding group, gauge boson, ghosts are created.

Note
After adding all desired gauged groups, you must call the init() function that settels once and for all the gauge.
If not given, the particles and couplings names follow the group name: A_<name> for the gauge bosons, c_<name> for the ghosts, g_<name> for the coupling constant.
Parameters
typeType of the gauged group
nameName of the group
dimDimension of the group (3 for SU(3) etc)
couplingCoupling constant (optional)
See also
GaugedGroup, Gauge

◆ addGaugedGroup() [2/2]

void mty::ModelData::addGaugedGroup ( group::Type  type,
std::string_view  name,
csl::Expr const &  coupling = nullptr 
)

Adds a gauge group to the model.

This function allow to add a gauged group to the model, before initializing it (see init()) and adding matter particles. Given the type, the name, and (optionnaly) a coupling constant, the corresponding group, gauge boson, ghosts are created. Here the dimension is not given. This function must then be used only for U(1), and exceptional algebras.

Note
After adding all desired gauged groups, you must call the init() function that settels once and for all the gauge.
If not given, the particles and couplings names follow the group name: A_<name> for the gauge bosons, c_<name> for the ghosts, g_<name> for the coupling constant.
Parameters
typeType of the gauged group
nameName of the group
couplingCoupling constant (optional)
See also
GaugedGroup, Gauge

◆ addLagrangianTerm() [1/2]

void mty::ModelData::addLagrangianTerm ( csl::Expr const &  term,
bool  addHermitic = false 
)

Adds a lagrangian term to the model.

The term can be a kinetic, mass term, or interaction term. It must be of course gauge invariant (see checkValidity()), and have no free indices (scalar term). Setting addHermitic to true, to hermitian conjugate will be computed and added automatically. For example, you may have in a Lagrangian

\[ \mathcal{L} \ni \frac{g}{\sqrt{2}} \bar{u}W^+\cdot \gamma P_Ld + h.c, \]

(in that case the '+h.c' corresponds to addHermitic = true), or

\[ \mathcal{L} \ni \frac{2}{3}e\bar{u}A\cdot \gamma u, \]

that do not have an hermitian counter part.

Parameters
termLagrangian term to add
addHermiticBoolean (default = false) that tells if the hermitian conjugate of the term must be also added

◆ addLagrangianTerm() [2/2]

void mty::ModelData::addLagrangianTerm ( mty::Lagrangian::TermType const &  term,
bool  addHermitic = false 
)

Adds a lagrangian term to the model.

The term can be a kinetic, mass term, or interaction term. It must be of course gauge invariant (see checkValidity()), and have no free indices (scalar term). Setting addHermitic to true, to hermitian conjugate will be computed and added automatically. For example, you may have in a Lagrangian

\[ \mathcal{L} \ni \frac{g}{\sqrt{2}} \bar{u}W^+\cdot \gamma P_Ld + h.c, \]

(in that case the '+h.c' corresponds to addHermitic = true), or

\[ \mathcal{L} \ni \frac{2}{3}e\bar{u}A\cdot \gamma u, \]

that do not have an hermitian counter part.

Parameters
termLagrangian term to add
addHermiticBoolean (default = false) that tells if the hermitian conjugate of the term must be also added

◆ addParticle()

void mty::ModelData::addParticle ( mty::Particle const &  part,
bool  initializeTerms = true 
)

Adds a particle to the model.

When adding a particle, its gauge representation should be already set, and the model must be initialized (see init()). You can choose to let MARTY create kinetic (including covariant derivative) and mass terms (default) or disable all automatic interaction terms with the initializeTerms parameter.

Parameters
partParticle to add to the model
initializeTermsBoolean (default = true) that tells if kinetic and mass terms must be added automatically.
See also
removeParticle()

◆ addParticles()

void mty::ModelData::addParticles ( std::vector< mty::Particle > const &  parts,
bool  initializeTerms = true 
)

Adds a list of particles to the model.

When adding a particle, its gauge representation should be already set, and the model must be initialized (see init()). You can choose to let MARTY create kinetic (including covariant derivative) and mass terms (default) or disable all automatic interaction terms with the initializeTerms parameter.

Parameters
partParticles to add to the model
initializeTermsBoolean (default = true) that tells if kinetic and mass terms must be added automatically.
See also
removeParticle()

◆ addQuantumNumber() [1/3]

void mty::ModelData::addQuantumNumber ( std::string_view  name,
std::vector< mty::Particle > const &  fields,
std::vector< int > const &  values,
bool  conserved = true 
)

Adds a new quantum number to a model, giving eigenvalues for particles also.

You must give a list of particles, and a list of eigenvalues. The list of eigenvalues may be empty: in this case, all eigenvalues are considered to be 1 by default. All particles not present in fields have 0 eigenvalue. Optionally, you may set conserved to false if you do not want this quantum number to interfere in calculations. Here is a code snippet that shows how to use this function, considering for example a quark q, and a lepton l (both of type mty::Particle).

model.addQuantumNumber("F", {l, q}, {}, false);
// l and q have fermionic number F = 1, and it is not
// used in calculations
model.addQuantumNumber("B", {l, q}, {0, 1});
// Baryonic number
model.addQuantumNumber("L", {l, q}, {1, 0});
// Leptonic number
Parameters
nameName of the quantum number
fieldsList of fields for which a non-trivial eigenvalue is defined
valuesEigenvalues for the fields (all 1 if the list is empty)
conservedBoolean (default = true) that tells if the quantum number must be conserved in calculations.

◆ addQuantumNumber() [2/3]

template<class FieldType >
void mty::ModelData::addQuantumNumber ( std::string_view  name,
std::vector< FieldType > const &  fields,
std::vector< int > const &  values,
bool  conserved = true 
)

Adds a new quantum number to a model, giving eigenvalues for particles also.

You must give a list of particles, and a list of eigenvalues. The list of eigenvalues may be empty: in this case, all eigenvalues are considered to be 1 by default. All particles not present in fields have 0 eigenvalue. Optionally, you may set conserved to false if you do not want this quantum number to interfere in calculations. Here is a code snippet that shows how to use this function, considering for example a quark q, and a lepton l (both of type mty::Particle).

model.addQuantumNumber("F", {l, q}, {}, false);
// l and q have fermionic number F = 1, and it is not
// used in calculations
model.addQuantumNumber("B", {l, q}, {0, 1});
// Baryonic number
model.addQuantumNumber("L", {l, q}, {1, 0});
// Leptonic number
Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function
Parameters
nameName of the quantum number
fieldsList of fields for which a non-trivial eigenvalue is defined
valuesEigenvalues for the fields (all 1 if the list is empty)
conservedBoolean (default = true) that tells if the quantum number must be conserved in calculations.

◆ addQuantumNumber() [3/3]

template<class FieldType >
void mty::ModelData::addQuantumNumber ( std::string_view  name,
std::initializer_list< FieldType >  fields,
std::vector< int > const &  values,
bool  conserved = true 
)

Adds a new quantum number to a model, giving eigenvalues for particles also.

You must give a list of particles, and a list of eigenvalues. The list of eigenvalues may be empty: in this case, all eigenvalues are considered to be 1 by default. All particles not present in fields have 0 eigenvalue. Optionally, you may set conserved to false if you do not want this quantum number to interfere in calculations. Here is a code snippet that shows how to use this function, considering for example a quark q, and a lepton l (both of type mty::Particle).

model.addQuantumNumber("F", {l, q}, {}, false);
// l and q have fermionic number F = 1, and it is not
// used in calculations
model.addQuantumNumber("B", {l, q}, {0, 1});
// Baryonic number
model.addQuantumNumber("L", {l, q}, {1, 0});
// Leptonic number
Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function
Parameters
nameName of the quantum number
fieldsList of fields for which a non-trivial eigenvalue is defined
valuesEigenvalues for the fields (all 1 if the list is empty)
conservedBoolean (default = true) that tells if the quantum number must be conserved in calculations.

◆ addScalarCoupling() [1/2]

void mty::ModelData::addScalarCoupling ( std::string_view  t_name)

Adds a scalar coupling constant in the model.

This function creates a csl::Constant named name and adds it to the list of coupling constants.

Parameters
t_nameName for the coupling constant.

◆ addScalarCoupling() [2/2]

void mty::ModelData::addScalarCoupling ( csl::Expr const &  coupling)

Adds a scalar coupling constant in the model.

This function adds coupling to the list of coupling constants.

Parameters
couplingNew coupling constant.

◆ addTensorCoupling()

void mty::ModelData::addTensorCoupling ( csl::Parent const &  tensorCoupling)

Adds a tensor coupling constant in the model.

This function adds tensorCoupling to the list of tensor coupling constants.

Parameters
tensorCouplingNew tensorial coupling constant.

◆ checkHermiticity()

void mty::ModelData::checkHermiticity ( )

Checks the hermiticity of the Lagrangian, i.e. checks if \( \mathcal{L}^\dagger = \mathcal{L} \).

If the Lagrangian is not hermitian, this function simply prints out the problematic terms. There is no check for integration by parts, so the Lagrangian may still be hermitic, this function simply does not automatically recognize this kind of patterns.

◆ checkValidity() [1/2]

void mty::ModelData::checkValidity ( mty::Particle const &  part) const

Checks the validity of a particle when adding it to the model.

This function checks if the gauge, flavor of the particle are the same as the ones defined in the model. If the particle is not valid, an error message is printed and the program stops.

Parameters
partParticle to check

◆ checkValidity() [2/2]

void mty::ModelData::checkValidity ( mty::Lagrangian::TermType const &  term) const

Checks the validity of a term when adding it to the Lagrangian.

This function simply computes the tensor product of the gauge representations of all particles in the interaction (taking conjugate representations for conjugate fields) and checks that the trivial gauge representation exists in the resulting decomposition. This represents a quick check of gauge invariance, even though the exact gauge invariance is not guaranteed at this point.

Parameters
termTerm to check

◆ doGenerateIndex() [1/3]

csl::Index mty::ModelData::doGenerateIndex ( mty::Group const *  group,
mty::Particle const &  fieldRep 
) const
protected

Actually returns a csl::Index corresponding to a particle's representation.

Parameters
groupGroup
fieldRepParticle
Returns
An index corresponding to the group representation of irrep in the group group.
See also
generateIndex()

◆ doGenerateIndex() [2/3]

csl::Index mty::ModelData::doGenerateIndex ( mty::Group const *  group) const
protected

Actually returns a csl::Index corresponding to the fundamental representation of a given group.

Parameters
groupGroup
Returns
An index corresponding to the fundamental representation of the group group.
Warning
For now only enabled for flavor groups, not gauged groups.
See also
generateIndex()

◆ doGenerateIndex() [3/3]

csl::Index mty::ModelData::doGenerateIndex ( std::string_view  nameIndex,
mty::Group const *  group,
mty::Particle const &  fieldRep 
) const
protected

Actually returns a csl::Index corresponding to a particle's representation.

Parameters
nameName of the index to generate
groupGroup
fieldRepParticle
Returns
An index corresponding to the group representation of irrep in the group group.
See also
generateIndex()

◆ doGetCharge()

csl::Expr mty::ModelData::doGetCharge ( mty::Particle const &  particle,
mty::Group const *  group 
) const
protected

Actually returns the charge representation of a particle for a U(1) group.

Parameters
partParticle from which we want the charge
groupU(1) Group
Returns
The charge representation of part or the group group.
See also
getCharge()

◆ doGetFlavorIrrep() [1/2]

mty::FlavorIrrep mty::ModelData::doGetFlavorIrrep ( mty::Particle const &  part) const
protected

Actually returns the flavor representation of a particle.

Parameters
partParticle from which we want the representation.
Returns
The flavor representation of part.
See also
getFlavorIrrep()

◆ doGetFlavorIrrep() [2/2]

mty::Irrep mty::ModelData::doGetFlavorIrrep ( mty::Particle const &  part,
mty::Group const *  flavor 
) const
protected

Actually returns the flavor group representation of a particle.

Parameters
partParticle from which we want the representation
groupFlavor group
Returns
The flavor group representation of part or the group group.
See also
getFlavorIrrep()

◆ doGetGaugeIrrep()

mty::GaugeIrrep mty::ModelData::doGetGaugeIrrep ( mty::Particle const &  part) const
protected

Actually returns the gauge representation of a particle.

Parameters
partParticle from which we want the representation.
Returns
The gauge representation of part.
See also
getGaugeIrrep()

◆ doGetGenerator()

mty::Generator mty::ModelData::doGetGenerator ( mty::Group const *  group,
mty::Particle const &  fieldRep 
) const
protected

Actually returns a generator corresponding to a particle's representation.

Parameters
groupGroup
fieldRepParticle
Returns
The generator corresponding to the group representation of fieldRep in the group group if it is not trivial.
nullptr else
See also
generateIndex()

◆ doGetGroupIrrep()

mty::Irrep mty::ModelData::doGetGroupIrrep ( mty::Particle const &  part,
mty::Group const *  group 
) const
protected

Actually returns the group representation of a particle.

Parameters
partParticle from which we want the representation
groupGroup
Returns
The group representation of part or the group group.
See also
getGroupIrrep()

◆ doGetVectorSpace() [1/2]

const csl::Space * mty::ModelData::doGetVectorSpace ( mty::Group const *  group,
mty::Particle const &  irrep 
) const
protected

Actually returns the vector space corresponding to a particle's representation.

Parameters
groupGroup
irrepParticle
Returns
The vector space of the group representation of irrep in the group group.
See also
getVectorSpace()

◆ doGetVectorSpace() [2/2]

const csl::Space * mty::ModelData::doGetVectorSpace ( mty::FlavorGroup const *  group,
mty::Particle const &  irrep 
) const
protected

Actually returns the vector space corresponding to a particle's representation.

Parameters
groupFlavor group
irrepParticle
Returns
The vector space of the flavor group representation of irrep in the flavor group group.
See also
getVectorSpace()

◆ doRenameParticle()

void mty::ModelData::doRenameParticle ( mty::Particle const &  part,
std::string_view  newName 
)
protected

Actually renames a particle.

Parameters
partParticle to rename.
newNameNew name for the particle.
See also
renameParticle()

◆ findParticle() [1/3]

bool mty::ModelData::findParticle ( std::string_view  t_name) const

Searches a particle in the model.

Parameters
t_nameName of the particle to search.
Returns
True if the particle exists
False else
See also
getParticle()

◆ findParticle() [2/3]

bool mty::ModelData::findParticle ( mty::Particle const &  part) const

Searches a particle in the model.

Parameters
partParticle to search in the model
Returns
True if the particle exists
False else
See also
getParticle()

◆ findParticle() [3/3]

bool mty::ModelData::findParticle ( mty::QuantumFieldParent const *  part) const

Searches a particle in the model.

Parameters
partParticle to search in the model
Returns
True if the particle exists
False else
See also
getParticle()

◆ findScalarCoupling() [1/2]

bool mty::ModelData::findScalarCoupling ( std::string_view  t_name) const

Searches a scalar coupling in the model.

Parameters
t_nameName of the coupling to search.
Returns
True if the coupling exists
False else
See also
getScalarCoupling()

◆ findScalarCoupling() [2/2]

bool mty::ModelData::findScalarCoupling ( csl::Expr const &  coupling) const

Searches a scalar coupling in the model.

Parameters
couplingCoupling to search
Returns
True if the coupling exists
False else
See also
getScalarCoupling()

◆ findTensorCoupling() [1/3]

bool mty::ModelData::findTensorCoupling ( std::string_view  t_name) const

Searches a tensor coupling in the model.

Parameters
t_nameName of the coupling to search.
Returns
True if the coupling exists
False else
See also
getTensorCoupling()

◆ findTensorCoupling() [2/3]

bool mty::ModelData::findTensorCoupling ( csl::Parent const &  coupling) const

Searches a tensor coupling in the model.

Parameters
couplingCoupling to search in the model
Returns
True if the coupling exists
False else
See also
getTensorCoupling()

◆ findTensorCoupling() [3/3]

bool mty::ModelData::findTensorCoupling ( csl::AbstractParent const *  coupling) const

Searches a tensor coupling in the model.

Parameters
couplingCoupling to search in the model
Returns
True if the coupling exists
False else
See also
getTensorCoupling()

◆ generateIndex() [1/3]

template<class GroupType , class FieldType >
csl::Index mty::ModelData::generateIndex ( GroupType &&  group,
FieldType &&  field 
) const

Returns an index coresponding to the representation of a field in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
groupGroup.
Returns
An index coresponding to the representation of a field in a given group.

◆ generateIndex() [2/3]

template<class GroupType >
csl::Index mty::ModelData::generateIndex ( GroupType &&  group) const

Returns an index coresponding to the fundamental representation in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
Parameters
groupGroup.
Warning
For now only enabled for flavor groups, not gauged groups.
Returns
An index coresponding to the fundamental representation of a given group.

◆ generateIndex() [3/3]

template<class GroupType , class FieldType >
csl::Index mty::ModelData::generateIndex ( std::string_view  nameIndex,
GroupType &&  group,
FieldType &&  field 
) const

Returns an index coresponding to the representation of a field in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
nameName for the generated index.
groupGroup.
fieldParticle.
Returns
An index coresponding to the representation of a field in a given group.

◆ generateIndices() [1/2]

template<class GroupType , class FieldType >
std::vector< csl::Index > mty::ModelData::generateIndices ( size_t  nIndices,
GroupType &&  group,
FieldType &&  field 
) const

Returns indices coresponding to the representation of a field in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
nIndicesNumber of indices to generate.
groupGroup.
fieldParticle.
Returns
nIndices indices coresponding to the representation of a field in a given group.

◆ generateIndices() [2/2]

template<class GroupType >
std::vector< csl::Index > mty::ModelData::generateIndices ( size_t  nIndices,
GroupType &&  group 
) const

Returns indices coresponding to the fundamental representation in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
Parameters
groupGroup.
Warning
For now only enabled for flavor groups, not gauged groups.
Returns
Indices coresponding to the fundamental representation of a given group.

◆ getCharge()

template<class GroupType , class FieldType >
csl::Expr mty::ModelData::getCharge ( FieldType &&  field,
GroupType &&  group 
) const

Returns the charge representation of a field in a U(1) group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
groupU(1) group.
Returns
The charge representation of field in group.

◆ getFlavor()

mty::Flavor * mty::ModelData::getFlavor ( ) const

Returns a pointer to the model's flavor.

This function does not transfer the ownership. In particular, you have not to delete the data.

Returns
The flavor of the model.

◆ getFlavorGroup() [1/2]

mty::FlavorGroup const * mty::ModelData::getFlavorGroup ( std::string_view  t_name) const

Returns a FlavorGroup (pointer) given its name.

Parameters
t_nameName of the flavor group to search
Returns
The flavor group of name t_name in the model
See also
getGroup()

◆ getFlavorGroup() [2/2]

mty::FlavorGroup * mty::ModelData::getFlavorGroup ( std::string_view  t_name)

Returns a FlavorGroup (pointer) given its name.

Parameters
t_nameName of the flavor group to search
Returns
The flavor group of name t_name in the model
See also
getGroup()

◆ getFlavorIrrep() [1/2]

template<class FieldType >
mty::FlavorIrrep mty::ModelData::getFlavorIrrep ( FieldType &&  field) const

Returns the flavor representation of a field.

Template Parameters
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
Returns
The flavor representation of the particle.

◆ getFlavorIrrep() [2/2]

template<class FlavorType , class FieldType >
mty::Irrep mty::ModelData::getFlavorIrrep ( FieldType &&  field,
FlavorType &&  flavor 
) const

Returns the flavor group representation of a field.

Template Parameters
FlavorTypemty::Flavor* or valid type for the function getFlavorGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
flavorFlavor group.
Returns
The flavor group representation of field in flavor.

◆ getGauge()

mty::Gauge * mty::ModelData::getGauge ( ) const

Returns a pointer to the model's gauge.

This function does not transfer the ownership. In particular, you have not to delete the data.

Returns
The gauge of the model.

◆ getGaugedGroup() [1/2]

mty::GaugedGroup const * mty::ModelData::getGaugedGroup ( std::string_view  t_name) const

Returns a GaugedGroup (pointer to const) given its name.

Parameters
t_nameName of the gauged group to search
Returns
The gauged group of name t_name in the model
See also
getGroup()

◆ getGaugedGroup() [2/2]

mty::GaugedGroup * mty::ModelData::getGaugedGroup ( std::string_view  t_name)

Returns a GaugedGroup (pointer) given its name.

Parameters
t_nameName of the gauged group to search
Returns
The gauged group of name t_name in the model
See also
getGroup()

◆ getGaugeIrrep()

template<class FieldType >
mty::GaugeIrrep mty::ModelData::getGaugeIrrep ( FieldType &&  field) const

Returns the gauge representation of a field.

Template Parameters
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
Returns
The gauge representation of the particle.

◆ getGenerator()

template<class GroupType , class FieldType >
mty::Generator mty::ModelData::getGenerator ( GroupType &&  group,
FieldType &&  field 
) const

Returns the generator coresponding to the representation of a field in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
groupGroup.
fieldParticle.
Returns
The generator coresponding to the representation of a field in a given group if it exists.
nullptr else.

◆ getGroup() [1/4]

mty::Group const * mty::ModelData::getGroup ( std::string_view  t_name) const

Returns a Group (pointer to const) given its name.

Parameters
t_nameName of the group to search
Returns
The group of name t_name in the model
See also
getGaugedGroup()

◆ getGroup() [2/4]

mty::Group * mty::ModelData::getGroup ( std::string_view  t_name)

Returns a Group (pointer) given its name.

Parameters
t_nameName of the group to search
Returns
The group of name t_name in the model
See also
getGaugedGroup()

◆ getGroup() [3/4]

mty::Group const * mty::ModelData::getGroup ( mty::FlavorGroup const *  flavGroup) const

Returns a Group (pointer to const) given its flavor group.

Parameters
flavGroupInitial flavor group.
Returns
The group of flavor flavGroup in the model
See also
getFlavorGroup()

◆ getGroup() [4/4]

mty::Group * mty::ModelData::getGroup ( mty::FlavorGroup const *  flavGroup)

Returns a Group (pointer to const) given its flavor group.

Parameters
flavGroupInitial flavor group.
Returns
The group of flavor flavGroup in the model
See also
getFlavorGroup()

◆ getGroupIrrep()

template<class GroupType , class FieldType >
mty::Irrep mty::ModelData::getGroupIrrep ( FieldType &&  field,
GroupType &&  group 
) const

Returns the group representation of a field.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
groupGroup.
Returns
The group representation of field in group.

◆ getLagrangian()

mty::Lagrangian const & mty::ModelData::getLagrangian ( ) const

Returns a const reference to the Lagrangian.

The lagrangian should not be modified directly. Always prefer using buitl-in functions to modify it. This is why this function returns an const-reference. The way to get the lagrangian from it is

mty::Lagrangian const &L = model.getLagrangian();
Returns
The lagrangian of the model.

◆ getParticle() [1/5]

mty::Particle mty::ModelData::getParticle ( std::string_view  t_name) const

Returns a particle in the model given a name.

In case no particle is found, an error message is printed and the code stops. If you want to know if a particle exists, consider using findParticle() instead.

Parameters
t_nameName of the particle to get.
Returns
The particle of name name.

◆ getParticle() [2/5]

mty::Particle mty::ModelData::getParticle ( mty::QuantumFieldParent const *  field) const

Returns a particle in the model given a pointer to QuantumFieldParent.

In case no particle is found, an error message is printed and the code stops. If you want to know if a particle exists, consider using findParticle() instead.

Parameters
fieldField from which you want a mty::Particle type.
Returns
The mty::Particle (a std::shared_ptr to field).

◆ getParticle() [3/5]

mty::Particle mty::ModelData::getParticle ( mty::QuantumFieldParent const &  field) const

Returns a particle in the model given a QuantumFieldParent.

In case no particle is found, an error message is printed and the code stops. If you want to know if a particle exists, consider using findParticle() instead.

Parameters
fieldField from which you want a mty::Particle type.
Returns
The mty::Particle (a std::shared_ptr to field).

◆ getParticle() [4/5]

mty::Particle mty::ModelData::getParticle ( mty::QuantumField const &  field) const

Returns a particle in the model given a QuantumField.

In case no particle is found, an error message is printed and the code stops. If you want to know if a particle exists, consider using findParticle() instead.

Parameters
fieldField from which you want a mty::Particle type.
Returns
The mty::Particle (a std::shared_ptr to field's parent).

◆ getParticle() [5/5]

mty::Particle mty::ModelData::getParticle ( csl::Expr const &  field) const

Returns a particle in the model given an expression.

In case no particle is found, an error message is printed and the code stops. If you want to know if a particle exists, consider using findParticle() instead. The expression field must of course be of type QuantumField, i.e. pointing to an object of this type.

Parameters
fieldField from which you want a mty::Particle type.
Returns
The mty::Particle (a std::shared_ptr to field's parent).

◆ getParticles()

std::vector< mty::Particle > const & mty::ModelData::getParticles ( ) const

Returns a const reference to the model's particles.

Particles should be modified through the built-in functions, not directly from this vector. This is why the function only returns a const reference. It must be called as follows

std::vector<mty::Particle> const &particles = model.getParticles();
Returns
The particles of the model.

◆ getPhysicalParticles()

std::vector< mty::Particle > mty::ModelData::getPhysicalParticles ( std::function< bool(mty::Particle)> const &  predicate = [](mty::Particle) { return true; }) const

Returns a list of the physical particles in a model.

Takes care of removing ghosts and particles that would appear twice in the full list of particles (see getParticles()), in particular removing left- and right-handed parts of Dirac fermions (letting only the full 4-component fermion). This function is meant to be called when repeting a particular calculation for all particles in a model. A boolean predicate can be given to filter more the list, for example taking only bosons or fermions. Example:

auto all = model.getPhysicalParticles();
auto bosons = model.getPhysicalParticles(
[](Particle p) { return p->isBosonic(); }
);
auto fermions = model.getPhysicalParticles(
[](Particle p) { return p->isFermionic(); }
);
auto vectors = model.getPhysicalParticles(
[](Particle p) { return p->getSpinDimension() == 3; }
);
Returns
The list of physical particles.

◆ getQuantumNumber() [1/2]

mty::QuantumNumber const & mty::ModelData::getQuantumNumber ( std::string_view  name) const

Returns a quantum number (const reference) given its name.

If the quantum number does not exist, this function prints an error message and stops the program.

Parameters
t_nameName of the quantum number to get
Returns
The quantum number of name t_name

◆ getQuantumNumber() [2/2]

mty::QuantumNumber & mty::ModelData::getQuantumNumber ( std::string_view  name)

Returns a quantum number (reference) given its name.

If the quantum number does not exist, this function prints an error message and stops the program.

Parameters
t_nameName of the quantum number to get
Returns
The quantum number of name t_name

◆ getQuantumNumbers() [1/2]

std::vector< QuantumNumber > const & mty::ModelData::getQuantumNumbers ( ) const

Returns the list of quantum numbers.

Returns
The quantum numbers of the model.
See also
quantumNumber.h

◆ getQuantumNumbers() [2/2]

std::vector< QuantumNumber > & mty::ModelData::getQuantumNumbers ( )

Returns the list of quantum numbers.

Returns
The quantum numbers of the model.
See also
quantumNumber.h

◆ getScalarCoupling()

csl::Expr mty::ModelData::getScalarCoupling ( std::string_view  t_name) const

Returns a scalar coupling given its name.

If the scalar coupling does not exist, this function prints an error message and stops the program. If you want to know if a scalar coupling exists, try using findScalarCoupling() instead.

Parameters
t_nameName of the scalar coupling to get
Returns
The scalar coupling of name t_name

◆ getScalarCouplings()

std::vector< csl::Expr > const & mty::ModelData::getScalarCouplings ( ) const

Returns the scalar couplings (gauge coupling typically) of the model.

When a gauge group is created, a gauge coupling constant comes with it. This coupling is stored in the model's scalar couplings that you can get with this function (as a constant reference).

Returns
The list of scalar couplings of the theory.

◆ getSpaceTime()

csl::Space const * mty::ModelData::getSpaceTime ( ) const

Returns a pointer to the space time of the mode (csl::Space).

For now, only csl::Minkowski is supported.

Returns
The space-time of the model.

◆ getTensorCoupling() [1/2]

csl::Tensor mty::ModelData::getTensorCoupling ( std::string_view  t_name) const

Returns a tensor coupling given its name.

If the tensor coupling does not exist, this function prints an error message and stops the program. If you want to know if a tensor coupling exists, try using findTensorCoupling() instead.

Parameters
t_nameName of the tensor coupling to get
Returns
The tensor coupling of name t_name

◆ getTensorCoupling() [2/2]

csl::Tensor mty::ModelData::getTensorCoupling ( csl::Parent const &  t_coupling) const

Returns a tensor coupling.

If the tensor coupling does not exist, this function prints an error message and stops the program. If you want to know if a tensor coupling exists, try using findTensorCoupling() instead.

Parameters
t_couplingCoupling to search in the model
Returns
The tensor coupling of name t_name

◆ getTensorCouplings()

std::vector< csl::Tensor > const & mty::ModelData::getTensorCouplings ( ) const

Returns the tensor couplings (Yukawa coupling typically) of the model.

When a Yukawa coupling is created, th corresponding tensor is stored in the model's tensor couplings that you can get with this function (as a constant reference).

Returns
The list of tensor couplings of the theory.

◆ getVectorSpace()

template<class GroupType , class FieldType >
csl::Space const * mty::ModelData::getVectorSpace ( GroupType &&  group,
FieldType &&  field 
) const

Returns the vector space coresponding to the representation of a field in a given group.

Template Parameters
GroupTypemty::Group* or valid type for the function getGroup()
FieldTypemty::Particle or valid type for the function getParticle()
Parameters
fieldParticle.
groupGroup.
Returns
The vector space coresponding to the representation of a field in a given group.

◆ init()

void mty::ModelData::init ( bool  initGaugeTerms = true)

Initializes the gauge once and for all. This function must be called after finishing the gauge, and before adding matter particles. Calling the constructors that take an already built gauge, this function is called automatically. Otherwise you have to call it.

Parameters
initGaugeTermsBoolean (default = true) that tells if kinetic and mass terms for gauge bosons and ghosts must be added.

◆ initGaugedGroups()

void mty::ModelData::initGaugedGroups ( bool  initGaugeTerms = true)
protected

Initializes gauge terms (gauge bosons, ghosts) and fixes the gauge.

Parameters
initGaugeTermsBoolean (default = true) that tells if kinetic and mass terms must be added automatically.

◆ isEnableChecks()

bool mty::ModelData::isEnableChecks ( ) const
inline
Returns
enableChecks

◆ printSubPart() [1/3]

void mty::ModelData::printSubPart ( std::vector< std::string > const &  particles,
std::ostream &  out = std::cout 
) const

Prints a sub part of the Lagrangian including some particles.

Parameters
particlesParticles that printed terms must have
outOutput stream (std::cout, standard stream by default)

◆ printSubPart() [2/3]

void mty::ModelData::printSubPart ( std::initializer_list< std::string >  particles,
std::ostream &  out = std::cout 
) const

Prints a sub part of the Lagrangian including some particles.

Parameters
particlesParticles that printed terms must have
outOutput stream (std::cout, standard stream by default)

◆ printSubPart() [3/3]

void mty::ModelData::printSubPart ( std::string const &  particle,
std::ostream &  out = std::cout 
) const

Prints a sub part of the Lagrangian including some particles.

Parameters
particlesParticles that printed terms must have
outOutput stream (std::cout, standard stream by default)

◆ removeParticle() [1/2]

void mty::ModelData::removeParticle ( mty::Particle const &  part)

Removes a particle from the model.

When removing a particle, all interaction terms containing it are removed. It is a non-return point. If you simply want to disable a given particle in calculations, consider using mty::DisableParticle().

Parameters
partParticle to remove.
See also
addParticle(), mty::DisableParticle()

◆ removeParticle() [2/2]

void mty::ModelData::removeParticle ( std::string const &  part)

Removes a particle from the model.

When removing a particle, all interaction terms containing it are removed. It is a non-return point. If you simply want to disable a given particle in calculations, consider using mty::DisableParticle().

Parameters
partName of the particle to remove.
See also
addParticle(), mty::DisableParticle()

◆ removeParticles() [1/2]

void mty::ModelData::removeParticles ( std::vector< mty::Particle > const &  parts)

Removes particles from the model.

When removing a particle, all interaction terms containing it are removed. It is a non-return point. If you simply want to disable a given particle in calculations, consider using mty::DisableParticle().

Parameters
partsParticles to remove.
See also
addParticle(), mty::DisableParticle()

◆ removeParticles() [2/2]

void mty::ModelData::removeParticles ( std::vector< std::string > const &  parts)

Removes particles from the model.

When removing a particle, all interaction terms containing it are removed. It is a non-return point. If you simply want to disable a given particle in calculations, consider using mty::DisableParticle().

Parameters
partsNames of the particles to remove.
See also
addParticle(), mty::DisableParticle()

◆ renameCoupling()

void mty::ModelData::renameCoupling ( std::string_view  name,
std::string_view  newName 
)

Renames a (scalar or tensor) coupling of the model.

Parameters
nameInitial name of the coupling
newNameNew name for the particle

◆ renameParticle()

template<class FieldType >
void mty::ModelData::renameParticle ( FieldType &&  field,
std::string_view  newName 
)

Renames a particle of the model.

Template Parameters
FieldTypemty::Particle or any valid type for the getParticle() function.
Parameters
fieldParticle to rename
newNameNew name for the particle

◆ setEnableChecks()

void mty::ModelData::setEnableChecks ( bool  t_enable)
inline

Sets enableChecks.

Parameters
t_enableNew boolean value

◆ setFlavor()

void mty::ModelData::setFlavor ( std::unique_ptr< mty::Flavor > &&  t_flavor)

Sets the flavor of the model.

This function should be used after creating a model with an empty flavor (in particular using the default constructor of ModelData). It may be used to create the flavor separately, not using built-in functions of this class. The std::unique_ptr given as parameter loses the ownership of the flavor and is not valid after the function call. Here is a code snippet that show how to use this function.

Model model;
std::unique_ptr<mty::Flavor> flavor = makeFlavor();
model.setFlavor(std::move(flavor));
// Here flavor is not valid anymore, model took the ownership
Warning
This function must be called before adding any particle or other property as the flavor must be the first one defined.
Parameters
t_flavorFlavor for the model.

◆ setGauge()

void mty::ModelData::setGauge ( std::unique_ptr< mty::Gauge > &&  t_gauge)

Sets the gauge of the model.

This function should be used after creating a model with an empty gauge (in particular using the default constructor of ModelData). It may be used to create the gauge separately, not using built-in functions of this class. The std::unique_ptr given as parameter loses the ownership of the gauge and is not valid after the function call. Here is a code snippet that show how to use this function.

Model model;
std::unique_ptr<mty::Gauge> gauge = makeGauge();
model.setGauge(std::move(gauge));
// Here gauge is not valid anymore, model took the ownership
Warning
This function must be called before adding any particle or other property as the gauge must be the first one defined.
Parameters
t_gaugeGauge for the model.

◆ setQuantumNumbers()

void mty::ModelData::setQuantumNumbers ( std::vector< mty::QuantumNumber > const &  numbers)

Sets the quantum numbers of the model.

This function should in principle not be used. It replaces the entire set of quantum numbers, without defining eigenvalues for particles. Consider using addQuantumNumber() instead.

Parameters
numbersNew quantum numbers

◆ setSpaceTime()

void mty::ModelData::setSpaceTime ( csl::Space const *  t_spaceTime)

Sets the space time of the model.

Warning
This function as been written to possibly extend MARTY to other space-time calculations than 4D Minkowski but it does not support it yet. This function should then not be used.
Parameters
t_spaceTimeNew space time for the model.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
ModelData const &  model 
)
friend

Prints the model.

This function prints out the model gauge, the particle content and the Lagrangian (kinetic, mass, and interaction terms).

Parameters
outOutput stream (default is standard stream std::cout).
modelModel to output.
Returns

Field Documentation

◆ defaultQuantumNumber

int mty::ModelData::defaultQuantumNumber = 1
inlinestatic

Default quantum number for particles when not given.

When defining a quantum number in a model, for example the baryonic number B, you may define it for any particle. If you do nothing, the default number is zero. If you define it, you can either give the quantum number, or nothing. It the latter case, the defined quantum number is equal to defaultQuantumNumber.

See also
getQuantumNumbers(), addQuantumNumber(), setQuantumNumbers()

◆ enableChecks

bool mty::ModelData::enableChecks = true
protected

Boolean telling if checks must be done with lagrangian terms added to the model (gauge representation, dispatching ...)

See also
addLagrangianTerm(), isEnableChecks(), setEnableCheck()

◆ gaugeLocked

bool mty::ModelData::gaugeLocked = false
protected

Boolean that tells if the gauge model is initilialized.

When building a model, the gauge must be created first before adding any other particle. The gauge must be fixed by calling the init() function. Only then, particles can be added using addParticle() function.

See also
init(), setGauge(), addGaugedGroup(), ModelData()

◆ L

mty::Lagrangian mty::ModelData::L
protected

Lagrangian of the model.

The lagrangian is modified only through built-in functions, either from this class (ModelData) for basic content modifications, or from the ModelBuilder class for more complicated model building features (symmetry breaking, replacements etc).

◆ particles

std::vector<mty::Particle> mty::ModelData::particles
protected

Particle content (including gauge bosons, ghosts etc) of the model.

See also
getParticle(), addParticle()

◆ quantumNumbers

std::vector<mty::QuantumNumber> mty::ModelData::quantumNumbers
protected

List of quantum numbers in the model.

Particles can have different eigenvalues for these quantum numbers (0 by default, if not given).

See also
getQuantumNumbers(), getQuantumNumber(), addQuantumNumber()

◆ scalarCouplings

std::vector<csl::Expr> mty::ModelData::scalarCouplings
protected

Lists of scalar couplings of the model.

See also
getScalarCouplings(), getScalarCoupling(), addScalarCoupling()

◆ spaceTime

csl::Space const* mty::ModelData::spaceTime
protected

Space time for the model.

By default, this variable is a pointer to csl::Minkowski (4D). There is actually no support for another space time so for now, nothing to do with this member.

◆ tensorCouplings

std::vector<csl::Tensor> mty::ModelData::tensorCouplings
protected

List of tensor couplings of the model.

See also
getTensorCouplings(), getTensorCoupling(), addTensorCoupling()

The documentation for this class was generated from the following files: