Commit 43530fa4 authored by Grégoire Uhlrich's avatar Grégoire Uhlrich
Browse files

GRAFED curvature adapted int -> double

parent 73332f40
......@@ -222,9 +222,9 @@ QPointF Diagram::getEdgeLabelPos(
}
QPointF mean = (posI + posJ) / 2;
QPointF perpdir{-dir.y(), +dir.x()};
if (lEdge.curve != 0) {
if (std::fabs(lEdge.curve) > 0.005) {
double L = edge->length();
double c = edge->getCurvature() * edge->length();
double c = edge->getCurve();// * edge->length();
double offset = -L*(1-std::sqrt(1-c*c/4))/c;
mean += offset * perpdir;
}
......@@ -1041,7 +1041,7 @@ void Diagram::refreshLinker()
edges[k]->getParticleType()),
name,
edges[k]->getSign(),
edges[k]->getCurve(),
edges[k]->getCurve()/2,
edges[k]->isFlipped(),
fromQColor(edges[k]->getColor()),
edges[k]->getLineWidth()
......
......@@ -65,36 +65,14 @@ QString Edge::getName() const
return (label) ? label->data : "";
}
qint32 Edge::getCurve() const
double Edge::getCurve() const
{
if (curvature == 0.)
return 0;
double max = 1.99;
if (std::abs(curvature) > 0.95 * max)
return (curvature > 0) ? 1 : 2;
return (curvature > 0) ? 3 : 4;
return curvature;
}
void Edge::setCurve(int t_curve)
void Edge::setCurve(double t_curve)
{
switch(t_curve) {
case 1:
setCurvature(1);
break;
case 2:
setCurvature(-1);
break;
case 3:
setCurvature(0.5);
break;
case 4:
setCurvature(-0.5);
break;
default:
setCurvature(0);
break;
}
setCurvature(t_curve);
}
const Node* Edge::getFirst() const
......@@ -213,7 +191,7 @@ void Edge::setName(QString const&name)
lEdge.i = graph->getPosNode(first);
lEdge.j = graph->getPosNode(second);
lEdge.flipped = flippedLabel;
lEdge.curve = getCurve();
lEdge.curve = getCurve() / 2;
graph->addEdgeLabel(this, lEdge, name);
graph->renderer->modificationDone();
}
......
......@@ -72,8 +72,8 @@ public:
QColor getColor() const;
QColor getPaintColor() const;
qreal length() const;
int getCurve() const;
void setCurve(int t_curve);
double getCurve() const;
void setCurve(double t_curve);
qreal getCurvature() const;
void setCurvature(double curvature);
......
......@@ -82,7 +82,7 @@ void LatexLinker::setParticlesType(size_t i,
ParticleType type,
std::string const& t_name,
bool sign,
int curve,
double curve,
bool flipped,
Color color,
int lineWidth)
......@@ -291,17 +291,17 @@ void LatexLinker::getFlippedEdgeLabels() const
std::vector<Point> labelPositions;
labelPositions.reserve(edges.size());
auto getPosLabel = [&](size_t i, size_t j, int curve, bool flipped)
auto getPosLabel = [&](size_t i, size_t j, double curve, bool flipped)
{
Point A = graph.nodes[i];
Point B = graph.nodes[j];
Point diff = B - A;
Point dirLeft(-diff.y, diff.x);
if (curve == 1 or curve == 3) {
if (curve > 0.45) {
// Left curve
diff += dirLeft;
}
else if (curve == 2 or curve == 4) {
else if (curve < -0.45) {
diff -= dirLeft;
}
int sign = (!flipped) ? 1 : -1;
......@@ -340,6 +340,9 @@ void LatexLinker::getFlippedEdgeLabels() const
// if (e.curve == 2)
// e.curve = 0;
}
const static std::array<double, 5> curvatureDef = {
0, 1, -1, 0.5, -0.5
};
for (const auto &[pos, m] : multiplicity) {
if (m < 2)
continue;
......@@ -359,10 +362,10 @@ void LatexLinker::getFlippedEdgeLabels() const
int start = (m == 3 or m == 5) ? 0 : 1;
for (auto &e : edges) {
if ((e.i == i and e.j == j)) {
e.curve = start++;
e.curve = curvatureDef[start++];
}
else if ((e.i == j and e.j == i)) {
e.curve = start++;
e.curve = curvatureDef[start++];
}
}
}
......@@ -552,7 +555,7 @@ void LatexLinker::saveToNode(JSON::Node *node) const
}
auto nameLeaf = JSON::Leaf<std::string>::make("name", correct_name);
auto flipLeaf = JSON::Leaf<int>::make("flip", e.flipped);
auto curveLeaf = JSON::Leaf<int>::make("curve", e.curve);
auto curveLeaf = JSON::Leaf<double>::make("curve", e.curve);
auto signLeaf = JSON::Leaf<int>::make("sign", e.sign xor sign);
auto colorLeaf = JSON::Leaf<std::string>::make(
"color", e.color.toStr());
......@@ -638,12 +641,12 @@ void LatexLinker::loadFromNode(JSON::Node *node)
JSON::Node* edgesNode = JSON::Parser::parseNode(node, "edges");
for (const auto& e : *edgesNode) {
int i = *JSON::Parser::parseArgument<int>(e, "i", true);
int j = *JSON::Parser::parseArgument<int>(e, "j", true);
int type = *JSON::Parser::parseArgument<int>(e, "type", true);
int i = *JSON::Parser::parseArgument<int>(e, "i", true);
int j = *JSON::Parser::parseArgument<int>(e, "j", true);
int type = *JSON::Parser::parseArgument<int>(e, "type", true);
int flipped = *JSON::Parser::parseArgument<int>(e, "flip", true);
int curve = *JSON::Parser::parseArgument<int>(e, "curve", true);
int sign = *JSON::Parser::parseArgument<int>(e, "sign", true);
double curve = *JSON::Parser::parseArgument<double>(e, "curve", true);
int sign = *JSON::Parser::parseArgument<int>(e, "sign", true);
std::string name
= *JSON::Parser::parseArgument<std::string>(e, "name", true);
std::optional<std::string> color
......
......@@ -119,7 +119,7 @@ class LatexLinker {
ParticleType type = ParticleType::Scalar;
std::string name = "";
int sign = true;
int curve = 0;
double curve = 0;
bool flipped = false;
Color color = Black;
int lineWidth = 3;
......@@ -156,7 +156,7 @@ class LatexLinker {
ParticleType type = ParticleType::Scalar,
std::string const& t_name = "",
bool sign = true,
int curve = 0,
double curve = 0,
bool flipped = false,
Color color = Black,
int lineWidth = 3);
......
......@@ -119,7 +119,7 @@ class LatexLinker {
ParticleType type = ParticleType::Scalar;
std::string name = "";
int sign = true;
int curve = 0;
double curve = 0;
bool flipped = false;
Color color = Black;
int lineWidth = 3;
......@@ -156,7 +156,7 @@ class LatexLinker {
ParticleType type = ParticleType::Scalar,
std::string const& t_name = "",
bool sign = true,
int curve = 0,
double curve = 0,
bool flipped = false,
Color color = Black,
int lineWidth = 3);
......
......@@ -82,7 +82,7 @@ void LatexLinker::setParticlesType(size_t i,
ParticleType type,
std::string const& t_name,
bool sign,
int curve,
double curve,
bool flipped,
Color color,
int lineWidth)
......@@ -291,17 +291,17 @@ void LatexLinker::getFlippedEdgeLabels() const
std::vector<Point> labelPositions;
labelPositions.reserve(edges.size());
auto getPosLabel = [&](size_t i, size_t j, int curve, bool flipped)
auto getPosLabel = [&](size_t i, size_t j, double curve, bool flipped)
{
Point A = graph.nodes[i];
Point B = graph.nodes[j];
Point diff = B - A;
Point dirLeft(-diff.y, diff.x);
if (curve == 1 or curve == 3) {
if (curve > 0.45) {
// Left curve
diff += dirLeft;
}
else if (curve == 2 or curve == 4) {
else if (curve < -0.45) {
diff -= dirLeft;
}
int sign = (!flipped) ? 1 : -1;
......@@ -340,6 +340,9 @@ void LatexLinker::getFlippedEdgeLabels() const
// if (e.curve == 2)
// e.curve = 0;
}
const static std::array<double, 5> curvatureDef = {
0, 1, -1, 0.5, -0.5
};
for (const auto &[pos, m] : multiplicity) {
if (m < 2)
continue;
......@@ -359,10 +362,10 @@ void LatexLinker::getFlippedEdgeLabels() const
int start = (m == 3 or m == 5) ? 0 : 1;
for (auto &e : edges) {
if ((e.i == i and e.j == j)) {
e.curve = start++;
e.curve = curvatureDef[start++];
}
else if ((e.i == j and e.j == i)) {
e.curve = start++;
e.curve = curvatureDef[start++];
}
}
}
......@@ -552,7 +555,7 @@ void LatexLinker::saveToNode(JSON::Node *node) const
}
auto nameLeaf = JSON::Leaf<std::string>::make("name", correct_name);
auto flipLeaf = JSON::Leaf<int>::make("flip", e.flipped);
auto curveLeaf = JSON::Leaf<int>::make("curve", e.curve);
auto curveLeaf = JSON::Leaf<double>::make("curve", e.curve);
auto signLeaf = JSON::Leaf<int>::make("sign", e.sign xor sign);
auto colorLeaf = JSON::Leaf<std::string>::make(
"color", e.color.toStr());
......@@ -638,12 +641,12 @@ void LatexLinker::loadFromNode(JSON::Node *node)
JSON::Node* edgesNode = JSON::Parser::parseNode(node, "edges");
for (const auto& e : *edgesNode) {
int i = *JSON::Parser::parseArgument<int>(e, "i", true);
int j = *JSON::Parser::parseArgument<int>(e, "j", true);
int type = *JSON::Parser::parseArgument<int>(e, "type", true);
int i = *JSON::Parser::parseArgument<int>(e, "i", true);
int j = *JSON::Parser::parseArgument<int>(e, "j", true);
int type = *JSON::Parser::parseArgument<int>(e, "type", true);
int flipped = *JSON::Parser::parseArgument<int>(e, "flip", true);
int curve = *JSON::Parser::parseArgument<int>(e, "curve", true);
int sign = *JSON::Parser::parseArgument<int>(e, "sign", true);
double curve = *JSON::Parser::parseArgument<double>(e, "curve", true);
int sign = *JSON::Parser::parseArgument<int>(e, "sign", true);
std::string name
= *JSON::Parser::parseArgument<std::string>(e, "name", true);
std::optional<std::string> color
......
......@@ -48,6 +48,7 @@ namespace mty {
void replaceDownYukawa();
void flavorSymmetryBreaking();
void adjust();
void addGaugeFixingTerms();
};
} // End of namespace mty
......
......@@ -117,6 +117,10 @@ class Choice {
return choice;
}
void setName(std::string const &t_name) {
xi->setName(t_name);
}
void setGauge(Type t_choice)
{
choice = t_choice;
......@@ -324,11 +328,13 @@ class U1Gauged: public GaugedGroup {
U1Gauged(SemiSimpleGroup* t_group,
Gauge* gauge,
std::string const& nameBoson);
std::string const& nameBoson,
bool addGhost);
U1Gauged(SemiSimpleGroup* t_group,
Gauge* gauge,
std::string const& nameBoson,
bool addGhost,
const csl::Expr& t_coupling);
~U1Gauged(){};
......
......@@ -61,6 +61,10 @@ class GhostBoson: public ScalarBoson {
GhostBoson(std::string const& t_name,
std::shared_ptr<VectorBoson> const& t_vectorBoson);
GhostBoson(
std::string const& t_name,
mty::GaugeIrrep const &rep);
/**
* @brief Prints the MARTY (C++) code defining the Ghost boson.
*
......@@ -134,12 +138,15 @@ class GhostBoson: public ScalarBoson {
*
* @param name Name of the Ghost.
* @param t_vectorBoson Associated vector boson.
* \param conjugated True if the ghost is a conjugated ghost (i.e. a ghost
* is already defined, such as c+ and c- for W in the SM)
*
* @return The newly created Ghost boson.
*/
Particle ghostboson_s(
std::string const& name,
std::shared_ptr<VectorBoson> const& t_vectorBoson);
std::shared_ptr<VectorBoson> const& t_vectorBoson,
bool conjugated = false);
/**
* @brief Creates a ghost boson.
......@@ -148,23 +155,29 @@ Particle ghostboson_s(
* GhostBoson::GhostBoson().
*
* @param t_vectorBoson Associated vector boson.
* \param conjugated True if the ghost is a conjugated ghost (i.e. a ghost
* is already defined, such as c+ and c- for W in the SM)
*
* @return The newly created Ghost boson.
*/
Particle ghostboson_s(
std::shared_ptr<VectorBoson> const& t_vectorBoson);
std::shared_ptr<VectorBoson> const& t_vectorBoson,
bool conjugated = false);
/**
* @brief Creates a ghost boson.
*
* @param name Name of the Ghost.
* @param t_vectorBoson Associated vector boson, **must be of type VectorBoson**.
* \param conjugated True if the ghost is a conjugated ghost (i.e. a ghost
* is already defined, such as c+ and c- for W in the SM)
*
* @return The newly created Ghost boson.
*/
Particle ghostboson_s(
std::string const& name,
Particle const& t_vectorBoson);
Particle const& t_vectorBoson,
bool conjugated = false);
/**
* @brief Creates a ghost boson.
......@@ -173,11 +186,14 @@ Particle ghostboson_s(
* GhostBoson::GhostBoson().
*
* @param t_vectorBoson Associated vector boson, **must be of type VectorBoson**.
* \param conjugated True if the ghost is a conjugated ghost (i.e. a ghost
* is already defined, such as c+ and c- for W in the SM)
*
* @return The newly created Ghost boson.
*/
Particle ghostboson_s(
Particle const& t_vectorBoson);
Particle const& t_vectorBoson,
bool conjugated = false);
}
......
......@@ -500,15 +500,6 @@ class QuantumFieldParent: public csl::TensorFieldParent {
*/
virtual Particle getDiracParent() const;
/**
* @brief For a vector boson in a non abelian gauged group, returns the
* associated ghost boson.
*
* @return The ghost associated with the vector if there is one.
* @return nullptr else.
*/
virtual Particle getGhost() const;
/**
* @brief For a vector boson in a non abelian gauged group, returns the
* associated Goldstone boson.
......@@ -613,6 +604,8 @@ class QuantumFieldParent: public csl::TensorFieldParent {
*/
virtual Particle getGhostBoson() const;
virtual Particle getConjugatedGhostBoson() const;
/*!
* \brief For a GaugeBoson, sets the associated GoldstoneBoson.
* \details After the call of this function, the link os created and the
......@@ -642,6 +635,8 @@ class QuantumFieldParent: public csl::TensorFieldParent {
*/
virtual void setGhostBoson(Particle const& ghost);
virtual void setConjugatedGhostBoson(Particle const& ghost);
/*!
* \brief Tells if the particle has a FieldStrength.
* \details A FieldStrength is defined automatically for VectorBoson fields,
......
......@@ -181,6 +181,11 @@ class VectorBoson: public BaseVectorBoson {
* is one.
*/
std::shared_ptr<GhostBoson> ghost;
/**
* @brief Pointer to the conjugated GhostBoson associated to the vector, if there
* is one (for example for the W boson that has two ghosts).
*/
std::shared_ptr<GhostBoson> ghost_c;
/**
* @brief Pointer to the FieldStrength associated to the vector.
*/
......@@ -198,6 +203,8 @@ class VectorBoson: public BaseVectorBoson {
template<class ...Args>
inline VectorBoson(Args&& ...args);
void setName(std::string t_name) override;
bool isSameSpecies(QuantumFieldParent const *other) const override;
bool contains(QuantumFieldParent const *other) const override {
......@@ -242,7 +249,9 @@ class VectorBoson: public BaseVectorBoson {
* @return The ghost associated with the vector if there is one.
* @return nullptr else.
*/
Particle getGhost() const override;
Particle getGhostBoson() const override;
Particle getConjugatedGhostBoson() const override;
/**
* @brief For a vector boson in a non abelian gauged group, returns the
......@@ -273,6 +282,8 @@ class VectorBoson: public BaseVectorBoson {
*/
void setGhostBoson(Particle const& ghost) override;
void setConjugatedGhostBoson(Particle const& ghost) override;
void setGaugeChoice(gauge::Type type) override;
void setFieldStrength(Particle const& fieldStrength) override;
......@@ -314,6 +325,11 @@ class VectorBoson: public BaseVectorBoson {
void initPropagator() override;
void updateBrokenFieldStrength(csl::Space const *space);
void updateBrokenGhost(
csl::Space const *space,
std::shared_ptr<GhostBoson> const &local_ghost
);
void updateBrokenGoldstone(csl::Space const *space);
};
class GoldstoneBoson;
......@@ -420,6 +436,7 @@ template<class ...Args>
inline VectorBoson::VectorBoson(Args&& ...args)
:BaseVectorBoson(std::forward<Args>(args)...)
{
choice.setName("xi_" + getName());
fieldStrength = csl::make_shared<FieldStrength>(this);
addRelative(fieldStrength);
initPropagator();
......
......@@ -25,7 +25,7 @@
"name":"SU2L",
"type":"SU",
"dim":2,
"boson": { "name": "W", "ghost": false },
"boson": { "name": "W" },
"coupling": { "name": "g_L" }
},
{
......
{
"name" : "SM",
"author" : "Grégoire Uhlrich",
"date" : "08-05-2021",
"version": "1.3",
"flavor":
[
{"name": "SM_flavor", "nF": 3, "complex": true}
],
"quantum numbers": [ "F", "L", "B" ],
"gauge":{
"name" : "3x2x1",
"scale" : 1e3,
"group": [
{
"name":"U1Y",
"type": "U1",
"boson": { "name": "B" },
"coupling": { "name": "g_Y" }
},
{
"name":"SU2L",
"type":"SU",
"dim":2,
"boson": { "name": "W", "ghost": false },
"coupling": { "name": "g_L" }
},
{
"name":"SU3c",
"type":"SU",
"dim":3,
"boson": { "name": "G" },
"coupling": { "name": "g_s" }
}
]
},
"field": [
{
"name": "Q",
"spin": 1,
"chirality": "L",
"irrep": { "U1Y": "1 6", "SU2L": "1", "SU3c": "1 0" },
"flavor": [ "SM_flavor" ],
"quantum numbers": { "F": 1 }
},
{
"name": "U_R",
"spin": 1,
"chirality": "R",
"irrep": { "U1Y": "2 3", "SU3c": "1 0" },
"flavor": [ "SM_flavor" ],
"quantum numbers": { "F": 1 }
},
{
"name": "D_R",
"spin": 1,
"chirality": "R",
"irrep": { "U1Y": "-1 3", "SU3c": "1 0" },
"flavor": [ "SM_flavor" ],
"quantum numbers": { "F": 1 }
},
{
"name": "L",
"spin": 1,
"chirality": "L",
"irrep": { "U1Y": "-1 2", "SU2L": "1" },
"flavor": [ "SM_flavor" ],
"quantum numbers": { "F": 1, "L": 1 }
},
{
"name": "E_R",
"spin": 1,
"chirality": "R",
"irrep": { "U1Y": "-1" },
"flavor": [ "SM_flavor" ],
"quantum numbers": { "F": 1, "L": 1 }
},
{
"name": "H",
"spin": 0,
"irrep": { "U1Y": "1 2", "SU2L": "1" },
"yukawa":
[
{
"flavor": "SM_flavor",
"coupling": "Yu",
"fields": ["Q", "U_R"]
},
{
"flavor": "SM_flavor",
"coupling": "Yd",
"fields": ["Q", "D_R"]
},
{
"flavor": "SM_flavor",
"coupling": "Ye",
"fields": ["L", "E_R"]
}
]
}
]
}
......@@ -985,14 +985,14 @@ void MSSM_Model::breakSU2LGaugeSymmetry()
breakGaugeSymmetry(
"L",
{"Hu", "Hd", "W", "c_A_L",
{"Hu", "Hd", "W", "c_W",
"Q_L", "L_L",
"sHu", "sHd", "sW",