How the actual calculation is done in cuby should be briefly explained here. Firstly, calculation object is created to contain the setup and results. Name of the calculation (used as an unique identifier), geometry on which the calculation is performed (instance of Geometry) and calculation settings (instance of Settings) must be provided to create the object.
Available methods are listed in file interfaces/interfaces.yaml, and the code providing the calculation for each interface is in its file in directory interfaces.
The calculation must be set up by calling its prepare method. It decides (according to the settings) which interface is used for the calculation, load the module containing the interface and extends itself with that module. Then, it calls prepare method of the interface to do what is necessary, i.e. create temporary directory for the calculation and prepare input files. Prepare shoul be run only once at the beginning, and multiple calculations on the same geometry (but with different coordinates) and the same setup can be run in the prepared environment.
To run the calculation, call method calculate. It will call the respective method of the interface for you.
Results are stored in the attributes of the Calculation objects, and some of them are also copied to the geometry, unless specified otherwise.
This class provides description of an interface used fot calculation. It is the structure of one record in interfaces.yaml
This class is a container for results of a calculation.
prepare(what = [], options = {})
Initializes the calulation and prepares it's working directory if needed. Prepare method should be called only once, even when multiple calculations are then run.
What to calculate (Array of Symbols):
Options are passed to the prepare method of the interface
calculate(what = [], options = {})
Runs the actual calculation on current geometry. In addition to storing the results in @results object, it also copies them to the geometry object (unless disabled in the options)
What to calculate (Array of Symbols):
Options:
intensity
Failsafe wrapper providing guess of computational intensity of the calculation (returns value retrieved from the interface, or 0 if intreface does not have method intensity_interface)
<=> (calculation2)
Copmarison of calculation based on their intensity. Used to sort the calculations.
numerical_hessian(displacement = 0.01) # => Matrix
Numerical calculation of second derivative of energy. Energy and gradient in the original geometry is not calculated, only calculation at displaced geometries are done
check_supported_features
Determines required special functionality needed for calculation and raises error when it is not supported by the interface.
Following private methods provide the interfaces unified way to work with calculation directories. Directory name is made of the name of the calculation and suffix specified in interfaces.yaml.
calc_dir_use_old_if_possible(need_file) # => boolean
Returns true when old directory is used, false when new was created. The argument need_file is a filename that should be present in the calculation dir.