function remuve0Utypes()
% Removes empty UMiu types from Umiu.mat

global  UqType iUqType Ucells Qtypes AtomMasses

UqType_save = [];
Ucells_save = [];
iUqType_save = 0;

% define foldername
modelfolder = getmodel;
    fullname = strcat(modelfolder,'Umiu.mat');
    load(fullname);

nUqType = length(UqType);
Uelements = zeros(1,4);
for i = 1:nUqType 
    Uelements = [0 0 0 0];
    u = UqType(i).u;
    if (u ~= 0),Uelements(1) = 1;end
    miu = UqType(i).miu;
    if (miu ~= 0)&&(~isnan(miu)),Uelements(2) = 1;end
    dm1dq2 = UqType(i).dm1dq2;
    if (dm1dq2 ~= 0)&&(~isnan(dm1dq2)),Uelements(3) = 1;end
    dm2dq1 = UqType(i).dm2dq1;
    if (dm2dq1 ~= 0)&&(~isnan(dm2dq1)),Uelements(4) = 1;end
    s = sum(Uelements);
    if s > 0
        iUqType_save = iUqType_save + 1;
        UqType_save = [UqType_save, UqType(i)];
        Ucells_save = [Ucells_save, Ucells(i)];
    end % if
end % i
iUqType = iUqType_save;
UqType = UqType_save;
clear global Ucells
global Ucells
Ucells = Ucells_save;

save(fullname,'UqType','iUqType','Ucells','Qtypes','AtomMasses');

% subfunctions ---------------------
function modelfolder = getmodel()
% gets model name in LevInfinite

filename = 'C:\LevInfinite\Config\Molecules.ini';
fid = fopen(filename,'rt');
molfolder = fgetl(fid);
fclose(fid);

filename = 'C:\LevInfinite\Config\ToCalculate.ini';
fid = fopen(filename,'rt');
modelname = fgetl(fid);
fclose(fid);

modelfolder = strcat(molfolder,modelname);
modelfolder = strcat(modelfolder,'\');
