def __str__(self):
        """
        Sorts a Structure (by fractional co-ordinate), and
        prints sites with magnetic information. This is
        useful over Structure.__str__ because sites are in
        a consistent order, which makes visual comparison between
        two identical Structures with different magnetic orderings
        easier.
        :return:
        """

        frac_coords = self.structure.frac_coords
        sorted_indices = np.lexsort(
            (frac_coords[:, 2], frac_coords[:, 1], frac_coords[:, 0])
        )
        s = Structure.from_sites([self.structure[idx] for idx in sorted_indices])

        # adapted from Structure.__repr__
        outs = ["Structure Summary", repr(s.lattice)]
        outs.append("Magmoms Sites")
        for site in s:
            if site.properties["magmom"] != 0:
                prefix = "{:+.2f}   ".format(site.properties["magmom"])
            else:
                prefix = "        "
            outs.append(prefix + repr(site))
        return "\n".join(outs)
def __str__ ( self ) : frac_coords = self . structure . frac_coords sorted_indices = np . lexsort ( ( frac_coords [ : , 2 ] , frac_coords [ : , 1 ] , frac_coords [ : , 0 ] ) ) s = Structure . from_sites ( [ self . structure [ idx ] for idx in sorted_indices ] ) outs = [ "Structure Summary" , repr ( s . lattice ) ] outs . append ( "Magmoms Sites" ) for site in s : if site . properties [ "magmom" ] != 0 : prefix = "{:+.2f}   " . format ( site . properties [ "magmom" ] ) else : prefix = "        " outs . append ( prefix + repr ( site ) ) return "\n" . join ( outs )
Sorts a Structure (by fractional co-ordinate), and
        prints sites with magnetic information. This is
        useful over Structure.__str__ because sites are in
        a consistent order, which makes visual comparison between
        two identical Structures with different magnetic orderings
        easier.
        :return: