From fa2b57dcd965bcd0b51a69ac7fb16ba26d703881 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Fri, 30 Jan 2026 17:02:33 +0000 Subject: [PATCH] update-dipolar-distance (#320) Change dipolar distances to nm to make minimization possible Reviewed-on: https://gitea.pkm.physik.tu-darmstadt.de/IPKM/nmreval/pulls/320 Co-authored-by: Dominik Demuth Co-committed-by: Dominik Demuth --- src/nmreval/nmr/coupling.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nmreval/nmr/coupling.py b/src/nmreval/nmr/coupling.py index b3534dc..552d8b9 100644 --- a/src/nmreval/nmr/coupling.py +++ b/src/nmreval/nmr/coupling.py @@ -106,7 +106,7 @@ class HomoDipolar(Coupling): name = 'Homonuclear Dipolar' parameter = ['r'] - unit = ['m'] + unit = ['nm'] choice = [ (r'\gamma', 'nucleus', {k: k for k in gamma}), ('Spin', 'spin', OrderedDict([('1/2', 0.5), ('1', 1), ('3/2', 1.5), ('2', 2), ('5/2', 2.5), ('3', 3)])), @@ -128,7 +128,7 @@ class HomoDipolar(Coupling): raise KeyError(f'Unknown nucleus {nucleus}') try: - coupling = mu0 / (4*pi) * hbar_joule * gamma_full[nucleus]**2 / (r+1e-34)**3 + coupling = mu0 / (4*pi) * hbar_joule * gamma_full[nucleus]**2 / ((r*1e-9) + 1e-34)**3 except ZeroDivisionError: return 1e318 @@ -143,7 +143,7 @@ class HeteroDipolar(Coupling): name = 'Heteronuclear Dipolar' parameter = ['r'] - unit = ['m'] + unit = ['nm'] choice = [ (r'\gamma_{1}', 'nucleus1', {k: k for k in gamma}), (r'\gamma_{2}', 'nucleus2', {k: k for k in gamma}), @@ -172,7 +172,7 @@ class HeteroDipolar(Coupling): raise KeyError(f'Unknown nucleus {nucleus2}') try: - coupling = mu0 / (4*pi) * hbar_joule * gamma_full[nucleus1]*gamma_full[nucleus2] / r**3 + coupling = mu0 / (4*pi) * hbar_joule * gamma_full[nucleus1]*gamma_full[nucleus2] / ((r*1e-9) + 1e-34)**3 except ZeroDivisionError: return 1e318