which Fortran standard of these codes?

Viewed 79

I am confused that the syntax in the subroutine of fortran code as following:

subroutine X(lr_orth_response)(mesh, st, lr, omega)
  type(mesh_t),   intent(in)    :: mesh
  type(states_t), intent(in)    :: st
  type(lr_t),     intent(inout) :: lr
  R_TYPE,         intent(in)    :: omega
  
  integer :: ist, ik
  PUSH_SUB(X(lr_orth_response))
  
  do ik = st%d%kpt%start, st%d%kpt%end
    do ist = 1, st%nst
      call X(lr_orth_vector) (mesh, st, lr%X(dl_psi)(:,:, ist, ik), ist, ik, omega)
    end do
  end do
  
  POP_SUB(X(lr_orth_response))
end subroutine X(lr_orth_response)

I've checked all Fortran standards and I cannot find any useful info about it! Does anyone know what's the label lr_orth_response? Also, accessing to data by the pointer is also confused a little bit in this line lr%X(dl_psi)(:,:, ist, ik), ist, ik, omega), in which lr is a new type lr_t defined by user but there is no member functions or variables named X(dl_psi).

1 Answers

This is not pure Fortran. It looks like a source that must be preprocessed by some preprocessor, perhaps the C preprocessor cpp or its variant fpp. The preprocessor will expand R_TYPE, PUSH_SUB, POP_SUB and X using some macro. Some of the macros apparently depend on some parameter called lr_orth_response. We cannot say what that parameter does in those macros without actually seeing the definition but we would need much more code from you. It is probably used for some generic programming, but hard to guess how exactly.

Related