write_aims Subroutine

public subroutine write_aims(self, unit)

Arguments

Type IntentOptional Attributes Name
class(structure_type), intent(in) :: self

Instance of the molecular structure data

integer, intent(in) :: unit

File handle


Source Code

subroutine write_aims(self, unit)

   !> Instance of the molecular structure data
   class(structure_type), intent(in) :: self

   !> File handle
   integer, intent(in) :: unit

   integer :: iat, ilt
   logical :: expo

   expo = maxval(self%xyz) > 1.0e+5 .or. minval(self%xyz) < -1.0e+5
   if (expo) then
      do iat = 1, self%nat
         write(unit, '(a, 1x, 3es24.14, 1x, a)') &
            "atom", self%xyz(:, iat) * autoaa, trim(self%sym(self%id(iat)))
      end do
   else
      do iat = 1, self%nat
         write(unit, '(a, 1x, 3f24.14, 1x, a)') &
            "atom", self%xyz(:, iat) * autoaa, trim(self%sym(self%id(iat)))
      end do
   end if

   if (any(self%periodic)) then
      if (size(self%lattice, 2) /= 3) return
      do ilt = 1, 3
         if (self%periodic(ilt)) then
            write(unit, '(a, 1x, 3f24.14)') &
               "lattice_vector", self%lattice(:, ilt) * autoaa
         end if
      end do
   end if

end subroutine write_aims