Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(structure_type), | intent(out) | :: | self |
Instance of the molecular structure data |
||
integer, | intent(in) | :: | unit |
File handle |
||
type(error_type), | intent(out), | allocatable | :: | error |
Error handling |
subroutine read_pymatgen(self, unit, error) !> Instance of the molecular structure data type(structure_type), intent(out) :: self !> File handle integer, intent(in) :: unit !> Error handling type(error_type), allocatable, intent(out) :: error #if WITH_JSON class(json_value), allocatable :: root type(json_object), pointer :: object type(json_error), allocatable :: parse_error type(json_context) :: ctx call json_load(root, unit, config=json_parser_config(context_detail=1), & & context=ctx, error=parse_error) if (allocated(parse_error)) then allocate(error) call move_alloc(parse_error%message, error%message) return end if object => cast_to_object(root) if (.not.associated(object)) then call fatal_error(error, ctx%report("Invalid JSON object", root%origin, "Expected JSON object")) return end if call load_pymatgen(self, object, ctx, error) #else call fatal_error(error, "JSON support not enabled") #endif end subroutine read_pymatgen