# This is a template file for RIETAN-FP for angle-dispersive X-ray and neutron
# diffraction.

# Throughout this file, 'hoge' means the metasyntactic variable that should
# be replaced by the common string consisting of 62 alphanumeric characters
# (A--Z, a--z, and 0--9) plus '_' (underscore).

# Many comments are sprinkled in this file for beginners.  Power users may
# delete part of them to shorten it.  Addition of memorandums is also fine.
# Comments can be input in the following manner:

# (1) # comment
# (2) ! comment
# (3) Comment {
# (4) } comment
# (5) Variable name = value: comment
# (6) Variable name = value! comment

# Form (1) may in input from the middle of a line.  On the other hand, '!' must
# be the first character except for a space in form (2), which is used as a
# bookmark in the RIETAN-FP-VENUS assistance environment.  Lines with top
# characters of '#' and '!', or forms (3) and (6) are regarded as comment lines
# as a whole.  Form (3), which is usually used in combination with form (4), is
# optional; that is, it is a mere comment line without any effect during refinement.
# Form (4) is used to indicate the end of a series of input lines.  Variable names
# in forms (5) and (6) should appear only once in one file.  The first character
# of an integer variable should be I, J, K, L, M, or N whereas that of a real
# variable must be capital letters other than these characters: A-H and O-Z.

# Lines, "Variable name = value", without any comments may be also input. In this
# case, variable names and their values are always read by RIETAN-FP, of course.

# Input data excluding a comment part must be placed up to column 80.  A line,
# which is inadequate to contain the whole data, may be split into two or more
# lines.

# For If and Select blocks, refer to 17.3.5 to 17.3.7 in RIETAN-FP_manual.pdf and
# Sect. 2 in "On New Features in "Multi-Purpose Pattern-Fitting System RIETAN-FP."

! Titles

Fluorapatite, Ca_5F(PO_4)_3

! Radiation (NBEAM)

NBEAM = 0! Neutron powder diffraction.
NBEAM = 1: Conventional X-ray powder diffraction with characteristic X rays.
NBEAM = 2! Synchrotron X-ray powder diffraction.

! Analytical method

NMODE = 0: Rietveld analysis of powder diffraction data.
NMODE = 1! Calculation of powder diffraction intensities (plus simulation).
NMODE = 2! Total-pattern fitting where structure factors are fixed at Fc(MEM)'s.
NMODE = 3! The same as NMODE = 2 but refine |Fc|'s for relaxed reflections.
NMODE = 4! Conventional Le Bail analysis.
NMODE = 5! Le Bail analysis using a partial structure.
NMODE = 6! Individual profile fitting.

NPRINT = 0! Minimal output.
NPRINT = 1! Standard output including a reflection list.
NPRINT = 2! Detailed output including xdc.gpd to plot f' and f'' against lamdba.
NPRINT = 1

! NBEAM

Select case NBEAM
case 0
  ! =0: Neutron PD
   XLMDN = 1.5401: Neutron wavelength/Angstrom.
   RADIUS = 0.5: Radius/cm of the cylindrical cell.
   ABSORP =  1.0! Positive --> Density/g.cm-3 of the sample.*
   ABSORP =  0.0: Zero --> Neglect absorption.
   ABSORP = -1.0! Negative --> -(Linear absorption coefficient)*(radius).
   # * Calculated from the inner diameter, height, and mass of the sample.
case 1
  ! =1: X-ray PD
   NTARG = 1! Ag K_alpha radiation.
   NTARG = 2! Mo K_alpha radiation.
   NTARG = 3! Cu K_beta radiation.
   NTARG = 4: Cu K_alpha radiation.
   NTARG = 5! Co K_alpha radiation.
   NTARG = 6! Fe K_alpha radiation.
   NTARG = 7! Cr K_alpha radiation.

   R12 = 0.5: R12 = Intensity(K_alpha2)/Intensity(K_alpha1) for K_alpha radiation, and R12 = 0.0 for Cu K_beta radiation.#1
   CTHM1 = 0.7998: (cos(2*alpha))**n for the monochromator.#2
   #1: Because Johansson-type monochromators are fairly expensive, Cu K_beta radiation obtained
   #   with a curved graphite monochromator is sometimes used.
   #2: alpha: Bragg angle of the monochromator.  CTHM1 = 1.0 if no monochromator is installed.

   NSURFR = 0: Do not correct for surface roughness.
   NSURFR = 1! Correct for surface roughness by combining NSURFR = 2 and 3.
   NSURFR = 2! Correct for surface roughness with Sparks et al.'s model.
   NSURFR = 3! Correct for surface roughness with Suortti's model.
   NSURFR = 4! Correct for surface roughness with Pitschke et al.'s model.
   NSURFR = 5! Correct for surface roughness with Sidey's model.

   NTRAN = 0: Bragg-Brentano geometry (conventional divergence slit).
   NTRAN = 1! Bragg-Brentano geometry (automatic divergence slit*).
   NTRAN = 2! Transmission geometry (e.g., Guinier diffractometer).
   NTRAN = 3! Debye-Scherrer geometry.
   # * This slit gives variable divergence angles and a fixed irradiation width.

   Select case NTRAN
   case 1
      DSANG = 0.5: Angle/degree of the divergence slit at the minimum 2-theta.
      RGON = 185.0: Goniometer radius/mm.
      SWIDTH = 20.0: Irradiation width/mm for the sample.
   case 2
      PCOR1 = 0.5: Fraction of the perfect crystal contribution.
      SABS = 1.0: (Linear absorption coefficient)*(effective thickness).
   case 3
      XMUR1 = 0.0: (Linear absorption coefficient)*(radius).
   end select
case 2
  ! =2: Synchrotron X-ray PD
   XLMDX = 1.5401: X-Ray wavelength/Angstrom.
   PCOR2 = 0.05: I0(perpendicular)/I0(parallel). I0: incident intensity.
   # Refer to D.E. Cox, "Synchrotron Radiation Crystallography," ed by
   # P. Coppens, Academic Press, London (1992), p. 233.
   CTHM2 = 1.0: cos(2*alpha)**2 for the crystal monochromator (see above).
   XMUR2 = 0.0: (Linear absorption coefficient)*(radius).
end select

! Real chemical species

Select case NBEAM
case 0
   # Real neutral chemical species, amounts of substances, plus '/'.  Names of
   # 'real chemical species' are recorded in the database file asfdc.  The
   # amounts of substances are used to calculate absorption factors.  When
   # magnetic scattering is observed, attach '*' or '%' (virtual MUC) to
   # magnetic atoms, e.g., 'Fe*' and 'Mn%'.
   'O' 12.0  'P' 3.0  'Ca' 5.0  'F' 1.0 /

   # Input chemical-species names (e.g., 'Fe2+' and 'Ni3+') and Lande splitting
   # factors, g, for magnetic atoms whose names are attached with '*' or '%'.
   # The total number of these lines equals those of magnetic atoms.
   # Note that g = 2.0 when <j2> = 0.

   # The following line is given for 'Co%':
   # 'Co3+'  2.0

   # '}' is unnecessary because the number of atoms attached with '*' and '%'
   #  has already been known.
case 1, 2
   # Real chemical species plus '/'.
   # Refer to the data base file asfdc for chemical species to be input here.
   'O-'  'P'  'Ca2+'  'F-' /

   If NBEAM = 2 or NTARG = 3 then
      # Input X-ray dispersion corrections, f' and f'', for real chemical species.
      # Neither '/' nor '}' is required because the number of the real chemical species
      # has already been known. If f' = f'' = 0.0, they are calculated with xdc.bin.
   end if
end select

! Virtual chemical species

# When a site is occupied by two or more chemical species as in solid
# solutions, supposing an 'virtual' chemical species where these chemical
# species are mixed with each other in definite amount-of-substance
# fractions (total = 1) serves to decrease the total number of sites.
# Of course, such virtual species can be used only when their occupancies
# are fixed.  Input one virtual species plus '/' per line and '}' (plus comment)
# in the last line in the following way:

# Virtual chemical species
# 'M1' 'Ba' 0.633 'Nd' 0.367 / # Metal on the rock-salt layer
# 'M2' 'Nd' 0.675 'Ce' 0.325 / # Eight-coordinated atom in the fluorite block
#} End of virtual chemical species.

# 'M1' and 'M2' are names of virtual chemical species, 'Ba', 'Nd,' and 'Ce' are
# names of real chemical species input above, and numbers are amount-of-
# substance fractions of constituent elements.  For the above species, Refer to
# F. Izumi et al., Physica C 160 (1989) 235.
# When no virtual species are used, all the lines must be commented out.

Data concerning crystalline phases contained in the sample {

! Phase(s)
  ! Phase #1

PHNAME1 = 'Fluorapatite': Phase name (CHARACTER*68).

VNS1 = 'A-176': (Vol.No. of Int.Tables: A or I)-(Space group No)-(Setting No).

# A Hermann-Mauguin symbol included in Spgr.daf under folder RIETAN_VENUS.
HKLM1 = 'P 63/m ': hkl and m are generated from the Hermann-Mauguin symbol.#1
HKLM1 = 'P 63/m*'! Crystal-structure data based on the Hermann-Mauguin symbol are standardized.#2
#1 The use of crystal-structure data standardized with STRUCTURE TIDY is recommended.
#2 '*' is attached to the tail of the Hermann-Mauguin symbol on standardization of
#  crystal data with STRUCTURE TIDY, which is also possible with VESTA.

If NBEAM >= 1 then
   LPAIR1 = 0: No Friedel pairs (hkl & -h-k-l) are generated.
   LPAIR1 = 1! Friedel pairs (hkl & -h-k-l) are generated.
   # Set at 0 in a centrosymmetric space group.  Note that in 24 centrosymmetric
   # space groups, e.g., origin choice 1 for Pnnn (No. 48), descriptions with
   # points of higher symmetry as origin are also provided.  Setting this value
   # at 0 for a noncentrosymmetric space group increases the calculation speed
   # with lowering accuracy of structure factors.
end if

INDIV1 = 0! The overall isotropic atomic displacement parameter is input.
INDIV1 = 1: Atomic displacement parameters are assigned to all the sites.
# Neither B's nor beta_ij's are input if INDIV1 = 0.  Input zero for the
# overal isotropic atomic displacement parameter, Q, when INDIV1 = 1.

IHA1 = 0: \
IKA1 = 0:   --> Anisotropic-broadening axis, ha, ka, la.
ILA1 = 1: /
# They are dummies when parameters related to anisotropic profile
# broadening are set at null.

# Three preferred-orientation vectors, hp, kp, and lp, in the modified March-Dollase
# function which is a linear combination of three March-Dollase functions.
# If hp = kp = lp = 0, no preferred-orientation is corrected for that vector.

# Each preferred-orientation vector should be set in such a way that it is
# a reciprocal-lattice vector, hpa* + kpb* + lpc*, perpendicular to a cleavage
# plane for a plate crystal and parallel with an extension direction for a
# needle-like crystal.

IHP1 = 1: \
IKP1 = 0:   --> Preferred-orientation vector, hp1, kp1, lp1.
ILP1 = 0: /

IHP2 = 0: \
IKP2 = 0:   --> Preferred-orientation vector, hp2, kp2, lp2.
ILP2 = 0: /

IHP3 = 0: \
IKP3 = 0:   --> Preferred-orientation vector, hp3, kp3, lp3.
ILP3 = 0: /

# When two or more phases are included in the sample, repeat their date below.
# Note that the same label should not be input repeatedly.

# Place '}" (+ comment) after the input of information on all the phases.
} End of information about phases.

! Profile function

NPRFN = 0! Pseudo-Voigt function of Thompson et al.*
NPRFN = 1! Split pseudo-Voigt function of Toraya.**
NPRFN = 2! Modified split pseudo-Voigt function*** for relaxed reflections.
NPRFN = 3! Split Pearson VII function of Toraya.**
#   * P. Thompson et al., J. Appl. Crystallogr. 20 (1987) 79.
#  ** H. Toraya, J. Appl. Crystallogr., 23 (1990) 485.
# *** FWHM(Lorentz) <> FWHM(Gauss).  The split pseudo-Voigt function is
#     applied for the other reflections.  Refer to the following paper:
#     F. Izumi and T. Ikeda, Mater. Sci. Forum, 321-324 (2000) 198.
NPRFN = 1

Select case NPRFN
case 0
   NASYM = 0! Made asymmetric according to the procedure of Finger et al.*
   NASYM = 1! Made asymmetric according to the procedure of Howard.**
   #  * L. W. Finger et al., J. Appl. Crystallogr. 27 (1994) 892.
   # ** C. J. Howard, J. Appl. Crystallogr. 15 (1982) 615.
   NASYM = 0
case default
   # Selection of the peak-shift function.
   # t0 - t3: Peak-shift parameters; x: 2-theta.
   NSHIFT = 0! t0.
   NSHIFT = 1! t0 + t1*cos(x) + t2*sin(x) + t3*tan(theta).
   NSHIFT = 2! t0 + t1*x + t2*x^2 + t3*x^3.
   NSHIFT = 3! t0 + t1*tan(theta) + t2*(tan(theta))^2 + t3*(tan(theta))^3.
   NSHIFT = 4: Legendre polynomials where 2-theta is normalized as -1 to 1.
   NSHIFT = 5! Legendre polynomials where tan(theta) is normalized as -1 to 1.
end select

# Labels (CHARACTER*25), parameters, A(I), to calculate diffraction intensities,
# and refinement identifiers, ID(I).  ID(I)'s are input without inserting any
# spaces between them only when NMODE = 0 (no problem even if they are input
# when NMODE = 1).

# In what follows, PPP and SPP denote a primary profile parameter and a
# secondary profile parameter, respectively.  For example, when calculating
# the FWHM, H, with the equation H = [U(tan(theta)**2 + Vtan(theta) + W]^0.5,
# H is a PPP, the FWHM parameters U, V, and W are SPPs.  In conventional
# Rietveld analysis, SPP's which are common to the whole 2-theta range are
# refined whereas PPPs are locally refined for relaxed reflections.

# ID(I) = 0: Fix parameter A(I) at the value input by the user.
# ID(I) = 1: Refine parameter A(I).
# ID(I) = 2: Impose a constraint to parameter A(I).
# ID(I) = 3: Fix a PPP at the value calculated from SPP's.
# When A(I) is set at zero by the user, A(I) is calculated from the SPP's in
# each cycle. In that event, if A(I) should actually be fixed at zero, input a
# value that is nearly zero, e.g., 10^(-15).

# Relations between ID(I)'s, NPRFN, and partial profile relaxation:
# (1) Partial profile relaxation cannot be used when NPRFN = 0.
# (2) ID(I)'s are 1-3 when NPRFN = 1-3 with partial profile relaxation.

! Label, A(I), ID(I)

Label, A(I), and ID(I) now starts here {

  ! Phase-independent data

# Peak-shift parameters.
# NPRFN = 0: Z, Ds, Ts & dummy1 (Ds = Ts = 0 in neutron diffraction).
# NPRFN > 0: t0, t1, t2 & t3.

Select case NPRFN
case 0
   SHIFT0  0.0  0.0  0.0  0.0  1110
case default
   SHIFTN  0.0  0.0  0.0  0.0  1000
end select

# Surface-roughness parameters.
ROUGH  0.0  0.0  0.0  0.0  0000

# Background parameters, b_j (j = 0-11).
BKGD  0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0  111111111100

  ! Partial profile relaxation

# PPP's of relaxed reflections (input as required.  May be lacking).
# Format of each label: PPPn_h.k.l (n: phase number, hkl: diffraction index).

# PPP's refined in relaxed reflections:
# NPRFN = 1 (split pseudo-Voigt function): W, A, eta_L, eta_H.
# NPRFN = 2 (modified split pseudo-Voigt function): W1, W2, A, eta_L, eta_H.
# NPRFN = 3 (split Pearson VII function): W, A, mL, mH.

#PPP1_2.1.1   0.0  0.0  0.0  0.0  0.0  33333

  ! Phase #1
    ! Scale factor

SCALE  3.55651E-5  1

    ! Profile parameters

If NPRFN = 0 and NASYM = 1 then

   # TCH's pseudo-Voigt function made asymmetric by Howard's method.

   # FWHM parameters of the Gauss function, U, V, W, and P.
   GAUSS01  1.49395E-4  7.401285E-5  2.558033E-4  0.0  0110

   # FWHM parameters of the Lorentz function, X, Xe, Y, and Ye.
   LORENTZ01  3.157068E-2  2.282011E-3  2.879626E-2  -1.928188E-3  1111

   # Asymmetry parameter, As, plus five dummies.
   ASYM01  2.800001E-2  0.0  0.0  0.0  0.0  0.0  100000

   # Mixing coefficient, zeta, and S_hkl
   ANISTR01 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000000000000000

else if NPRFN = 0 and NASYM = 0 then

   # TCH's pseudo-Voigt function made asymmetric by Finger et al.'s method.

   # FWHM parameters of the Gauss function, U, V, W, and P.
   GAUSS00  1.49395E-4  1.41366E-4  2.07988E-4  0.0  0110

   # FWHM parameters of the Lorentz function, X, Xe, Y, and Ye.
   LORENTZ00  3.3918E-2  1.85408E-3  2.48941E-2  -1.11746E-3  1010

   # Asymmetry parameters, rs and rd, plus four dummies.
   ASYM00  2.82968E-2  9.34981E-3  0.0  0.0  0.0  0.0  110000

   # Mixing coefficient, zeta, and S_hkl
   ANISTR00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000000000000000

else if NPRFN = 1 or NPRFN = 2 then

   # Non-relaxed reflections: split pseudo-Voigt function
   # Relaxed reflections: Modified split pseudo-Voigt function.

   # FWHM parameters, U, V, and W, plus a dummy.
   FWHM12  5.77641E-3  -1.67383E-3  5.66877E-3  0.0  1110

   # Asymmetry parameters, a0, a1, and a2 plus a dummy.
   ASYM12  1.03944  0.141961  -4.10434E-2  0.0  1110

   # Decay parameters, eta_L0, eta_L1, eta_H0, and eta_H1.
   ETA12  0.611844  0.140346  0.504656  0.175874  1111

   # Anisotropic-broadening parameters, Ue and Pe.
   ANISOBR12  0.0  0.0  00

   # Dummy data
   DUMMY12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000000000000000

else if NPRFN = 3 then

   # Split Pearson VII function

   # FWHM parameters, U, V, W, plus a dummy.
   FWHM3  5.874843E-3  -2.614835E-3  5.290567E-3  0.0  1110

   # Asymmetry parameters, a0, a1, and a2, plus a dummy.
   ASYM3  0.976399  0.184397  -4.801547E-2  0.0  1110

   # Decay parameters, eta_L0, eta_L1, eta_H0, and eta_H1.
   M3  0.712220  0.219749  0.630807  0.125848  1111

   # Anisotropic-broadening parameter, Ue and Pe.
   ANISOBR3  0.0  0.0  00

   # Dummy data
   DUMMY3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000000000000000

end if

    ! Preferred orientation

# Six preferred-orientation parameters, f1, r1, f2, r2, f3, and r3,
# for the modified March-Dollase function
PREF  1.0  1.0  0.0  0.0  0.0  0.0  000000

    ! Lattice parameters & Q

# Lattice parameters, a, b, c, alpha, beta, & gamma.
# Overall isotropic atomic displacement parameter, Q.
CELLQ  9.36903  9.36903  6.88384  90.0  90.0  120.0  0.0  1010000

    ! Structure parameters

# Label/(chemical species name), occupancy (g) , fractional coordinates
# (x,y,z), isotropic atomic displacement parameter (B), ID(I)'s.
# One label is given to each site.  'Chemical species' include virtual ones
# (should not enclosed by ' ').  On the calculation of anisotropic atomic
# displacement parameters, input beta_11, beta_22, beta_33, beta_12,
# beta_13 and beta_23.  When a dummy '+' is input just before the value of B,
# RIETAN will determine the corresponding beta_ij.  Of course, six ID(I)'s
# must be input in that event.

O1/O-  1.0  0.324184  0.485358  0.25  0.737457  01101
O2/O-  1.0  0.591783  0.469823  0.25  0.739035  01101
O3/O-  1.0  0.339149  0.257271  6.98004E-2  0.83381  01111
P/P  1.0  0.39731  0.367878  0.25  0.554302  01101
Ca1/Ca2+  1.0  0.333333  0.666667  1.33E-3  0.647714  00011
Ca2/Ca2+  1.0  0.241793  -7.9608E-3  0.25  0.531388  01101
F/F-  1.0  0.0  0.0  0.25  1.42319  00001
} End of lines for label/species, A(I), and ID(I)

# When two or more phases are included in the sample, repeat the input of
# parameters (scale factor or later) after structure parameters in the
# previous phase.  Do not enter labels that have already been input.

! Linear constraints

If NMODE <> 1 then
# Input linear constraints for parameters with ID(I) = 2.  A parameter with
# ID(I) = 2 is place at the left side, and equations to calculate it from other
# parameters with ID = 1.  "Linear" means that the equation is linear with
# respect to parameters contained in the right side.  Linear constraints can
# be imposed on PPPs, SPPs, and structure parameters.  In the cases of SPPs,
# the linear constraints are used to set SPPs for two or more phases equal
# to each other.  Refer to the user's manual for the method of describing
# linear constraints.

# For example, linear constraints imposed among anisotropic atomic displacement
# parameters, beta_ij, are described in the following ways:
# A(X,B22)=A(X,B11) #5
# A(X,B22)=A(X,B11); A(X,B23)=A(X,B13) #6
# A(X,B22)=A(X,B11); A(X,B23)=-A(X,B13) #7
# A(X,B22)=A(X,B11) #8
# A(X,B33)=A(X,B22) #9
# A(X,B33)=A(X,B22); A(X,B13)=A(X,B12) #10
# A(X,B33)=A(X,B22); A(X,B13)=-A(X,B12) #11
# A(X,B33)=A(X,B22) #12
# A(X,B12)=0.5*A(X,B22) #13
# A(X,B12)=0.5*A(X,B22) #14
# A(X,B12)=0.5*A(X,B22); A(X,B23)=2.0*A(X,B13) #15
# A(X,B22)=A(X,B11); A(X,B12)=0.5*A(X,B11) #16
# A(X,B22)=A(X,B11); A(X,B33)=A(X,B11) #17
# A(X,B22)=A(X,B11); A(X,B33)=A(X,B11); A(X,B13)=A(X,B12); A(X,B23)=A(X,B12) #18
# where 'X' is a label (site name).  Please replace it with another label.
# Comments ('#'+integer) at the tails of these lines denote reference numbers in
# W. J. A. M. Peterson and J. H. Palm, Acta Crystallogr. 20 (1966) 147.

# Place '}' + comment after the input of all the linear constraints.
# When no constraints are given, comment out them, including '}.'
} End of linear constraints.
end if

! Voxel numbers

If NMODE <> 6 then
   # Unless MEP analysis, Fourier synthesis, or MEM analysis is carried out,
   # set NVOXA, NVOXB, and NVOXC at 0; then, these three are regarded as dummy data.
   NVOXA = 0: Number of voxels along the a axis.
   NVOXB = 0: Number of voxels along the b axis.
   NVOXC = 0: Number of voxels along the c axis.
end if

! BVS3D

If NMODE = 1 then
   NBVS3D = 0: No text file, BVS3D.inp, is created in the current folder.
   NBVS3D = 1! A text file, BVS3D.inp, is created in the current folder.

   If NBVS3D = 1 then
      # Note that data in this If block are those given for a sodium ion conductor.

      # Formal valence (positive) of the mobile ion.
      1.0

      # Name, R0, and b of counter ions (refer to bvparm2013.cif).
      'O'  1.56225  0.482 # For Na-O
      } # End of counter ions
   end if
end if

NCUT = 0! The profile range for relaxed reflections is determined by RIETAN.
NCUT = 1! The profile range for relaxed reflections is input by the user.
NCUT = 0
# NCUT = 0 when NPRFN = 0.

If NCUT = 1 then
   # 2-theta ranges for the profiles of relaxed reflections in the same order
   # as PPPn_h.k.l+PPP.  The total number of 2-theta pairs is equal to that of
   # the PPPn_h.k.l+PPP+ID lines. in the same order.  No '}' is necessary
   # because the number of the relaxed reflections has been already known.
    5.10    9.40
   11.00   14.10
   18.20   21.80
   19.40   24.10
   21.60   23.40
end if

If NMODE <> 1 then

! Diffraction data

   # NMODE = 0, 2-6: pattern fitting (Rietveld analysis, Le Bail analysis, MPF, etc.)

   NEXC = 0: Parameters are refined using all the data points.
   NEXC = 1! Parameters are refined by excluding part of the data points.

   If NEXC = 1 then
      2-theta range not to be used for the refinement {
        0.0    14.99
      130.01  180.0
      } End of excluded 2-theta ranges.
   end if

   NINT =  0! RIETAN format.
   NINT =  1: General (X-Y) format.
   NINT =  2! IGOR text file.
   NINT =  3! FVFM (Fully Variable ForMat).
   NINT =  4! Standard DBWS format.
   NINT =  5! DBWS format for multiple detectors.
   NINT =  6! Free format.
   NINT =  7! GSAS format.
   NINT =  8! HRPD (JAERI, JRR-3M) formats. Two types are supported.
   NINT =  9! RIGAKU RINT2000 ASCII format.
   NINT = 10! MAC Science format.
   NINT = 11! General-3 format.
   NINT = 12! PANalytical XML format.

! Backgrounds

   NRANGE = 0: Refine background parameters.
   NRANGE = 1! Fix backgrounds at (interpolated) values at specified 2-theta's.
   NRANGE = 2! Fix backgrounds of all the points at values in *.bkg.
   NRANGE = 3! Background = (background in *.bkg) * (Legendre polynomials).

   # When NRANGE > 0, 2-theta and background pairs are read in from *.bkg.
   # (1) NRANGE = 1
   # When a background is zero, it is set at a smoothed value at that data point.
   # Backgrounds at other data points are fixed at interpolated values.  Such a
   # manner is useful for the analysis of diffraction patterns where the number of
   # reflections are relatively small and the background curve is complex, for
   # example, having humps.
   # List-directed READ statement in RIETAN-2000: READ(4,*) (X(J),Y(J), J=1,100).
   # That is, we can input up to 100 diffraction points.  To show the end of data
   # points, place '/' after the last data point.
   # (2) NRANGE = 2
   # Input 2-theta and background pairs whose total number should be equal to
   # that of observed diffraction intensities in *.int.
   # List-directed READ statement in RIETAN-2000:
   # READ(8,*,END=9) (DEG(J),BG(J), J=1,NP)
   # (3) NRANGE = 3
   # This composite background function is particularly useful for the Debye-
   # Scherrer geometry where samples are charged in capillaries, which makes the
   # shape of the background complex.

   # A background file, hoge.bgr, created with WinPLOTR can be converted into
   # hoge.bkg (see 3.12.3 in RIETAN-FP_manual.pdf).

   If NRANGE >= 2 then
      # Note that the following three data are ineffective if *.bkg or *.bgr exists.
      NPICKUP = 20: Intensity data are taken out in every NPICK-th points for background estimation.
      NREPEAT = 40: Repeating time for background subtraction.
      CURVATURE = 0.0: A constant to cosider the curvature of the background.
   end if
else
   # NMODE = 1: Simulation of a diffraction pattern.
   
   DEG1 = 3.0: Minimum 2-theta in the calculated (simulated) pattern.
   DEG2 = 120.0: Maximum 2-theta in the calculated (simulated) pattern.
   USTP = 0.01: Step width/degree.
end if

! Profile cutoff

# PC: A constant to determine a 2-theta range for calculating profiles.
# PC < 1 ==> A region where the profile function exceeds peak intensity X PC.
#            When NPRFN = 0, PC < 1.
# PC > 1 ==> A region within peak position +/- FWHM*PC.
Select case NPRFN
case 0
   PC = 0.001
case 1
   PC = 7.00
case 2, 3
   PC = 7.00
end select

If NMODE = 1 then
   Go to *Graph
end if

! Pattern decomposition

If NMODE = 4 then
   # Initial values of integrated intensities, |F|**2, for the 1st phase are
   NSFF = 0: estimated according to the Wilson statistics.
   NSFF = 1! input from *.ffi.
   NSFF = 2! all set at 100.0.

   If NSFF = 1 then
      NCONST = 0! Integrated intensities are varied during Le Bail analysis.
      NCONST = 1! Integrated intensities remain constant during Le Bail analysis.*
      # * |F|'s are calculated from final refined parameters.
      NCONST = 0
   end if

   CHGPC = 1.0: Cut-off is at first set at CHGPC*PC.*
   # * Restored when lattice or profile parameters are refined.

   NOPT = 0! No integrated intensities are refined after Le Bail analysis.
   NOPT = 1: Integrated intensities are refined after Le Bail analysis.

   If NOPT = 1 then
      MREG = 15: Maximum number of reflections in each group of overlapped reflections.
      RWID = 0.350: Integrated intensities of reflections with Delta.2-theta < RWID*FWHM are set equal.
      XMAX = 180.0: Integrated intensities are refined up to XMAX/degrees.
      WNEG = 1.E30: Weight to suppress negative integrated intensities.
   end if

   INCLH = 0: Output no reflections near 2-theta(max) to *.ffo for lack of partial observed intensities.
   INCLH = 1! Output reflections near 2-theta(max) to *.ffo despite partial lack of observed intensities.

   MEP = 0! No integrated intensities are improved by the maximum-entropy Patterson method.
   MEP = 1: Integrated intensities are improved by the maximum-entropy Patterson method.

   If MEP = 1 then
      # Element symbols and numbers of atoms in the unit cell.
      'Ca' 10.0 'P' 6.0 'O' 24.0 'F' 2.0 /

      FLAMBDAMEP = 0.005: Initial Lagrange multiplier.
            TMEP = 0.010: Coefficient, t, to adjust the Lagrangian multiplier.

      ISCIOMEP = 2832: Coefficient to adjust estimated standard uncertainties.
      MAXITERMEP = 99999: Maximum number of MEP iterations.
   end if
end if

! Least-squares method

NLESQ = 0! Marquardt method (recommended in most cases).
NLESQ = 1! Gauss-Newton method.
NLESQ = 2! Conjugate-direction method (stable but very slow).
NLESQ = 0

NESU = 0: Standard uncertainties are estimated by the conventional method.
NESU = 1! Standard uncertainties are estimated by Scott's method.*
# * Much larger standard uncertainties will result in comparison with NESU = 0.

Select case NLESQ
case 0, 1
   NAUTO = 0! Refine all the variable parameters simultaneously.
   NAUTO = 1! Refine incrementally (specify variable parameters in each cycle).
   NAUTO = 2! Refine incrementally (automatic; recommended in most cases).
   NAUTO = 3! In addition to NAUTO = 2, check convergence to the global min.
   NAUTO = 2
   # Set NAUTO at 2 usually and at zero near the convergence.

   NCYCL = 100: Maximum number of cycles.
   CONV = 0.0001: Small positive number used for convergence judgement.
   NCONV = 6: Number of cycles used for convergence judgement.

   NC = 0: No nonlinear restraints are imposed on geometric parameters.
   NC = 1! Nonlinear restraints are imposed on geometric parameters.

   TK = 650.0: Penalty parameter.
   FINC = 2.0: Factor by which TK is multiplied when TK is increased.

   Select case NAUTO
   case 1
      # Specify parameters to be refined in each cycle plus '/'.
      # In addition to absolute parameter numbers, "label,number/symbol" may be
      # used (Refer to user's manual).
      Parameters refined in each cycle {
      BKGD,1 BKGD,2 BKGD,3 BKGD,4 BKGD,5 BKGD,6 BKGD,7 BKGD,8 BKGD,9 BKGD,10
      SCALE,1 /
      CELLQ,1 CELLQ,3 /
      # Place '}' (+ comment) after the last cycle.
      } End of inputs for numbers of refinable parameters.
   case 3
      # Input data for the conjugate-direction method (used to check the
      # convergence at a local minimum).
      MITER = 4: Maximum number of iterations.
      STEP = 0.02: Coefficient to calculate the initial step interval.
      ACC = 1.0E-6: Small positive number used for convergence judgement.
   end select
case 2
   MITER = 4: Maximum number of iterations.
   STEP = 0.02: Coefficient to calculate the initial step interval.
   ACC = 1.0E-6: Small positive number used for convergence judgement.

   NC = 0: No nonlinear restraints are imposed on geometric parameters.
   NC = 1! Nonlinear restraints are imposed on geometric parameters.

   TK = 650.0: Penalty parameter.
end select

If NC = 0 or NMODE <> 0 then
   Go to *Update
end if

! Restraints

LSER = 0! Input site names for restrained bond lengths/angles.
LSER = 1! Input serial numbers of restrained bond lengths/angles in *.ffe.
LSER = 0

Select case LSER
case 0
   LPAIR = 0! Input no pairs of site names, 'A' and 'B', for restrained A-B bond lengths.
   LPAIR = 1: Input pairs of site names, 'A' and 'B', for restrained A-B bond lengths.

   LTRIP = 0! Input no triplets of site names, 'A', 'B', and 'C', for restrained A-B-C bond angles.
   LTRIP = 1! Input triplets of site names, 'A', 'B', and 'C', for restrained A-B-C bond angles.
   LTRIP = 0

   If LPAIR = 1 then
      # Bond lengths between l_min and l_max are restrained.
      # 'A' and 'B' should not contain serial numbers.
      'A'  'B'  l_min  l_max  l_exp  Allowed dev.  Weight {
      'P'  'O'  1.3    1.7    1.50   0.08          0.0
      # Place '}' (+ comment) after the last restraint.
      } End of nonlinear restraints for bond lengths.
   end if

   If LTRIP = 1 then
      # Bond angles between phi_min and phi_max are restrained
      'A'  'B'  'C'   phi_min  phi_max  phi_exp  Allowed dev.  Weight {
      'O'  'P'  'O'   99.47    119.47   109.47   6.0           0.0
      # Place '}' (+ comment) after the last restraint.
      } End of nonlinear restraints for bond angles.
   end if
case 1
   # To specify nonlinear restraints, an input file for ORFFE, Filename.xyz,
   # must be created by inputting non-zero NDA (described below).  Then, ORFFE
   # is executed to output Filename.ffe, which is referred to learn serial
   # numbers for various interatomic distances and bond angles to enter them
   # in addition to their expected values and allowed deviations.
   # If Filename.ffe has already been created, it is not created at all.
   # Therefore, note that Filename.ffe must be wasted to make it again.

   Ser. No.  Exp. value  Allowed dev.  Weight {
   122       1.47        0.01          0.0
   123       1.54        0.01          0.0
   178       108.0       3.0           0.0
   # Place '}' (+ comment) after the last restraint.
   } End of nonlinear restraints on bond lengths/angles.
end select

LQUART = 0! Input no quartets of atoms related to restrained torsion angles.
LQUART = 1! Input quartets of atoms related to restrained torsion angles.
LQUART = 1

If LQUART = 1 then
   1      O1  O  0.48563  1.16145  0.75000 ( 0, 1, 1)+ y, -x+y, -z
   3      O3  O  0.25697  0.91812  0.93008 ( 0, 1, 1)+ y, -x+y, -z
   3      O3  O  0.25697  0.91812  0.56992 ( 0, 1, 0)+ y, -x+y, z+1/2
   2      O2  O  0.46981  0.87819  0.75000 ( 0, 1, 1)+ y, -x+y, -z
   # Exp. value  Allowed dev.  Weight
   71.0          0.2            0.015
   # Place '}' (+ comment) after the last restraint.
   } End of nonlinear restraints on torsion angles.
end if

*Update

! Update of hoge.ins

NUPDT = 0: Variable parameters (ID = 1, 2) in the input file remain unchanged.
NUPDT = 1! Variable parameters (ID = 1, 2) are updated in the packing mode.
# When NUPDT = 1, parameters are updated by inserting two spaces between data.

*Graph

! Graphs

# A graph to plot results of pattern fitting (NMODE <> 1) and simulation (NMODE = 1).
NPAT = 1: Output gnuplot files, *.plt and *.gpd, to plot a graph.
NPAT = 2! Output an Igor text file, *.itx, to plot a graph.
NPAT = 3! Output a RietPlot file, *.itx, to plot a graph (obselete).
# NPAT = 1 is higly recommended because gnuplot is multi-platform free software.

If NMODE <> 1 then
   # NMODE = 0, 2-6: pattern fitting (Rietveld analysis, Le Bail analysis, MPF, etc.)
   
   Select case NPAT
   case 1
  ! Gnuplot
      INDREF = 0: Output no profile intensities of individual reflections.
      INDREF = 1! Output profile intensities of individual reflections.

      LBG = 0! Plot no background.
      LBG = 1: Plot the background.

      LRES = 0: Plot Delta_y = (observed intensity - calculated intensity).
      LRES = 1! Plot Delta_y/(standard uncertainty).
      LRES = 2! Plot [Delta_y/(observed intensity)]/(standard uncertainty).*
      # * Refer to Eq. (1.13) in R. A. Young, "The Rietveld Method," p. 24.

       WIDTH = 24.5: Width/cm of the graph.
      HEIGHT = 13.0: Height/cm of the graph.

      YMIN = -5000: Minimum value for the y axis.
      YMAX = 20000: Maximum value for the y axis.
      YINC =  5000: Increment for ticks on the y axis.

      IVSIZE = 15: Size of numerical values for the x and y axes.
      ILSIZE = 17: Size of labels for axes.

      PSIZE = 0.35: Size of '+' marks representing observed intensities.
      TSIZE = 0.90: Length (in percent of the y-axis length) of tick marks to show peak positions.

      OFFSETD = -2800: Offset for the residual curve.

      OFFSET1 = -700: Offset (nonzero) for tick marks (peak positions) for phase No. 1.
      # When other phases are contained, input offsets in the above way.
      / # Place '/' if the number of phases whose offsets are input is less than 16.

      MSCS = 0! No commands to draw a Williamson-Hall or Halder-Wagner plot are appended to *.plt.
      MSCS = 1! Commands to draw a Williamson-Hall plot are appended to *.plt as comment lines.
      MSCS = 2! Commands to draw a Halder-Wagner plot are appended to *.plt as comment lines.
      MSCS = 2

      POWER = 2.0: n in [beta(sample)]**n = [beta(obs)]**n - [beta(instr)]**n.
      
      # You may also modify *.plt by an editor to replot refinement patterns.
   case 2
  ! Igor Pro
      IWIDTH = 800: Width of the graph.
      IHEIGHT = 400: Height of the graph.
      IYMIN = -2500: Minimum value for the y axis (default for zero).
      IYMAX = 20000: Maximum value for the y axis (default for zero).

      LBG = 0: Do not plot the background.
      LBG = 1! Plot the background.

      # Kind of a residual curve
      LDEL = 0: Plot Delta_y = (observed intensity - calculated intensity).
      LDEL = 1! Plot Delta_y/(standard uncertainty).
      LDEL = 2! Plot [Delta_y/(observed intensity)]/(standard uncertainty).*

      IOFFSETD = -1500: Offset for the residual curve.
      IPSIZE = 3: Length of tick marks to show peak positions.
      IFSIZE = 12: Size of numerical values attached to the x and y axes.
      ILSIZE = 14: Size of labels for axes.

      INDREF = 0: Do not output waves xrefl or yrefl.
      INDREF = 1! The profile of each reflection is output to waves xrefl and yrefl.

      IOFFSET1 = -300: Offset for tick marks (peak positions) for the first phase.
      # When other phases are contained, input offsets in the above way.
      / # Place '/' if the number of phases whose offsets are input is less than 16.

      # You may also edit Igor procedures at the tail of *.itx with an editor.
   end select
else
   # NMODE = 1: Simulation of a diffraction pattern.
   
   Select case NPAT
  ! Simulation
   case 1
      WIDTH = 24.5: Width/cm of the graph.
      HEIGHT = 12.0: Height/cm of the graph.

      IVSIZE = 15: Size of numerical values for the x and y axes.
      ILSIZE = 17: Size of labels for axes.
   case 2
      IWIDTH = 800: Width of the graph.
      IHEIGHT = 400: Height of the graph.

      LBG = 0: Plot no background (fixed).

      IPSIZE =  3: Length of tick marks (peak positions).
      IFSIZE = 12: Size of numerical values attached to the x and y axes.
      ILSIZE = 14: Size of labels for axes.
   end select
end if

! hoge.inflip & hoge.exp

If NMODE <> 1 and NMODE <> 6 then
   NCF = 0: No input file, *.inflip, of superflip is output for charge flipping.
   NCF = 1! An input file, *.inflip, of superflip is output for charge flipping.

   If NCF = 1 then
      # COMPOSCF = ' ' if command 'composition' is not used.
      # Only integers may be input after element symbols.
      COMPOSCF = 'Ca10 P6 O24 F2': String following 'composition' (CHARACTER*100)
   end if
end if

If NMODE = 4 or NMODE = 5 then
   NEXPO = 0! No input file, *.exp, of EXPO is output for buidling a structural model.
   NEXPO = 1: An input file, *.exp, of EXPO is output for buidling a structural model.
   
   If NEXPO = 1 then
      CONTENTEXP = 'Ca 10 P 6 O 24 F 2': String following 'content' in *.exp (CHARACTER*100)
   end if
end if

Select case NMODE
case 0, 1
  # Proceed to the input of NDA.
case 2, 3
  Go to *MEM
case 4-6
  Go to *Quit
end select

! Bond lengths and angles

NDA = 0! No file is output which store ORFFE data.
NDA = 1! Filename.xyz for ORFFE is output for the first phase.
NDA = 1

If NDA > 0 then
# Input ORFFE instructions as required and place '}' (+ comment) at the tail.
# Refer to the user's manual for ORFFE instructions used frequently.  ORFFE
# instructions must be input with a fixed column format; note not to set input
# data at erroneous positions.  When NDA > 0, Filename.xyz is output.  This file
# is used as an input file for ORFFE to calculate interatomic distances and bond
# angles.  ORFFE instructions in Filename.xyz can be modified and/or added by
# the user.

ORFFE instructions start {
# Note that the formats of ORFFE instructions differ from original ones!
#        1         2         3         4         5         6         7         8
#2345678901234567890123456789012345678901234567890123456789012345678901234567890

# Instruction 201, FORMAT(2I5,15X,I5).  Output a list of interatomic distances
# for all the sites.  The second number is the number of sites.  The third
# integer is 10 X (maximum distance in Angstroms).
# Interatomic distances less than 3.1 angstroms are listed
  201    7                  31
# Instruction 2, FORMAT(7I5).  Calculate a bond angle.  Three sets of A and
# 1000*C + S (refer to the output of ORFFE) follow after instruction 2.
# O3-P-O1
    2    3    0    4    0    1    0
# O3-P-O2
    2    3    0    4    0    2    0
} End of ORFFE instructions.
# ORFFE instructions can be modified and added by editing *.xyz directly.
end if

If NMODE = 1 then
   Go to *Quit
end if

NFR = 0! No file is output for Fourier/D synthesis.
NFR = 1! Filename.hkl for Fourier/D synthesis is output for the first phase.
NFR = 0

If NFR = 1 then
   TSCAT = 500.0: Total number of electrons (X-ray) or sum of b_c (N).
   # b_c: coherent scattering length (International Tables, Vol. C, p. 384).
end if

*MEM

! MEM analysis

NMEM = 0! No file is output for MEM analysis.
NMEM = 1! Filename.fos for MEM analysis is output for the first phase.
NMEM = 0

If NMEM = 1 then
   LANOM = 0: Calculate esu's from I's without contributions of a.d.
   LANOM = 1! Calculate esu's from I's with contributions of a.d.
   # esu: estimated standard uncertainty, I: integrated intensity,
   # a.d.: anomalous dispersion

   LGR = 0: All the reflections are output independently (should be fixed at 0).
   LGR = 1! Reflections overlapped heavily are output by being grouped.

   LFOFC = 0: Using calculated F'o' based on Rietveld refinement.
   LFOFC = 1! Using Fcal (dependent on the model) in Rietveld refinement.

   EPSD = 0.001: Maximum difference in d/Angstrom in grouped reflections.
   TSCAT1 = 500.0: Total number of electrons (X-ray diffraction) or
                   # sum of positive b_c (neutron diffraction).
   TSCAT2 = 0.0: Zero (X-ray diffraction) or
                 # sum of negative b_c (Neutron diffraction).
end if

# Cite the following reference whenever you report scientific results obtained
# with RIETAN-FP:
# F. Izumi and K. Momma, Solid State Phenom., 130 (2007) 15-20.
# Giving credit to RIETAN-FP is fine in the cases of abstracts, reports, etc.

# Fujio IZUMI
# E-mail: fujioizumi@me.com

*Quit
