TABLE OF CONTENTS


etsf_io_geometry_get

[ Top ] [ etsf_geometry ] [ Methods ]

NAME

etsf_io_geometry_get

FUNCTION

Read an opened ETSF file to get data related to the given group. Only associated pointers of argument @folder will be accessed. If any accessed variable is missing, this routine returns an error (usually an access_mode_id of argument error_data set to ERROR_MODE_INQ). Any other errors implies a return with @lstat = .false..

INPUTS

OUTPUT

SIDE EFFECTS

NOTES

This file has been automatically generated by the autogen_subroutines.py script. Any change you would bring to it will systematically be overwritten.

SOURCE

subroutine etsf_io_geometry_get(ncid, folder, lstat, error_data, use_atomic_units)

  !Arguments ------------------------------------
  integer, intent(in) :: ncid
  type(etsf_geometry), intent(inout) :: folder
  logical, intent(out) :: lstat
  type(etsf_io_low_error), intent(out) :: error_data
  logical, optional, intent(in) :: use_atomic_units

  !Local variables-------------------------------
  character(len = *), parameter :: my_name = 'etsf_io_geometry_get'
  logical :: my_use_atomic_units
  integer,allocatable :: varid(:)
  integer,allocatable :: start(:)
  integer,allocatable :: count(:)
  integer :: len
  character(etsf_charlen) :: flag


  ! *************************************************************************

!DEBUG
!write (*,*) 'etsf_io_geometry_get : enter'
!ENDDEBUG

  ! Get values for optional arguments, set default.
  if (present(use_atomic_units)) then
    my_use_atomic_units = use_atomic_units
  else
    my_use_atomic_units = .true.
  end if
  
  allocate(varid(11))
  
  if (associated(folder%space_group)) then
    call etsf_io_low_read_var(ncid, "space_group", &
                            & folder%space_group, &
                            & lstat, ncvarid = varid(1), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%primitive_vectors)) then
    call etsf_io_low_read_var(ncid, "primitive_vectors", &
                            & folder%primitive_vectors, &
                            & lstat, ncvarid = varid(2), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%reduced_symmetry_matrices)) then
    call etsf_io_low_read_var(ncid, "reduced_symmetry_matrices", &
                            & folder%reduced_symmetry_matrices, &
                            & lstat, ncvarid = varid(3), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%reduced_symmetry_translations)) then
    call etsf_io_low_read_var(ncid, "reduced_symmetry_translations", &
                            & folder%reduced_symmetry_translations, &
                            & lstat, ncvarid = varid(4), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%atom_species)) then
    call etsf_io_low_read_var(ncid, "atom_species", &
                            & folder%atom_species, &
                            & lstat, ncvarid = varid(5), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%reduced_atom_positions)) then
    call etsf_io_low_read_var(ncid, "reduced_atom_positions", &
                            & folder%reduced_atom_positions, &
                            & lstat, ncvarid = varid(6), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%valence_charges)) then
    call etsf_io_low_read_var(ncid, "valence_charges", &
                            & folder%valence_charges, &
                            & lstat, ncvarid = varid(7), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%atomic_numbers)) then
    call etsf_io_low_read_var(ncid, "atomic_numbers", &
                            & folder%atomic_numbers, &
                            & lstat, ncvarid = varid(8), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%atom_species_names)) then
    call etsf_io_low_read_var(ncid, "atom_species_names", &
                            & folder%atom_species_names, etsf_charlen, &
                            & lstat, ncvarid = varid(9), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%chemical_symbols)) then
    call etsf_io_low_read_var(ncid, "chemical_symbols", &
                            & folder%chemical_symbols, etsf_chemlen, &
                            & lstat, ncvarid = varid(10), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  if (associated(folder%pseudopotential_types)) then
    call etsf_io_low_read_var(ncid, "pseudopotential_types", &
                            & folder%pseudopotential_types, etsf_charlen, &
                            & lstat, ncvarid = varid(11), &
                            & error_data = error_data)
    if (.not. lstat) then
      call etsf_io_low_error_update(error_data, my_name)
      return
    end if
  end if
  
  deallocate(varid)

!DEBUG
!write (*,*) 'etsf_io_geometry_get : exit'
!ENDDEBUG

end subroutine etsf_io_geometry_get