def from_dict(cls, d):
        """
        Creates a CTRL file object from a dictionary. The dictionary
        must contain the items "ALAT", PLAT" and "SITE".

        Valid dictionary items are:
            ALAT: the a-lattice parameter
            PLAT: (3x3) array for the lattice vectors
            SITE: list of dictionaries: {'ATOM': class label,
                                         'POS': (3x1) array of fractional
                                                coordinates}
            CLASS (optional): list of unique atom labels as str
            SPCGRP (optional): space group symbol (str) or number (int)
            HEADER (optional): HEADER text as a str
            VERS (optional): LMTO version as a str

        Args:
            d: The CTRL file as a dictionary.

        Returns:
            An LMTOCtrl object.
        """
        for cat in ["HEADER", "VERS"]:
            if cat not in d:
                d[cat] = None
        alat = d["ALAT"] * bohr_to_angstrom
        plat = d["PLAT"] * alat
        species = []
        positions = []
        for site in d["SITE"]:
            species.append(re.split("[0-9*]", site["ATOM"])[0])
            positions.append(site["POS"] * alat)

        # Only check if the structure is to be generated from the space
        # group if the number of sites is the same as the number of classes.
        # If lattice and the spacegroup don't match, assume it's primitive.
        if "CLASS" in d and "SPCGRP" in d \
           and len(d["SITE"]) == len(d["CLASS"]):
            try:
                structure = Structure.from_spacegroup(d["SPCGRP"], plat,
                                                      species, positions,
                                                      coords_are_cartesian=True)
            except ValueError:
                structure = Structure(plat, species, positions,
                                      coords_are_cartesian=True,
                                      to_unit_cell=True)
        else:
            structure = Structure(plat, species, positions,
                                  coords_are_cartesian=True,
                                  to_unit_cell=True)

        return cls(structure, header=d["HEADER"], version=d["VERS"])
Creates a CTRL file object from a dictionary. The dictionary
        must contain the items "ALAT", PLAT" and "SITE".

        Valid dictionary items are:
            ALAT: the a-lattice parameter
            PLAT: (3x3) array for the lattice vectors
            SITE: list of dictionaries: {'ATOM': class label,
                                         'POS': (3x1) array of fractional
                                                coordinates}
            CLASS (optional): list of unique atom labels as str
            SPCGRP (optional): space group symbol (str) or number (int)
            HEADER (optional): HEADER text as a str
            VERS (optional): LMTO version as a str

        Args:
            d: The CTRL file as a dictionary.

        Returns:
            An LMTOCtrl object.