function varargout = printLatticeSummary(cdef)
% print lattice data
%
% THIS IS NO USER FUNCTION

% The elk-library: convex geometry applied to crystallization modeling.
%   Copyright (C) 2013 Alexander Reinhold
%
% This program is free software: you can redistribute it and/or modify it 
%   under the terms of the GNU General Public License as published by the 
%   Free Software Foundation, either version 3 of the License, or (at your 
%   option) any later version.
%
% This program is distributed in the hope that it will be useful, but 
%   WITHOUT ANY WARRANTY; without even the implied warranty of 
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
%   General Public License for more details.
%
% You should have received a copy of the GNU General Public License along 
%   with this program.  If not, see <http://www.gnu.org/licenses/>.

disp(' ');

if ~isfield(cdef, 'lat')
    disp('Lattice parameters not yet defined.');
    disp(' ');
end

outline = ['With lattice type ''' cdef.sym.system ''', the following is given:'];
if isfield(cdef, 'lat')
    outline = [outline ' (a,b,c in Aengstroem)'];
end
disp(outline);
latspec = obtainLatticeSpecFromCrystalFamily(abbreviateCrystalSystem(...
    cdef.sym.system));

outline = '';
switch [latspec{1} latspec{2} latspec{3}]
    case 'aaa'
        outline = [outline 'a = b = c'];
        if isfield(cdef, 'lat')
            outline = [outline ' = ' num2str(cdef.lat.a)];
        end
    case 'aac'
        outline = [outline 'a = b'];
        if isfield(cdef, 'lat')
            outline = [outline ' = ' num2str(cdef.lat.a) ', '...
                'c = ' num2str(cdef.lat.c)];
        end
        
    otherwise
        if isfield(cdef, 'lat')
            outline = [outline 'a = ' num2str(cdef.lat.a) ', '...
                'b = ' num2str(cdef.lat.b) ', '...
                'c = ' num2str(cdef.lat.c)];
        end
end
if isnumeric(latspec{4})
    if ~isempty(outline), outline = [outline ', '];end
    outline = [outline 'alpha = ' num2str(latspec{4}) '°'];
    lat.alpha = latspec{4};
elseif isfield(cdef, 'lat')
    outline = [outline ', alpha = ' num2str(cdef.lat.alpha) '°'];
end
if isnumeric(latspec{5})
    if ~isempty(outline), outline = [outline ', '];end
    outline = [outline 'beta = ' num2str(latspec{5}) '°'];
    lat.beta = latspec{5};
elseif isfield(cdef, 'lat')
    outline = [outline ', beta = ' num2str(cdef.lat.beta) '°'];
end
if isnumeric(latspec{6})
    if ~isempty(outline), outline = [outline ', '];end
    outline = [outline 'gamma = ' num2str(latspec{6}) '°'];
    lat.gamma = latspec{6};
elseif isfield(cdef, 'lat')
    outline = [outline ', gamma = ' num2str(cdef.lat.gamma) '°'];
end
disp(['  ' outline]);

if exist('lat', 'var')
    cdef.lat = lat;
end

if nargout == 2
    varargout{1} = latspec;
    varargout{2} = cdef;
end