Warning: Trying to access array offset on value of type null in /home/site/wwwroot/lib/plugins/move/action/rename.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/Action/Export.php on line 106

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/Action/Export.php on line 106
optional_sections

#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

With variable temperature or pressure refinements you often want to include different phases for different data sets. Some of the tricks are in Section 12.2 of the Topas text book. The snippets below are from an INP file which uses the #list language and includes different phases for different datasets. You can do similar things with e.g. temperature.

/*series of refinments for mono to ortho with mixed phase region between*/
num_runs 54 
#list Filename Temperature Time Range_Num  {  
	filename.raw 103.66  1380      1 
	filename.raw 111.33  2760      2 
	filename.raw 119     4140      3 
	...etc
	}
#prm tempcon = Temperature(Run_Number);  /*this lets you do different things for different temperatures*/
#prm range = Range_Num(Run_Number); /*this lets you do different things for different ranges*/
 
#if (range <= 33)
	#prm mono  = 1;
	#prm orth = 0;
#elseif ( And(range >= 34, range <= 41) )
	#prm mono  = 1;
	#prm orth = 1;
#else
	#prm mono  = 0;
	#prm orth = 1;
#endif
 
xdd Filename(Run_Number)
	range Range_Num(Run_Number)  
	#if (mono)
		(str info for mono)
	#else
		(alternative instructions)
	#endif
	#if (ortho)
		(str info for ortho)
	#else
		(alternative instructions)
	#endif

The forum has a thread on removing phases when their phase fraction falls to low values, including tricks to e.g. set the scale factor to zero if peaks become too broad. See forum.