Skip to content
Snippets Groups Projects
Commit 3afca515 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

gtReadSpaceGroup : remove use of mhashtable


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@788 4c865b51-4357-4376-afb4-474e03ccb993
parent a9f7cd39
No related branches found
No related tags found
No related merge requests found
function [lattice, crystal, table] = gtReadSpaceGroup(sg)
function [lattice, crystal] = gtReadSpaceGroup(sg)
% GTREADSPACEGROUP Read the spacegroup and give the hermann_mauguin symbol
% [lattice, crystal, table] = gtReadSpaceGroup(sg)
% [lattice, crystal] = gtReadSpaceGroup(sg)
% ------------------------------------------------
%
% INPUT:
......@@ -9,7 +9,9 @@ function [lattice, crystal, table] = gtReadSpaceGroup(sg)
% OUTPUT:
% lattice = lattice system for this spacegroup
% crystal = crystal system for this spacegroup
% table = mhashtable with 'spacegroup' : hermann_mauguin symbol
%
% Version 005 21-09-2012 by LNervo
% Removed mhashtable
%
% Version 004 20-09-2012 by YGuilhem
% Now using GT_MATLAB_HOME to determine path to spacegroups.dat
......@@ -19,26 +21,18 @@ function [lattice, crystal, table] = gtReadSpaceGroup(sg)
global GT_MATLAB_HOME
fid=fopen( fullfile(GT_MATLAB_HOME, 'zUtil_Cryst', 'spacegroups.dat' ),'r');
C=textscan(fid,'%s %d','delimiter','\t','commentstyle','matlab');
fid = fopen( fullfile(GT_MATLAB_HOME, 'zUtil_Cryst', 'spacegroups.dat' ),'r');
C = textscan(fid,'%s %*d','delimiter','\t','commentstyle','matlab');
fclose(fid);
spacegroup=uint8(C{2});
hermann=C{1};
n=size(hermann,1);
table=mhashtable;
for i=1:n
s=hermann{i};
s(isspace(s))=[];
table.put(num2str(spacegroup(i)),s);
end
% remove commented types from lists
index = cellfun(@(num) ~isempty(strfind(num, '%')), C{:});
C{:}(index) = [];
table.remove('0');
herm=table.get(num2str(sg));
% get the hermann-mauguin symbol
hermann = cellfun(@(num) strtrim(num), C{:},'UniformOutput', false);
% Spacegroups
if between(sg,1,2)
crystal = 'triclinic'; % a ~= b ~= c; alpha ~= beta ~= gamma ~= 90
lattice = 'triclinic';
......@@ -61,11 +55,11 @@ end
if between(sg,143,167)
crystal = 'trigonal';
if ~isempty(strfind(herm,'P')) % hexagonal lattice
if ~isempty(strfind(hermann{sg},'P')) % hexagonal lattice
% a1 = a2 = a3 ~= c; alpha = beta = 90; gamma = 120
lattice = 'hexagonal';
elseif ~isempty(strfind(herm,'R')) % rhombohedral lattice
elseif ~isempty(strfind(hermann{sg},'R')) % rhombohedral lattice
% a = b = c; alpha = beta = gamma ~= 90
lattice = 'rhombohedral';
end
......@@ -81,6 +75,4 @@ if between(sg,195,230)
lattice = 'cubic';
end
end % end of function
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment