本文整理汇总了Python中pymatgen.symmetry.analyzer.SpacegroupAnalyzer.get_space_group_operations方法的典型用法代码示例。如果您正苦于以下问题:Python SpacegroupAnalyzer.get_space_group_operations方法的具体用法?Python SpacegroupAnalyzer.get_space_group_operations怎么用?Python SpacegroupAnalyzer.get_space_group_operations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.symmetry.analyzer.SpacegroupAnalyzer
的用法示例。
在下文中一共展示了SpacegroupAnalyzer.get_space_group_operations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_snl
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_space_group_operations [as 别名]
def add_snl(self, snl, force_new=False, snlgroup_guess=None):
try:
self.lock_db()
snl_id = self._get_next_snl_id()
spstruc = snl.structure.copy()
spstruc.remove_oxidation_states()
sf = SpacegroupAnalyzer(spstruc, SPACEGROUP_TOLERANCE)
sf.get_space_group_operations()
sgnum = sf.get_space_group_number() if sf.get_space_group_number() \
else -1
sgsym = sf.get_space_group_symbol() if sf.get_space_group_symbol() \
else 'unknown'
sghall = sf.get_hall() if sf.get_hall() else 'unknown'
sgxtal = sf.get_crystal_system() if sf.get_crystal_system() \
else 'unknown'
sglatt = sf.get_lattice_type() if sf.get_lattice_type() else 'unknown'
sgpoint = sf.get_point_group_symbol()
mpsnl = MPStructureNL.from_snl(snl, snl_id, sgnum, sgsym, sghall,
sgxtal, sglatt, sgpoint)
snlgroup, add_new, spec_group = self.add_mpsnl(mpsnl, force_new, snlgroup_guess)
self.release_lock()
return mpsnl, snlgroup.snlgroup_id, spec_group
except:
self.release_lock()
traceback.print_exc()
raise ValueError("Error while adding SNL!")
示例2: complete_ordering
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_space_group_operations [as 别名]
def complete_ordering(self, structure, num_remove_dict):
self.logger.debug("Performing complete ordering...")
all_structures = []
symprec = 0.2
s = SpacegroupAnalyzer(structure, symprec=symprec)
self.logger.debug("Symmetry of structure is determined to be {}."
.format(s.get_space_group_symbol()))
sg = s.get_space_group_operations()
tested_sites = []
starttime = time.time()
self.logger.debug("Performing initial ewald sum...")
ewaldsum = EwaldSummation(structure)
self.logger.debug("Ewald sum took {} seconds."
.format(time.time() - starttime))
starttime = time.time()
allcombis = []
for ind, num in num_remove_dict.items():
allcombis.append(itertools.combinations(ind, num))
count = 0
for allindices in itertools.product(*allcombis):
sites_to_remove = []
indices_list = []
for indices in allindices:
sites_to_remove.extend([structure[i] for i in indices])
indices_list.extend(indices)
s_new = structure.copy()
s_new.remove_sites(indices_list)
energy = ewaldsum.compute_partial_energy(indices_list)
already_tested = False
for i, tsites in enumerate(tested_sites):
tenergy = all_structures[i]["energy"]
if abs((energy - tenergy) / len(s_new)) < 1e-5 and \
sg.are_symmetrically_equivalent(sites_to_remove,
tsites,
symm_prec=symprec):
already_tested = True
if not already_tested:
tested_sites.append(sites_to_remove)
all_structures.append({"structure": s_new, "energy": energy})
count += 1
if count % 10 == 0:
timenow = time.time()
self.logger.debug("{} structures, {:.2f} seconds."
.format(count, timenow - starttime))
self.logger.debug("Average time per combi = {} seconds"
.format((timenow - starttime) / count))
self.logger.debug("{} symmetrically distinct structures found."
.format(len(all_structures)))
self.logger.debug("Total symmetrically distinct structures found = {}"
.format(len(all_structures)))
all_structures = sorted(all_structures, key=lambda s: s["energy"])
return all_structures
示例3: analyze_symmetry
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_space_group_operations [as 别名]
def analyze_symmetry(self, tol):
s = Structure.from_sites(self.framework)
site_to_vindex = {}
for i, v in enumerate(self.vnodes):
s.append("Li", v.frac_coords)
site_to_vindex[s[-1]] = i
print(len(s))
finder = SpacegroupAnalyzer(s, tol)
print(finder.get_space_group_operations())
symm_structure = finder.get_symmetrized_structure()
print(len(symm_structure.equivalent_sites))
return [[site_to_vindex[site]
for site in sites]
for sites in symm_structure.equivalent_sites
if sites[0].specie.symbol == "Li"]