当前位置: 首页>>代码示例>>Python>>正文


Python outputs.Outcar类代码示例

本文整理汇总了Python中pymatgen.io.vasp.outputs.Outcar的典型用法代码示例。如果您正苦于以下问题:Python Outcar类的具体用法?Python Outcar怎么用?Python Outcar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Outcar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_single_atom

    def test_single_atom(self):
        filepath = os.path.join(test_dir, "OUTCAR.Al")
        outcar = Outcar(filepath)
        expected_mag = ({"p": 0.0, "s": 0.0, "d": 0.0, "tot": 0.0},)
        expected_chg = ({"p": 0.343, "s": 0.425, "d": 0.0, "tot": 0.768},)

        self.assertAlmostEqual(outcar.magnetization, expected_mag)
        self.assertAlmostEqual(outcar.charge, expected_chg)
        self.assertFalse(outcar.is_stopped)
        self.assertEqual(
            outcar.run_stats,
            {
                "System time (sec)": 0.592,
                "Total CPU time used (sec)": 50.194,
                "Elapsed time (sec)": 52.337,
                "Maximum memory used (kb)": 62900.0,
                "Average memory used (kb)": 0.0,
                "User time (sec)": 49.602,
                "cores": "32",
            },
        )
        self.assertAlmostEqual(outcar.efermi, 8.0942)
        self.assertAlmostEqual(outcar.nelect, 3)
        self.assertAlmostEqual(outcar.total_mag, 8.2e-06)

        self.assertIsNotNone(outcar.as_dict())
开发者ID:shyamd,项目名称:pymatgen,代码行数:26,代码来源:test_outputs.py

示例2: test_read_fermi_contact_shift

 def test_read_fermi_contact_shift(self):
     filepath = os.path.join(test_dir, "OUTCAR_fc")
     outcar = Outcar(filepath)
     outcar.read_fermi_contact_shift()
     self.assertAlmostEqual(outcar.data["fermi_contact_shift"][u'fch'][0][0], -0.002)
     self.assertAlmostEqual(outcar.data["fermi_contact_shift"][u'th'][0][0], -0.052)
     self.assertAlmostEqual(outcar.data["fermi_contact_shift"][u'dh'][0][0], 0.0)
开发者ID:setten,项目名称:pymatgen,代码行数:7,代码来源:test_outputs.py

示例3: test_read_piezo_tensor

    def test_read_piezo_tensor(self):
        filepath = os.path.join(test_dir, "OUTCAR.lepsilon.gz")
        outcar = Outcar(filepath)

        outcar.read_piezo_tensor()
        self.assertAlmostEqual(outcar.data["piezo_tensor"][0][0], 0.52799)
        self.assertAlmostEqual(outcar.data["piezo_tensor"][1][3], 0.35998)
        self.assertAlmostEqual(outcar.data["piezo_tensor"][2][5], 0.35997)
开发者ID:adozier,项目名称:pymatgen,代码行数:8,代码来源:test_outputs.py

示例4: test_cs_core_contribution

 def test_cs_core_contribution(self):
     filename = os.path.join(test_dir, "nmr", "cs", "core.diff",
                             "core.diff.chemical.shifts.OUTCAR")
     outcar = Outcar(filename)
     core_contrib = outcar.read_cs_core_contribution()
     self.assertEqual(core_contrib,
                      {'Mg': -412.8248405,
                       'C': -200.5098812,
                       'O': -271.0766979})
开发者ID:bocklund,项目名称:pymatgen,代码行数:9,代码来源:test_outputs.py

示例5: test_cs_g0_contribution

 def test_cs_g0_contribution(self):
     filename = os.path.join(test_dir, "nmr", "cs", "core.diff",
                             "core.diff.chemical.shifts.OUTCAR")
     outcar = Outcar(filename)
     g0_contrib = outcar.read_cs_g0_contribution()
     self.assertEqual(g0_contrib,
                      [[-8.773535, 9e-06, 1e-06],
                       [1.7e-05, -8.773536, -0.0792],
                       [-6e-06, -0.008328, -9.320237]])
开发者ID:bocklund,项目名称:pymatgen,代码行数:9,代码来源:test_outputs.py

示例6: test_freq_dielectric

 def test_freq_dielectric(self):
     filepath = os.path.join(test_dir, "OUTCAR.LOPTICS")
     outcar = Outcar(filepath)
     outcar.read_freq_dielectric()
     self.assertAlmostEqual(outcar.frequencies[0], 0)
     self.assertAlmostEqual(outcar.frequencies[-1], 39.826101)
     self.assertAlmostEqual(outcar.dielectric_tensor_function[0][0, 0], 8.96938800)
     self.assertAlmostEqual(outcar.dielectric_tensor_function[-1][0, 0], 7.36167000e-01 +1.53800000e-03j)
     self.assertEqual(len(outcar.frequencies), len(outcar.dielectric_tensor_function))
开发者ID:zulissi,项目名称:pymatgen,代码行数:9,代码来源:test_outputs.py

示例7: test_read_elastic_tensor

    def test_read_elastic_tensor(self):
        filepath = os.path.join(test_dir, "OUTCAR.total_tensor.Li2O.gz")
        outcar = Outcar(filepath)

        outcar.read_elastic_tensor()

        self.assertAlmostEqual(outcar.data["elastic_tensor"][0][0], 1986.3391)
        self.assertAlmostEqual(outcar.data["elastic_tensor"][0][1], 187.8324)
        self.assertAlmostEqual(outcar.data["elastic_tensor"][3][3], 586.3034)
开发者ID:adozier,项目名称:pymatgen,代码行数:9,代码来源:test_outputs.py

示例8: test_freq_dielectric_vasp544

 def test_freq_dielectric_vasp544(self):
     filepath = os.path.join(test_dir, "OUTCAR.LOPTICS.vasp544")
     outcar = Outcar(filepath)
     outcar.read_freq_dielectric()
     self.assertAlmostEqual(outcar.frequencies[0], 0)
     self.assertAlmostEqual(outcar.frequencies[-1], 39.63964)
     self.assertAlmostEqual(outcar.dielectric_tensor_function[0][0, 0], 12.769435+0j)
     self.assertAlmostEqual(outcar.dielectric_tensor_function[-1][0, 0], 0.828615+0.016594j)
     self.assertEqual(len(outcar.frequencies), len(outcar.dielectric_tensor_function))
     np.testing.assert_array_equal( outcar.dielectric_tensor_function[0], outcar.dielectric_tensor_function[0].transpose())
开发者ID:bocklund,项目名称:pymatgen,代码行数:10,代码来源:test_outputs.py

示例9: test_chemical_shifts_with_different_core_contribution

 def test_chemical_shifts_with_different_core_contribution(self):
     filename = os.path.join(test_dir, "nmr", "cs", "core.diff", "core.diff.chemical.shifts.OUTCAR")
     outcar = Outcar(filename)
     outcar.read_chemical_shifts()
     c_vo = outcar.data["chemical_shifts"]["valence_only"][7].maryland_values
     for x1, x2 in zip(list(c_vo), [198.7009, 73.7484, 1.0000]):
         self.assertAlmostEqual(x1, x2)
     c_vc = outcar.data["chemical_shifts"]["valence_and_core"][7].maryland_values
     for x1, x2 in zip(list(c_vc), [-1.9406, 73.7484, 1.0000]):
         self.assertAlmostEqual(x1, x2)
开发者ID:shyamd,项目名称:pymatgen,代码行数:10,代码来源:test_outputs.py

示例10: test_cs_raw_tensors

 def test_cs_raw_tensors(self):
     filename = os.path.join(test_dir, "nmr", "cs", "core.diff",
                             "core.diff.chemical.shifts.OUTCAR")
     outcar = Outcar(filename)
     unsym_tensors = outcar.read_cs_raw_symmetrized_tensors()
     self.assertEqual(unsym_tensors[0],
                      [[-145.814605, -4.263425, 0.000301],
                       [4.263434, -145.812238, -8.7e-05],
                       [0.000136, -0.000189, -142.794068]])
     self.assertEqual(unsym_tensors[29],
                      [[287.789318, -53.799325, 30.900024],
                       [-53.799571, 225.668117, -17.839598],
                       [3.801103, -2.195218, 88.896756]])
开发者ID:bocklund,项目名称:pymatgen,代码行数:13,代码来源:test_outputs.py

示例11: test_nmr_efg

 def test_nmr_efg(self):
     filename = os.path.join(test_dir, "nmr", "efg", "AlPO4", "OUTCAR")
     outcar = Outcar(filename)
     outcar.read_nmr_efg()
     expected_efg = [{'eta': 0.465, 'nuclear_quadrupole_moment': 146.6, 'cq': -5.573},
                     {'eta': 0.465, 'nuclear_quadrupole_moment': 146.6, 'cq': -5.573},
                     {'eta': 0.137, 'nuclear_quadrupole_moment': 146.6, 'cq': 6.327},
                     {'eta': 0.137, 'nuclear_quadrupole_moment': 146.6, 'cq': 6.327},
                     {'eta': 0.112, 'nuclear_quadrupole_moment': 146.6, 'cq': -7.453},
                     {'eta': 0.112, 'nuclear_quadrupole_moment': 146.6, 'cq': -7.453},
                     {'eta': 0.42, 'nuclear_quadrupole_moment': 146.6, 'cq': -5.58},
                     {'eta': 0.42, 'nuclear_quadrupole_moment': 146.6, 'cq': -5.58}]
     self.assertEqual(len(outcar.data["efg"][2:10]), len(expected_efg))
     for e1, e2 in zip(outcar.data["efg"][2:10], expected_efg):
         for k in e1.keys():
             self.assertAlmostEqual(e1[k], e2[k], places=5)
开发者ID:adozier,项目名称:pymatgen,代码行数:16,代码来源:test_outputs.py

示例12: test_chemical_shifts

 def test_chemical_shifts(self):
     filename = os.path.join(test_dir, "nmr_chemical_shift", "hydromagnesite", "OUTCAR")
     outcar = Outcar(filename)
     expected_chemical_shifts = [[191.9974, 69.5232, 0.6342],
                                 [195.0808, 68.183, 0.833],
                                 [192.0389, 69.5762, 0.6329],
                                 [195.0844, 68.1756, 0.8336],
                                 [192.005, 69.5289, 0.6339],
                                 [195.0913, 68.1859, 0.833],
                                 [192.0237, 69.565, 0.6333],
                                 [195.0788, 68.1733, 0.8337]]
     self.assertAlmostEqual(len(outcar.chemical_shifts[20: 28]), len(expected_chemical_shifts))
     for c1, c2 in zip(outcar.chemical_shifts[20: 28], expected_chemical_shifts):
         for x1, x2 in zip(list(c1.maryland_values), c2):
             self.assertAlmostEqual(x1, x2, places=5)
     d1 = outcar.as_dict()
     self.assertIn("chemical_shifts", d1)
开发者ID:Rongpeng,项目名称:pymatgen,代码行数:17,代码来源:test_outputs.py

示例13: forces_from_outcar

def forces_from_outcar( filename='OUTCAR' ):
    """Finds and returns forces from the OUTCAR file.
      
    Args:
        filename (:obj:'str', optional): the name of the ``OUTCAR`` file to be read. Default is `OUTCAR`.

    Returns:
        (np.array): The force as found in the ``OUTCAR`` file, as a NSTEPS x NIONS x 3 numpy array.

    """
    outcar = Outcar("OUTCAR")
    forces = outcar.read_table_pattern(
        header_pattern=r"\sPOSITION\s+TOTAL-FORCE \(eV/Angst\)\n\s-+",
        row_pattern=r"\s+[+-]?\d+\.\d+\s+[+-]?\d+\.\d+\s+[+-]?\d+\.\d+\s+([+-]?\d+\.\d+)\s+([+-]?\d+\.\d+)\s+([+-]?\d+\.\d+)",
        footer_pattern=r"\s--+",
        postprocess=lambda x: float(x),
        last_one_only=False
    )
    return np.array( forces )
开发者ID:bjmorgan,项目名称:vasppy,代码行数:19,代码来源:outcar.py

示例14: test_single_atom

    def test_single_atom(self):
        filepath = os.path.join(test_dir, "OUTCAR.Al")
        outcar = Outcar(filepath)
        expected_mag = ({u'p': 0.0, u's': 0.0, u'd': 0.0, u'tot': 0.0},)
        expected_chg = ({u'p': 0.343, u's': 0.425, u'd': 0.0, u'tot': 0.768},)

        self.assertAlmostEqual(outcar.magnetization, expected_mag)
        self.assertAlmostEqual(outcar.charge, expected_chg)
        self.assertFalse(outcar.is_stopped)
        self.assertEqual(outcar.run_stats, {'System time (sec)': 0.592,
                                            'Total CPU time used (sec)': 50.194,
                                            'Elapsed time (sec)': 52.337,
                                            'Maximum memory used (kb)': 62900.0,
                                            'Average memory used (kb)': 0.0,
                                            'User time (sec)': 49.602,
                                            'cores': '32'})
        self.assertAlmostEqual(outcar.efermi, 8.0942)
        self.assertAlmostEqual(outcar.nelect, 3)
        self.assertAlmostEqual(outcar.total_mag, 8.2e-06)

        self.assertIsNotNone(outcar.as_dict())
开发者ID:adozier,项目名称:pymatgen,代码行数:21,代码来源:test_outputs.py

示例15: test_dielectric

 def test_dielectric(self):
     filepath = os.path.join(test_dir, "OUTCAR.dielectric")
     outcar = Outcar(filepath)
     outcar.read_corrections()
     self.assertAlmostEqual(outcar.data["dipol_quadrupol_correction"], 0.03565)
     self.assertAlmostEqual(outcar.final_energy, -797.46760559)
开发者ID:adozier,项目名称:pymatgen,代码行数:6,代码来源:test_outputs.py


注:本文中的pymatgen.io.vasp.outputs.Outcar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。