function [title,FREQ,ZS,M,MS,NL,NDEP,ZMIN,ZINC,RMIN,RMAX,RINC, ...
          HW,HB,depw,svpw,dbpwlw,rhow,NW,depb,svpb,dbpwlb,rhob,NB]= ...
          read_rimLG(data_file)
fid = fopen(data_file);
% Read data
title = fgetl(fid);
%
Source = fscanf(fid,'%f %f',2);
FREQ=Source(1);
ZS=Source(2);
%
N_modes = fscanf(fid,'%d %d',2);
% M is the nmber of functions in the Legendre polynomial basis
% MS is the number of modes to sum in the acoustic field
M=2*ceil(N_modes(1)/2); % Make M even
if(M~=N_modes(1));
display(M,'M made even');
end;
NL=(M+2)/2; % Maximum order of Legendre polynomials
MS=min(N_modes(2),M); % Make MS<=M
%
Receiver_Dep = fscanf(fid,'%d %f %f',3);
NDEP=Receiver_Dep(1);
ZMIN=Receiver_Dep(2);
ZINC=Receiver_Dep(3);
%
Receiver_Rng = fscanf(fid,'%f %f %f',3);
RMIN=Receiver_Rng(1);
RMAX=Receiver_Rng(2);
RINC=Receiver_Rng(3);
%
N_Profile = fscanf(fid,'%d %d',2);
NW=N_Profile(1);
NB=N_Profile(2);
%
W_Profile = fscanf(fid,'%f %f %f %f',[4,NW]);
depw=W_Profile(1,1:NW);
svpw=W_Profile(2,1:NW);
dbpwlw=W_Profile(3,1:NW);
rhow=W_Profile(4,1:NW);
B_Profile = fscanf(fid,'%f %f %f %f',[4,NB]);
depb=B_Profile(1,1:NB);
svpb=B_Profile(2,1:NB);
dbpwlb=B_Profile(3,1:NB);
rhob=B_Profile(4,1:NB);
%
HW=depw(NW); % Depth of water column
% Make sure the top of seabed is the bottom of the water column
depb(1)=HW;
HB=depb(NB);
% Check that the total depth HB is greater than the water depth
if (HB <= HW)
    'Insufficient sediment depth'
    Keyboard;
end
clear Source Receiver_Dep Receiver_Rng N_Profile W_Profile B_Profile
% Close data file
fclose(fid);