Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcstas-comps/examples/ILL/ILL_H22_D1B/ILL_H22_D1B.instr
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* obtained by scanning the temperature. A complete thermal variation of the
* diffraction patterns (1.5 - 300 K) can be achieved in few hours (3-5h).
*
* %Example: lambda=2.52 Detector: D1B_BananaTheta_I=5097.25
* %Example: lambda=2.52 Detector: D1B_BananaTheta_I=4400
*
* %Parameters:
* lambda: [AA] mean incident wavelength.
Expand Down
26 changes: 18 additions & 8 deletions mcstas-comps/samples/PowderN.comp
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,24 @@ struct line_info_struct

// PN_list_compare *****************************************************************

int PN_list_compare (void const *a, void const *b)
{
struct line_data const *pa = a;
struct line_data const *pb = b;
double s = pa->q - pb->q;
int PN_list_compare(const void *a, const void *b)
{
const struct line_data *pa = a;
const struct line_data *pb = b;

/* Sort by q */
if (pa->q < pb->q) return -1;
if (pa->q > pb->q) return 1;

/* In case of tie, sort by F2 also */
if (pa->F2 < pb->F2) return -1;
if (pa->F2 > pb->F2) return 1;

if (!s) return 0;
else return (s < 0 ? -1 : 1);
/* In case of tie, sort by j also */
if (pa->j < pb->j) return -1;
if (pa->j > pb->j) return 1;

return 0;
} /* PN_list_compare */

#ifndef CIF2HKL
Expand Down Expand Up @@ -1140,7 +1150,7 @@ TRACE


l_1 = v*(t3 - t2 + t1 - t0); /* Length to exit */

pmul *= Nq*l_full*my_s_n *exp(-(line_info.my_a_v/v+my_s)*(l+l_1))
/(1-(p_inc+p_transmit));

Expand Down
26 changes: 18 additions & 8 deletions mcstas-comps/union/Powder_process.comp
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,24 @@ SHARE

// PN_list_compare *****************************************************************

int PN_list_compare_union (void const *a, void const *b)
{
struct line_data_union const *pa = a;
struct line_data_union const *pb = b;
double s = pa->q - pb->q;

if (!s) return 0;
else return (s < 0 ? -1 : 1);
int PN_list_compare_union(const void *a, const void *b)
{
const struct line_data_union *pa = a;
const struct line_data_union *pb = b;

/* Sort by q */
if (pa->q < pb->q) return -1;
if (pa->q > pb->q) return 1;

/* In case of tie, sort by F2 also */
if (pa->F2 < pb->F2) return -1;
if (pa->F2 > pb->F2) return 1;

/* In case of tie, sort by j also */
if (pa->j < pb->j) return -1;
if (pa->j > pb->j) return 1;

return 0;
} /* PN_list_compare */

int read_line_data_union(char *SC_file, struct line_info_struct_union *info)
Expand Down
24 changes: 17 additions & 7 deletions mcxtrace-comps/samples/PowderN.comp
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,24 @@ SHARE
// used for qsort, to sort reflections
// input: a,b: two 'line_data' reflection pointers.
// output: -1,0,1 for a<b, a=b, a>b
int PN_list_compare (void const *a, void const *b)
{
struct line_data const *pa = a;
struct line_data const *pb = b;
double s = pa->q - pb->q;
int PN_list_compare(const void *a, const void *b)
{
const struct line_data *pa = a;
const struct line_data *pb = b;

/* Sort by q */
if (pa->q < pb->q) return -1;
if (pa->q > pb->q) return 1;

/* In case of tie, sort by F2 also */
if (pa->F2 < pb->F2) return -1;
if (pa->F2 > pb->F2) return 1;

if (!s) return 0;
else return (s < 0 ? -1 : 1);
/* In case of tie, sort by j also */
if (pa->j < pb->j) return -1;
if (pa->j > pb->j) return 1;

return 0;
} /* PN_list_compare */

#ifndef CIF2HKL
Expand Down
Loading