Skip to content

Commit

Permalink
Added doco for REFLECTION. Tidied unit conveersion in STR.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-jayatilaka committed Oct 25, 2024
1 parent 147aebd commit 86e4fe7
Show file tree
Hide file tree
Showing 2 changed files with 299 additions and 89 deletions.
318 changes: 262 additions & 56 deletions foofiles/reflection.foo
Original file line number Diff line number Diff line change
Expand Up @@ -313,102 +313,255 @@ contains
word.to_lower_case

select case (word)
case ("} "); ! exit surrounding loop
case ("f_exp= "); .read_F_exp
case ("f_pred= "); .read_F_pred
case ("f_sigma= "); .read_F_sigma
case ("group= "); .read_group
case ("h= "); .read_h1
case ("h1= "); .read_h1
case ("h2= "); .read_h2
case ("h3= "); .read_h3
case ("indices= "); .read_indices
case ("i_exp= "); .read_I_exp
case ("i_pred= "); .read_I_pred
case ("i_sigma= "); .read_I_sigma
case ("junk= "); .read_junk
case ("k= "); .read_h2
case ("l= "); .read_h3
case ("units= "); .read_units
case default; UNKNOWN(word)
case ("} "); ! exit surrounding loop
case ("f_exp= "); .read_F_exp
case ("f_pred= "); .read_F_pred
case ("f_sigma="); .read_F_sigma
case ("group= "); .read_group
case ("h= "); .read_h1
case ("h1= "); .read_h1
case ("h2= "); .read_h2
case ("h3= "); .read_h3
case ("indices="); .read_indices
case ("i_exp= "); .read_I_exp
case ("i_pred= "); .read_I_pred
case ("i_sigma="); .read_I_sigma
case ("junk= "); .read_junk
case ("k= "); .read_h2
case ("l= "); .read_h3
case ("units= "); .read_units
case default; UNKNOWN(word)
end

end

! units= and junk=

docu_units(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("units= STR")
stdout.flush
stdout.text(". The units symbol for the next numerical item to be input or output.")
stdout.text(" Atomic units are assumed after the next numerical item is processed.")
stdout.text(" Note that an item may be a single number, or a whole array.")
stdout.flush
stdout.text(". The value of default_units is temporarily set in the OUTPUT_STYLE of")
stdout.text(" the stdin or stdout TEXTFILE objects.")
stdout.flush
stdout.text(". Often used as embedded input in the keys= part of list input")
stdout.text(". e.g. like: keys= { ... { junk= } ... } ")
stdout.text(". See manual for more details.")
stdout.flush
stdout.text(". The following unit symbols are recognised:")
stdout.flush
stdout.text(" amu")
stdout.text(" angstrom angstroms")
stdout.text(" angstrom^2 angstrom^3 angstrom^4")
stdout.text(" angstrom^-1 angstrom^-3 angstrom^-5")
stdout.text(" bohr bohrs")
stdout.text(" cm^-1 wavenumber")
stdout.text(" debye debye-angstrom debye-angstrom^2")
stdout.text(" degrees radian radians")
stdout.text(" ev")
stdout.text(" joule")
stdout.text(" kcal/mol kcal.mol^-1")
stdout.text(" kelvin")
stdout.text(" kilojoule kjoule kj kj/mol kj.mol^-1")
stdout.text(" meter meters")
stdout.text(" mb mw gb")
if (present(die)) stop
end

read_units ::: get_from(OBJECT), private
! Read a string which describes the units to be used
end

docu_junk(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("junk= STR")
stdout.flush
stdout.text(". The next word or number to be input or output is ignored.")
stdout.flush
stdout.text(". Often used as embedded input in the keys= part of list input")
stdout.text(". e.g. like: keys= { ... { junk= } ... } ")
stdout.text(". See manual for more details.")
if (present(die)) stop
end

read_junk ::: get_from(OBJECT), private
! Read in a junk string, useful for ignoring a field
end

! F

docu_F_pred(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("f_pred= REAL")
stdout.flush
stdout.text(". The predicted tructure factor magnitude for the reflection.")
stdout.text(" It should include a scale factor, perhaps also an extinction")
stdout.text(" correction. Values not on an absolute scale.")
stdout.flush
if (present(die)) stop
end

read_F_pred
! Read in a predicted (real) structure factor
self :: INOUT
stdin.read(.F_pred)
end

! G

docu_group(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("group= INT")
stdout.flush
stdout.text(". The measurement or frame group index that the reflection")
stdout.text(" belongs to.")
if (present(die)) stop
end

read_group
! Read the group index that this reflection belongs to.
self :: INOUT
stdin.read(.group)
end

! H

docu_h1(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("h1= INT")
stdout.flush
stdout.text(". The h1 value of this reflection's indices [h1 h2 h3]")
if (present(die)) stop
end

read_h1
! Read in the "h1" Miller index
self :: INOUT
stdin.read(.h1)
end

docu_h2(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("h2= INT")
stdout.flush
stdout.text(". The h2 value of this reflection's indices [h1 h2 h3]")
if (present(die)) stop
end

read_h2
! Read in the "h2" Miller index
self :: INOUT
stdin.read(.h2)
end

docu_h3(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("h3= INT")
stdout.flush
stdout.text(". The h3 value of this reflection's indices [h1 h2 h3]")
if (present(die)) stop
end

read_h3
! Read in the "h3" Miller index
self :: INOUT
stdin.read(.h3)
end

read_indices
! Read in the h k l Miller indices as a triple
self :: INOUT
stdin.read(.h1)
stdin.read(.h2)
stdin.read(.h3)
! I

docu_I_exp(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("I_exp= REAL")
stdout.flush
stdout.text(". The measured (experimental) squared structure factor magnitude")
stdout.text(" or this reflection, on a non-absolute scale. These are intensities,")
stdout.text(" except for the Lorentz & polarization factor.")
stdout.flush
stdout.text(". Only symmetry unique reflections should be input.")
stdout.flush
if (present(die)) stop
end

read_F_exp
! Read in the experimentally determined structure factor
read_I_exp
! Read in the experimentay F2 i.e. I_exp
! NOTE: F_exp is overwritten!
! NOTE: The sign of I_exp is preserved on F_exp
self :: INOUT

val :: REAL

stdin.read(val)
.set_F_exp(val)
.set_I_exp(val)

end

read_F_sigma
! Read in the experimentally determined standard devaiation in
! the structure factor
self :: INOUT

val :: REAL

stdin.read(val)
.set_F_sigma(val)

docu_I_pred(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("i_pred= REAL")
stdout.flush
stdout.text(". The predicted squared structure factor magnitude for the")
stdout.text(" reflection. It should include a scale factor, perhaps also")
stdout.text(" an extinction correction. Values are not on an absolute scale.")
stdout.flush
if (present(die)) stop
end

read_I_exp
! Read in the experimentay F2 i.e. I_exp
! NOTE: F_exp is overwritten!
! NOTE: The sign of I_exp is preserved on F_exp
read_I_pred
! Read in a predicted intensity
! NOTE: if it is negative, the sign is preserved on F_pred, for
! later rejection.
! NOTE: F_pred is overwritten!
self :: INOUT
stdin.read(.I_pred)
if (.I_pred<ZERO) then; .F_pred = -sqrt(-.I_pred)
else; .F_pred = sqrt( .I_pred)
end
end

val :: REAL

stdin.read(val)
.set_I_exp(val)

docu_I_sigma(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("i_sigma= REAL")
stdout.flush
stdout.text(". The estimated standard deviation for the measured squared")
stdout.text(" structure factor magnitude, for this reflection.")
if (present(die)) stop
end

read_I_sigma
Expand All @@ -425,22 +578,75 @@ contains

end

read_F_pred
! Read in a predicted (real) structure factor

docu_indices(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("indices= VEC{INT}(3)")
stdout.flush
stdout.text(". The the three indices h1 h2 h3 of this reflection.")
stdout.text(" Braces not required.")
if (present(die)) stop
end

read_indices
! Read in the h k l Miller indices as a triple
self :: INOUT
stdin.read(.F_pred)
stdin.read(.h1)
stdin.read(.h2)
stdin.read(.h3)
end

read_I_pred
! Read in a predicted intensity
! NOTE: if it is negative, the sign is preserved on F_pred, for
! later rejection.
! NOTE: F_pred is overwritten!
! F

docu_F_exp(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("f_exp= REAL")
stdout.flush
stdout.text(". The measured (experimental) structure factor magnitude on a")
stdout.text(" non-absolute scale, for this reflection.")
if (present(die)) stop
end

read_F_exp
! Read in the experimentally determined structure factor
self :: INOUT
stdin.read(.I_pred)
if (.I_pred<ZERO) then; .F_pred = -sqrt(-.I_pred)
else; .F_pred = sqrt( .I_pred)
end

val :: REAL

stdin.read(val)
.set_F_exp(val)

end


docu_F_sigma(die) ::: selfless, private
! Documentation.
die :: BIN, optional, IN
stdout.flush
stdout.flush
stdout.text("f_sigma= REAL")
stdout.flush
stdout.text(". The estimated standard deviation for the measured structure")
stdout.text(" factor magnitude, for this reflection.")
if (present(die)) stop
end

read_F_sigma
! Read in the experimentally determined standard devaiation in
! the structure factor
self :: INOUT

val :: REAL

stdin.read(val)
.set_F_sigma(val)

end

! ====================
Expand Down
Loading

0 comments on commit 86e4fe7

Please sign in to comment.