I have a problem with a function and its data type. Here is a very basic code (which will be expanded after I solved my problem):
module params
real,parameter :: spin = 0.5;
real,parameter :: gvalue = 2;
real,parameter :: exchange = 10; !cm^-1
integer,parameter :: length = 2;
integer,parameter :: hamsize = int((2*spin+1)**length)
end module params
program matrix
use params
implicit none
integer,dimension(length) :: vec;
vec(:) = create_base_vector(1);
write(*,*) vec;
end program matrix
function create_base_vector(pos)
use params
implicit none
integer :: pos;
integer,dimension(length) :: create_base_vector;
create_base_vector(1) = 2;
create_base_vector(2) = 3;
end function create_base_vector
The function create_base_vector should create an array. But if I want to compile it, the compiler tells me 'Error: Function 'create_base_vector' at (1) has no implicit type'. I tried to remove implicit none, but than the compiler tells me 'Error: Function 'create_base_vector' is of rank 1 at (1) and of rank 0 at (2)', where (1) is the function definition and (2) is the function call.
Does anybody know how to solve this problem?