예제 #1
0
def test_electron_shells_start_fail(nelectrons):
    with pytest.raises(RuntimeError, match=r'Electrons cover a partial shell'):
        lut.electron_shells_start(nelectrons)
    with pytest.raises(RuntimeError, match=r'negative number of electrons'):
        lut.electron_shells_start(-nelectrons)
    with pytest.raises(NotImplementedError, match=r'Too many electrons'):
        lut.electron_shells_start(nelectrons + 120)
예제 #2
0
def test_stored_nelec_start_slow(basis_name):
    bs_data = api.get_basis(basis_name) 

    for el in bs_data['elements'].values():
        if not 'ecp_electrons' in el:
            continue

        ecp_electrons = el['ecp_electrons']
        starting_shells = lut.electron_shells_start(ecp_electrons, 8)

        # Make sure the number of covered electrons matches
        nelec_sum = 0 
        for am,count in enumerate(starting_shells):
            # How many shells of AM are covered by the ECP
            covered = count - 1

            # Adjust for the principal quantum number where the shells for the AM start
            # (ie, p start at 2, d start at 3)
            covered -= am

            # Number of orbs = 2*am+1. Multiply by 2 to get electrons
            nelec_sum += (2*am+1)*2*covered

        assert nelec_sum == ecp_electrons
예제 #3
0
def test_electron_shells_start(nelectrons, expected):
    assert expected == lut.electron_shells_start(nelectrons, 3)
    expected.extend([5, 6, 7, 8, 9])
    assert expected == lut.electron_shells_start(nelectrons, 8)