Esempio n. 1
0
def test_pwscf_crystal_instance(file, expected_spg):
    """Test the construction of Crystal instances, and check against expected symmetry properties"""

    parser = PWSCFParser(file)
    crystal = Crystal.from_pwscf(file)

    # COmparison of lattice vectors
    assert np.allclose(
        np.array(crystal.lattice_vectors),
        np.array(parser.lattice_vectors()),
    )

    # Comparison requires slighly relaxed precision
    assert crystal.symmetry(
        symprec=1e-1)["international_number"] == expected_spg
Esempio n. 2
0
    def test_crystal_instance(self):
        """ Test the construction of Crystal instances, and check against expected symmetry properties """

        for parser, expected_spg in zip(
            (self.parser_tise2, self.parser_snse, self.parser_graphite),
            (164, 62, 194)):
            with self.subTest(parser.filename):
                crystal = Crystal.from_pwscf(parser.filename)

                # COmparison of lattice vectors
                self.assertTrue(
                    np.allclose(
                        np.array(crystal.lattice_vectors),
                        np.array(parser.lattice_vectors()),
                    ))

                # Comparison requires slighly relaxed precision
                self.assertEqual(
                    crystal.symmetry(symprec=1e-1)["international_number"],
                    expected_spg)