#define and #prm (hash prm or hash parameter

It's often useful to have optional sections in an INP file to test different models. You can do this by commenting in/out sections of the INP file using ' or /*…*/.

Often it's easier to use the #define command:

#define fit_xray
#define fit_neutron
 
#ifdef fit_xray
  ..xray stuff
#endif
 
#ifdef fit_neutron
  ..neutron stuff
#endif

You can get more flexibility with #prm. For example the code below does the same as #define:

#prm x_ray = 1;   'or set to 0 to not include
#prm neutron = 1; 'or set to 0 to not include
 
#if (x_ray)
  ..xray stuff
#endif
#if (neutron)
  ..neutron stuff
#endif

But you can also do a lot more and combine conditions. For example:

#if (x_ray == 0)
  ..xray stuff
#elseif  (And(neutron == 1,  x_ray == 3)
  ...
#elseif (Or (Run_Number == 18, x_ray))
#else
#endif

Personal Tools