本文整理汇总了Python中pymatgen.transformations.site_transformations.PartialRemoveSitesTransformation类的典型用法代码示例。如果您正苦于以下问题:Python PartialRemoveSitesTransformation类的具体用法?Python PartialRemoveSitesTransformation怎么用?Python PartialRemoveSitesTransformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PartialRemoveSitesTransformation类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: apply_transformation
def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply the transformation.
Args:
structure:
input structure
return_ranked_list:
Boolean stating whether or not multiple structures are
returned. If return_ranked_list is an int, that number of
structures is returned.
Returns:
Depending on returned_ranked list, either a transformed structure
or
a list of dictionaries, where each dictionary is of the form
{"structure" = .... , "other_arguments"}
the key "transformation" is reserved for the transformation that
was actually applied to the structure.
This transformation is parsed by the alchemy classes for generating
a more specific transformation history. Any other information will
be stored in the transformation_parameters dictionary in the
transmuted structure class.
"""
sp = smart_element_or_specie(self._specie)
specie_indices = [i for i in xrange(len(structure)) if structure[i].species_and_occu == Composition({sp: 1})]
trans = PartialRemoveSitesTransformation([specie_indices], [self._frac], algo=self._algo)
return trans.apply_transformation(structure, return_ranked_list)
开发者ID:hgfb,项目名称:pymatgen,代码行数:28,代码来源:standard_transformations.py
示例2: test_apply_transformation_fast
def test_apply_transformation_fast(self):
t = PartialRemoveSitesTransformation([tuple(range(4)), tuple(range(4, 8))], [0.5, 0.5], PartialRemoveSitesTransformation.ALGO_FAST)
s = t.apply_transformation(self.struct)
self.assertEqual(s.formula, "Li2 O2")
t = PartialRemoveSitesTransformation([tuple(range(8))], [0.5], PartialRemoveSitesTransformation.ALGO_FAST)
s = t.apply_transformation(self.struct)
self.assertEqual(s.formula, "Li2 O2")
开发者ID:chenweis,项目名称:pymatgen,代码行数:7,代码来源:test_site_transformations.py
示例3: test_apply_transformation_enumerate
def test_apply_transformation_enumerate(self):
t = PartialRemoveSitesTransformation(
[tuple(range(4)), tuple(range(4, 8))],
[0.5, 0.5],
PartialRemoveSitesTransformation.ALGO_ENUMERATE
)
s = t.apply_transformation(self.struct)
self.assertEqual(s.formula, "Li2 O2")
s = t.apply_transformation(self.struct, 12)
self.assertEqual(len(s), 12)
开发者ID:AtlasL,项目名称:pymatgen,代码行数:10,代码来源:test_site_transformations.py
示例4: test_apply_transformation_enumerate
def test_apply_transformation_enumerate(self):
if not enumlib_present:
raise SkipTest("enumlib not present. "
"Skipping ALGO.ENUMERATE "
"PartialRemoveSitesTransformationTest...")
t = PartialRemoveSitesTransformation(
[tuple(range(4)), tuple(range(4, 8))],
[0.5, 0.5],
PartialRemoveSitesTransformation.ALGO_ENUMERATE
)
s = t.apply_transformation(self.struct)
self.assertEqual(s.formula, "Li2 O2")
s = t.apply_transformation(self.struct, 12)
self.assertEqual(len(s), 12)
开发者ID:jesuansito,项目名称:pymatgen,代码行数:14,代码来源:test_site_transformations.py
示例5: test_to_from_dict
def test_to_from_dict(self):
d = PartialRemoveSitesTransformation([tuple(range(4))], [0.5]).as_dict()
t = PartialRemoveSitesTransformation.from_dict(d)
s = t.apply_transformation(self.struct)
self.assertEqual(s.formula, "Li2 O4")
开发者ID:AtlasL,项目名称:pymatgen,代码行数:5,代码来源:test_site_transformations.py
注:本文中的pymatgen.transformations.site_transformations.PartialRemoveSitesTransformation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论