AtomsCalculators.AtomsCalculatorsTesting.test_energy_forcesMethod
test_energy_forces(sys, calculator; force_eltype=nothing, rtol=1e8, kwargs...)

Test your calculator for AtomsCalculators interface. Passing test means that your calculator implements energy and forces interfaces correctly.

To use this function create a AtomsBase system sys and a calculator for your own calculator. Test function will then call the interface and performs checks for the output and checks that random keywords are accepted in input.

force_eltype can be given to forces! interface testing. Default promote_force_type. rtol can be given to control error in comparisons. kwargs can be passed to the calculator for tuning during testing.

The calculator is expected to work without kwargs.

AtomsCalculators.AtomsCalculatorsTesting.test_energy_forces_virialMethod
test_energy_forces_virial(sys, calculator; force_eltype=nothing, rtol=1e8, kwargs...)

Test your calculator for AtomsCalculators interface. Passing test means that your calculator implements energy, forces and virial interfaces correctly.

To use this function create a AtomsBase system sys and a calculator for your own calculator. Test function will then call the interface and performs checks for the output and checks that random keywords are accepted in input.

force_eltype can be given to forces! interface testing. Default promote_force_type. rtol can be given to control error in comparisons. kwargs can be passed to the calculator for tuning during testing.

The calculator is expected to work without kwargs.

AtomsCalculators.AtomsCalculatorsTesting.test_forcesMethod
test_forces(sys, calculator; force_eltype::AbstractVector=default_force_eltype, rtol=1e8, kwargs...)

Test your calculator for AtomsCalculators interface. Passing test means that your forces calculation implementation works correctly.

To use this function create a AtomsBase system sys and a calculator for your own calculator. Test function will then call the interface and performs checks for the output and checks that random keywords are accepted in input.

force_eltype can be given to forces! interface testing. Default promote_force_type. rtol can be given to control error in comparisons. kwargs can be passed to the calculator for tuning during testing.

The calculator is expected to work without kwargs.

AtomsCalculators.AtomsCalculatorsTesting.test_potential_energyMethod
test_potential_energy(sys, calculator; rtol=1e8, kwargs...)

Test your calculator for AtomsCalculators interface. Passing test means that your potential energy calculation implementation works correctly.

To use this function create an AtomsBase system sys and a calculator for your own calculator. Test function will then call the interface and performs checks for the output and checks that random keywords are accepted in input.

rtol can be given to control error in comparisons. kwargs can be passed to the calculator for tuning during testing.

The calculator is expected to work without kwargs.

AtomsCalculators.AtomsCalculatorsTesting.test_virialMethod
test_virial(sys, calculator; kwargs...)

Test your calculator for AtomsCalculators interface. Passing test means that your virial calculation implementation works correctly.

To use this function create an AtomsBase system sys and a calculator for your own calculator. Test function will then call the interface and performs checks for the output and checks that random keywords are accepted in input.

kwargs can be passed to the calculator for tuning during testing.

The calculator is expected to work without kwargs.

AtomsCalculators.@generate_interfaceMacro
@generate_interface

Generate complementary function for given function expression. This is mean to help defining the interface, so that you only need to define one of the interface methods for a given type of calculation (energy, forces, virial).

Example

Generate forces! and calculate(AtomsCalculators.Forces(), ...) calls from forces definition

AtomsCalculators.@generate_interface function AtomsCalculators.forces(system, calculator::MyType; kwargs...)
    #definition here
end

Generate forces and calculate(AtomsCalculators.Forces(), ...) calls from forces! definition

AtomsCalculators.@generate_interface function AtomsCalculators.forces!(f::AbstractVector, system, calculator::MyOtherType; kwargs...)
    #definition here
end

Generate AtomsCalculators.potential_energy call from AtomsCalculators.calculate call.

AtomsCalculators.@generate_interface function AtomsCalculators.calculate(::AtomsCalculators.Energy(), system, calculator::MyType; kwargs...)
    #definition here
end