예제 #1
0
def test__dist_analysis():
    """ test geom.coulomb_spectrum
    """
    ref_coul_spec = (0.23373850982000086, 0.26771181015927226,
                     21.472418990888897, 38.92412503488664, 104.1418603738336,
                     456.00384141400343)

    assert numpy.allclose(geom.coulomb_spectrum(C2H2CLF_GEO), ref_coul_spec)

    for _ in range(10):
        axis = numpy.random.rand(3)
        angle = numpy.random.rand()
        geo = geom.rotate(C2H2CLF_GEO, axis, angle)
        assert numpy.allclose(geom.coulomb_spectrum(geo), ref_coul_spec)

    ref_dist_mat = ((0.0000000, 2.5616993, 4.3547794, 6.6877445, 3.9644122,
                     4.7627773), (2.5616993, 0.0000000, 2.4806333, 4.3481308,
                                  2.0452679, 3.8991098),
                    (4.3547794, 2.4806333, 0.0000000, 2.5392899, 3.9684476,
                     2.0228115), (6.6877445, 4.3481308, 2.5392899, 0.0000000,
                                  4.8648485, 3.9664779),
                    (3.9644122, 2.0452679, 3.9684476, 4.8648485, 0.0000000,
                     5.7501111), (4.7627773, 3.8991098, 2.0228115, 3.9664779,
                                  5.7501111, 0.0000000))
    assert numpy.allclose(geom.distance_matrix(geo), ref_dist_mat)
예제 #2
0
def test__coulomb_spectrum():
    """ test geom.coulomb_spectrum
    """
    ref_coul_spec = (0.23373850982000086, 0.26771181015927226,
                     21.472418990888897, 38.92412503488664, 104.1418603738336,
                     456.00384141400343)

    assert numpy.allclose(geom.coulomb_spectrum(C2H2CLF_GEO), ref_coul_spec)

    for _ in range(10):
        axis = numpy.random.rand(3)
        angle = numpy.random.rand()
        geo = geom.rotate(C2H2CLF_GEO, axis, angle)
        assert numpy.allclose(geom.coulomb_spectrum(geo), ref_coul_spec)
예제 #3
0
def test__argunique_coulomb_spectrum():
    """ test geom.argunique_coulomb_spectrum
    """
    ref_idxs = (0, 3, 5, 8)

    geo = C2H2CLF_GEO
    natms = len(geom.symbols(geo))

    geos = []
    for idx in range(10):
        axis = numpy.random.rand(3)
        angle = numpy.random.rand()
        geo = geom.rotate(geo, axis, angle)

        if idx in ref_idxs and idx != 0:
            idx_to_change = numpy.random.randint(0, natms)
            new_xyz = numpy.random.rand(3)
            geo = geom.set_coordinates(geo, {idx_to_change: new_xyz})

        geos.append(geo)

    idxs = geom.argunique_coulomb_spectrum(geos)
    assert idxs == ref_idxs