Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid example for spintracing #213

Open
Krzmbrzl opened this issue Jul 3, 2024 · 1 comment
Open

Invalid example for spintracing #213

Krzmbrzl opened this issue Jul 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Krzmbrzl
Copy link
Collaborator

Krzmbrzl commented Jul 3, 2024

In

const auto expr =
ex<Constant>(rational{1, 2}) *
ex<Tensor>(L"g", WstrList{L"i_1", L"i_2"}, WstrList{L"a_1", L"a_2"},
Symmetry::antisymm) *
ex<Tensor>(L"t", WstrList{L"a_1"}, WstrList{L"i_1"}) *
ex<Tensor>(L"t", WstrList{L"a_2"}, WstrList{L"i_2"});
auto result = spintrace(expr, {{L"i_1", L"a_1"}});

the spintrace function is fed the given expression with the information that i_1 and a_1 are external indices that belong to a single particle (group). However, the given expression is a full contraction leading to a scalar and thus the expression doesn't have any external indices. Therefore, I believe that this test case doesn't make sense in its current form 🤔

@Krzmbrzl Krzmbrzl added the bug Something isn't working label Jul 3, 2024
@Krzmbrzl
Copy link
Collaborator Author

Krzmbrzl commented Jul 3, 2024

Actually, it seems that this issue is present in the entire block

SECTION("Product") {
const auto expr = ex<Tensor>(L"f", WstrList{L"i_1"}, WstrList{L"a_1"}) *
ex<Tensor>(L"t", WstrList{L"a_1"}, WstrList{L"i_1"});
auto result = spintrace(expr, {{L"i_1", L"a_1"}});
canonicalize(result);
REQUIRE(to_latex(result) ==
L"{ \\bigl({{{2}}{f^{{a_1}}_{{i_1}}}{t^{{i_1}}_{{a_1}}}}\\bigr) }");
}
SECTION("Scaled Product") {
{
// 1/2 * g * t1 * t1
const auto expr =
ex<Constant>(rational{1, 2}) *
ex<Tensor>(L"g", WstrList{L"i_1", L"i_2"}, WstrList{L"a_1", L"a_2"},
Symmetry::antisymm) *
ex<Tensor>(L"t", WstrList{L"a_1"}, WstrList{L"i_1"}) *
ex<Tensor>(L"t", WstrList{L"a_2"}, WstrList{L"i_2"});
auto result = spintrace(expr, {{L"i_1", L"a_1"}});
canonicalize(result);
REQUIRE(
to_latex(result) ==
L"{ \\bigl( - "
L"{{g^{{a_1}{a_2}}_{{i_1}{i_2}}}{t^{{i_2}}_{{a_1}}}{t^{{i_1}}_{"
L"{a_2}}}} + "
L"{{{2}}{g^{{a_1}{a_2}}_{{i_1}{i_2}}}{t^{{i_1}}_{{a_1}}}{t^{{i_2}}_{"
L"{a_2}}}}\\bigr) }");
}
}
SECTION("Sum") {
// f * t1 + 1/2 * g * t1 * t1 + 1/4 * g * t2
const auto ex1 = ex<Tensor>(L"f", WstrList{L"i_1"}, WstrList{L"a_1"}) *
ex<Tensor>(L"t", WstrList{L"a_1"}, WstrList{L"i_1"});
const auto ex2 = ex<Constant>(rational{1, 2}) *
ex<Tensor>(L"g", WstrList{L"i_1", L"i_2"},
WstrList{L"a_1", L"a_2"}, Symmetry::antisymm) *
ex<Tensor>(L"t", WstrList{L"a_1"}, WstrList{L"i_1"}) *
ex<Tensor>(L"t", WstrList{L"a_2"}, WstrList{L"i_2"});
const auto ex3 = ex<Constant>(rational{1, 4}) *
ex<Tensor>(L"g", WstrList{L"i_1", L"i_2"},
WstrList{L"a_1", L"a_2"}, Symmetry::antisymm) *
ex<Tensor>(L"t", WstrList{L"a_1", L"a_2"},
WstrList{L"i_1", L"i_2"}, Symmetry::antisymm);
auto expr = ex1 + ex2 + ex3;
auto result = ex<Constant>(rational{1, 2}) * spintrace(expr);
expand(result);
rapid_simplify(result);
canonicalize(result);
REQUIRE(to_latex(result) ==
L"{ \\bigl({{f^{{a_1}}_{{i_1}}}{t^{{i_1}}_{{a_1}}}} + "
L"{{g^{{a_1}{a_2}}_{{i_1}{i_2}}}{t^{{i_1}{i_2}}_{{a_1}{a_2}}}} - "
L"{{{\\frac{1}{2}}}{g^{{a_1}{a_2}}_{{i_1}{i_2}}}{t^{{i_2}{i_1}}_{{"
L"a_1}{a_2}}}} - "
L"{{{\\frac{1}{2}}}{g^{{a_1}{a_2}}_{{i_1}{i_2}}}{t^{{i_2}}_{{a_1}}}"
L"{t^{{i_1}}_{{a_2}}}} + "
L"{{g^{{a_1}{a_2}}_{{i_1}{i_2}}}{t^{{i_1}}_{{a_1}}}{t^{{i_2}}_{{a_"
L"2}}}}\\bigr) }");
} // Sum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant