/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: TestSANS
*
* %Identification
* Written by: Martin Cramer Pedersen (mcpe@nbi.dk) and S&oslash;en Kynde (kynde@nbi.dk)
* Date: October 29th, 2012
* Origin: KU-Science
* %INSTRUMENT_SITE: Tests_samples
*
* Template instrument for a suite of SANS sample models.
*
* %Description
* Model instrument with test use-cases for a suite of SANS-sample components modelling
* a set of in-solution SANS samples.
*
* %Parameters
* DistSrcPin1: [m]  Distance to first pinhole from source.
* DistSrcPin2: [m]  Distance to second pinhole - used for focussing rays.
* DistPinSamp: [m]  Collimation length.
* DistSampDet: [m]  Sample-detector-distance.
* DetRadius: [m]    Radius of the circular detector.
* Lambda: [AA]      Wavelength of the rays emitted from source.
* DLambda: [AA]     Relative deviation of wavelength of the rays emitted from source.
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT TestSANS( DistSrcPin1=1.0, DistSrcPin2=10.0, DistPinSamp=1.0, DistSampDet=10.0, DetRadius=4.0, Lambda=4.5, DLambda=0.1 )


DECLARE
%{
%}


INITIALIZE
%{
%}


TRACE
COMPONENT Origin = Progress_bar()
AT (0, 0, 0) ABSOLUTE


COMPONENT Source = Source_simple(
	radius = 0.02,
	dist = DistSrcPin2,
	yheight = 0.01,
	xwidth = 0.01,
	lambda0 = Lambda,
	dlambda = DLambda * Lambda)
  AT (0, 0, 0) RELATIVE Origin


COMPONENT FirstPinhole = Slit(
	radius = 0.01)
  AT (0, 0, DistSrcPin1) RELATIVE Source


COMPONENT SecondPinhole = Slit(
	radius = 0.005)
  AT (0, 0, DistSrcPin2) RELATIVE Source

/*COMPONENT Sample = SANSSpheres(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	R = 100.0,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSShells(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius,
	R = 50.0,
	Thickness = 20.0)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSCylinders(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSEllipticCylinders(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


COMPONENT Sample = SANSLiposomes(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole


/*COMPONENT Sample = SANSNanodiscs(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSNanodiscsWithTags(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSPDB(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius,
	//PDBFilepath = "1EV3.pdb"
	//PDBFilepath = "6LYZ.pdb"
	PDBFilepath = "3v03.pdb")
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSCurve(
	FileWithCurve = "Curve.mcp",
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSNanodiscsFast(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSNanodiscsWithTagsFast(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


/*COMPONENT Sample = SANSPDBFast(
	xwidth = 0.1,
	yheight = 0.1,
	zdepth = 0.1,
	SampleToDetectorDistance = DistSampDet,
	DetectorRadius = DetRadius,
	PDBFilepath = "6LYZ.pdb",
    qMax = 0.9)
AT (0, 0, DistSampDet) RELATIVE SecondPinhole*/


COMPONENT Beamstop = Beamstop(
	radius = 0.1)
AT (0, 0, DistSampDet - 0.000001) RELATIVE Sample


COMPONENT Monitor = PSD_monitor(
	filename = "PSDMonitor",
	//xwidth = 2.0 * DetRadius / sqrt(2.0),
	xwidth = 2.0 * DetRadius,
	//yheight = 2.0 * DetRadius / sqrt(2.0),
	yheight = 2.0 * DetRadius,
	nx = 200,
	ny = 200,
	restore_neutron = 1)
AT (0, 0, 0.000001) RELATIVE Beamstop


COMPONENT QMonitor = SANSQMonitor(
	RadiusDetector = DetRadius,
	DistanceFromSample = DistSampDet,
	LambdaMin = Lambda,
	Lambda0 = Lambda,
	NumberOfBins = 100)
AT (0, 0, 0.000001000000001) RELATIVE Beamstop


FINALLY
%{
%}

END
