예제 #1
0
 def test_get_header(self):
     comment = 'From cif file'
     header = str(FeffInputSet.get_header(x, structure, 'CoO19128.cif',
                                          comment))
     self.maxDiff = 1000
     self.assertEqual(FeffInputSetTest.header_string.splitlines(),
                      header.splitlines())
예제 #2
0
 def test_get_header(self):
     comment = 'From cif file'
     header = str(
         FeffInputSet.get_header(x, structure, 'CoO19128.cif', comment))
     self.maxDiff = 1000
     self.assertEqual(FeffInputSetTest.header_string.splitlines(),
                      header.splitlines())
예제 #3
0
    def test_get_header(self):
        comment = 'From cif file'
        header = str(FeffInputSet.get_header(x, structure, 'CoO19128.cif',
                                             comment))

        ref = FeffInputSetTest.header_string.splitlines()
        last4 = [" ".join(l.split()[2:]) for l in ref[-4:]]
        for i, l in enumerate(header.splitlines()):
            if i < 9:
                self.assertEqual(l, ref[i])
            else:
                s = " ".join(l.split()[2:])
                self.assertIn(s, last4)
예제 #4
0
 def test_get_feff_atoms(self):
     ATOMS = str(FeffInputSet.get_feff_atoms(x, structure, central_atom))
     self.assertEqual(ATOMS.splitlines()[3].split()[4], central_atom,
                      "failed to create ATOMS string")
예제 #5
0
    def test_get_feffPot(self):
        POT = str(FeffInputSet.get_feff_pot(x, structure, central_atom))
        d, dr = FeffPot.pot_dict_from_string(POT)

        self.assertEqual(d['Co'], 1, "Wrong symbols read in for FeffPot")
예제 #6
0
 def test_getfefftags(self):
     tags = FeffInputSet.get_feff_tags(x, "XANES").as_dict()
     self.assertEqual(tags['COREHOLE'], "FSR",
                      "Failed to generate PARAMETERS string")
예제 #7
0
import unittest
import os

from pymatgen.io.feffio_set import FeffInputSet
from pymatgen.io.feffio import FeffPot
from pymatgen.io.cifio import CifParser

test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..",
                        'test_files')
cif_file = 'CoO19128.cif'
central_atom = 'O'
cif_path = os.path.join(test_dir, cif_file)
r = CifParser(cif_path)
structure = r.get_structures()[0]
x = FeffInputSet("MaterialsProject")


class FeffInputSetTest(unittest.TestCase):

    header_string = """* This FEFF.inp file generated by pymatgen
TITLE comment: From cif file
TITLE Source:  CoO19128.cif
TITLE Structure Summary:  Co2 O2
TITLE Reduced formula:  CoO
TITLE space group: (P6_3mc), space number:  (186)
TITLE abc:  3.297078   3.297078   5.254213
TITLE angles: 90.000000  90.000000 120.000000
TITLE sites: 4
* 1 Co     0.333334     0.666666     0.503676
* 2 Co     0.666667     0.333333     0.003676
예제 #8
0
 def test_get_feff_atoms(self):
     ATOMS = str(FeffInputSet.get_feff_atoms(x, structure, central_atom))
     self.assertEqual(ATOMS.splitlines()[3].split()[4], central_atom,
                      "failed to create ATOMS string")
예제 #9
0
    def test_get_feffPot(self):
        POT = str(FeffInputSet.get_feff_pot(x, structure, central_atom))
        d, dr = FeffPot.pot_dict_from_string(POT)

        self.assertEqual(d['Co'], 1, "Wrong symbols read in for FeffPot")
예제 #10
0
 def test_getfefftags(self):
     tags = FeffInputSet.get_feff_tags(x, "XANES").as_dict()
     self.assertEqual(tags['COREHOLE'], "FSR",
                      "Failed to generate PARAMETERS string")
예제 #11
0
 def test_getfefftags(self):
     tags = FeffInputSet.get_feff_tags(x, "XANES")
     self.assertEqual(tags["COREHOLE"], "FSR",
                      "Failed to read PARAMETERS file")
예제 #12
0
 def test_get_header(self):
     header = FeffInputSet.get_header(x, structure, 'CoO19128')
     self.maxDiff = 1000
     self.assertEqual(FeffInputSetTest.header_string.splitlines(),
                      header.splitlines())