14
14
zed % The u vector in eq (9) of Toth & Lake
15
15
SI % A struct with single-ion (SI) properties
16
16
RR % A 3 x nMagExt matrix with positions of the spins/atoms
17
+ orthWarn = false % Flag if orthogonal warning is triggered
18
+ posdefWarn = false % Flag if positive-definite warning triggered
17
19
end
18
20
19
21
methods (Access = public )
34
36
Vsave_twin = cell(1 ,nTwins );
35
37
Sabp_twin = cell(1 ,nTwins );
36
38
omegap_twin = cell(1 ,nTwins );
39
+ if self .magnetic_structure .incomm
40
+ k_incomm_vec = [-self .magnetic_structure .km ' , zeros(3 ,1 ), self .magnetic_structure .km ' ];
41
+ calc_type = ' INCOMMENSURATE' ;
42
+ else
43
+ k_incomm_vec = zeros(3 ,1 );
44
+ calc_type = ' COMMENSURATE' ;
45
+ end
46
+ fprintf0(self .parameters .fid ,[' Calculating %s spin wave spectra ' ...
47
+ ' (nMagExt = %d , nHkl = %d , nTwin = %d )...\n ' ], calc_type , ...
48
+ self .magnetic_structure .nMagExt , self .qvectors .nHkl , nTwins );
37
49
% Gets the transformation matrices for the hkl for each twin
38
50
[~ , rotQ ] = self .spinWaveObject .twinq([0 ;0;0]);
39
51
for iTwin = 1 : nTwins
40
52
rotC = self .spinWaveObject .twin .rotc(: ,: ,iTwin );
41
53
% Incommensurate loop
42
- if self .magnetic_structure .incomm
43
- k_incomm_vec = [-self .magnetic_structure .km ' , zeros(3 ,1 ), self .magnetic_structure .km ' ];
44
- else
45
- k_incomm_vec = zeros(3 ,1 );
46
- end
47
54
sz_incomm = size(k_incomm_vec ,2 );
48
55
Hsave = cell(1 , sz_incomm );
49
56
Vsave = cell(1 , sz_incomm );
116
123
end
117
124
end
118
125
end
126
+ if self .posdefWarn && ~self .parameters .fitmode
127
+ warning(' spinw:spinwave:NonPosDefHamiltonian' ,[' To make the Hamiltonian ' ...
128
+ ' positive definite, a small omega_tol value was added to its diagonal!' ])
129
+ end
130
+ % issue eigorth warning
131
+ if self .orthWarn
132
+ warning(' spinw:spinwave:NoOrth' ,' Eigenvectors of defective eigenvalues cannot be orthogonalised at some q-point!' );
133
+ end
119
134
% If number of formula units are given per cell normalize to formula unit
120
135
if self .spinWaveObject .unit .nformula > 0
121
136
Sab = Sab / double(self .spinWaveObject .unit .nformula );
@@ -295,12 +310,10 @@ function prepareHamiltonian(self)
295
310
bqAtom2 = SS .all(5 , bq );
296
311
bqJJ = SS .all(6 , bq );
297
312
self.bq_hamiltonian = sw_classes .biquadratic_hamiltonian(bqJJ , bqdR , bqAtom1 , bqAtom2 , self .zed , self .eta , S_mag );
313
+ % Remove the biquadratic interactions for subsequent calculations
298
314
SS.all = SS .all(1 : 14 ,SS .all(15 ,: )==0 );
299
315
end
300
316
301
- % fprintf0(fid,['Calculating COMMENSURATE spin wave spectra '...
302
- % '(nMagExt = %d, nHkl = %d, nTwin = %d)...\n'],nMagExt, nHkl0, nTwin);
303
-
304
317
dR = [SS .all(1 : 3 ,: ) zeros(3 ,nMagExt )];
305
318
atom1 = [SS .all(4 ,: ) 1 : nMagExt ];
306
319
atom2 = [SS .all(5 ,: ) 1 : nMagExt ];
@@ -363,7 +376,7 @@ function prepareHamiltonian(self)
363
376
if self .parameters .hermit
364
377
% All the matrix calculations are according to Colpa's paper
365
378
% J.H.P. Colpa, Physica 93A (1978) 327-353
366
- [V , omega ] = spinwave_hermit(ham , self .parameters , nMagExt );
379
+ [V , omega , self . posdefWarn ] = spinwave_hermit(ham , self .parameters , nMagExt );
367
380
368
381
else
369
382
% All the matrix calculations are according to White's paper
@@ -377,9 +390,9 @@ function prepareHamiltonian(self)
377
390
378
391
gham = mmat(gComm ,ham );
379
392
380
- [V , omega , orthWarn ] = eigorth(gham , self .parameters .omega_tol , self .parameters .useMex );
393
+ [V , omega , orthWarn1 ] = eigorth(gham , self .parameters .omega_tol , self .parameters .useMex );
381
394
382
- % orthWarn0 = orthWarn || orthWarn0 ;
395
+ self.orthWarn = orthWarn1 || self . orthWarn ;
383
396
384
397
for ii = 1 : size(omega , 2 )
385
398
% multiplication with g removed to get negative and positive
@@ -420,7 +433,6 @@ function prepareHamiltonian(self)
420
433
% calculate magnetic structure factor using the hklExt0 Q-values
421
434
% since the S(Q+/-k,omega) correlation functions also belong to the
422
435
% F(Q)^2 form factor
423
-
424
436
if self .parameters .formfact
425
437
% include the form factor in the z^alpha, z^beta matrices
426
438
zeda = zeda .* repmat(permute(self .parameters .FF ,[3 4 5 1 2 ]),[3 3 2 * nMagExt 2 1 ]);
@@ -448,7 +460,8 @@ function prepareHamiltonian(self)
448
460
end
449
461
450
462
451
- function [V , omega ] = spinwave_hermit(ham , param , nMagExt )
463
+ function [V , omega , warn1 ] = spinwave_hermit(ham , param , nMagExt )
464
+ warn1 = false ;
452
465
nHklMEM = size(ham , 3 );
453
466
454
467
% diagonal of the boson commutator matrix
0 commit comments