Newer
Older
Laura Nervo
committed
function [symm, sg] = gtCrystCalculateSymmetryOperators(phaseid, sg, crystal_system)
Laura Nervo
committed
% GTCRYSTCALCULATEREFLECTIONS Calculate the symmetry operators list using python
% from xfab library in fable (sg.py)
Laura Nervo
committed
% [symm, sg] = gtCrystCalculateSymmetryOperators(phaseid, [sg], [crystal_system])
% ----------------------------------------------------------------------------------
% If spacegroup and crystal_system are not provided, they are read from
% parameters.mat.
Laura Nervo
committed
%
% INPUT:
% phaseid = <double> phase number {1}
% sg = <double> spacegroup number
% crystal_system = <string> crystal system
Laura Nervo
committed
%
% OUTPUT:
% symm = <struct 1xN> contains :
% .perm = set of indistinguishable lattice permutations <double 3x3>
Laura Nervo
committed
% .g3 = set of unitary rotation matrices corresponding to the
% indistinguishable lattice permutations <double 3x3>
Laura Nervo
committed
% sg = <struct 1xM> contains :
% .rot = rotations (complete list using symmetry operators) <double 3x3>
% .trans = translation values from symmetry operators <double 1x3>
Laura Nervo
committed
%
%
% Version 001 10-12-2012 by LNervo
if ~exist('phaseid','var') || isempty(phaseid)
phaseid = 1;
end
Laura Nervo
committed
if ~exist('sg','var') || isempty(sg)
parameters = [];
load('parameters.mat');
sg = parameters.cryst(phaseid).spacegroup;
if ~exist('crystal_system','var') || isempty(crystal_system)
crystal_system = parameters.cryst(phaseid).crystal_system;
end
Laura Nervo
committed
end
global GT_MATLAB_HOME;
script_file = fullfile(GT_MATLAB_HOME, 'zUtil_Python', 'symmetry_operators_list.py');
[~, msg] = gtPythonCommand([script_file ' ' num2str(sg)], true);
disp(msg);
Laura Nervo
committed
% read produced files
permN = gtReadTextFile(['perm_' crystal_system '.txt'],'%f %f %f',[3 3],true,'Delimiter',' ','CommentStyle','#');
rotN = gtReadTextFile(['rot_' crystal_system '.txt'],'%f %f %f',[3 3],true,'Delimiter',' ','CommentStyle','#');
sg_rotN = gtReadTextFile(['sg_rot_' crystal_system '.txt'],'%f %f %f',[3 3],true,'Delimiter',' ','CommentStyle','#');
sg_transN = gtReadTextFile(['sg_trans_' crystal_system '.txt'],'%f %f %f',[1 3],true,'Delimiter',' ','CommentStyle','#');
Laura Nervo
committed
Laura Nervo
committed
symm = struct('g3', rotN, 'perm', permN);
if nargout == 2
Laura Nervo
committed
sg = struct('rot', sg_rotN, 'trans', sg_transN);
Laura Nervo
committed
end
end % end of function