def polarGroupUsedInMP():
    """
    Materials Project has more space groups than normal convention. This function finds
    all the polar groups for materials project extended list of space groups.
    """
    # This is a list of the point groups as noted in pymatgen
    point_groups = []
    for i in range(1,231):
        symbol = sg_symbol_from_int_number(i)
        point_groups.append(SYMM_DATA['space_group_encoding'][symbol]['point_group'])

    # Note that there are 40 of them, rather than 32.
    print("Number of point groups denoted in pymatgen: {}".format(len(set(point_groups))))

    # This is because multiple conventions are used for the same point group.
    # This dictionary can be used to convert between them.
    point_group_conv = {'321' :'32', '312': '32', '3m1' :'3m', '31m': '3m',
                        '-3m1' : '-3m', '-31m': '-3m', '-4m2': '-42m', '-62m': '-6m2' }

    # Using this dictionary we can correct to the standard point group notation.
    corrected_point_groups = [point_group_conv.get(pg, pg) for pg in point_groups]
    # Which produces the correct number of point groups. 32.
    print("Number of point groups in conventional notation: {}".format(len(set(corrected_point_groups))))

    # There are 10 polar point groups
    polar_point_groups = ['1', '2', 'm', 'mm2', '4', '4mm', '3', '3m', '6', '6mm']

    # Polar spacegroups have polar point groups.
    polar_spacegroups = []

    # There are 230 spacegroups
    for i in range(1,231):
        symbol = sg_symbol_from_int_number(i)
        pg = SYMM_DATA['space_group_encoding'][symbol]['point_group']
        if point_group_conv.get(pg, pg) in polar_point_groups:
            polar_spacegroups.append(i)

    # 68 of the 230 spacegroups are polar.
    print("Number of polar spacegroups: {}".format(len(polar_spacegroups)))

    return polar_spacegroups
def cellsize(sg):
    """
    Returns the number of duplications in the conventional lattice
    """
    symbol = sg_symbol_from_int_number(sg)
    letter = symbol[0]
    if letter == 'P':
    	return 1
    if letter in ['A', 'C', 'I']:
    	return 2
    elif letter in ['R']:
    	return 3
    elif letter in ['F']:
    	return 4
    else: return "Error: Could not determine lattice type"
Example #3
0
 def spacegroup(self):
     sg_symbol = sg_symbol_from_int_number(self.spacegroup_number)
     return SpaceGroup(sg_symbol)
                target = spacegroups_all_classes[str(atoms.info['target'])]

                y_true_spglib_all_classes.extend([target])

                #atom_class_true = spacegroup_dict[target]
                # y_true.extend(atom_class_true)

                #mg_structure = AseAtomsAdaptor.get_structure(prototypes[0]*(4,4,4))
                #finder = SpacegroupAnalyzer(mg_structure)
                #symb = finder.get_space_group_symbol()

                # loose
                #spno = ase_get_spacegroup(atoms, symprec=0.1).no
                spno = get_spacegroup(atoms, symprec=0.1, angle_tolerance=5)[0]
                sg_sym = sg_symbol_from_int_number(
                    spno, hexagonal=False
                )  # hexagonal should be false, otherwise geth H at the end for rhombohedral groups 160,166,155,146,148,167 etc
                # only include structures from aflow for testing spglib
                if atoms.info[
                        'target'] in materials_being_allowed:  #targets_ordered_by_materialtype['Binaries'] or atoms.info['target'] in targets_ordered_by_materialtype['Elemental_solids']:
                    y_pred_loose.extend([sg_sym])
                    y_true_spglib.extend([target])
                y_pred_loose_all_classes.extend([sg_sym])
                # tight
                #spno = ase_get_spacegroup(atoms, symprec=1e-3).no
                spno = get_spacegroup(atoms, symprec=1e-4,
                                      angle_tolerance=1)[0]
                sg_sym = sg_symbol_from_int_number(
                    spno, hexagonal=False
                )  # hexagonal should be false, otherwise geth H at the end for rhombohedral groups 160,166,155,146,148,167 etc
                # only include structures from aflow for testing spglib