コード例 #1
0
ファイル: test_string_utils.py プロジェクト: ExpHP/pymatgen
    def test_disordered_formula(self):

        disordered_struct = Structure([[10, 0, 0], [0, 10, 0], [0, 0, 10]],
                                      [{'Cu': 0.25, 'Au': 0.75}],
                                      [[0, 0, 0]])

        formula_plain = disordered_formula(disordered_struct, fmt='plain')
        formula_latex = disordered_formula(disordered_struct, fmt='LaTeX')
        formula_html = disordered_formula(disordered_struct, fmt='HTML')

        self.assertEqual(formula_plain, 'CuxAu1-x x=0.25')
        self.assertEqual(formula_latex, 'Cu_{x}Au_{1-x} x=0.25')
        self.assertEqual(formula_html, 'Cu<sub>x</sub>Au<sub>1-x</sub> x=0.25')
コード例 #2
0
    def test_disordered_formula(self):

        disordered_struct = Structure([[10, 0, 0], [0, 10, 0], [0, 0, 10]],
                                      [{'Cu': 0.25, 'Au': 0.75}],
                                      [[0, 0, 0]])

        formula_plain = disordered_formula(disordered_struct, fmt='plain')
        formula_latex = disordered_formula(disordered_struct, fmt='LaTeX')
        formula_html = disordered_formula(disordered_struct, fmt='HTML')

        self.assertEqual(formula_plain, 'CuxAu1-x x=0.25')
        self.assertEqual(formula_latex, 'Cu_{x}Au_{1-x} x=0.25')
        self.assertEqual(formula_html, 'Cu<sub>x</sub>Au<sub>1-x</sub> x=0.25')
コード例 #3
0
ファイル: test_string.py プロジェクト: zooks97/pymatgen
    def test_disordered_formula(self):
        disordered_struct = Structure(
            [[10, 0, 0], [0, 10, 0], [0, 0, 10]],
            [{"Cu": 0.25, "Au": 0.75}],
            [[0, 0, 0]],
        )

        formula_plain = disordered_formula(disordered_struct, fmt="plain")
        formula_latex = disordered_formula(disordered_struct, fmt="LaTeX")
        formula_html = disordered_formula(disordered_struct, fmt="HTML")

        self.assertEqual(formula_plain, "CuxAu1-x x=0.25")
        self.assertEqual(formula_latex, "Cu_{x}Au_{1-x} x=0.25")
        self.assertEqual(formula_html, "Cu<sub>x</sub>Au<sub>1-x</sub> x=0.25")