# DeltaTest¶

class DeltaTest(elements, calculator, initial_spin=None, eos_data=None)

Do a Delta test for a number of elements with a given calculator.

Parameters: elements (Sequence) – Sequence of elements to be tested, e.g. [Silicon, Hydrogen, Carbon]. calculator (Calculator) – The calculator to be tested. Can be any QuantumATK calculator that supports total energy calculation. initial_spin (InitialSpin) – The inital spin to set on the configuration.
calculateEquationOfState()

Method to calculate the total energy as function of volume and storing the data on the object as a dictionary.

calculator()

Query method for the calculator.

delta(element=None, reference=None)

Get the delta value of the Delta test for a given element or the average among all elements.

Parameters: element (PeriodicTableElement) – Element for which to return the delta value. If no element is specified the average value for all the elements will be returned. reference (str | DeltaTest) – The filename of the file that holds the reference data to test against, or an other DeltaTest, which must include the specific element. Default: WIEN2k data from https://molmod.ugent.be/deltacodesdft. The delta value. PhysicalQuantity of type energy.
deltaStatistics(reference=None)

Get statistics about the delta values of the Delta test.

Parameters: reference (str | DeltaTest) – The filename of the file that holds the reference data to test against, or an other DeltaTest, which must include the specific element. Default: WIEN2k data from https://molmod.ugent.be/deltacodesdft. Dict with (element, delta), the minimum delta, element for the minimum, maximim delta, element for the maximum, average delta, standard deviation of delta, and failed elements. (Dict with PeriodicTableElement, PhysicalQuantity of type energy, PhysicalQuantity of type energy, PeriodicTableElement, PhysicalQuantity of type energy, PeriodicTableElement, PhysicalQuantity of type energy, PhysicalQuantity of type energy, list of PeriodicTableElement).
elements()

Query method for the elements.

equationOfState(element)

Query method for the equation of state of a specific element.

equationOfStateParameters(element)

Query for the Birch-Murnaghan equation of state parameters for a specific element.

nlprint(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, reference=None)

Print a formatted report of the Delta test.

referenceEquationOfStateParameters(element, reference=None)

Query method for the reference eos parameters (Birch-Murnaghan parameters).

## Usage Examples¶

### Perform a DeltaTest for ATK-DFT vs. WIEN2k over Si and Ge.¶

# Perform a delta test for ATK-DFT over Si and Ge

# Setup calculator to use.
calculator = LCAOCalculator(
iteration_control_parameters=IterationControlParameters(tolerance=1.0e-6, max_steps=300),
numerical_accuracy_parameters=NumericalAccuracyParameters(
density_mesh_cutoff=GridSampling(60),
k_point_sampling=[9,9,9]),
exchange_correlation=GGA.PBE)

elements = [Silicon, Germanium]
# Construct the test.
delta_test = DeltaTest(elements=elements, calculator=calculator)

# Print the delta test report.
nlprint(delta_test)

# Get the delta value for Si.
Si_delta = delta_test.delta(Silicon)

# Get the equation of state parameters for Si.
Si_equilibrium_volume, Si_bulk_modulus, Si_bulk_modulus_derivative, Si_bulk_minimum_total_energy = delta_test.equationOfStateParameters(Silicon)

# Get the equation of state data E(V) for Ge.
Ge_volumes, Ge_total_energies = delta_test.equationOfState(Germanium)



### Run DeltaTest against 3rd party code¶

By default, the DeltaTest is carried out against the WIEN2k data. Any other code can be compared to by providing the corresponding equation of state parameters in a file. This file must contain the reference equation of state parameters for each element to test organized in four columns: element symbol, equilibrium volume in units of cubic Angstrom, bulk modulus in units of GPa, and the normalized derivative of the bulk modulus which is unitless. The path to the reference data file is then given as a parameter to the DeltaTest constructor, e.g.

delta_test = DeltaTest(elements=[Silicon, Germanium],
calculator=LCAOCalculator(),
reference=/path/to/reference_file.txt
)