File: Pump_probe_solvent.instr

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,113,256 kB
  • sloc: ansic: 40,697; python: 25,137; yacc: 8,438; sh: 5,405; javascript: 4,596; lex: 1,632; cpp: 742; perl: 296; lisp: 273; makefile: 226; fortran: 132
file content (198 lines) | stat: -rw-r--r-- 7,323 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*******************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Pump_probe_solvent
*
* %Identification
* Written by: Erik B Knudsen
* Date: \today
* Origin: DTU Fysik
* Version: 0.2
* %INSTRUMENT_SITE: DTU
*
* Design study of a pump and probe type instrument. The sample is an excitable molecule
*
* %Description
* This is an example instrument for simulating time resolved scattering from
* optically excitable, disordered molecules in solution, including scattering
* signal from the solvent. By FSOLV it is possible to change the concentration of
* solute.
*
* This is to be considered a concept instrument model, i.e. it is _not_ a model of
* an existing real instrument. A simple flat source emitting photons impinge on a chopper,
* defining an X-ray pulse. Timing jitter in the chopper may be included through the JITTER
* parameter which introduces a random uncertainty in the timing of the pulse.
*
* The X-ray pulse is allowed to propagate to the sample which is excited by an instantaneous laser
* pulse at t=0. The whole sample is assumed to be excited uniformly.
* A Monte Carlo choice between interacting with solvent or solute is performed at the sample position.
* The chopper is set such that the X-ray pulse front will arive at the sample at t=Dt. Thus,
* setting Dt<-tau (chopper opening time) will simulate the "laser-off" setting.
*
* The sampling of the scattered signal may be controlled by PSIMAX,PSIMIN and ETAMAX,ETAMIN
* parameters. Please be aware the by restricting the azimuthal range it is not uncommon to underfill
* the acceptance area of subsequent components. This is particularly the case for small psi.
*
* %Example: Pump_probe_solvent.instr Dt=0 Detector: det_ccd_I=0.00664655
*
* %Parameters
* excitation_prob: [1] Fraction of the molecules in solution that are excited at t=0.
* Dt: [1] Time delay between laser pulse exciting the sample and the x-ray pulse.
* PSIMAX: [deg.] Maximum scattering angle to be simulated.
* PSIMIN: [deg.] Minimum scattering angle to be simulated.
* ETAMAX: [deg.] Maximum azimuthal angle for scattered photons.
* ETAMIN: [deg.] Minimum azimuthal angle for scattered photons.
* NOSOLVENT: [ ] If nonzero - ignore scattering from solvent.
* NOSOLUTE: [ ] If nonzeor - ignore scattering from solute.
* FSOLV: [ ] Volume fraction of solvent to solute. ( =1 means only solvent, =0 only solute)
* JITTER: [s] Jitter in chopper.
* 
* %End
*******************************************************************************/

/* Change name of instrument and input parameters with default values */
DEFINE INSTRUMENT Pump_probe_solvent(excitation_prob=0.2, Dt=100e-9, PSIMIN=0, 
        PSIMAX=50, FSOLV=0, JITTER=0, ETAMIN=-180,ETAMAX=180, NOSOLVENT=0, NOSOLUTE=0)

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
%}

USERVARS
%{
  int scattered;
  double rr;
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
  /*sanity check*/
  if(FSOLV==0 && NOSOLUTE){
      fprintf(stderr,"Warning (Pump_probe_solvent): You have disabled solute scattering"
              "(NOSOLUTE!=0) and set a solute volume fraction of 1 (FSOLV==0).\n");
  }
  if(NOSOLUTE && NOSOLVENT){
      fprintf(stderr,"Warning (Pump_probe_solvent): You have disabled solute and solvent scattering.\nAborting to avoid wasting your time.\n");
      exit(0);
  }

%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE

/* The Arm() class component defines reference points and orientations  */
/* in 3D space. Every component instance must have a unique name. Here, */
/* Origin is used. This Arm() component is set to define the origin of  */
/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used   */
/* for further RELATIVE reference, Other useful keywords are : ROTATED  */
/* EXTEND GROUP PREVIOUS. Also think about adding an xray source !    */
/* Progress_bar is an Arm displaying simulation progress.               */
COMPONENT Origin = Progress_bar()
AT (0,0,0) ABSOLUTE

COMPONENT src=Source_flat(xwidth=1e-9,yheight=1e-9,focus_xw=1e-10,focus_yh=1e-10,dist=1,E0=15.5, dE=0.000005, gauss=1,
      flux=1e33)
AT(0,0,0) RELATIVE Origin

COMPONENT emon_src=E_monitor(filename="emon_src",xwidth=0.01,yheight=0.01,Emin=5,Emax=20)
AT(0,0,1e-3) RELATIVE PREVIOUS

COMPONENT lmon_src=L_monitor(filename="lmon_src",xwidth=0.01,yheight=0.01, Lmin=0.2,Lmax=2)
AT(0,0,1e-3) RELATIVE PREVIOUS

COMPONENT ap1 = Arm()
AT (0,0,10) RELATIVE  src

COMPONENT pulse_shape_chop = Chopper_simple(
    t0 = -0.5/M_C, T = 20e-6, tau = 100e-12, xwidth = 1e-4,
    yheight = 1e-4, isfirst = 1, tjit=JITTER)
AT (0, 0, 0.5) RELATIVE ap1

COMPONENT sample_pos = Arm()
  AT (0,0,0.5) RELATIVE PREVIOUS
EXTEND
%{
  rr=rand01();
  scattered=0;
%}

COMPONENT sampsd= PSD_monitor(
      xwidth=0.05,yheight=0.01, filename="sampsd", restore_xray=1)
AT(0,0,0) RELATIVE PREVIOUS

COMPONENT sample=Molecule_2state(
  nq=512,state_0_file="Fe_bpy_GS_DFT.txt",state_1_file="Fe_bpy_ES_DFT.txt",xwidth=0.05,
  yheight=0.01, zdepth=0.001,
  psimin=PSIMIN*DEG2RAD, psimax=PSIMAX*DEG2RAD, etamin=ETAMIN*DEG2RAD,etamax=ETAMAX*DEG2RAD,
  t_relax=600e-12, delta_t=Dt, excitation_yield=excitation_prob,
  material_datafile="noabs.txt",Emax=1000
)
WHEN (rr>0.5) AT(0,0,0) RELATIVE sample_pos
EXTEND
%{
  if (INSTRUMENT_GETPAR(NOSOLUTE)) ABSORB;
  if (SCATTERED){
    scattered=1;
    p*=(1.0-INSTRUMENT_GETPAR(FSOLV))/0.5;
  }
%}

COMPONENT solvent=Molecule_2state(
  nq=512,state_0_file="H2O_hot.txt",state_1_file="H2O_cold.txt",xwidth=0.05,
  yheight=0.01, zdepth=0.001,initial_state=1,
  psimin=PSIMIN*DEG2RAD, psimax=PSIMAX*DEG2RAD, etamin=ETAMIN*DEG2RAD,etamax=ETAMAX*DEG2RAD,
  t_relax=2e-12, delta_t=Dt, q_parametric=1, excitation_yield=1,
  material_datafile="noabs.txt",Emax=100
)
WHEN (rr<0.5) AT(0,0,0) RELATIVE sample_pos
EXTEND
%{
  if (INSTRUMENT_GETPAR(NOSOLVENT)) ABSORB;
  if (SCATTERED){
    scattered=1;
    p*=INSTRUMENT_GETPAR(FSOLV)/0.5;
  }
%}

COMPONENT beamstop = Arm()
AT(0,0,0) RELATIVE sample_pos
EXTEND
%{
  if (!scattered) ABSORB;
%}

COMPONENT psd4pi=PSD_monitor_4PI(
  restore_xray=1,radius=0.3,filename="4pi.dat")
AT(0,0,0) RELATIVE PREVIOUS

COMPONENT bananapsd=Monitor_nD(
        restore_xray=1, options="banana theta limits=[0,45] bins=201", filename="bananapsd", radius=0.49, yheight=0.001)
AT(0,0,0) RELATIVE PREVIOUS

COMPONENT det_ccd_rad1 = Monitor_nD(
        restore_xray=1, xwidth=0.05, yheight=0.05,options="angle, limits=[0,45], bins=120", filename="det_ccd_angle")
AT(0,0,0.02) RELATIVE sample_pos

COMPONENT det_ccd_rad = PSD_monitor(
        nr=200,radius=0.025, filename="det_ccd_rad")
AT(0,0,0.02) RELATIVE sample_pos

COMPONENT det_ccd = PSD_monitor(
        nx=200, ny=200, xwidth=0.05, yheight=0.05, filename="det_ccd")
AT(0,0,0.02) RELATIVE sample_pos

/* This section is executed when the simulation ends (C code). Other    */
/* optional sections are : SAVE                                         */
FINALLY
%{
%}
/* The END token marks the instrument definition end */
END