• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python structure.Structure类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_from_dict

 def test_from_dict(self):
     d = self.propertied_structure.to_dict
     s = Structure.from_dict(d)
     self.assertEqual(s[0].magmom, 5)
     d = {'lattice': {'a': 3.8401979337, 'volume': 40.044794644251596,
                      'c': 3.8401979337177736, 'b': 3.840198994344244,
                      'matrix': [[3.8401979337, 0.0, 0.0],
                                 [1.9200989668, 3.3257101909, 0.0],
                                 [0.0, -2.2171384943, 3.1355090603]],
                      'alpha': 119.9999908639842, 'beta': 90.0,
                      'gamma': 60.000009137322195},
          'sites': [{'properties': {'magmom': 5}, 'abc': [0.0, 0.0, 0.0],
                     'occu': 1.0, 'species': [{'occu': 1.0,
                                               'oxidation_state':-2,
                                               'properties': {'spin': 3},
                                               'element': 'O'}],
                     'label': 'O2-', 'xyz': [0.0, 0.0, 0.0]},
                    {'properties': {'magmom':-5}, 'abc': [0.75, 0.5, 0.75],
                     'occu': 0.8, 'species': [{'occu': 0.8,
                                               'oxidation_state': 2,
                                               'properties': {'spin': 2},
                                               'element': 'Mg'}],
                     'label': 'Mg2+:0.800',
                     'xyz': [3.8401979336749994, 1.2247250003039056e-06,
                             2.351631795225]}]}
     s = Structure.from_dict(d)
     self.assertEqual(s[0].magmom, 5)
     self.assertEqual(s[0].specie.spin, 3)
开发者ID:thuwangming,项目名称:pymatgen,代码行数:28,代码来源:test_structure.py


示例2: test_get_slab

    def test_get_slab(self):
        s = self.get_structure("LiFePO4")
        gen = SlabGenerator(s, [0, 0, 1], 10, 10)
        s = gen.get_slab(0.25)
        self.assertAlmostEqual(s.lattice.abc[2], 20.820740000000001)

        fcc = Structure.from_spacegroup("Fm-3m", Lattice.cubic(3), ["Fe"],
                                        [[0, 0, 0]])
        gen = SlabGenerator(fcc, [1, 1, 1], 10, 10)
        slab = gen.get_slab()
        gen = SlabGenerator(fcc, [1, 1, 1], 10, 10, primitive=False)
        slab_non_prim = gen.get_slab()
        self.assertEqual(len(slab), 6)
        self.assertEqual(len(slab_non_prim), len(slab) * 4)

        #Some randomized testing of cell vectors
        for i in range(1, 231):
            i = random.randint(1, 230)
            sg = SpaceGroup.from_int_number(i)
            if sg.crystal_system == "hexagonal" or (sg.crystal_system == \
                    "trigonal" and sg.symbol.endswith("H")):
                latt = Lattice.hexagonal(5, 10)
            else:
                #Cubic lattice is compatible with all other space groups.
                latt = Lattice.cubic(5)
            s = Structure.from_spacegroup(i, latt, ["H"], [[0, 0, 0]])
            miller = (0, 0, 0)
            while miller == (0, 0, 0):
                miller = (random.randint(0, 6), random.randint(0, 6),
                          random.randint(0, 6))
            gen = SlabGenerator(s, miller, 10, 10)
            a, b, c = gen.oriented_unit_cell.lattice.matrix
            self.assertAlmostEqual(np.dot(a, gen._normal), 0)
            self.assertAlmostEqual(np.dot(b, gen._normal), 0)
开发者ID:tallakahath,项目名称:pymatgen,代码行数:34,代码来源:test_surface.py


示例3: test_get_primitive_structure

 def test_get_primitive_structure(self):
     coords = [[0, 0, 0], [0.5, 0.5, 0], [0, 0.5, 0.5], [0.5, 0, 0.5]]
     fcc_ag = Structure(Lattice.cubic(4.09), ["Ag"] * 4, coords)
     self.assertEqual(len(fcc_ag.get_primitive_structure()), 1)
     coords = [[0, 0, 0], [0.5, 0.5, 0.5]]
     bcc_li = Structure(Lattice.cubic(4.09), ["Li"] * 2, coords)
     self.assertEqual(len(bcc_li.get_primitive_structure()), 1)
开发者ID:thuwangming,项目名称:pymatgen,代码行数:7,代码来源:test_structure.py


示例4: to

 def to(self, fmt, filename, weight=True, lattice=None):
     composition = self.to_composition(weight)
     charge = sum([k.oxi_state * v for k, v in composition.iteritems()])
     s = Structure(lattice,
                   [self.central_subsite.specie] + [site.specie for site in self.peripheral_subsites],
                   [self.central_subsite.site.coords] + [site.site.coords for site in self.peripheral_subsites], coords_are_cartesian=True)
     s.to(fmt, filename)
开发者ID:blondegeek,项目名称:structural_descriptors_repo,代码行数:7,代码来源:substructure.py


示例5: get_refined_structure

    def get_refined_structure(self):
        """
        Get the refined structure based on detected symmetry. The refined
        structure is a *conventional* cell setting with atoms moved to the
        expected symmetry positions.

        Returns:
            Refined structure.
        """
        # Atomic positions have to be specified by scaled positions for spglib.
        num_atom = self._structure.num_sites
        lattice = self._transposed_latt.copy()
        pos = np.zeros((num_atom * 4, 3), dtype='double')
        pos[:num_atom] = self._positions.copy()

        zs = np.zeros(num_atom * 4, dtype='intc')
        zs[:num_atom] = np.array(self._numbers, dtype='intc')
        num_atom_bravais = spg.refine_cell(
            lattice, pos, zs, num_atom, self._symprec, self._angle_tol)

        zs = zs[:num_atom_bravais]
        species = [self._unique_species[i - 1] for i in zs]
        s = Structure(lattice.T.copy(),
                      species,
                      pos[:num_atom_bravais])
        return s.get_sorted_structure()
开发者ID:NadezhdaBzhilyanskaya,项目名称:pymatgen,代码行数:26,代码来源:finder.py


示例6: test_primitive_on_large_supercell

 def test_primitive_on_large_supercell(self):
     coords = [[0, 0, 0], [0.5, 0.5, 0], [0, 0.5, 0.5], [0.5, 0, 0.5]]
     fcc_ag = Structure(Lattice.cubic(4.09), ["Ag"] * 4, coords)
     fcc_ag.make_supercell([2, 2, 2])
     fcc_ag_prim = fcc_ag.get_primitive_structure()
     self.assertEqual(len(fcc_ag_prim), 1)
     self.assertAlmostEqual(fcc_ag_prim.volume, 17.10448225)
开发者ID:Lightslayer,项目名称:pymatgen,代码行数:7,代码来源:test_structure.py


示例7: test_get_slabs

    def test_get_slabs(self):
        gen = SlabGenerator(self.get_structure("CsCl"), [0, 0, 1], 10, 10)

        #Test orthogonality of some internal variables.
        a, b, c = gen.oriented_unit_cell.lattice.matrix
        self.assertAlmostEqual(np.dot(a, gen._normal), 0)
        self.assertAlmostEqual(np.dot(b, gen._normal), 0)

        self.assertEqual(len(gen.get_slabs()), 1)

        s = self.get_structure("LiFePO4")
        gen = SlabGenerator(s, [0, 0, 1], 10, 10)
        self.assertEqual(len(gen.get_slabs()), 5)

        self.assertEqual(len(gen.get_slabs(bonds={("P", "O"): 3})), 2)

        # There are no slabs in LFP that does not break either P-O or Fe-O
        # bonds for a miller index of [0, 0, 1].
        self.assertEqual(len(gen.get_slabs(
            bonds={("P", "O"): 3, ("Fe", "O"): 3})), 0)

        #If we allow some broken bonds, there are a few slabs.
        self.assertEqual(len(gen.get_slabs(
            bonds={("P", "O"): 3, ("Fe", "O"): 3},
            max_broken_bonds=2)), 2)

        # At this threshold, only the origin and center Li results in
        # clustering. All other sites are non-clustered. So the of
        # slabs is of sites in LiFePO4 unit cell - 2 + 1.
        self.assertEqual(len(gen.get_slabs(tol=1e-4)), 15)

        LiCoO2=Structure.from_file(get_path("icsd_LiCoO2.cif"),
                                          primitive=False)
        gen = SlabGenerator(LiCoO2, [0, 0, 1], 10, 10)
        lco = gen.get_slabs(bonds={("Co", "O"): 3})
        self.assertEqual(len(lco), 1)
        a, b, c = gen.oriented_unit_cell.lattice.matrix
        self.assertAlmostEqual(np.dot(a, gen._normal), 0)
        self.assertAlmostEqual(np.dot(b, gen._normal), 0)

        scc = Structure.from_spacegroup("Pm-3m", Lattice.cubic(3), ["Fe"],
                                        [[0, 0, 0]])
        gen = SlabGenerator(scc, [0, 0, 1], 10, 10)
        slabs = gen.get_slabs()
        self.assertEqual(len(slabs), 1)
        gen = SlabGenerator(scc, [1, 1, 1], 10, 10, max_normal_search=1)
        slabs = gen.get_slabs()
        self.assertEqual(len(slabs), 1)

        # Test whether using units of hkl planes instead of Angstroms for
        # min_slab_size and min_vac_size will give us the same number of atoms
        natoms = []
        for a in [1, 1.4, 2.5, 3.6]:
            s = Structure.from_spacegroup("Im-3m", Lattice.cubic(a), ["Fe"], [[0,0,0]])
            slabgen = SlabGenerator(s, (1,1,1), 10, 10, in_unit_planes=True,
                                    max_normal_search=2)
            natoms.append(len(slabgen.get_slab()))
        n = natoms[0]
        for i in natoms:
            self.assertEqual(n, i)
开发者ID:ExpHP,项目名称:pymatgen,代码行数:60,代码来源:test_surface.py


示例8: generate_defect_structure

    def generate_defect_structure(self, supercell=(1, 1, 1)):
        """
        Returns Defective Interstitial structure, decorated with charge
        If bulk structure had any site properties, all of these properties are
        removed in the resulting defect structure

        Args:
            supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
        """
        defect_structure = Structure( self.bulk_structure.copy().lattice,
                                      [site.specie for site in self.bulk_structure],
                                      [site.frac_coords for site in self.bulk_structure],
                                      to_unit_cell=True, coords_are_cartesian = False,
                                      site_properties = None) #remove all site_properties
        defect_structure.make_supercell(supercell)

        #create a trivial defect structure to find where supercell transformation moves the defect site
        struct_for_defect_site = Structure( self.bulk_structure.copy().lattice,
                                             [self.site.specie],
                                             [self.site.frac_coords],
                                             to_unit_cell=True, coords_are_cartesian = False)
        struct_for_defect_site.make_supercell(supercell)
        defect_site = struct_for_defect_site[0]

        defect_structure.append(self.site.specie.symbol, defect_site.coords, coords_are_cartesian=True,
                                properties = None)
        defect_structure.set_charge(self.charge)
        return defect_structure
开发者ID:materialsproject,项目名称:pymatgen,代码行数:28,代码来源:core.py


示例9: get_aligned_lattices

def get_aligned_lattices(slab_sub, slab_2d, max_area=200,
                         max_mismatch=0.05,
                         max_angle_diff=1, r1r2_tol=0.2):
    """
    given the 2 slab structures and the alignment paramters, return
    slab structures with lattices that are aligned with respect to each
    other
    """
    # get the matching substrate and 2D material lattices
    uv_substrate, uv_mat2d = get_matching_lattices(slab_sub, slab_2d,
                                                   max_area=max_area,
                                                   max_mismatch=max_mismatch,
                                                   max_angle_diff=max_angle_diff,
                                                   r1r2_tol=r1r2_tol)
    if not uv_substrate and not uv_mat2d:
        print("no matching u and v, trying adjusting the parameters")
        sys.exit()
    substrate = Structure.from_sites(slab_sub)
    mat2d = Structure.from_sites(slab_2d)
    # map the intial slabs to the newly found matching lattices
    substrate_latt = Lattice(np.array(
            [
                uv_substrate[0][:],
                uv_substrate[1][:],
                substrate.lattice.matrix[2, :]
            ]))
    # to avoid numerical issues with find_mapping
    mat2d_fake_c = mat2d.lattice.matrix[2, :] / np.linalg.norm(mat2d.lattice.matrix[2, :]) * 5.0
    mat2d_latt = Lattice(np.array(
            [
                uv_mat2d[0][:],
                uv_mat2d[1][:],
                mat2d_fake_c
            ]))
    mat2d_latt_fake = Lattice(np.array(
            [
                mat2d.lattice.matrix[0, :],
                mat2d.lattice.matrix[1, :],
                mat2d_fake_c
            ]))
    _, __, scell = substrate.lattice.find_mapping(substrate_latt,
                                                  ltol=0.05,
                                                  atol=1)
    scell[2] = np.array([0, 0, 1])
    substrate.make_supercell(scell)
    _, __, scell = mat2d_latt_fake.find_mapping(mat2d_latt,
                                                ltol=0.05,
                                                atol=1)
    scell[2] = np.array([0, 0, 1])
    mat2d.make_supercell(scell)
    # modify the substrate lattice so that the 2d material can be
    # grafted on top of it
    lmap = Lattice(np.array(
            [
                substrate.lattice.matrix[0, :],
                substrate.lattice.matrix[1, :],
                mat2d.lattice.matrix[2, :]
            ]))
    mat2d.modify_lattice(lmap)
    return substrate, mat2d
开发者ID:JARVIS-Unifies,项目名称:MPInterfaces,代码行数:60,代码来源:transformations.py


示例10: interpolate_poscar

    def interpolate_poscar(self, fw_spec):
        # make folder for poscar interpolation start and end structure files.
        interpolate_folder = 'interpolate'
        if not os.path.exists(os.path.join(os.getcwd(), interpolate_folder)):
            os.makedirs(os.path.join(os.getcwd(), interpolate_folder))

        # use method of GrabFilesFromCalcLoc to grab files from previous locations.
        CopyFilesFromCalcLoc(calc_dir=None, calc_loc=self["start"],
                             filenames=["CONTCAR"],
                             name_prepend=interpolate_folder + os.sep,
                             name_append="_0").run_task(fw_spec=fw_spec)
        CopyFilesFromCalcLoc(calc_dir=None, calc_loc=self["end"],
                             filenames=["CONTCAR"],
                             name_prepend=interpolate_folder + os.sep,
                             name_append="_1").run_task(fw_spec=fw_spec)


        # assuming first calc_dir is polar structure for ferroelectric search
        s1 = Structure.from_file(os.path.join(interpolate_folder, "CONTCAR_0"))
        s2 = Structure.from_file(os.path.join(interpolate_folder, "CONTCAR_1"))

        structs = s1.interpolate(s2, self["nimages"], interpolate_lattices=True,
                                 autosort_tol=self.get("autosort_tol", 0.0))

        # save only the interpolation needed for this run

        i = self.get("this_image")
        return structs[i]
开发者ID:montoyjh,项目名称:MatMethods,代码行数:28,代码来源:glue_tasks.py


示例11: _preprocess

    def _preprocess(self, struct1, struct2, niggli=True):
        """
        Rescales, finds the reduced structures (primitive and niggli),
        and finds fu, the supercell size to make struct1 comparable to
        s2
        """
        struct1 = Structure.from_sites(struct1)
        struct2 = Structure.from_sites(struct2)

        if niggli:
            struct1 = struct1.get_reduced_structure(reduction_algo="niggli")
            struct2 = struct2.get_reduced_structure(reduction_algo="niggli")

        #primitive cell transformation
        if self._primitive_cell:
            struct1 = struct1.get_primitive_structure()
            struct2 = struct2.get_primitive_structure()

        if self._supercell:
            fu, s1_supercell = self._get_supercell_size(struct1, struct2)
        else:
            fu, s1_supercell = 1, True
        mult = fu if s1_supercell else 1/fu

        #rescale lattice to same volume
        if self._scale:
            ratio = (struct2.volume / (struct1.volume * mult)) ** (1 / 6)
            nl1 = Lattice(struct1.lattice.matrix * ratio)
            struct1.modify_lattice(nl1)
            nl2 = Lattice(struct2.lattice.matrix / ratio)
            struct2.modify_lattice(nl2)

        return struct1, struct2, fu, s1_supercell
开发者ID:image-tester,项目名称:pymatgen,代码行数:33,代码来源:structure_matcher.py


示例12: test_from_magnetic_spacegroup

    def test_from_magnetic_spacegroup(self):

        # AFM MnF
        s1 = Structure.from_magnetic_spacegroup("P4_2'/mnm'", Lattice.tetragonal(4.87, 3.30),
                                                ["Mn", "F"],
                                                [[0, 0, 0],
                                                 [0.30, 0.30, 0.00]],
                                                {'magmom': [4, 0]})

        self.assertEqual(s1.formula, "Mn2 F4")
        self.assertEqual(sum(map(float, s1.site_properties['magmom'])), 0)
        self.assertEqual(max(map(float, s1.site_properties['magmom'])), 4)
        self.assertEqual(min(map(float, s1.site_properties['magmom'])), -4)

        # AFM LaMnO3, ordered on (001) planes
        s2 = Structure.from_magnetic_spacegroup("Pn'ma'", Lattice.orthorhombic(5.75, 7.66, 5.53),
                                                ["La", "Mn", "O", "O"],
                                                [[0.05, 0.25, 0.99],
                                                 [0.00, 0.00, 0.50],
                                                 [0.48, 0.25, 0.08],
                                                 [0.31, 0.04, 0.72]],
                                                {'magmom': [0, Magmom([4, 0, 0]), 0, 0]})

        self.assertEqual(s2.formula, "La4 Mn4 O12")
        self.assertEqual(sum(map(float, s2.site_properties['magmom'])), 0)
        self.assertEqual(max(map(float, s2.site_properties['magmom'])), 4)
        self.assertEqual(min(map(float, s2.site_properties['magmom'])), -4)
开发者ID:xhqu1981,项目名称:pymatgen,代码行数:27,代码来源:test_structure.py


示例13: test_to_from_file_string

    def test_to_from_file_string(self):
        for fmt in ["cif", "json", "poscar", "cssr"]:
            s = self.struct.to(fmt=fmt)
            self.assertIsNotNone(s)
            ss = IStructure.from_str(s, fmt=fmt)
            self.assertArrayAlmostEqual(
                ss.lattice.lengths_and_angles,
                self.struct.lattice.lengths_and_angles, decimal=5)
            self.assertArrayAlmostEqual(ss.frac_coords, self.struct.frac_coords)
            self.assertIsInstance(ss, IStructure)

        self.struct.to(filename="POSCAR.testing")
        self.assertTrue(os.path.exists("POSCAR.testing"))
        os.remove("POSCAR.testing")

        self.struct.to(filename="Si_testing.yaml")
        self.assertTrue(os.path.exists("Si_testing.yaml"))
        s = Structure.from_file("Si_testing.yaml")
        self.assertEqual(s, self.struct)
        os.remove("Si_testing.yaml")

        self.struct.to(filename="POSCAR.testing.gz")
        s = Structure.from_file("POSCAR.testing.gz")
        self.assertEqual(s, self.struct)
        os.remove("POSCAR.testing.gz")
开发者ID:xhqu1981,项目名称:pymatgen,代码行数:25,代码来源:test_structure.py


示例14: test_kpath_generation

    def test_kpath_generation(self):
        triclinic = [1, 2]
        monoclinic = range(3, 16)
        orthorhombic = range(16, 75)
        tetragonal = range(75, 143)
        rhombohedral = range(143, 168)
        hexagonal = range(168, 195)
        cubic = range(195, 231)
        
        species = ['K', 'La', 'Ti']
        coords = [[.345, 5, .77298], [.1345, 5.1, .77298], [.7, .8, .9]]
        for i in range(230):
            sg_num = i + 1
            if sg_num in triclinic:
                lattice = Lattice([[3.0233057319441246,0,0], [0,7.9850357844548681,0], [0,0,8.1136762279561818]])
            elif sg_num in monoclinic:
                lattice = Lattice.monoclinic(2, 9, 1, 99)
            elif sg_num in orthorhombic:
                lattice = Lattice.orthorhombic(2, 9, 1)
            elif sg_num in tetragonal:
                lattice = Lattice.tetragonal(2, 9)
            elif sg_num in rhombohedral:
                lattice = Lattice.hexagonal(2, 95)
            elif sg_num in hexagonal:
                lattice = Lattice.hexagonal(2, 9)
            elif sg_num in cubic:
                lattice = Lattice.cubic(2)
        
            struct = Structure.from_spacegroup(sg_num, lattice, species, coords)
            kpath = HighSymmKpath(struct) #Throws error if something doesn't work, causing test to fail.

        struct_file_path = os.path.join(test_dir_structs, 'ICSD_170.cif')
        struct = Structure.from_file(struct_file_path)
        hkp = HighSymmKpath(struct)
        self.assertEqual(hkp.name, 'MCLC5')
开发者ID:albalu,项目名称:pymatgen,代码行数:35,代码来源:test_kpaths.py


示例15: test_merge_sites

    def test_merge_sites(self):
        species = [{'Ag': 0.5}, {'Cl': 0.25}, {'Cl': 0.1},
                   {'Ag': 0.5}, {'F': 0.15}, {'F': 0.1}]
        coords = [[0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5],
                  [0, 0, 0], [0.5, 0.5, 1.501], [0.5, 0.5, 1.501]]
        s = Structure(Lattice.cubic(1), species, coords)
        s.merge_sites(mode="s")
        self.assertEqual(s[0].specie.symbol, 'Ag')
        self.assertEqual(s[1].species_and_occu,
                         Composition({'Cl': 0.35, 'F': 0.25}))
        self.assertArrayAlmostEqual(s[1].frac_coords, [.5, .5, .5005])

        # Test for TaS2 with spacegroup 166 in 160 setting.
        l = Lattice.from_lengths_and_angles([3.374351, 3.374351, 20.308941],
                                            [90.000000, 90.000000, 120.000000])
        species = ["Ta", "S", "S"]
        coords = [[0.000000, 0.000000, 0.944333], [0.333333, 0.666667, 0.353424],
                  [0.666667, 0.333333, 0.535243]]
        tas2 = Structure.from_spacegroup(160, l, species, coords)
        assert len(tas2) == 13
        tas2.merge_sites(mode="d")
        assert len(tas2) == 9

        l = Lattice.from_lengths_and_angles([3.587776, 3.587776, 19.622793],
                                            [90.000000, 90.000000, 120.000000])
        species = ["Na", "V", "S", "S"]
        coords = [[0.333333, 0.666667, 0.165000], [0.000000, 0.000000, 0.998333],
                  [0.333333, 0.666667, 0.399394], [0.666667, 0.333333, 0.597273]]
        navs2 = Structure.from_spacegroup(160, l, species, coords)
        assert len(navs2) == 18
        navs2.merge_sites(mode="d")
        assert len(navs2) == 12
开发者ID:gpetretto,项目名称:pymatgen,代码行数:32,代码来源:test_structure.py


示例16: relax

def relax(dim=2, submit=True, force_overwrite=False):
    """
    Writes input files and (optionally) submits a self-consistent
    relaxation. Should be run before pretty much anything else, in
    order to get the right energy and structure of the material.

    Args:
        dim (int): 2 for relaxing a 2D material, 3 for a 3D material.
        submit (bool): Whether or not to submit the job.
        force_overwrite (bool): Whether or not to overwrite files
            if an already converged vasprun.xml exists in the
            directory.
    """

    if force_overwrite or not utl.is_converged(os.getcwd()):
        directory = os.getcwd().split('/')[-1]

        # vdw_kernel.bindat file required for VDW calculations.
        if VDW_KERNEL:
            os.system('cp {} .'.format(VDW_KERNEL))
        # KPOINTS
        Kpoints.automatic_density(Structure.from_file('POSCAR'),
                                  1000).write_file('KPOINTS')

        # INCAR
        INCAR_DICT.update(
            {'MAGMOM': utl.get_magmom_string(Structure.from_file('POSCAR'))}
        )
        Incar.from_dict(INCAR_DICT).write_file('INCAR')
        # POTCAR
        utl.write_potcar()

        # Special tasks only performed for 2D materials.
        if dim == 2:
            # Ensure 20A interlayer vacuum
            utl.ensure_vacuum(Structure.from_file('POSCAR'), 20)
            # Remove all z k-points.
            kpts_lines = open('KPOINTS').readlines()
            with open('KPOINTS', 'w') as kpts:
                for line in kpts_lines[:3]:
                    kpts.write(line)
                kpts.write(kpts_lines[3].split()[0] + ' '
                           + kpts_lines[3].split()[1] + ' 1')

        # Submission script
        if dim == 2:
            binary = VASP_TWOD_BIN
        elif dim == 3:
            binary = VASP_STD_BIN
        if QUEUE_SYSTEM == 'pbs':
            utl.write_pbs_runjob(directory, 1, 16, '800mb', '6:00:00', binary)
            submission_command = 'qsub runjob'

        elif QUEUE_SYSTEM == 'slurm':
            utl.write_slurm_runjob(directory, 16, '800mb', '6:00:00', binary)
            submission_command = 'sbatch runjob'

        if submit:
            os.system(submission_command)
开发者ID:henniggroup,项目名称:MPInterfaces,代码行数:59,代码来源:startup.py


示例17: setUp

    def setUp(self):

        l = Lattice.cubic(3.51)
        species = ["Ni"]
        coords = [[0,0,0]]
        self.Ni = Structure.from_spacegroup("Fm-3m", l, species, coords)
        self.Si = Structure.from_spacegroup("Fd-3m", Lattice.cubic(5.430500),
                                            ["Si"], [(0, 0, 0.5)])
开发者ID:navnidhirajput,项目名称:pymatgen,代码行数:8,代码来源:test_surface.py


示例18: setUp

 def setUp(self):
     """Loading structures before tests"""
     #print "TestConnectivityMethods:setUp_"
     print "Loading structures from file"
     self.fe_structure = Structure.from_file('Fe.cif', True, True)
     self.caf2_structure = Structure.from_file('CaF2.cif', True, True)
     self.licoo2_structure = Structure.from_file('LiCoO2.cif', True, True)
     print "Structures from file loaded"
开发者ID:tchen0965,项目名称:structural_descriptors_repo,代码行数:8,代码来源:connectivity_test.py


示例19: test_primitive_structure_volume_check

 def test_primitive_structure_volume_check(self):
     l = Lattice.tetragonal(10, 30)
     coords = [[0.5, 0.8, 0], [0.5, 0.2, 0],
               [0.5, 0.8, 0.333], [0.5, 0.5, 0.333],
               [0.5, 0.5, 0.666], [0.5, 0.2, 0.666]]
     s = Structure(l, ["Ag"] * 6, coords)
     sprim = s.get_primitive_structure(tolerance=0.1)
     self.assertEqual(len(sprim), 6)
开发者ID:thuwangming,项目名称:pymatgen,代码行数:8,代码来源:test_structure.py


示例20: test_get_sorted_structure

 def test_get_sorted_structure(self):
     coords = list()
     coords.append([0, 0, 0])
     coords.append([0.75, 0.5, 0.75])
     s = Structure(self.lattice, ["O", "Li"] , coords)
     sorted_s = s.get_sorted_structure()
     self.assertEqual(sorted_s[0].species_and_occu, {Element("Li"):1})
     self.assertEqual(sorted_s[1].species_and_occu, {Element("O"):1})
开发者ID:chenweis,项目名称:pymatgen,代码行数:8,代码来源:test_structure.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python structure_modifier.StructureEditor类代码示例发布时间:2022-05-25
下一篇:
Python structure.Molecule类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap