mod_elemental_property_model¶
Dependencies¶
Module Variables¶
-
BATCHSIZE: integer (dim: (MAX_ELEM_NUM)) -
GENERIC_KEYWORDS_ELEMENTAL: character (dim: (*))
Derived Types Summary¶
| Name | Description |
|---|---|
NonEnvironmentDependentElementalPropertyModel |
A general feed-forward neural network with an arbitrary number of input nodes, hidden layers,... |
Procedures Summary¶
| Name | Type | Description |
|---|---|---|
constructor_elemental_property_model |
Function | |
get_num_parameters_elemental_property_model |
Function | |
initialize_elemental_property_model |
Subroutine | |
set_optimizer_elemental_property_model |
Subroutine | Set the optimizer_idx on this NonEnvironmentDependentElementalPropertyModel. Must be called... |
initialize_from_file_elemental_property_model |
Subroutine | |
reallocate_elemental_property_model |
Subroutine | |
reset_elemental_property_model |
Subroutine | Reset the information stored from the previous forward and backward passes. |
reset_prediction_elemental_property_model |
Subroutine | Reset the internal arrays that store the gradient information from the previous forward pass.... |
print_elemental_property_model |
Subroutine | Display information about the object and its members. |
read_parameters_from_file_elemental_property_model |
Subroutine | |
write_parameters_to_file_elemental_property_model |
Subroutine | |
get_parameters_elemental_property_model |
Subroutine | Get all property values for the given atomic numbers which are updated by the given optimizer in... |
set_parameters_elemental_property_model |
Subroutine | Set all property values for the given atomic numbers which are updated by the given optimizer... |
get_gradients_wrt_parameters_elemental_property_model |
Subroutine | Get all gradients d_loss/d_property values for the given atomic numbers which are updated by the... |
forward_elemental_property_model |
Subroutine | Calculate the output of the model. |
forward_gradient_elemental_property_model |
Subroutine | Calculate the output of the model for the given featuers. As the model is explicitely... |
backward_elemental_property_model |
Subroutine | Store the given d_loss/d_property gradient on the object. |
backward_gradient_elemental_property_model |
Subroutine | Store the given d_loss/d_property gradient on the object. |
calc_jacobian_elemental_property_model |
Subroutine | |
precondition_parameters_elemental_property_model |
Subroutine | |
init_params_from_property_elemental_property_model |
Subroutine | |
get_opt_ids_and_targets_elemental_property_model |
Subroutine | Returns the atomic numbers composing the model in the targets array. The opt_indices array... |
Derived Types Details¶
type NonEnvironmentDependentElementalPropertyModel¶
A general feed-forward neural network with an arbitrary number of input nodes, hidden layers, and output nodes.
Components
-
keyword_suffix: character– Inherited from AbstractPropertyModel -
num_output_properties: integer– How many properties this model predicts. – Inherited from AbstractPropertyModel -
max_num_features: integer– Inherited from AbstractPropertyModel -
name: character– Inherited from AbstractPropertyModel -
parameter_file_prefix: character– Prefix of the file from which parameters will be read/written. – Inherited from AbstractPropertyModel -
file_path: character– Path to the directory where parameters are stored and output files will be written. – Inherited from AbstractPropertyModel -
num_parameters: integer– Inherited from AbstractPropertyModel -
num_parameters_mask: integer– The total number of free parameters in the model. This should always be set by the `constructor` procedure of the derived type. – Inherited from AbstractPropertyModel -
batchsize: integer– Inherited from AbstractPropertyModel -
num_forward_passes: integer– Inherited from AbstractPropertyModel -
num_backward_passes: integer– Inherited from AbstractPropertyModel -
optimizer_idx: integer– Inherited from AbstractPropertyModel -
featcalc_index: integer– Inherited from AbstractPropertyModel -
comm_idx: integer– To which committee member this model belongs. – Inherited from AbstractPropertyModel -
output: real(DP) (dim: (:,:))– The output of the model. Dimension (batchsize x num_output_values) – Inherited from AbstractPropertyModel -
jacobian: real(DP) (dim: (:,:,:))– The gradients of the output property with respect to input features. Dimension (max_num_features x batchsize x num_output_values). – Inherited from AbstractPropertyModel -
mask: logical (dim: (:))– A logical array specifying, for each free parameter, whether it should be optimized or not. – Inherited from AbstractPropertyModel -
initialization_method: character– Inherited from AbstractPropertyModel -
lset_initialization_method: logical– Inherited from AbstractPropertyModel -
precondition_method: character– Inherited from AbstractPropertyModel -
lset_precondition_method: logical– Inherited from AbstractPropertyModel -
parameter_min: real(DP)– Inherited from AbstractPropertyModel -
parameter_max: real(DP)– Inherited from AbstractPropertyModel -
lparameter_min: logical– Inherited from AbstractPropertyModel -
lparameter_max: logical– Inherited from AbstractPropertyModel -
property: real(DP) (dim: (MAX_ELEM_NUM)) -
gradients: real(DP) (dim: (MAX_ELEM_NUM))– Gradients wrt the model parameters. -
atomic_numbers: integer (dim: (:)) -
optimizer_indices: integer (dim: (:)) -
activation: class(AbstractActivationFunction)
Type-Bound Procedures
| Name | Attributes | Binding |
|---|---|---|
| initialize_parent | public | ⇒ initialize_abstract_property_model |
| initialize_from_file_parent | public | ⇒ initialize_from_file_abstract_property_model |
| reset_results | public | ⇒ reset_results |
| get_num_forward_passes | public | ⇒ get_num_forward_passes_abstract_property_model |
| get_num_backward_passes | public | ⇒ get_num_backward_passes_abstract_property_model |
| reallocate | public | ⇒ reallocate_elemental_property_model |
| reset | public | ⇒ reset_elemental_property_model |
| reset_prediction | public | ⇒ reset_prediction_elemental_property_model |
| public | ⇒ print_elemental_property_model | |
| get_num_parameters | public | ⇒ get_num_parameters_elemental_property_model |
| get_parameters | public | ⇒ get_parameters_elemental_property_model |
| set_parameters | public | ⇒ set_parameters_elemental_property_model |
| get_gradients_wrt_parameters | public | ⇒ get_gradients_wrt_parameters_elemental_property_model |
| get_opt_ids_and_targets | public | ⇒ get_opt_ids_and_targets_elemental_property_model |
| forward | public | ⇒ forward_elemental_property_model |
| forward_gradient | public | ⇒ forward_gradient_elemental_property_model |
| backward | public | ⇒ backward_elemental_property_model |
| backward_gradient | public | ⇒ backward_gradient_elemental_property_model |
| calc_jacobian | public | ⇒ calc_jacobian_elemental_property_model |
| read_parameters_from_file | public | ⇒ read_parameters_from_file_elemental_property_model |
| write_parameters_to_file | public | ⇒ write_parameters_to_file_elemental_property_model |
| initialize | public | ⇒ initialize_elemental_property_model |
| initialize_from_file | public | ⇒ initialize_from_file_elemental_property_model |
| precondition_parameters | public | ⇒ precondition_parameters_elemental_property_model |
| initialize_parameters | public | ⇒ init_params_from_property_elemental_property_model |
| set_optimizer | public | ⇒ set_optimizer_elemental_property_model |
Inherits
Interface Details¶
interface NonEnvironmentDependentElementalPropertyModel¶
Procedure Details¶
function constructor_elemental_property_model¶
function constructor_elemental_property_model( &
name, &
atomic_numbers, &
keyword_suffix, &
parameter_file_prefix, &
comm_idx &
)
Arguments
-
name: character [in] -
atomic_numbers: integer (dim: (:)) [in] -
keyword_suffix: character [in] -
parameter_file_prefix: character [in] -
comm_idx: integer [in]
Called By
function get_num_parameters_elemental_property_model¶
function get_num_parameters_elemental_property_model( &
self, &
luse_mask, &
optimizer_idx, &
atomic_numbers &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [in] -
luse_mask: logical [in] -
optimizer_idx: integer [in] -
atomic_numbers: integer (dim: (:)) [in]
subroutine initialize_elemental_property_model¶
subroutine initialize_elemental_property_model( &
self, &
file_path, &
initialization_method, &
precondition_method, &
parameter_min, &
parameter_max &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
file_path: character [in] -
initialization_method: character [in] -
precondition_method: character [in] -
parameter_min: real(DP) [in] -
parameter_max: real(DP) [in]
subroutine set_optimizer_elemental_property_model¶
subroutine set_optimizer_elemental_property_model( &
self, &
lines, &
num_parameters_per_optimizer &
)
Set the optimizer_idx on this NonEnvironmentDependentElementalPropertyModel.
Must be called after initialization.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
lines: character (dim: (:)) [in] -
num_parameters_per_optimizer: integer (dim: (:)) [inout]
subroutine initialize_from_file_elemental_property_model¶
subroutine initialize_from_file_elemental_property_model( &
self, &
file_path, &
lines, &
atomic_numbers, &
num_input_features_per_element, &
num_output_properties, &
batchsize_per_element, &
lsaturation_check &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
file_path: character [in]– Path to the directory where the parameters are stored. -
lines: character (dim: (:)) [in]– Individual lines from input.nn -
atomic_numbers: integer (dim: (:)) [in]– The atomic numbers for which the elemental models are constructed. -
num_input_features_per_element: integer (dim: (:)) [in] -
num_output_properties: integer [in] -
batchsize_per_element: integer (dim: (:)) [in] -
lsaturation_check: logical [in]
subroutine reallocate_elemental_property_model¶
subroutine reallocate_elemental_property_model( &
self, &
batchsize &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
batchsize: integer (dim: (MAX_ELEM_NUM)) [in]
Called By
subroutine reset_elemental_property_model¶
subroutine reset_elemental_property_model( &
self &
)
Reset the information stored from the previous forward and backward passes.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout]
Called By
subroutine reset_prediction_elemental_property_model¶
subroutine reset_prediction_elemental_property_model( &
self &
)
Reset the internal arrays that store the gradient information from the previous forward pass. This should be called before every forward pass.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout]
Called By
subroutine print_elemental_property_model¶
subroutine print_elemental_property_model( &
self &
)
Display information about the object and its members.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [in]
subroutine read_parameters_from_file_elemental_property_model¶
subroutine read_parameters_from_file_elemental_property_model( &
self, &
iteration, &
prefix, &
idx, &
suffix &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
iteration: integer [in] -
prefix: character [in] -
idx: integer [in] -
suffix: character [in]
Called By
subroutine write_parameters_to_file_elemental_property_model¶
subroutine write_parameters_to_file_elemental_property_model( &
self, &
iteration, &
prefix, &
idx, &
suffix &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [in] -
iteration: integer [in] -
prefix: character [in] -
idx: integer [in] -
suffix: character [in]
subroutine get_parameters_elemental_property_model¶
subroutine get_parameters_elemental_property_model( &
self, &
parameters, &
luse_mask, &
optimizer_idx &
)
Get all property values for the given atomic numbers which are updated by the given optimizer in a flat array.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [in] -
parameters: real(DP) (dim: (:)) [inout]– Empty array to which free parameters will be cast. -
luse_mask: logical [in]– Only retrieve those parameters for which `self%mask` is `.true.`. -
optimizer_idx: integer [in]– Only retrieve parameters for those parts of the model which are updated by the optimizer with this index.
Called By
subroutine set_parameters_elemental_property_model¶
subroutine set_parameters_elemental_property_model( &
self, &
parameters, &
luse_mask, &
optimizer_idx &
)
Set all property values for the given atomic numbers which are updated by the given optimizer from a flat array.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
parameters: real(DP) (dim: (:)) [in]– Flat array of the parameters which will be set. -
luse_mask: logical [in]– Only set the parameters for which `self%mask` is `.true.`. -
optimizer_idx: integer [in]– Only set parameters for those parts of the model which are updated by the optimizer with this index.
Called By
subroutine get_gradients_wrt_parameters_elemental_property_model¶
subroutine get_gradients_wrt_parameters_elemental_property_model( &
self, &
gradients, &
luse_mask, &
optimizer_idx &
)
Get all gradients d_loss/d_property values for the given atomic numbers which are updated by the given optimizer in a flat array.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
gradients: real(DP) (dim: (:)) [inout]– Flat array of the parameters which will be set. -
luse_mask: logical [in]– Only set the parameters for which `self%mask` is `.true.`. -
optimizer_idx: integer [in]– Only set parameters for those parts of the model which are updated by the optimizer with this index.
subroutine forward_elemental_property_model¶
subroutine forward_elemental_property_model( &
self, &
features, &
atomic_numbers, &
num_features &
)
Calculate the output of the model.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
features: real(DP) (dim: (:,:)) [in]– Dimension (max_num_features x batchsize) -
atomic_numbers: integer (dim: (:)) [in]– The atomic number for each entry in the batch. -
num_features: integer (dim: (MAX_ELEM_NUM)) [in]– The number of features for each entry in the batch.
subroutine forward_gradient_elemental_property_model¶
subroutine forward_gradient_elemental_property_model( &
self, &
features, &
feature_gradients, &
atomic_numbers, &
num_features &
)
Calculate the output of the model for the given featuers.
As the model is explicitely environment-independent it does not implement a forward pass.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
features: real(DP) (dim: (:,:)) [in] -
feature_gradients: real(DP) (dim: (:,:)) [in] -
atomic_numbers: integer (dim: (:)) [in]– The atomic number for each entry in the batch. -
num_features: integer (dim: (MAX_ELEM_NUM)) [in]– The number of features for each entry in the batch.
subroutine backward_elemental_property_model¶
subroutine backward_elemental_property_model( &
self, &
atomic_numbers, &
loss_gradients &
)
Store the given d_loss/d_property gradient on the object.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
atomic_numbers: integer (dim: (:)) [in] -
loss_gradients: real(DP) (dim: (:,:)) [in]– Loss gradient information.
subroutine backward_gradient_elemental_property_model¶
subroutine backward_gradient_elemental_property_model( &
self, &
atomic_numbers, &
loss_gradients &
)
Store the given d_loss/d_property gradient on the object.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
atomic_numbers: integer (dim: (:)) [in] -
loss_gradients: real(DP) (dim: (:,:)) [in]– Loss gradient information.
subroutine calc_jacobian_elemental_property_model¶
subroutine calc_jacobian_elemental_property_model( &
self, &
atomic_numbers &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
atomic_numbers: integer (dim: (:)) [in]
subroutine precondition_parameters_elemental_property_model¶
subroutine precondition_parameters_elemental_property_model( &
self, &
target_mean, &
prediction_mean, &
target_std, &
prediction_std &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
target_mean: real(DP) (dim: (:)) [in] -
prediction_mean: real(DP) (dim: (:)) [in] -
target_std: real(DP) (dim: (:)) [in] -
prediction_std: real(DP) (dim: (:)) [in]
subroutine init_params_from_property_elemental_property_model¶
subroutine init_params_from_property_elemental_property_model( &
self, &
target_mean, &
target_range, &
target_std, &
eckhoff_avg_atomic_energy, &
rng &
)
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [inout] -
target_mean: real(DP) (dim: (:)) [in] -
target_range: real(DP) (dim: (:)) [in] -
target_std: real(DP) (dim: (:)) [in] -
eckhoff_avg_atomic_energy: real(DP) (dim: (:)) [in] -
rng: type(RandomNumberGenerator) [inout]
subroutine get_opt_ids_and_targets_elemental_property_model¶
subroutine get_opt_ids_and_targets_elemental_property_model( &
self, &
opt_ids, &
targets &
)
Returns the atomic numbers composing the model in the targets array.
The opt_indices array which is also returned contains -1, as no optimizers
are attached to this model.
Arguments
-
self: class(NonEnvironmentDependentElementalPropertyModel) [in] -
opt_ids: integer (dim: (:)) [out] -
targets: integer (dim: (:)) [out]