McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 52 forks source link

mcdisplay-mantid does not increment type names in xml file? #823

Open huegle opened 5 years ago

huegle commented 5 years ago

Hi! I just tested the McStas -> Mantid workflow in 2.5, and ran into a problem. The .instr file has multiple banana type detectors around the sample location:

COMPONENT nD_Mantid_1 = Monitor_nD(
    yheight = 0.01, radius = 1.0,
    options="mantid, banana, theta limits=[10,170] bins=349, y bins=1, neutron pixel min=0 t, list all neutrons",
    restore_neutron=1)
    AT (0,0,0) RELATIVE sampleMantid

COMPONENT nD_Mantid_2 = Monitor_nD(
    yheight = 0.01, radius = 1.25,
    options="mantid, banana, theta limits=[10,170] bins=436, y bins=1, neutron pixel min=349 t, list all neutrons",
    restore_neutron=1)
    AT (0,0,0) RELATIVE sampleMantid

When trying to open the result of this in Mantid, it complains that "mccode.h5 contains more than one type element named MonNDtype-0". Looking into the .instr.xml file, I do indeed see:

component type="MonNDtype-0" name="nD_Mantid_1" idlist="MonNDtype-0-list type name="MonNDtype-0"

component type="MonNDtype-0" name="nD_Mantid_2" idlist="MonNDtype-0-list" type name="MonNDtype-0"

With McStas 2.4x, the same lines read:

component type="MonNDtype-0_origin" name="nD_Mantid_1" idlist="MonNDtype-0-list" type name="MonNDtype-0_origin">

component type="MonNDtype-1_origin" name="nD_Mantid_2" idlist="MonNDtype-1-list" type name="MonNDtype-1_origin">

The way I generated the nexus files changed, because my old scripts did not work with McStas2.5 any more. It used to be:

mcstas "$y.instr" --trace mcdisplay.pl "$y.instr" --format=Mantid -n0 --complete mpicc -o "$y.out" "$y.c" -lm -DUSE_MPI -DUSE_NEXUS -lNeXus -I/usr/local/include/nexus/ mcrun "./$y.out" --format=NeXus -n"$2" -d"$y" --mpi=64

and is now: mcdisplay-mantid "$y.instr" --default mpicc -o "$y.out" "$y.c" -lm -DUSE_MPI -DUSE_NEXUS -lNeXus mcrun "./$y.out" --format=NeXus -n"$2" -d"$y" --mpi=64

So I guess the question is if this is a bug in mcdisplay-mantid, or a problem with a user (me) who does things wrong because he has no idea what he's doing?

huegle commented 5 years ago

Ok, slight correction: The old script still works (and seems to produce the right output), but only after I install the NeXus development libraries (libnexus0-dev). The runtime libraries (libnexus0v5) are not enough. You might need to update the wiki page on this.

climbcat commented 4 years ago

Hi, thanks for reporting this. This should be straightforward to fix.