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

Test sw_egrid #130

Merged
merged 36 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8061554
Add initial test file
rebeccafair Jan 17, 2023
6d7df21
Add Sxx etc tests
rebeccafair Feb 14, 2023
026248f
Add polarisation tests
rebeccafair Feb 14, 2023
2c99f9b
Add Evect tests
rebeccafair Feb 24, 2023
749fff2
Add temperature test
rebeccafair Feb 24, 2023
3be94df
Add fName test
rebeccafair Feb 24, 2023
4473919
Add twin tests
rebeccafair Feb 24, 2023
b3cd184
Add test for cell array of components
RichardWaiteSTFC Mar 10, 2023
cd588d4
Add test for imagChk parameter
RichardWaiteSTFC Mar 10, 2023
9e262be
Fix bug where epsilon was overwritten
RichardWaiteSTFC Mar 10, 2023
f3e3a7e
Fix bug in sw_egrid test for imagChk
RichardWaiteSTFC Mar 10, 2023
bf8d40b
Fix bug causing out-by-one binning of eigvals onto energy grid
RichardWaiteSTFC Mar 13, 2023
20f9833
Add test for irregular bins (now gives same result)
RichardWaiteSTFC Mar 13, 2023
3f8c1f9
Add test for autoEmin
RichardWaiteSTFC Mar 13, 2023
d4a6e09
Add test for modeIdx
RichardWaiteSTFC Mar 13, 2023
d4dc060
Fix incomm/comm consistency systems test (WIP)
RichardWaiteSTFC Mar 24, 2023
da78445
Merge branch 'master' into 72_test_sw_egrid
RichardWaiteSTFC Apr 20, 2023
d7a4241
Do not include strucutre factor at zero eigenvalue
RichardWaiteSTFC Apr 21, 2023
ac36a88
Update system test data post removing 0 eigenvalues from struct. fact
RichardWaiteSTFC Apr 21, 2023
d72569f
Fix size mismatch bug if modeIDx supplied post neglect zero eigvals
RichardWaiteSTFC Apr 21, 2023
be643bd
Increase tolerance on eigvals = 0 (for which DSF to be neglected)
RichardWaiteSTFC Apr 21, 2023
ffd3570
Add threshold parameter to remove zero-energy modes
RichardWaiteSTFC Apr 24, 2023
270cf34
Increase tolerance on ghost mdoe identification AFM kagome
RichardWaiteSTFC Apr 24, 2023
a23c6c7
Add unit test for ZeroModeThreshold
RichardWaiteSTFC Apr 24, 2023
b11f738
Update test data post zero mode check
RichardWaiteSTFC Apr 27, 2023
6ab62b3
Merge branch 'master' into 72_test_sw_egrid
RichardWaiteSTFC Jun 7, 2023
88b814a
Update system test data for biquad, KCu3As2O7 and afm kagome
RichardWaiteSTFC Jun 9, 2023
8086fab
Use tol on magnitude of all eigvals to ignore (not just zero modes)
RichardWaiteSTFC Jun 21, 2023
bac3ca2
Deprecate epsilon parameter
RichardWaiteSTFC Jun 21, 2023
4a0ceb6
Remove epsilon from autoEmin check
RichardWaiteSTFC Jun 21, 2023
8781427
Update system test reference data
RichardWaiteSTFC Jun 21, 2023
40fbc1d
Increase zeroEnergyTol in incom vs supercell test
RichardWaiteSTFC Jun 21, 2023
14d5cf6
Fix bug in half polarise calc reshaping intP
RichardWaiteSTFC Jul 6, 2023
243b1f0
Update fname test
RichardWaiteSTFC Jul 6, 2023
373d0ff
Move autoEmin check to occur only if imgChk true
RichardWaiteSTFC Jul 6, 2023
e1186b5
Add parameter to zero DSF above a given limit (maxDSF)
RichardWaiteSTFC Jul 6, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
reference_data_file = [];
tol = 1e-5;
end
methods
function om = remove_ghosts(testCase, spec)
om = spec.omega(find(abs(spec.Sperp) > testCase.tol));
om = sort(unique(round(om / testCase.tol) * testCase.tol));
methods (Static)
function om = remove_ghosts(spec, tol)
om = spec.omega(find(abs(spec.Sperp) > tol));
om = sort(unique(round(om / tol) * tol));
end

end
methods
function assert_super_and_incom_consistency(testCase, swobj, ...
spec_super, spec_incom)
spec_super, spec_incom, ...
ghost_tol)
if nargin < 5
ghost_tol = testCase.tol;
end
% test cross-section in q,En bins
testCase.verify_test_data(spec_incom.swConv, ...
spec_super.swConv)
Expand All @@ -22,8 +27,8 @@ function assert_super_and_incom_consistency(testCase, swobj, ...
6*n_matom);
testCase.assertEqual(size(spec_super.Sperp, 1), ...
2*prod(nExt)*n_matom);
testCase.assertEqual(testCase.remove_ghosts(spec_super),...
testCase.remove_ghosts(spec_incom));
testCase.assertEqual(testCase.remove_ghosts(spec_super, ghost_tol), ...
testCase.remove_ghosts(spec_incom, ghost_tol));
end
end

Expand All @@ -35,31 +40,33 @@ function test_AFM_kagome(testCase)
'angled',[90 90 120], 'sym','P -3')
AF33kagome.addatom('r',[1/2 0 0],'S', 1, 'label','MCu1')
AF33kagome.gencoupling('maxDistance',7);
AF33kagome.addmatrix('label','J1','value',1.00)
AF33kagome.addmatrix('label','J1','value',1)
AF33kagome.addcoupling('mat','J1','bond',1);
% sqrt3 x sqrt(3) magnetic structure
k = [-1/3 -1/3 0];
n = [0, 0, 1];
S = [0 0 -1; 1 1 -1; 0 0 0];
% binning for spinwave spectrum
qarg = {[-1/2 0 0] [0 0 0] [1/2 1/2 0] 3};
evec = 0:0.5:2;
qarg = {[-1/2 0 0] [0 0 0] [1/2 1/2 0] 50};
evec = 0:0.1:1.5;

% use structural unit cell with incommensurate k
AF33kagome.genmagstr('mode','helical','unit','lu', 'k', k,...
'n',n, 'S', S, 'nExt',[1 1 1]);
testCase.disable_warnings('spinw:spinwave:NonPosDefHamiltonian');
spec_incom = AF33kagome.spinwave(qarg, 'hermit', true);
spec_incom = sw_egrid(spec_incom, 'component','Sperp', 'Evect',evec);
spec_incom = sw_egrid(spec_incom, 'component','Sperp', 'Evect', evec, ...
'zeroEnergyTol', 1e-2);
% use supercell k=0 structure
AF33kagome.genmagstr('mode','helical','unit','lu', 'k', k,...
'n',n, 'S', S, 'nExt', [3,3,1]);

spec_super = AF33kagome.spinwave(qarg, 'hermit', true);
spec_super = sw_egrid(spec_super, 'component','Sperp', 'Evect',evec);
spec_super = sw_egrid(spec_super, 'component','Sperp', 'Evect', evec);

testCase.assert_super_and_incom_consistency(AF33kagome, ...
spec_super, ...
spec_incom);
spec_incom, 5e-2);
end

function test_two_matom_per_unit_cell(testCase)
Expand All @@ -81,8 +88,8 @@ function test_two_matom_per_unit_cell(testCase)
k = [1/2, 0, 0];
S = [0 0;1 1;0 0];
% binning for spinwave spectrum
qarg = {[0 0 0] [1/2 0 0] 5};
evec = 0:1.5:5;
qarg = {[0 0 0] [0, 0.5, 0] 5};
evec = 0:0.5:5;

% use structural unit cell with incommensurate k
testCase.disable_warnings('spinw:spinwave:NonPosDefHamiltonian', ...
Expand Down
Loading