From b00f26ad9a6abd8be146273fe403cc9b131f1b14 Mon Sep 17 00:00:00 2001 From: Duc Le Date: Tue, 22 Oct 2024 09:03:00 +0100 Subject: [PATCH] Fix 'sym', 0 behaviour and tutorial 4 #205 --- swfiles/@spinw/genlattice.m | 7 +++++-- tutorials/publish/tutorial4.m | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/swfiles/@spinw/genlattice.m b/swfiles/@spinw/genlattice.m index a4dc97823..52360db08 100644 --- a/swfiles/@spinw/genlattice.m +++ b/swfiles/@spinw/genlattice.m @@ -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 + param.sym = []; +end if any(strcmp('angled', varargin(1:2:end))) && ... any(strcmp('angle', varargin(1:2:end))) warning('spinw:genlattice:WrongInput', ... @@ -293,4 +296,4 @@ obj.unit.nformula = int32(param.nformula); -end \ No newline at end of file +end diff --git a/tutorials/publish/tutorial4.m b/tutorials/publish/tutorial4.m index 3a693a3cf..75b9ebaef 100644 --- a/tutorials/publish/tutorial4.m +++ b/tutorials/publish/tutorial4.m @@ -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)