-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathget_sympairs.m
52 lines (45 loc) · 1.29 KB
/
get_sympairs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [Spairs,nsympairs] = get_sympairs(pgnum,dispnameQ)
arguments
pgnum(1,1) int8 {mustBeInteger} = 32 %default == cubic
dispnameQ(1,1) logical = false
end
% GET_SYMPAIRS get all combinations (pairs) of operators for a point group
%--------------------------------------------------------------------------
% Author: Sterling Baird
%
% Date: 2020-07-27
%
% Inputs:
% pgnum - point group number, 32 == Oh (cubic)
%
% dispnameQ - whether or not to display the name of the point group
%
% Outputs:
% Spairs - combinations of symmetry operators, including repeats
%
% Usage:
% Spairs = get_sympairs(32); % combinations of cubic symmetry operators
%
% Dependencies:
% Pgsymops.mat, PGnames.mat (optional, default is not required)
%
%--------------------------------------------------------------------------
%load operators
symops = load('PGsymops.mat');
if dispnameQ
%display point group name
symnames = load('PGnames.mat');
pgname = symnames.PG_names{pgnum};
disp(pgname)
end
%unpack point group
qpt = symops.Q{pgnum};
%get all combinations of symmetry operators
qpttmp = num2cell(qpt,2);
qptpairs = allcomb(qpttmp,qpttmp);
% unpack symmetry operator combinations
SAlist = vertcat(qptpairs{:,1});
SBlist = vertcat(qptpairs{:,2});
% catenate combinations
Spairs = [SAlist SBlist];
end %get_sympairs