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

Abins: Correct setting numerical zero for b_tensors. #18984

Merged
merged 9 commits into from Feb 27, 2017
2 changes: 1 addition & 1 deletion Testing/Data/SystemTest/BenzeneLargerOrderAbins.nxs.md5
@@ -1 +1 @@
c00f071587df0eb690c0626c7d50c6b7
36df84d9a0bcecc9d43350a474027f20
1 change: 1 addition & 0 deletions Testing/Data/SystemTest/BenzeneScale.nxs.md5
@@ -0,0 +1 @@
923d886b3cbad14bffa14c75782a5c50
2 changes: 1 addition & 1 deletion Testing/Data/SystemTest/BenzeneScratchAbins.nxs.md5
@@ -1 +1 @@
4b6c42f07033ded1f17f2d42008d3c64
91f709686e985858b7e6334e6356fefb
2 changes: 1 addition & 1 deletion Testing/Data/SystemTest/BenzeneSmallerOrderAbins.nxs.md5
@@ -1 +1 @@
4139453fd1081e415a364973e3779cca
1c5de7f7bd927680b4869112ae62dc03
2 changes: 1 addition & 1 deletion Testing/Data/SystemTest/BenzeneTAbins.nxs.md5
@@ -1 +1 @@
5970791a49af584310af004fb26d055c
036359f44df9beb793e5d7e267e96f15
2 changes: 1 addition & 1 deletion Testing/Data/SystemTest/Crystalb3lypScratchAbins.nxs.md5
@@ -1 +1 @@
30f46fc38d280d27f944d8a078699ec2
b9299d7d95aee7a583bfa5939a2247d7
@@ -1 +1 @@
c907ea22a74082b61c6f81192503ea15
3ecf242b5538fa3df2f6b443548120db
2 changes: 1 addition & 1 deletion Testing/Data/UnitTest/Si2-sc_CalculateSPowder_S.txt.md5
@@ -1 +1 @@
d7b15926be182560527f3266e625b379
c89208aab5f05dec2b1dc301acedc098
@@ -1 +1 @@
891f2c88d600bbdd69a2b7d5a1b5c872
769f015c42985496ee5218621b206602
@@ -1 +1 @@
c853db9391459be5161a4e57f318b900
94f9d94cc7344dd85a375de868086780
20 changes: 4 additions & 16 deletions Testing/SystemTests/tests/analysis/AbinsTest.py
Expand Up @@ -286,7 +286,7 @@ class AbinsCASTEPTestScale(stresstesting.MantidStressTest, HelperTestingClass):
In this benchmark it is tested if scaling is correct.
"""
_wrk_1 = None
_wrk_2 = None
_ref_result = None

def skipTests(self):
return skip_tests()
Expand All @@ -296,7 +296,8 @@ def runTest(self):

scaling_factor = 2.0

name = "BenzeneNoScale"
name = "BenzeneScale"
self.ref_result = name + ".nxs"
self.set_dft_program("CASTEP")
self.set_name(name)
self.set_order(AbinsConstants.QUANTUM_ORDER_TWO)
Expand All @@ -308,21 +309,8 @@ def runTest(self):
Operation='Multiply',
Factor=scaling_factor)

self._output_name = ""
name = "BenzeneScale"
self.set_dft_program("CASTEP")
self.set_name(name)
self.set_order(AbinsConstants.QUANTUM_ORDER_TWO)
self.set_scale(scaling_factor)
self.case_from_scratch()

self._wrk_2 = self._output_name

def validateMethod(self):
return "validateWorkspaceToWorkspace"

def validate(self):
return self._wrk_1, self._wrk_2
return self._output_name, self.ref_result

# ----------------------------------------------------------------------------------------------------------------
# Tests for 2D S
Expand Down
1 change: 1 addition & 0 deletions docs/source/release/v3.10.0/indirect_inelastic.rst
Expand Up @@ -33,5 +33,6 @@ Bugfixes
--------

- The *Diffraction* Interface no longer crashes when in OSIRIS diffonly mode
- *Abins*: fix setting very small off-diagonal elements of b tensors

`Full list of changes on GitHub <http://github.com/mantidproject/mantid/pulls?q=is%3Apr+milestone%3A%22Release+3.10%22+is%3Amerged+label%3A%22Component%3A+Indirect+Inelastic%22>`_
1 change: 1 addition & 0 deletions scripts/AbinsModules/AbinsConstants.py
Expand Up @@ -132,6 +132,7 @@
# values of S below that are considered to be zero
S_THRESHOLD = 10e-8
THRESHOLD = 10e-15
NUM_ZERO = 10e-15

MAX_ORDER = 4 # max quantum order event

Expand Down
5 changes: 3 additions & 2 deletions scripts/AbinsModules/CalculatePowder.py
Expand Up @@ -89,8 +89,9 @@ def _calculate_powder(self):
# b_tensors[num_atoms, num_freq, dim, dim]
b_tensors = np.einsum('ijkl,ij->ijkl', np.einsum('lki, lkj->lkij', disp, disp).real, factor)

indices = b_tensors < AbinsModules.AbinsConstants.THRESHOLD
b_tensors[indices] = AbinsModules.AbinsConstants.THRESHOLD
temp = np.fabs(b_tensors)
indices = temp < AbinsModules.AbinsConstants.NUM_ZERO
b_tensors[indices] = AbinsModules.AbinsConstants.NUM_ZERO

# a_tensors[num_atoms, dim, dim]
a_tensors = np.sum(a=b_tensors, axis=1)
Expand Down