本文整理汇总了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)])
示例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)