MCXTRACE(1)

πŸ“¦
version 3.5+3.5.19 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute

πŸ’– MCXTRACE πŸ’– (that's the mcxtrace manual, section 1, bestie)

okay so. sit down, grab a strawberry πŸ“, because we're talking about mcxtrace β€” the compiler of the mcxtrace xray ray-trace simulation package. yes she's the whole compiler. yes she's iconic. no cap. πŸ‘‘


✨ SYNOPSIS ✨

mcxtrace [-o file] [-I dir1 ...]  [-t] [-p] [-v] [–no-main]
[–no-runtime] [–verbose] file

🌸 DESCRIPTION 🌸

so basically, the compiler for the mcxtrace instrument definition gets summoned when you type a command like mcxtrace name.instr in a shell or a command prompt. that's the vibe check. πŸ’…

what happens next is genuinely so cool: it reads your beamline definition, name.instr, which is written in the mcxtrace meta-language. then the compiler translates that instrument definition into a Monte Carlo simulation program, provided in ISO-C. yeah. it literally writes you a C program. main character energy fr fr.

by default the output lands in a file in the current directory with the same name as the instrument file, except the extension is .c instead of .instr. cute right? but you can override that with the -o option, like this:

mcxtrace -o code.c name.instr

which gives the output in the file code.c. slay. ✨

also, a single dash - may be used for both the input and output filename, to represent standard input and standard output, respectively. yup, both. stdin and stdout, living their best lives.

the default component search list is usually defined by the environment variable MCXTRACE (default is /usr/share/mcxtrace/resources). lowkey important, don't forget her. 🫢

ngl though, it's often more convenient to use the front-end program mxgui or mxrun. those front-ends will compile and run the simulations automatically. obsessed with the convenience honestly. πŸŽ€

the usual instrument syntax goes a little something like this:

DEFINE INSTRUMENT name(parameters)

DECLARE %{
  // C_code
%}
INITIALIZE %{
  // C_code
%}
TRACE

COMPONENT name = comp(parameters)
WHEN (condition)
AT (...) [RELATIVE reference
{ROTATED {RELATIVE reference }
EXTEND %{
  // C_code
%}

FINALLY %{
  // C_code
%}
END

πŸ’… OPTIONS πŸ’…

  • -o FILE –output-file=FILE β€” places the C output in the file FILE. that's it, that's the whole job. πŸ’–
  • -I DIR –search-dir=DIR β€” appends DIR to the component search list. adding more places to look, we love an expansive queen.
  • -t –trace β€” enables trace mode for instrument display. ✨
  • -v –version β€” prints the mcxtrace version. cute lil flex.
  • –no-main β€” do not create main(). this one's for external embedding, iykyk. πŸ”₯
  • –no-runtime β€” do not embed run-time libraries.
  • –verbose β€” displays the compilation process steps. the way that she narrates everything. πŸ™ˆ
  • –source β€” embeds the instrument source code in the executable. iconic behaviour honestly.

πŸ¦‹ FILES πŸ¦‹

  • /usr/share/mcxtrace/resources
  • /usr/share/mcxtrace/tools/Python/mccodelib/mccode_config.json
  • ~/.mcxtrace/mccode_config.json
  • http://www.mcxtrace.org

🌈 EXAMPLES 🌈

translate the Test_SX example (Single crystal diffraction) into C. okay so here's the move:

  • mcxtrace Test_SX.instr
  • gcc Test_SX.instr -o Test_SX.out -lm

periodt. πŸ’…


πŸ‘‘ AUTHORS πŸ‘‘

mcxtrace Team (mcxtrace.org)


πŸ’œ SEE ALSO πŸ’œ

mcxtrace(1), mxdoc(1), mxplot(1), mxrun(1), mxgui(1), mxdisplay(1)


⭐ AUTHORS (yes, again) ⭐

MCXTRACE xray Ray Tracing Team.


and that's the whole page bestie πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά β€” this one came to you from the git version, dated like the original footer, from the MCXTRACE(1) manual. go compile something gorgeous, you absolute legend. 😭πŸ”₯πŸ‘‘πŸŒˆβ­
πŸ“¦ where this page comes from