AtomsCalculatorsUtilities

Documentation for AtomsCalculatorsUtilities.

AtomsCalculatorsUtilities.CombinationCalculatorType
CombinationCalculator{N}

You can combine several calculators to one calculator with this. Giving keyword argument executor=SequentialEx() toggles on multithdeaded execution of calculators. Using executor=DistributedEx() executes calculators using multiprocessing.

Other use case is editing keywords that are passed on the calculators. E.g. you can generate new keyword argument that is then passed to all calculators. This allows you to share e.g. a pairlist between calculators.

To control what keywords are passed you need to extend generate_keywords function.

Fields

  • calculators::NTuple{N,Any} : NTuple that holds calculators
  • executor::Any : Transducers executor used to execute calculation - default SequentialEx
  • keywords::Function : function used to generate keywords for calculators

Creation

CombinationCalculator( calc1, calc2, ...; executor=SequentialEx())
source
AtomsCalculatorsUtilities.ReportingCalculatorType
ReportingCalculator{T, TC, TF}

ReportingCalculator collects information during calculation and sent it to a Channel that can be read.

Fields

  • calculator::T : caculator used in calculations
  • channel::Channel{TC} : Channel where message is put
  • message::TF : function that generates the message

Creation

rcalc = ReportingCalculator(calculator, Channel(32))
rcalc = ReportingCalculator(calculator, Channel(32); message_function=my_message_function)

When message_function is omitted, generate_message function is used. See it for more details on how to control generated messages.

You can access the channel by calling calculator directly with fetch or take!.

source
AtomsCalculatorsUtilities.SubSystemCalculatorType
SubSystemCalculator{T, TC}

Submits subsystem to given calculator.

The purpose of this calculator is that you can split system to smaller system that can then be calculated with e.g. with different methods. One possible use case here is QM/MM calculations where you can split QM system out.

The structrure is mutable to allow mutable calculators.

Fields

  • calculator::T : calculator which is used for the subsystem calculation
  • subsys::TC : definition of subsystem like array of indices - has to be iterable
source
AtomsCalculatorsUtilities.generate_keywordsMethod
generate_keywords

This function is called when CombinationCalculator is used.

Default implementation will only pass keywords forward.

The call type is AtomsBase system first then all calculators and kwargs. This will allow you to extend based on calculator type.

Example

function AtomsCalculatorsUtilities.generate_keywords(sys, pp1::PairPotential, pp2::PairPotential; kwargs...)
    if cutoff_radius(pp1) ≈ cutoff_radius(pp2)
        nlist = PairList(sys, cutoff_radius(pp1))
        return (; :nlist => nlist, kwargs...)
    else
        return kwargs
    end
end

will check that PairPotentials have same cutoff radius. Then calculates pairlist and passes it forward as a keyword.

source
AtomsCalculatorsUtilities.generate_messageMethod
generate_message(sys, calculator, calc_result; kwargs...) = calc_result

This is the default function that is called when ReportingCalculator collects a message. Extending this allows you to control what is reported.

This function is ment to allow setting of global stetting. If you want to set reporting function for an individual case, give ReportingCalculator keyword message_function=my_report where my_report is function that returns your message.

If function returns nothing the message is ignored. You can use this to control when message is sent.

source