CombinedCalculator¶
- class CombinedCalculator(calculators=None, weights=None)¶
Class for representing combinations of calculators for configurations of the type MoleculeConfiguration and BulkConfiguration.
- Parameters:
calculators (sequence of
Calculator
) – The input calculators.weights (sequence of float and/or int (same sequence length as the number of input calculators).) – Weight for the calculators. Default:
[1.0, .. ,1.0]
- calculators()¶
- Returns:
The input calculators.
- Return type:
Sequence of
Calculator
- isConverged()¶
- Returns:
True when the call to “update()” resulted in a converged SCF loop.
- Return type:
bool
- metatext()¶
- Returns:
The metatext of the object or None if no metatext is present.
- Return type:
str | None
- setCheckpointHandler(checkpoint_handler)¶
Set the checkpoint handler. Not applicable and will be passed on.
- Parameters:
checkpoint_handler (
CheckpointHandler
) – The checkpoint handler to use.
- setMetatext(metatext)¶
Set a given metatext string on the object.
- Parameters:
metatext (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.
- setWeights(weights)¶
- Parameters:
weights – The weights for calculators.
- Rtype weights:
list of float.
- uniqueString()¶
Return a unique string representing the state of the object.
- upgrade(configuration)¶
Method for upgrading the configuration. The upgrade method is used when applying setCalculator for each encapsulated calculator.
Private method for updating the calculator from the configuration, if it is possible. @private
- versionUsed()¶
- Returns:
The version of ATK used to update the calculator.
- Return type:
str
- weights()¶
- Returns:
The weights for calculators
- Return type:
list of float
Usage Examples¶
The CombinedCalculator takes in as many calculators needed.
# Two arbitrary calculators are defined for the purpose of this example.
Icalculator = LCAOCalculator()
IIpotential_set = Tersoff_Si_1988()
IIcalculator = TremoloXCalculator(potential_set=IIpotential_set)
list_of_calculators = [Icalculator, IIcalculator]
# In case of specific weights, define them as well.
weights = [1, -0.5]
# Define CombinedCalculator with the two calculators and respective weights.
combined_calculator = CombinedCalculator(
calculators=list_of_calculators,
weights=weights,
)
Now the CombinedCalculator may be set on a configuration as usual and used in MD analysis, geometry optimization etc.
Notes¶
The CombinedCalculator adds energy, forces, and stress of the given list of calculators with the given weights. It can be used in simulations like MolecularDynamics, OptimizeGeometry, and can be used with analysis and study objects that require only energy, forces, or stress, such as Forces, TotalEnergy, Stress, ElasticConstants, PhononBandStructre, or PhononDensityOfStates. The CombinedCalculator does not support analysis objects that require the electronic structure.