bobleesj / cifkit

High-throughput .cif analysis made easy. Visit: https://bobleesj.github.io/cifkit/
https://bobleesj.github.io/cifkit/
MIT License
11 stars 0 forks source link

Remove duplicate points for files with atomic mixing #9

Closed bobleesj closed 1 month ago

bobleesj commented 1 month ago

https://github.com/bobleesj/cifkit/issues/7 has been fixed

The following test has been added to ensure duplicate points are removed for .cif files with atomic mixing.

@pytest.mark.fast
def test_remove_duplicate_connections():
    connections = {
        "CoM1": [
            ("CoM1", 2.618, [-1.33, -0.768, 1.06], [-1.33, 0.768, -1.06]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [-2.66, -1.536, 3.18]),
            ("CoM1", 2.618, [-1.33, -0.768, 1.06], [-2.66, -1.536, 3.18]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [-2.66, -1.536, -1.06]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [0.0, -1.536, 3.18]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [-1.33, 0.768, 3.18]),
        ],
        "OsM2": [
            ("OsM2", 2.618, [1.33, -0.768, 1.06], [2.66, -1.536, 3.18]),
            ("CoM1", 2.618, [1.33, -0.768, 1.06], [1.33, 0.768, 3.18]),
            ("OsM2", 2.618, [1.33, -0.768, 1.06], [1.33, 0.768, -1.06]),
            ("OsM2", 2.618, [1.33, -0.768, 1.06], [0.0, -1.536, 3.18]),
            ("CoM1", 2.618, [1.33, -0.768, 1.06], [1.33, 0.768, -1.06]),
            ("CoM1", 2.618, [1.33, -0.768, 1.06], [2.66, -1.536, 3.18]),
        ],
    }

    assert remove_duplicate_connections(connections) == {
        "CoM1": [
            ("CoM1", 2.618, [-1.33, -0.768, 1.06], [-1.33, 0.768, -1.06]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [-2.66, -1.536, 3.18]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [-2.66, -1.536, -1.06]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [0.0, -1.536, 3.18]),
            ("OsM2", 2.618, [-1.33, -0.768, 1.06], [-1.33, 0.768, 3.18]),
        ],
        "OsM2": [
            ("OsM2", 2.618, [1.33, -0.768, 1.06], [2.66, -1.536, 3.18]),
            ("CoM1", 2.618, [1.33, -0.768, 1.06], [1.33, 0.768, 3.18]),
            ("OsM2", 2.618, [1.33, -0.768, 1.06], [1.33, 0.768, -1.06]),
            ("OsM2", 2.618, [1.33, -0.768, 1.06], [0.0, -1.536, 3.18]),
        ],
    }
bobleesj commented 1 month ago

261241_CoM1

Adding a polyhedron generated with atomic mixing.