Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

Good afternoon,

I am trying to define a spinor bilinear and I would like the two spinors to appear in the output as \psi_{1} and \psi_{2}. A minimal example is the following:

{\alpha,\beta,\gamma,\delta,\alpha#,\beta#}::Indices(spinor, position=fixed).
{a,b,c,d,e,a#, b#}::Indices(flat,position=fixed).
\gamma{#}::GammaMatrix(metric=\eta);
\delta{#}::KroneckerDelta.
{\psi1, \psi2}::Spinor(dimension=4, type=Majorana);
\bar{#}::DiracBar.
{\psi1, \psi2}::AntiCommuting.
{\psi1, \psi2}::SortOrder.
\psi1::LaTeXForm("{\psi_{1}}").
\psi2::LaTeXForm("{\psi_{2}}").

ex:= \bar{\psi1} \gamma_{a b} \gamma_{c} \psi2 \+ \bar{\psi2} \gamma_{a b} \gamma_{c} \psi1;

However, the output that I get is the following:

\psi_{1}\psi_{1} \gamma_{a b} \gamma_{c} \psi_{2} + \psi_{2} \psi_{2} \gamma_{a b} \gamma_{c} \psi_{1}

If I try to perform calculations, like sorting the two spinors, it seems to give the correct answer but the output of the adjoint spinor is still given by a couple of unbarred spinors.

I am unsure if this is a general issue or depends on my system. I am working on Windows.

Best regards

in General questions by (190 points)

3 Answers

+2 votes
 
Best answer

This is now fixed in 2.3.9.5 available on github.

Just for the record, you don't have to give LaTeXForm properties for symbols with numbers at the end. The \psi1 symbol will automatically typeset as $$\psi_{1}$$.

by (82.6k points)
selected by

Thanks, I am trying to install the new version on my laptop. I am still having some issue in the installation, but I hope to solve it soon.

+2 votes

I can't reproduce this; the sample code you posted gives me the expected output, and doing e.g. a join_gamma(_) after that, followed by distribute(_) and sort_spinors(_) gives the expected result too.

Which version of Cadabra are you using?

by (82.6k points)

Thanks for your message. I am using Version 2.2.7.

That one's more than 3 years old, can you try the current 2.3.9.3? If you are stuck on 2.2.7 because there are no recent precompiled binaries for Windows, I can give you an account on the cloud server.

Dear Kasper,

I was stuck on 2.2.7 exactly for that reason, but now I am trying to update it. I will let you know the outcome.

Dear Kasper, I am having some problems installing the new version on Windows. In particular, after running

cmake -DCMAKE_TOOLCHAIN_FILE=C:/Windows/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INCLUDE_PATH="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_INSTALL_PREFIX=C:\Cadabra -G "Visual Studio 17 2022" -A x64 ..

I get

-- Configuring incomplete\, errors occurred! See also "C:/Windows/cadabra2/build/CMakeFiles/CMakeOutput.log". See also "C:/Windows/cadabra2/build/CMakeFiles/CMakeError.log".

Looking into CMakeError.log   this is what I see

Determining if the include file pthread.h exists failed with the following output: Change Dir: C:/cadabra2/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_10416.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64   CheckIncludeFile.c   Copyright (C) Microsoft Corporation.  All rights reserved.   cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_10416.dir\Debug\" /Fd"cmTC_10416.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue C:\cadabra2\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c C:\cadabra2\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [C:\cadabra2\build\CMakeFiles\CMakeTmp\cmTC_10416.vcxproj]



Determining if the include file pthread.h exists failed with the following output: Change Dir: C:/cadabra2/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_879b7.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64   CheckIncludeFile.c   Copyright (C) Microsoft Corporation.  All rights reserved.   cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_879b7.dir\Debug\" /Fd"cmTC_879b7.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue C:\cadabra2\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c C:\cadabra2\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [C:\cadabra2\build\CMakeFiles\CMakeTmp\cmTC_879b7.vcxproj]


Do you have any advice? Best

It's missing the pthread library. That should have been installed with the lines of vcpkg ... in the installation instructions, but of course things may have changed since those were written.

The best advice I can give you is to run this on Linux, or on WSL if you really have to stay inside Windows. I do not have resources to maintain the Windows build process, and Windows is anyhow suboptimal for Cadabra given the very slow file system (as compared to Linux or macOS).

Ok thanks a lot. Best

+1 vote

Hi Luca and Kasper.

I was puzzled by your post Luca, and wanted to try myself. FYI I'm using a fair new version of cadabra (Version 2.3.9 (build 2829.40f334a67c dated 2022-08-05)).

Your code

First let me point that I copy your code and my cadabra session got stocked! Weird, because so far you're defining a expression.

  • Problem: there is a \+ in your ex.
  • Solution: Change \+ by +.

Then, unlike Kasper, I reproduce your error! Even more puzzled...

Since you're not computing anything (yet), I tried the rendering.

  • Possible problem: Rendering options.
  • Solution: simplifying the rendering properties.

Then, I got the expected result.

Updated code

NOTE: I've added the algorithms suggested by Kasper

{\alpha,\beta,\gamma,\delta,\alpha#,\beta#}::Indices(spinor, position=fixed).
{a,b,c,d,e,a#, b#}::Indices(flat,position=fixed).
\gamma{#}::GammaMatrix(metric=\eta);
\delta{#}::KroneckerDelta.
{\psi1, \psi2}::Spinor(dimension=4, type=Majorana);
\bar{#}::DiracBar.
# {\psi1, \psi2}::AntiCommuting.
# {\psi1, \psi2}::SortOrder.
# \psi1::LaTeXForm("\psi_{1}").
# \psi2::LaTeXForm("\psi_{2}").

ex:= \bar{\psi1} \gamma_{a b} \gamma_{c} \psi2 + \bar{\psi2} \gamma_{a b} \gamma_{c} \psi1;
join_gamma(_)
distribute(_)
sort_spinors(_);

See the result in an image

UPDATE 1

Sorry I noticed that I commented a couple of desired properties...

The new code

{\alpha,\beta,\gamma,\delta,\alpha#,\beta#}::Indices(spinor, position=fixed).
{a,b,c,d,e,a#, b#}::Indices(flat,position=fixed).
\gamma{#}::GammaMatrix(metric=\eta);
\delta{#}::KroneckerDelta.
{\psi1, \psi2}::Spinor(dimension=4, type=Majorana);
\bar{#}::DiracBar.
{\psi1, \psi2}::AntiCommuting.
{\psi1, \psi2}::SortOrder.
# \psi1::LaTeXForm("\psi_{1}").
# \psi2::LaTeXForm("\psi_{2}").

ex:= \bar{\psi1} \gamma_{a b} \gamma_{c} \psi2 + \bar{\psi2} \gamma_{a b} \gamma_{c} \psi1;
join_gamma(_)
distribute(_)
sort_spinors(_);

See the new result

by (15.0k points)
edited by

Ah, sorry guys, I did this in the command line version (and of course stripped the spurious backslash). The problem seems to be the accent \bar wrapping the object \psi1 which has a LaTeXForm property. I'll have a look.

Thank you K.

Dear doxdrum,

thanks for your comment. Sorry for the +, this is something that for some reason appeared during copy-paste (however I do not have it ). I tried to remove all the improper slashes but I missed this one. I will edit it in the question if it is ok.

Regarding the calculations, I have not included it in the question, but I mentioned that it seems the calculation is carried out properly, it is only the output that shows two unbarred spinors instead of a barred one.

Hi Luca. As Kasper mentioned, and I show in the code, you have to comment the lines that assign LaTeXForm to your spinors.

Please try it, and let us know.

Dear doxdrum ,

in that way it works but it does not give me what I would like to get (It is the way I am using on the full calculations right now). In particular the output on screen for me is

\bar{\psi 1}

and not

\bar{\psi_{1}}

It is slightly different from your image. The point is also that I would like to generalize it to other subscripts, as for example

\psi_gravitino, \psi_gaugino

Ps: I have tried to upload an image https://ibb.co/Mp4nytZ

Best regards

...