Skip to content

assert

Assert that the result from a previous calculation agrees with a specified value. Allowed types for comparison are integer or double. Vector and matrix notations are allowed as well. For floating point number comparisons, the precision is up to the specified margin.

For example:

helium_HF := dft(
  structure( formula = He )
  xc = HF
  ao = 'STO-3G'
  coulomb_method = direct_4idx
)
helium_DFT := dft(
  structure( formula = He )
  xc = PBE
  ao = 'STO-3G'
)
assert(
  load = helium_HF
  variable = energy
  value = -2.807784
  margin = 0.000001
)
assert(load = helium_DFT variable = n_iter value = 1)
assert(load = helium_DFT variable = 'structure(0, 1)' value = 0.0 margin = 1e-12)
assert(load = helium_DFT variable = 'orbitals(0, 0)' absolute_value = 1.0 margin = 1e-12)

This command can appear in the global context.

Options

absolute_value

Numerical value that the absolute value of variable should match. This is an alternative to value.

  • The type is real
  • There is no default value.
  • The value must be nonnegative
load

Name of result set to load the variable from.

  • The type is string
  • There is no default value.
margin

Margin within which the variable should agree with the specified value.

  • The type is real
  • The default is 0
  • The value must be nonnegative
name

Name of result set to take the variable from.

This option is deprecated.

  • The type is string
  • The default is previous
value

Numerical value that the variable should match.

  • The type is real
  • There is no default value.
variable

Name of variable, to be used together with value.

This option is mandatory.

  • The type is string
  • There is no default value.