def test_bond_histogram(self, p3ht_gsd): bonds_hist = bond_distribution( p3ht_gsd, "cc", "ss", start=0, stop=1, histogram=True ) bonds_no_hist = bond_distribution( p3ht_gsd, "cc", "ss", start=0, stop=1, histogram=False ) assert bonds_hist.ndim == 2 assert bonds_no_hist.ndim == 1
def test_bond_range_outside(self, p3ht_gsd): with pytest.warns(UserWarning): bonds_hist = bond_distribution(p3ht_gsd, "cc", "ss", start=0, stop=1, histogram=True, l_min=0.52, l_max=0.60)
def test_bond_dist_normalize(self, p3ht_gsd): bonds_hist = bond_distribution( p3ht_gsd, "cc", "ss", start=0, stop=1, histogram=True, normalize=True ) assert np.allclose(np.sum(bonds_hist[:,1]), 1, 1e-3)
def test_bond_distribution_range(self, p3ht_gsd): bonds = bond_distribution(p3ht_gsd, "cc", "ss", start=0, stop=1, l_min=0, l_max=1, histogram=True) assert np.allclose(bonds[0, 0], 0, atol=0.5) assert np.allclose(bonds[-1, 0], 1, atol=0.5)
def test_bond_not_found(self, p3ht_gsd): with pytest.raises(ValueError): bonds = bond_distribution(p3ht_gsd, "xx", "ss", start=0, stop=1)
def test_bond_distribution_order(self, p3ht_gsd): bonds = bond_distribution(p3ht_gsd, "cc", "ss", start=0, stop=1) bonds2 = bond_distribution(p3ht_gsd, "ss", "cc", start=0, stop=1) assert bonds.shape == bonds2.shape assert np.array_equal(bonds, bonds2)
def test_bond_distribution(self, p3ht_gsd): bonds = bond_distribution(p3ht_gsd, "cc", "ss", start=0, stop=1) for bond in bonds: print(bond) assert 0.45 < bond < 0.52