From 1ef8c07ba75fe01e47030a30be01db4d696a0e97 Mon Sep 17 00:00:00 2001 From: Frederik Date: Mon, 16 Oct 2023 15:10:38 +0200 Subject: [PATCH] Fixed issue with rthres masks in I(Q) calc. --- debyecalculator/debye_calculator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debyecalculator/debye_calculator.py b/debyecalculator/debye_calculator.py index ee6915e..37659ff 100644 --- a/debyecalculator/debye_calculator.py +++ b/debyecalculator/debye_calculator.py @@ -335,7 +335,7 @@ def iq( occ_product = self.struc_occupancy[i][idx[0]] * self.struc_occupancy[i][idx[1]] sinc = torch.sinc(d[mask] * self.q / torch.pi) ffp = self.struc_unique_form_factors[i][inv_idx[0]] * self.struc_unique_form_factors[i][inv_idx[1]] - iq += torch.sum(occ_product.unsqueeze(-1) * ffp * sinc.permute(1,0), dim=0) + iq += torch.sum(occ_product.unsqueeze(-1)[mask] * ffp[mask] * sinc.permute(1,0), dim=0) # Apply Debye-Weller Isotropic Atomic Displacement if self.biso != 0.0: @@ -542,7 +542,7 @@ def _get_all( occ_product = self.struc_occupancy[i][idx[0]] * self.struc_occupancy[i][idx[1]] sinc = torch.sinc(d[mask] * self.q / torch.pi) ffp = self.struc_unique_form_factors[i][inv_idx[0]] * self.struc_unique_form_factors[i][inv_idx[1]] - iq += torch.sum(occ_product.unsqueeze(-1) * ffp * sinc.permute(1,0), dim=0) + iq += torch.sum(occ_product.unsqueeze(-1)[mask] * ffp[mask] * sinc.permute(1,0), dim=0) # Apply Debye-Weller Isotropic Atomic Displacement if self.biso != 0.0: