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


Python StructureNL.from_structures方法代码示例

本文整理汇总了Python中pymatgen.matproj.snl.StructureNL.from_structures方法的典型用法代码示例。如果您正苦于以下问题:Python StructureNL.from_structures方法的具体用法?Python StructureNL.from_structures怎么用?Python StructureNL.from_structures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymatgen.matproj.snl.StructureNL的用法示例。


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

示例1: test_from_structures

# 需要导入模块: from pymatgen.matproj.snl import StructureNL [as 别名]
# 或者: from pymatgen.matproj.snl.StructureNL import from_structures [as 别名]
    def test_from_structures(self):
        s1 = Structure([[5, 0, 0], [0, 5, 0], [0, 0, 5]], ["Fe"], [[0, 0, 0]])
        s2 = Structure([[5, 0, 0], [0, 5, 0], [0, 0, 5]], ["Mn"], [[0, 0, 0]])
        remarks = ["unittest"]
        authors="Test User <[email protected]>"
        snl_list = StructureNL.from_structures([s1, s2], authors, remarks=remarks)

        self.assertEqual(len(snl_list), 2)
        snl1 = snl_list[0]
        snl2 = snl_list[1]
        self.assertEqual(snl1.remarks, remarks)
        self.assertEqual(snl2.remarks, remarks)
        self.assertEqual(snl1.authors, [Author.parse_author(authors)])
        self.assertEqual(snl2.authors, [Author.parse_author(authors)])
开发者ID:Lightslayer,项目名称:pymatgen,代码行数:16,代码来源:test_snl.py

示例2: submit_structures

# 需要导入模块: from pymatgen.matproj.snl import StructureNL [as 别名]
# 或者: from pymatgen.matproj.snl.StructureNL import from_structures [as 别名]
    def submit_structures(self, structures, authors, projects=None,
                             references='', remarks=None, data=None,
                             histories=None, created_at=None):
        """
        Submits a list of structures to the Materials Project as SNL files.
        The argument list mirrors the arguments for the StructureNL object,
        except that a list of structures with the same metadata is used as an
        input.

        .. note::

            As of now, this MP REST feature is open only to a select group of
            users. Opening up submissions to all users is being planned for
            the future.

        Args:
            structures:
                A list of Structure objects
            authors:
                *List* of {"name":'', "email":''} dicts,
                *list* of Strings as 'John Doe <[email protected]>',
                or a single String with commas separating authors
            projects:
                List of Strings ['Project A', 'Project B']. This applies to
                all structures.
            references:
                A String in BibTeX format. Again, this applies to all
                structures.
            remarks:
                List of Strings ['Remark A', 'Remark B']
            data:
                A list of free form dict. Namespaced at the root level with an
                underscore, e.g. {"_materialsproject":<custom data>}. The
                length of data should be the same as the list of structures
                if not None.
            histories:
                List of list of dicts - [[{'name':'', 'url':'',
                'description':{}}], ...] The length of histories should be the
                same as the list of structures if not None.
            created_at:
                A datetime object

        Returns:
            A list of inserted submission ids.
        """
        snl_list = StructureNL.from_structures(structures,
                    authors, projects, references, remarks, data,
                    histories, created_at)

        self.submit_snl(snl_list)
开发者ID:isayev,项目名称:pymatgen,代码行数:52,代码来源:rest.py


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