本文整理汇总了Python中pymatgen.symmetry.analyzer.SpacegroupAnalyzer.get_spacegroup_number方法的典型用法代码示例。如果您正苦于以下问题:Python SpacegroupAnalyzer.get_spacegroup_number方法的具体用法?Python SpacegroupAnalyzer.get_spacegroup_number怎么用?Python SpacegroupAnalyzer.get_spacegroup_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.symmetry.analyzer.SpacegroupAnalyzer
的用法示例。
在下文中一共展示了SpacegroupAnalyzer.get_spacegroup_number方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_snl
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [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, ANGLE_TOLERANCE)
sf.get_spacegroup()
sgnum = sf.get_spacegroup_number() if sf.get_spacegroup_number() \
else -1
sgsym = sf.get_spacegroup_symbol() if sf.get_spacegroup_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()
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: test_tricky_structure
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def test_tricky_structure(self):
# for some reason this structure kills spglib1.9
# 1.7 can't find symmetry either, but at least doesn't kill python
s = Structure.from_file(os.path.join(test_dir, 'POSCAR.tricky_symmetry'))
sa = SpacegroupAnalyzer(s, 0.1)
sa.get_spacegroup_symbol()
sa.get_spacegroup_number()
sa.get_point_group()
sa.get_crystal_system()
sa.get_hall()
示例3: create_structure_db_info
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def create_structure_db_info(structure, spacegroup=None):
# Figure out the symmetry group
if not spacegroup:
spacegroup = SpacegroupAnalyzer(structure, normalised_symmetry_precision(structure), -1)
d = dict()
# Set the composition and formulas for the system
comp = structure.composition
el_amt = structure.composition.get_el_amt_dict()
d.update({"unit_cell_formula": comp.to_dict,
"reduced_cell_formula": comp.to_reduced_dict,
"elements": list(el_amt.keys()),
"nelements": len(el_amt),
"pretty_formula": comp.reduced_formula,
"anonymous_formula": comp.anonymized_formula,
"nsites": comp.num_atoms,
"chemsys": "-".join(sorted(el_amt.keys()))})
d["spacegroup"] = {"symbol": unicode(spacegroup.get_spacegroup_symbol(),
errors="ignore"),
"number": spacegroup.get_spacegroup_number(),
"point_group": unicode(spacegroup.get_point_group(),
errors="ignore"),
"source": "spglib",
"crystal_system": spacegroup.get_crystal_system(),
"hall": spacegroup.get_hall()}
return d
示例4: print_spg
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def print_spg(src="POSCAR"):
srcpos = Poscar.from_file(src)
finder = SpacegroupAnalyzer(srcpos.structure, symprec=5e-2, angle_tolerance=8)
spg = finder.get_spacegroup_symbol()
spg_num = finder.get_spacegroup_number()
print(spg)
print(spg_num)
示例5: cif2geom_sym2
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def cif2geom_sym2(cif):
parser=CifParser.from_string(cif)
struct=parser.get_structures()[0]
sg = SpacegroupAnalyzer(struct)
struct = sg.get_conventional_standard_structure()
sg = SpacegroupAnalyzer(struct)
geomlines=["CRYSTAL"]
geomlines += ["0 0 1"]
geomlines += [str(sg.get_spacegroup_number())]
cry_sys = sg.get_crystal_system()
lattice = struct.lattice
if cry_sys == 'trigonal' or cry_sys == 'hexagonal' or cry_sys == 'tetragonal':
geomlines += ["%s %s" %(lattice.a,lattice.c)]
elif cry_sys == 'cubic':
geomlines += ["%s" %(lattice.a)]
elif cry_sys == 'triclinic':
geomlines += ["%s %s %s %s %s %s" %(lattice.a,lattice.b,lattice.c,lattice.alpha,lattice.beta,lattice.gamma)]
elif cry_sys == 'monoclinic':
geomlines += ["%s %s %s %s" %(lattice.a,lattice.b,lattice.c,lattice.beta)]
elif cry_sys == 'orthorhombic':
geomlines += ["%s %s %s" %(lattice.a,lattice.b,lattice.c)]
else:
print('Error printing symmetrized structure.')
quit()
ds = sg.get_symmetry_dataset()
eq_sites = np.unique(ds['equivalent_atoms'])
geomlines += [str(len(eq_sites))]
for eq_site in eq_sites:
site = struct.sites[eq_site]
geomlines += ["%s %s %s %s" %(site.specie.Z+200,site.a,site.b,site.c)]
return geomlines,struct
示例6: process_item
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def process_item(self, item, index):
nrow, ncol, snlgroups = super(SNLSpaceGroupChecker, self).process_item(item, index)
local_mismatch_dict = dict((k,[]) for k in categories[self.checker_name])
category = ''
try:
mpsnl_dict = self._snls.collection.find_one({ 'snl_id': item })
mpsnl = MPStructureNL.from_dict(mpsnl_dict)
mpsnl.structure.remove_oxidation_states()
sf = SpacegroupAnalyzer(mpsnl.structure, symprec=0.1)
if sf.get_spacegroup_number() != mpsnl.sg_num:
category = categories[self.checker_name][int(sf.get_spacegroup_number() == 0)]
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
category = categories[0][2]
if category:
local_mismatch_dict[category].append(str(item))
_log.info('(%d) %r', self._counter_total.value, local_mismatch_dict)
self._increase_counter(nrow, ncol, local_mismatch_dict)
示例7: print_spg
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def print_spg(src='POSCAR'):
"""
space group を return
"""
srcpos = Poscar.from_file(src)
finder = SpacegroupAnalyzer(srcpos.structure,
symprec=5e-2, angle_tolerance=8)
spg = finder.get_spacegroup_symbol()
spg_num = finder.get_spacegroup_number()
return spg, spg_num
示例8: check_snl_spacegroups
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def check_snl_spacegroups(args):
"""check spacegroups of all available SNLs"""
range_index = args.start / num_ids_per_stream
idxs = [range_index*2]
idxs += [idxs[0]+1]
s = [py.Stream(stream_ids[i]) for i in idxs]
for i in range(len(idxs)): s[i].open()
end = num_snls if args.end > num_snls else args.end
id_range = {"$gt": args.start, "$lte": end}
mpsnl_cursor = sma.snl.find({ "snl_id": id_range})
num_good_ids = 0
colors=[]
for mpsnl_dict in mpsnl_cursor:
start_time = time.clock()
exc_raised = False
try:
mpsnl = MPStructureNL.from_dict(mpsnl_dict)
sf = SpacegroupAnalyzer(mpsnl.structure, symprec=0.1)
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
exc_raised = True
is_good = (not exc_raised and sf.get_spacegroup_number() == mpsnl.sg_num)
if is_good: # Bar (good)
num_good_ids += 1
data = dict(x=[num_good_ids], y=[range_index])
else: # Scatter (bad)
if exc_raised:
category = 2 if fnmatch(str(exc_type), '*pybtex*') else 3
text = ' '.join([str(exc_type), str(exc_value)])
else:
category = int(sf.get_spacegroup_number() == 0)
text = '%s: %d' % (mpsnl.snlgroup_key, sf.get_spacegroup_number())
colors.append(category_colors[category])
data = dict(
x=mpsnl_dict['snl_id']%num_ids_per_stream,
y=range_index, text=text, marker=Marker(color=colors)
)
s[is_good].write(data)
for i in range(len(idxs)): s[i].close()
示例9: run_task
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def run_task(self, fw_spec):
btrap_dir = os.path.join(os.getcwd(), "boltztrap")
bta = BoltztrapAnalyzer.from_files(btrap_dir)
d = bta.as_dict()
d["boltztrap_dir"] = btrap_dir
# trim the output
for x in ['cond', 'seebeck', 'kappa', 'hall', 'mu_steps',
'mu_doping', 'carrier_conc']:
del d[x]
if not self.get("hall_doping"):
del d["hall_doping"]
# add the structure
bandstructure_dir = os.getcwd()
v, o = get_vasprun_outcar(bandstructure_dir, parse_eigen=False,
parse_dos=False)
structure = v.final_structure
d["structure"] = structure.as_dict()
d.update(get_meta_from_structure(structure))
d["bandstructure_dir"] = bandstructure_dir
# add the spacegroup
sg = SpacegroupAnalyzer(Structure.from_dict(d["structure"]), 0.1)
d["spacegroup"] = {"symbol": sg.get_spacegroup_symbol(),
"number": sg.get_spacegroup_number(),
"point_group": sg.get_point_group(),
"source": "spglib",
"crystal_system": sg.get_crystal_system(),
"hall": sg.get_hall()}
d["created_at"] = datetime.utcnow()
db_file = env_chk(self.get('db_file'), fw_spec)
if not db_file:
with open(os.path.join(btrap_dir, "boltztrap.json"), "w") as f:
f.write(json.dumps(d, default=DATETIME_HANDLER))
else:
mmdb = MMDb.from_db_file(db_file, admin=True)
# dos gets inserted into GridFS
dos = json.dumps(d["dos"], cls=MontyEncoder)
fsid, compression = mmdb.insert_gridfs(
dos, collection="dos_boltztrap_fs", compress=True)
d["dos_boltztrap_fs_id"] = fsid
del d["dos"]
mmdb.db.boltztrap.insert(d)
示例10: _get_data_from_single_dirc
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def _get_data_from_single_dirc(dirc, src_str="str_relax.out",
src_ene='energy'):
"""
指定したdircから構造とエネルギーを読み取る
"""
src = os.path.join(dirc, src_str)
strout = StrOut.from_file(src)
src = os.path.join(dirc, src_ene)
with open(src, 'r') as rfile:
lines = rfile.readlines()
num_atoms = sum(strout.structure.composition.
to_data_dict['unit_cell_composition'].values())
energy = float(lines[0]) / num_atoms
analyzer = SpacegroupAnalyzer(strout.structure)
#std_prim = analyzer.get_primitive_standard_structure()
std_str = analyzer.get_conventional_standard_structure()
analyzer = SpacegroupAnalyzer(std_str)
wyckoffs = analyzer.get_symmetry_dataset()['wyckoffs']
formula = std_str.composition.to_data_dict['unit_cell_composition']
symbol_spg = analyzer.get_spacegroup_symbol()
num_spg = analyzer.get_spacegroup_number()
spg = [symbol_spg, num_spg]
lattice = std_str.as_dict()['lattice']
equiv_sites = analyzer.get_symmetrized_structure().equivalent_sites
equiv_indices = analyzer.get_symmetrized_structure().equivalent_indices
# Wycoffs labelと組み合わせたsites_groupのlistを作る
sites_and_wyckoffs = []
for eq_s, eq_i in zip(equiv_sites, equiv_indices):
sites_and_wyckoffs.append({'wyckoffs': wyckoffs[eq_i[0]],
'site_grp': eq_s})
# check
for i in range(len(eq_i)-1):
if wyckoffs[eq_i[i]] != wyckoffs[eq_i[i+1]] or \
len(eq_s) != len(eq_i):
print("wyckoffs label is wrong !!!!")
print(wyckoffs)
print(eq_i)
print(len(eq_s))
print(dirc)
exit()
return {'formula': formula, 'lattice': lattice, 'spg': spg,
'sites_and_wyckoffs': sites_and_wyckoffs, 'energy': energy,
'str_id': os.path.basename(dirc)}
示例11: test_apply_transformation
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def test_apply_transformation(self):
trans = MagOrderingTransformation({"Fe": 5})
p = Poscar.from_file(os.path.join(test_dir, "POSCAR.LiFePO4"), check_for_POTCAR=False)
s = p.structure
alls = trans.apply_transformation(s, 10)
self.assertEqual(len(alls), 3)
f = SpacegroupAnalyzer(alls[0]["structure"], 0.1)
self.assertEqual(f.get_spacegroup_number(), 31)
model = IsingModel(5, 5)
trans = MagOrderingTransformation({"Fe": 5}, energy_model=model)
alls2 = trans.apply_transformation(s, 10)
# Ising model with +J penalizes similar neighbor magmom.
self.assertNotEqual(alls[0]["structure"], alls2[0]["structure"])
self.assertEqual(alls[0]["structure"], alls2[2]["structure"])
s = self.get_structure("Li2O")
# Li2O doesn't have magnetism of course, but this is to test the
# enumeration.
trans = MagOrderingTransformation({"Li+": 1}, max_cell_size=3)
alls = trans.apply_transformation(s, 100)
self.assertEqual(len(alls), 10)
示例12: set_output_data
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def set_output_data(self, d_calc, d):
"""
set the 'output' key
"""
d["output"] = {
"structure": d_calc["output"]["structure"],
"density": d_calc.pop("density"),
"energy": d_calc["output"]["energy"],
"energy_per_atom": d_calc["output"]["energy_per_atom"]}
d["output"].update(self.get_basic_processed_data(d))
sg = SpacegroupAnalyzer(Structure.from_dict(d_calc["output"]["structure"]), 0.1)
if not sg.get_symmetry_dataset():
sg = SpacegroupAnalyzer(Structure.from_dict(d_calc["output"]["structure"]), 1e-3, 1)
d["output"]["spacegroup"] = {
"source": "spglib",
"symbol": sg.get_spacegroup_symbol(),
"number": sg.get_spacegroup_number(),
"point_group": sg.get_point_group(),
"crystal_system": sg.get_crystal_system(),
"hall": sg.get_hall()}
if d["input"]["parameters"].get("LEPSILON"):
for k in ['epsilon_static', 'epsilon_static_wolfe', 'epsilon_ionic']:
d["output"][k] = d_calc["output"][k]
示例13: __init__
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def __init__(self, struct, symprec=None):
format_str = "{:.8f}"
block = OrderedDict()
loops = []
latt = struct.lattice
comp = struct.composition
no_oxi_comp = comp.element_composition
spacegroup = ("P 1", 1)
if symprec is not None:
sf = SpacegroupAnalyzer(struct, symprec)
spacegroup = (sf.get_spacegroup_symbol(),
sf.get_spacegroup_number())
block["_symmetry_space_group_name_H-M"] = spacegroup[0]
for cell_attr in ['a', 'b', 'c']:
block["_cell_length_" + cell_attr] = format_str.format(
getattr(latt, cell_attr))
for cell_attr in ['alpha', 'beta', 'gamma']:
block["_cell_angle_" + cell_attr] = format_str.format(
getattr(latt, cell_attr))
block["_symmetry_Int_Tables_number"] = spacegroup[1]
block["_chemical_formula_structural"] = no_oxi_comp.reduced_formula
block["_chemical_formula_sum"] = no_oxi_comp.formula
block["_cell_volume"] = latt.volume.__str__()
reduced_comp, fu = no_oxi_comp.get_reduced_composition_and_factor()
block["_cell_formula_units_Z"] = str(int(fu))
if symprec is None:
block["_symmetry_equiv_pos_site_id"] = ["1"]
block["_symmetry_equiv_pos_as_xyz"] = ["x, y, z"]
else:
sf = SpacegroupAnalyzer(struct, symprec)
def round_symm_trans(i):
for t in TRANSLATIONS.values():
if abs(i - t) < symprec:
return t
if abs(i - round(i)) < symprec:
return 0
raise ValueError("Invalid translation!")
symmops = []
for op in sf.get_symmetry_operations():
v = op.translation_vector
v = [round_symm_trans(i) for i in v]
symmops.append(SymmOp.from_rotation_and_translation(
op.rotation_matrix, v))
ops = [op.as_xyz_string() for op in symmops]
block["_symmetry_equiv_pos_site_id"] = \
["%d" % i for i in range(1, len(ops) + 1)]
block["_symmetry_equiv_pos_as_xyz"] = ops
loops.append(["_symmetry_equiv_pos_site_id",
"_symmetry_equiv_pos_as_xyz"])
contains_oxidation = True
try:
symbol_to_oxinum = OrderedDict([
(el.__str__(), float(el.oxi_state))
for el in sorted(comp.elements)])
except AttributeError:
symbol_to_oxinum = OrderedDict([(el.symbol, 0) for el in
sorted(comp.elements)])
contains_oxidation = False
if contains_oxidation:
block["_atom_type_symbol"] = symbol_to_oxinum.keys()
block["_atom_type_oxidation_number"] = symbol_to_oxinum.values()
loops.append(["_atom_type_symbol", "_atom_type_oxidation_number"])
atom_site_type_symbol = []
atom_site_symmetry_multiplicity = []
atom_site_fract_x = []
atom_site_fract_y = []
atom_site_fract_z = []
atom_site_label = []
atom_site_occupancy = []
count = 1
if symprec is None:
for site in struct:
for sp, occu in site.species_and_occu.items():
atom_site_type_symbol.append(sp.__str__())
atom_site_symmetry_multiplicity.append("1")
atom_site_fract_x.append("{0:f}".format(site.a))
atom_site_fract_y.append("{0:f}".format(site.b))
atom_site_fract_z.append("{0:f}".format(site.c))
atom_site_label.append("{}{}".format(sp.symbol, count))
atom_site_occupancy.append(occu.__str__())
count += 1
else:
# The following just presents a deterministic ordering.
unique_sites = [
(sorted(sites, key=lambda s: tuple([abs(x) for x in
s.frac_coords]))[0],
len(sites))
for sites in sf.get_symmetrized_structure().equivalent_sites
]
for site, mult in sorted(
#.........这里部分代码省略.........
示例14: analyze
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
#.........这里部分代码省略.........
if delta_energy and delta_bandgap: writer1.writerow(row)
else: writer2.writerow(row)
elif args.fig_id == 16:
out_fig = Figure()
badsnls_trace = Scatter(x=[], y=[], text=[], mode='markers', name='SG Changes')
bisectrix = Scatter(x=[0,230], y=[0,230], mode='lines', name='bisectrix')
print 'pulling bad snls from plotly ...'
bad_snls = OrderedDict()
for category, text in zip(fig['data'][2]['y'], fig['data'][2]['text']):
for snl_id in map(int, text.split('<br>')):
bad_snls[snl_id] = category
with open('mpworks/check_snl/results/bad_snls.csv', 'wb') as f:
print 'pulling bad snls from database ...'
mpsnl_cursor = sma.snl.find({
'snl_id': { '$in': bad_snls.keys() },
'about.projects': {'$ne': 'CederDahn Challenge'}
})
writer = csv.writer(f)
writer.writerow([
'snl_id', 'category', 'snlgroup_key', 'nsites', 'remarks', 'projects', 'authors'
])
print 'writing bad snls to file ...'
for mpsnl_dict in mpsnl_cursor:
mpsnl = MPStructureNL.from_dict(mpsnl_dict)
row = [ mpsnl.snl_id, bad_snls[mpsnl.snl_id], mpsnl.snlgroup_key ]
row += _get_snl_extra_info(mpsnl)
writer.writerow(row)
sg_num = mpsnl.snlgroup_key.split('--')[1]
if (bad_snls[mpsnl.snl_id] == 'SG default' and sg_num != '-1') or \
bad_snls[mpsnl.snl_id] == 'SG change':
mpsnl.structure.remove_oxidation_states()
sf = SpacegroupAnalyzer(mpsnl.structure, symprec=0.1)
badsnls_trace['x'].append(mpsnl.sg_num)
badsnls_trace['y'].append(sf.get_spacegroup_number())
badsnls_trace['text'].append(mpsnl.snl_id)
if bad_snls[mpsnl.snl_id] == 'SG default':
print sg_num, sf.get_spacegroup_number()
print 'plotting out-fig ...'
out_fig['data'] = Data([bisectrix, badsnls_trace])
out_fig['layout'] = Layout(
showlegend=False, hovermode='closest',
title='Spacegroup Assignment Changes',
xaxis=XAxis(showgrid=False, title='old SG number', range=[0,230]),
yaxis=YAxis(showgrid=False, title='new SG number', range=[0,230]),
)
filename = 'spacegroup_changes_'
filename += datetime.datetime.now().strftime('%Y-%m-%d')
py.plot(out_fig, filename=filename, auto_open=False)
elif args.fig_id == 43: # SNLGroupMemberChecker
matcher2 = StructureMatcher(
ltol=0.2, stol=0.3, angle_tol=5, primitive_cell=False, scale=True,
attempt_supercell=True, comparator=ElementComparator()
)
print 'pulling data from plotly ...'
trace = Scatter(x=[], y=[], text=[], mode='markers', name='mismatches')
bad_snls = OrderedDict() # snlgroup_id : [ mismatching snl_ids ]
for category, text in zip(fig['data'][2]['y'], fig['data'][2]['text']):
if category != 'mismatch': continue
for entry in text.split('<br>'):
fields = entry.split(':')
snlgroup_id = int(fields[0].split(',')[0])
print snlgroup_id
snlgrp_dict = sma.snlgroups.find_one({ 'snlgroup_id': snlgroup_id })
snlgrp = SNLGroup.from_dict(snlgrp_dict)
s1 = snlgrp.canonical_structure.get_primitive_structure()
bad_snls[snlgroup_id] = []
示例15: get_sg_info
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_spacegroup_number [as 别名]
def get_sg_info(ss):
finder = SpacegroupAnalyzer(Structure.from_sites(ss), self.symm_prec)
sgnum = finder.get_spacegroup_number()
return sgnum