Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sym=0 fix #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions swfiles/@spinw/genlattice.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@
' instead']);
if ~isempty(param.sym)
error('spinw:genlattice:WrongInput', ...
'Both sym and spgr provided - note sym will be used.');
'Both sym and spgr provided - please only use sym.');
else
param.sym = param.spgr;
end
end
if ~isempty(param.sym) && isnumeric(param.sym) && param.sym == 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails when symmetry is given as a matrix
`spgr_type=[ 1 0 0 0
0 1 0 0
0 0 1 0]';

Can add && isscalar(param.sym) to the check:
if ~isempty(param.sym) && isnumeric(param.sym)&& isscalar(param.sym) && param.sym == 0,

but it seems like there's also an issue with the label it makes, and I didn't manage to figure out what's supposed to happen there...

param.sym = [];
end
if any(strcmp('angled', varargin(1:2:end))) && ...
any(strcmp('angle', varargin(1:2:end)))
warning('spinw:genlattice:WrongInput', ...
Expand Down Expand Up @@ -293,4 +296,4 @@

obj.unit.nformula = int32(param.nformula);

end
end
2 changes: 1 addition & 1 deletion tutorials/publish/tutorial4.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% We define a square lattice in the ab plane, with Cu+ ions with S=1 spin.

AFsq = spinw;
AFsq.genlattice('lat_const',[3 3 6],'angled',[90 90 90],'sym',0)
AFsq.genlattice('lat_const',[3 3 6],'angled',[90 90 90])
AFsq.addatom('r',[0 0 0],'S', 1,'label','Cu1','color','b')
AFsq.table('atom')
plot(AFsq)
Expand Down
Loading