<commit_before>from __future__ import print_function
import mdtraj as md
from mdtraj.testing import get_fn
from mdtraj import nmr

def test_1():
    t = md.load(get_fn('2EQQ.pdb'))
    result = nmr.chemical_shifts_spartaplus(t)

    print(result)<commit_msg>Added tests for scalar couplings.<commit_after>from __future__ import print_function
import mdtraj as md
from mdtraj.testing import get_fn, eq, DocStringFormatTester, skipif
from mdtraj import nmr

def test_1():
    t = md.load(get_fn('2EQQ.pdb'))
    result = nmr.chemical_shifts_spartaplus(t)

    print(result)

def test_2_scalar_couplings():
    t = md.load(get_fn('frame0.h5'))  # This is Alanine dipeptide
    for model in ["Ruterjans1999", "Bax2007", "Bax1997"]:
        indices, J = md.J3_HN_HA_from_trajectory(t)
        eq(indices.shape, (1, 4))
        eq(J.shape, (501, 1))
        J = J.mean()
        assert abs(J - 6.06) <= 2.0, "Value is far from experimental value."
        # 6.06 [Hz] is the value from Baldwin PNAS 2006 Table 1.  
        # We expect the models to give something comparable to this
        # If it doesn't, something is fishy.
        # Typical ranges are between 1 and 9.
        # Obviously this isn't a perfect test, but it's still a useful sanity check.


def test_3_scalar_couplings():
    t = md.load(get_fn('1bpi.pdb'))
    for model in ["Ruterjans1999", "Bax2007", "Bax1997"]:
        indices, J = md.J3_HN_HA_from_trajectory(t)
{'fraction_non_alphanumeric': 0.10552061495457722, 'fraction_numerical': 0.039133473095737246, 'mean_word_length': 3.3525835866261398, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4704737', 'n_tokens_mistral': 555, 'n_tokens_neox': 494, 'n_words': 147}