Skip to content

mod_inputdata

Lines: 662 | Visibility: private

Provide an interface to the input.data file which holds structure properties for the whole dataset. author: Knut Nikolas Lausch

Dependencies

Uses

module~~mod_inputdata~~UsesGraph module~mod_inputdata mod_inputdata module~mod_abstract_structure_data_file mod_abstract_structure_data_file module~mod_inputdata->module~mod_abstract_structure_data_file module~mod_array_helpers mod_array_helpers module~mod_inputdata->module~mod_array_helpers module~mod_constants mod_constants module~mod_inputdata->module~mod_constants module~mod_dynamic_logical_array mod_dynamic_logical_array module~mod_inputdata->module~mod_dynamic_logical_array module~mod_io mod_io module~mod_inputdata->module~mod_io module~mod_mpi mod_mpi module~mod_inputdata->module~mod_mpi module~mod_neighbor_grid mod_neighbor_grid module~mod_inputdata->module~mod_neighbor_grid module~mod_optional_args mod_optional_args module~mod_inputdata->module~mod_optional_args module~mod_periodic_table mod_periodic_table module~mod_inputdata->module~mod_periodic_table module~mod_precision mod_precision module~mod_inputdata->module~mod_precision module~mod_settings mod_settings module~mod_inputdata->module~mod_settings module~mod_sort mod_sort module~mod_inputdata->module~mod_sort module~mod_structures mod_structures module~mod_inputdata->module~mod_structures module~mod_structures_helper mod_structures_helper module~mod_inputdata->module~mod_structures_helper module~mod_throw mod_throw module~mod_inputdata->module~mod_throw module~mod_abstract_structure_data_file->module~mod_mpi module~mod_abstract_structure_data_file->module~mod_periodic_table module~mod_abstract_structure_data_file->module~mod_structures module~mod_dataset_storage mod_dataset_storage module~mod_abstract_structure_data_file->module~mod_dataset_storage module~mod_genericfile mod_genericfile module~mod_abstract_structure_data_file->module~mod_genericfile module~mod_array_helpers->module~mod_precision module~mod_array_helpers->module~mod_throw module~mod_constants->module~mod_precision iso_c_binding iso_c_binding module~mod_constants->iso_c_binding module~mod_io->module~mod_optional_args module~mod_io->module~mod_precision iso_fortran_env iso_fortran_env module~mod_io->iso_fortran_env module~mod_mpi->module~mod_precision mpi_f08 mpi_f08 module~mod_mpi->mpi_f08 module~mod_neighbor_grid->module~mod_mpi module~mod_neighbor_grid->module~mod_precision module~mod_neighbor_grid->module~mod_structures_helper module~mod_dynamic_int_array mod_dynamic_int_array module~mod_neighbor_grid->module~mod_dynamic_int_array module~mod_neighborlist_helper mod_neighborlist_helper module~mod_neighbor_grid->module~mod_neighborlist_helper module~mod_periodic_table->module~mod_array_helpers module~mod_periodic_table->module~mod_constants module~mod_periodic_table->module~mod_io module~mod_periodic_table->module~mod_precision module~mod_periodic_table->module~mod_throw module~mod_precision->iso_c_binding module~mod_precision->iso_fortran_env module~mod_settings->module~mod_constants module~mod_settings->module~mod_io module~mod_settings->module~mod_periodic_table module~mod_settings->module~mod_precision module~mod_settings->module~mod_throw module~mod_cpu_vendor mod_cpu_vendor module~mod_settings->module~mod_cpu_vendor module~mod_sort->module~mod_precision module~mod_structures->module~mod_array_helpers module~mod_structures->module~mod_constants module~mod_structures->module~mod_mpi module~mod_structures->module~mod_periodic_table module~mod_structures->module~mod_precision module~mod_structures->module~mod_structures_helper module~mod_structures->module~mod_throw module~mod_linalg mod_linalg module~mod_structures->module~mod_linalg module~mod_structures_helper->module~mod_precision module~mod_structures_helper->module~mod_linalg module~mod_throw->module~mod_io module~mod_throw->module~mod_mpi module~mod_throw->module~mod_precision module~mod_throw->module~mod_sort module~mod_throw->iso_c_binding module~mod_throw->iso_fortran_env module~mod_cpu_vendor->iso_c_binding module~mod_dataset_storage->module~mod_mpi module~mod_dataset_storage->module~mod_sort mod_property_list mod_property_list module~mod_dataset_storage->mod_property_list module~mod_storage_container mod_storage_container module~mod_dataset_storage->module~mod_storage_container module~mod_genericfile->module~mod_io module~mod_genericfile->module~mod_mpi module~mod_genericfile->module~mod_throw module~mod_linalg->module~mod_precision module~mod_linalg->module~mod_settings module~mod_linalg->module~mod_throw module~cublas_wrapper cublas_wrapper module~mod_linalg->module~cublas_wrapper module~mod_neighborlist_helper->module~mod_mpi module~mod_neighborlist_helper->module~mod_precision module~mod_neighborlist_helper->module~mod_linalg module~cublas_wrapper->module~mod_settings module~cublas_wrapper->iso_c_binding module~mod_storage_container->module~mod_io module~mod_storage_container->module~mod_mpi module~mod_storage_container->module~mod_sort module~mod_storage_container->module~mod_dynamic_int_array module~mod_storage_container->mod_property_list module~mod_abstract_property_list mod_abstract_property_list module~mod_storage_container->module~mod_abstract_property_list module~mod_string mod_string module~mod_storage_container->module~mod_string module~mod_abstract_property_list->module~mod_mpi module~mod_abstract_property_list->module~mod_optional_args module~mod_abstract_property_list->module~mod_throw module~mod_abstract_property_list->module~mod_dynamic_int_array module~mod_abstract_property_list->module~mod_string module~mod_dynamic_int_array_2d mod_dynamic_int_array_2d module~mod_abstract_property_list->module~mod_dynamic_int_array_2d module~mod_dynamic_string_array mod_dynamic_string_array module~mod_abstract_property_list->module~mod_dynamic_string_array module~mod_string->module~mod_precision module~mod_dynamic_int_array_2d->module~mod_mpi module~mod_dynamic_string_array->module~mod_string

Used By

module~~mod_inputdata~~UsedByGraph module~mod_inputdata mod_inputdata program~runner RuNNer program~runner->module~mod_inputdata

Module Variables

  • TOTAL_CHARGE_TOLERANCE : real(DP)– Tolerance for checking whether the sum of atomic charges matches the total charge of a structure.
  • DEFAULT_FIELDS_BEGIN : character (dim: (6))– The default columns when only "begin" is specified in a line.
  • START_IDX_FIELDS : integer– Index of the first property that is not fixed. These first three columns (begin, positions, element) in the "begin" line are always the same and users cannot change them. All following columns (starting at index 4) are potentially predicted properties with user-chosen names.
  • START_COL_FIELDS : integer– Number of columns in the fixed fields (1x begin, 1x element, 3x position).

Derived Types Summary

Name Description
InputData A class for storing all data read from the input.data file.

Procedures Summary

Name Type Description
constructor Function Construct a new InputData object for holding structure data.
check_distances Function
get_line Function
broadcast_counts Subroutine
determine_max_num_atoms_inputdata Subroutine
count_structures_and_atoms_inputdata Subroutine Counts the number of structures, atom, neighbors, ... in the file without storing anything in memory.
set_property_indices Subroutine Parse a "begin" line in input.data to route properties to the correct position in...
read_next_structure_inputdata Subroutine Reads a single structure from input.data into object of type Structure. During parsing,...
read_reference_properties_inputdata Subroutine
check_lbegin Subroutine
read_structures_inputdata Subroutine
check_begin_line Subroutine Check formatting of the "begin" line in an input.data file. We enforce that the first five...
parse_field Subroutine
rewind_inputdata Subroutine

Derived Types Details

type InputData

A class for storing all data read from the input.data file.

Components

  • name : character– The name of the file. – Inherited from GenericFile
  • path : character– The relative or absolute path to the file. – Inherited from GenericFile
  • iomsg : character– Inherited from GenericFile
  • fileunit : integer– Fortran file unit ID. -1 is the (invalid) default and has to be changed to an actual fileunit, preferably using new_unit in the intrinsic open() routine. – Inherited from GenericFile
  • ios : integer– I/O status. 0 is the default and indicates that no error has occurred. Any other value indicates an error. – Inherited from GenericFile
  • tot_num_structures : integer– Total number of structures in the file. – Inherited from AbstractStructureDataFile
  • tot_num_atoms : integer– Total number of atoms in the file. – Inherited from AbstractStructureDataFile
  • num_atoms_element : integer (dim: (MAX_ELEM_NUM))– Total number of atoms per element in the file. – Inherited from AbstractStructureDataFile
  • max_num_atoms : integer– Maximum number of atoms in a single structure. – Inherited from AbstractStructureDataFile
  • max_num_atoms_per_element : integer (dim: (MAX_ELEM_NUM))– Maximum number of atoms per element in a single structure. – Inherited from AbstractStructureDataFile
  • mean_num_neighbors : real(DP)– The average number of neighbors per atom. Collected for statistical purposes. – Inherited from AbstractStructureDataFile
  • num_parsed_atoms : integer– Total number of atoms that were seen while parsing the file. – Inherited from AbstractStructureDataFile
  • num_used_atoms : integer– Total number of atoms that were parsed from the file. This may differ from `num_parsed_atoms` due to thresholds applied during parsing. – Inherited from AbstractStructureDataFile
  • num_parsed_structures : integer– Total number of structures that were seen while parsing the file. – Inherited from AbstractStructureDataFile
  • num_used_structures : integer– Total number of structures that were parsed from the file. This may differ from `num_parsed_structures` due to thresholds applied during parsing. – Inherited from AbstractStructureDataFile
  • reference_properties : type(DatasetStorage)– Inherited from AbstractStructureDataFile
  • lbond_warning : logical
  • lthresholds : logical
  • property_thresholds : type(PropertyThreshold) (dim: (:))
  • current_num_properties : integer
  • current_property_threshold_min : real(DP) (dim: (:))
  • current_property_threshold_max : real(DP) (dim: (:))
  • lthreshold_property : logical (dim: (:))
  • lpassed_thresholds : type(DynamicLogicalArray)
  • max_cutoff : real(DP)
  • bond_threshold : real(DP)
  • previous_begin_line : character
  • property_indices : integer (dim: (:))
  • property_columns : integer (dim: (:))
  • num_property_columns : integer
  • lread_reference_properties : logical

Type-Bound Procedures

Name Attributes Binding
open public ⇒ open_abstract_file
close public ⇒ close_abstract_file
check_ios public ⇒ check_ios
determine_max_num_atoms public ⇒ determine_max_num_atoms_inputdata
count_structures_and_atoms public ⇒ count_structures_and_atoms_inputdata
read_next_structure public ⇒ read_next_structure_inputdata
read_structures public ⇒ read_structures_inputdata
set_property_indices public ⇒ set_property_indices
read_reference_properties public ⇒ read_reference_properties_inputdata
broadcast_counts public ⇒ broadcast_counts
rewind public ⇒ rewind_inputdata

Inherits

type~~inputdata~~InheritsGraph type~inputdata InputData type~abstractstructuredatafile AbstractStructureDataFile type~inputdata->type~abstractstructuredatafile type~dynamiclogicalarray DynamicLogicalArray type~inputdata->type~dynamiclogicalarray lpassed_thresholds type~propertythreshold PropertyThreshold type~inputdata->type~propertythreshold property_thresholds type~datasetstorage DatasetStorage type~abstractstructuredatafile->type~datasetstorage reference_properties type~genericfile GenericFile type~abstractstructuredatafile->type~genericfile type~storagecontainer StorageContainer type~datasetstorage->type~storagecontainer structure, atom PropertyListInt PropertyListInt type~storagecontainer->PropertyListInt int PropertyListReal PropertyListReal type~storagecontainer->PropertyListReal real

Interface Details

interface InputData


Procedure Details

function constructor

function constructor( &
    filename, &
    path, &
    action, &
    lbond_warning, &
    max_cutoff, &
    bond_threshold, &
    property_thresholds &
)

Construct a new InputData object for holding structure data.

Arguments

  • filename : character [in]– The name of the file.
  • path : character [in]– The relative path to the file on disk.
  • action : character [in]– action to be performed on file. Can either be read or write.
  • lbond_warning : logical [in]– Whether to check short bonds while parsing. If true, a criterion should be given via `bond_threshold`, otherwise the default value of 1 Bohr is used.
  • max_cutoff : real(DP) [in]– The largest cutoff value that will be used for constructing atomic environments for the structures in this file. It will be used for estimating the number of neighbors.
  • bond_threshold : real(DP) [in]– Upper limit for the length of a bond. Will be checked if `lbond_warning` is true.
  • property_thresholds : type(PropertyThreshold) (dim: (:)) [in]– If given, the contained thresholds will be checked for each parsed structure and atom. Only structures where all values are below the given thresholds will be read.

Called By

proc~~constructor~3~~CalledByGraph proc~constructor~3 mod_inputdata::constructor interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

function check_distances

function check_distances( &
    istruc, &
    struct, &
    cutoff, &
    bond_threshold, &
    lwarn &
)

Arguments

  • istruc : integer [in]
  • struct : type(Structure) [inout]
  • cutoff : real(DP) [in]
  • bond_threshold : real(DP) [in]
  • lwarn : logical [in]

Called By

proc~~check_distances~~CalledByGraph proc~check_distances mod_inputdata::check_distances proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~count_structures_and_atoms_inputdata->proc~check_distances proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

function get_line

function get_line( &
    fileunit &
)

Arguments

  • fileunit : integer [in]

Called By

proc~~get_line~~CalledByGraph proc~get_line mod_inputdata::get_line proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~count_structures_and_atoms_inputdata->proc~get_line proc~read_reference_properties_inputdata mod_inputdata::InputData%read_reference_properties_inputdata proc~read_reference_properties_inputdata->proc~get_line proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine broadcast_counts

subroutine broadcast_counts( &
    self &
)

Arguments

Called By

proc~~broadcast_counts~~CalledByGraph proc~broadcast_counts mod_inputdata::InputData%broadcast_counts proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~broadcast_counts interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine determine_max_num_atoms_inputdata

subroutine determine_max_num_atoms_inputdata( &
    self &
)

Arguments

Called By

proc~~determine_max_num_atoms_inputdata~~CalledByGraph proc~determine_max_num_atoms_inputdata mod_inputdata::InputData%determine_max_num_atoms_inputdata proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~determine_max_num_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine count_structures_and_atoms_inputdata

subroutine count_structures_and_atoms_inputdata( &
    self &
)

Counts the number of structures, atom, neighbors, ... in the file without storing anything in memory.

Arguments

Called By

proc~~count_structures_and_atoms_inputdata~~CalledByGraph proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine set_property_indices

subroutine set_property_indices( &
    self, &
    begin_line, &
    line_idx, &
    map_to_reference_properties &
)

Parse a "begin" line in input.data to route properties to the correct position in self%reference_properties%atom%real%prop.

self%property_indices will be set to - "-1" if the property specified in the line does not exist in the reference_properties%atom%real%prop. In that case, it will be ignored later. - The index of the property in reference_properties%atom%real%prop which is the result of name2idx. - nothing if map_to_reference_properties is .false..

Arguments

  • self : class(InputData) [inout]
  • begin_line : character [in]
  • line_idx : integer [in]
  • map_to_reference_properties : logical [in]– If False, we will not look up the index of the property in the `self%reference_property` object. This saves time (no name2idx call) when that information is not needed. Be careful: this means that `self%property_indices` will remain undefined.

Called By

proc~~set_property_indices~~CalledByGraph proc~set_property_indices mod_inputdata::InputData%set_property_indices proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~count_structures_and_atoms_inputdata->proc~set_property_indices proc~read_reference_properties_inputdata mod_inputdata::InputData%read_reference_properties_inputdata proc~read_reference_properties_inputdata->proc~set_property_indices proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine read_next_structure_inputdata

subroutine read_next_structure_inputdata( &
    self, &
    struct, &
    lcheck &
)

Reads a single structure from input.data into object of type Structure.

During parsing, different properties may be checked against threshold values depending on the settings on the InputData object. If a threshold is not met, we keep reading until we meet the next structure that passes all threshold checks.

Arguments

  • self : class(InputData) [inout]
  • struct : type(Structure) [out]
  • lcheck : logical [in]– If `.true.` (default) checks will be performed on the structure to be read in. Currently, the only validate we do is that atomic charges sum up to the total charge (respecting TOTAL_CHARGE_TOLERANCE).

Called By

proc~~read_next_structure_inputdata~~CalledByGraph proc~read_next_structure_inputdata mod_inputdata::InputData%read_next_structure_inputdata proc~read_structures_inputdata mod_inputdata::InputData%read_structures_inputdata proc~read_structures_inputdata->proc~read_next_structure_inputdata

subroutine read_reference_properties_inputdata

subroutine read_reference_properties_inputdata( &
    self &
)

Arguments


subroutine check_lbegin

subroutine check_lbegin( &
    lbegin, &
    keyword &
)

Arguments

  • lbegin : logical [in]
  • keyword : character [in]

Called By

proc~~check_lbegin~~CalledByGraph proc~check_lbegin mod_inputdata::check_lbegin proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~count_structures_and_atoms_inputdata->proc~check_lbegin proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine read_structures_inputdata

subroutine read_structures_inputdata( &
    self, &
    ids, &
    structures &
)

Arguments

  • self : class(InputData) [inout]
  • ids : integer (dim: (:)) [in]
  • structures : type(Structure) (dim: (size(ids))) [out]

subroutine check_begin_line

subroutine check_begin_line( &
    fields, &
    line_idx &
)

Check formatting of the "begin" line in an input.data file.

We enforce that the first five statements in a begin line are always the same: "begin x y z element".

Arguments

  • fields : character (dim: (:)) [in]
  • line_idx : integer [in]

Called By

proc~~check_begin_line~~CalledByGraph proc~check_begin_line mod_inputdata::check_begin_line proc~set_property_indices mod_inputdata::InputData%set_property_indices proc~set_property_indices->proc~check_begin_line proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~count_structures_and_atoms_inputdata->proc~set_property_indices proc~read_reference_properties_inputdata mod_inputdata::InputData%read_reference_properties_inputdata proc~read_reference_properties_inputdata->proc~set_property_indices proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine parse_field

subroutine parse_field( &
    field, &
    line_idx, &
    name, &
    length &
)

Arguments

  • field : character [in]
  • line_idx : integer [in]
  • name : character [out]
  • length : integer [out]

Called By

proc~~parse_field~~CalledByGraph proc~parse_field mod_inputdata::parse_field proc~set_property_indices mod_inputdata::InputData%set_property_indices proc~set_property_indices->proc~parse_field proc~count_structures_and_atoms_inputdata mod_inputdata::InputData%count_structures_and_atoms_inputdata proc~count_structures_and_atoms_inputdata->proc~set_property_indices proc~read_reference_properties_inputdata mod_inputdata::InputData%read_reference_properties_inputdata proc~read_reference_properties_inputdata->proc~set_property_indices proc~constructor~3 mod_inputdata::constructor proc~constructor~3->proc~count_structures_and_atoms_inputdata interface~inputdata mod_inputdata::InputData interface~inputdata->proc~constructor~3

subroutine rewind_inputdata

subroutine rewind_inputdata( &
    self &
)

Arguments