next up previous contents index
Next: PLOT Up: Commands Previous: IFELSE, ENDIF

WRITE, PRINT

   Write some data. The only difference between WRITE and PRINT is the default destination which is OutFile for WRITE and MsgFile for PRINT. Therefore, they are identical if FILE operand is specified. Another difference is that errors in reading the command cause abnormal termination for WRITE whereas the command is ignored for PRINT.

[form-1: write beam data]WRITE BEAM, [FILE=tex2html_wrap_inline7636tex2html_wrap_inline7312'file_name',] [RIGHTtex2html_wrap_inline7312LEFT,] [KIND=k,] [INCP,] [SHORT] ;

BEAM
Write beam data.
tex2html_wrap_inline7636
File reference number. See above for default.
file_name
New or old file name. Must be enclosed by apostrophes. Either full path or relative path. Note that CAIN is run in the directory cain/exec.
When file_name is specified, the input file reference number is ignored and the file is opened with the reference number 98.
SHORT
Short format which fits to a wide screen. Otherwise, use standard format (see Sec.3.3).  
RIGHTtex2html_wrap_inline7312LEFT
Write only either right-going or left-going particles. Default=both.
INCP
Write particles created by incoherent processes (defined by PPINT command). Otherwise, normal particles only. If you want both, execute the command twice.
k
Write only photon (k=1) or electron (k=2) or positron (k=3) selectively. Default=all.

[form-2: write beam statistics data] PRINT STATISTICS, [INCP,] [SHORTtex2html_wrap_inline7312LONG,] [FILE=tex2html_wrap_inline7636,] ;  

STATISTICS
Write beam global data such as number of particles, r.m.s. size, etc.
SHORT
Print only the number of macro- and real particles. If none of SHORT and LONG is specified, print average and r. m. s. of (t,x,y,s) and tex2html_wrap_inline7702 as well as the average spin components.
LONG
Print max. and min. in addition to the standard items.
INCP
Include incoherent particles only. Otherwise, normal particles only. If you want both, execute the command twice.
tex2html_wrap_inline7636
File reference number. See above for default.

[form-3: write cpu time so far] PRINT CPUTIME, [LONG,] [FILE=tex2html_wrap_inline7636,] ;  

LONG
Print cpu-time for individual major subroutines. If not specfied, print only the total cpu-time.

[form-4: write values of parameters and expressions] PRINT [PARAMETER,] [FILE=tex2html_wrap_inline7636,] tex2html_wrap_inline8788[, tex2html_wrap_inline8790[, tex2html_wrap_inline8792]], [FORMAT=(fmt),] ;  

PARAMETER
Write values of (predefined or user defined) parameters or expressions. Can be omitted.
tex2html_wrap_inline7636
File reference number. See above for default.
tex2html_wrap_inline8798
Expressions . It is safer to enclose each expression by ( ) or [ ] or { }.gif
It is also possible to write a do-type sequence of the form (almost like FORTRAN)
( tex2html_wrap_inline8800,tex2html_wrap_inline8802,tex2html_wrap_inline8804,i=tex2html_wrap_inline8806,tex2html_wrap_inline8808,tex2html_wrap_inline8810)
where tex2html_wrap_inline8812's are expressions, i is a user-parameter name (need not be defined by SET command), tex2html_wrap_inline8806, tex2html_wrap_inline8808, and tex2html_wrap_inline8810 are expressions for initial, final, and increment values of i. If tex2html_wrap_inline8810 is omitted, tex2html_wrap_inline8822 is adopted. Note that tex2html_wrap_inline8806, tex2html_wrap_inline8808, and tex2html_wrap_inline8810 are considered to be integers. (Nint is applied.)
Do-type sequence may be nested as in FORTRAN. The do-control variable must not duplicate, of course. (Duplication within the sequence is checked but possible interference with variables outside PRINT or WRITE is not checked.)
(fmt)
Fortran format. Must be enclosed by ( ). CAIN  does not check the grammer so that a wrong format will cause an abnormal term by your computer system. Note that all the expressions are REAL*8. You cannot use I-format. If format is not specified, printed as `expression=value' by 1PD15.8 (one line for each).
If format is given but there is no expression to be printed, the format is executed as in FORTRAN. For example,
W RITE FORMAT=('nothing');
will cause `nothing' be printed.gif
Unfortunately, the grammer of CAIN does not allow an un-paired apostrophe so that, for example, 1H' will cause an error.


next up previous contents index
Next: PLOT Up: Commands Previous: IFELSE, ENDIF

Toshiaki Tauchi
Thu Dec 3 17:27:26 JST 1998