<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_prev_calc(cls, prev_calc_dir, copy_chgcar=True, nbands_factor=1.2, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, small_gap_multiply=None, **kwargs):
 """ Generate a set of Vasp input files for SOC calculations from a directory of previous static Vasp run. SOC calc requires all 3 components for MAGMOM for each atom in the structure. Args: prev_calc_dir (str):
 The directory contains the outputs( vasprun.xml and OUTCAR) of previous vasp run. copy_chgcar: Whether to copy the old CHGCAR. Defaults to True. nbands_factor (float):
 Multiplicative factor for NBANDS. Choose a higher number if you are doing an LOPTICS calculation. standardize (float):
 Whether to standardize to a primitive standard cell. Defaults to False. sym_prec (float):
 Tolerance for symmetry finding. If not 0, the final structure from the previous run will be symmetrized to get a primitive standard cell. Set to 0 if you don't want that. international_monoclinic (bool):
 Whether to use international convention (vs Curtarolo) for monoclinic. Defaults True. reciprocal_density (int):
 density of k-mesh by reciprocal volume (defaults to 100) small_gap_multiply ([float, float]):
 If the gap is less than 1st index, multiply the default reciprocal_density by the 2nd index. \\*\\*kwargs: All kwargs supported by MPSOCSet, other than structure, prev_incar and prev_chgcar which are determined from the prev_calc_dir. """

        vasprun, outcar = get_vasprun_outcar(prev_calc_dir)

        incar = vasprun.incar
      
        # Remove magmoms from previous INCAR, since we will prefer
        # the final calculated magmoms
        # TODO: revisit in context of MPStaticSet incar logic
        if 'MAGMOM' in incar:
            del incar['magmom']
      
        # Get a magmom-decorated structure
        structure = get_structure_from_prev_run(
            vasprun, outcar, sym_prec=standardize and sym_prec,
            international_monoclinic=international_monoclinic)
        # override magmom if provided
        if kwargs.get("magmom", None):
            structure = structure.copy(
                site_properties={"magmom": kwargs["magmom"]})
            kwargs.pop("magmom", None)
        # magmom has to be 3D for SOC calculation.
        if hasattr(structure[0], "magmom"):
            if not isinstance(structure[0].magmom, list):
                structure = structure.copy(site_properties={
                    "magmom": [[0, 0, site.magmom] for site in structure]})
        else:
            raise ValueError("Neither the previous structure has mamgom "
                             "property nor magmom provided")

        nbands = int(np.ceil(vasprun.parameters["NBANDS"] * nbands_factor))
        incar.update({"NBANDS": nbands})

        if standardize:
            warnings.warn("Use of standardize=True with from_prev_run is not "
                          "recommended as there is no guarantee the copied "
                          "files will be appropriate for the standardized"
                          " structure. copy_chgcar is enforced to be false.")
            copy_chgcar = False

        files_to_transfer = {}
        if copy_chgcar:
            chgcars = sorted(glob.glob(str(Path(prev_calc_dir) / "CHGCAR*")))
            if chgcars:
                files_to_transfer["CHGCAR"] = str(chgcars[-1])

        # multiply the reciprocal density if needed:
        if small_gap_multiply:
            gap = vasprun.eigenvalue_band_properties[0]
            if gap <= small_gap_multiply[0]:
                reciprocal_density = reciprocal_density * small_gap_multiply[1]

        return cls(structure, prev_incar=incar,
                   files_to_transfer=files_to_transfer,
                   reciprocal_density=reciprocal_density, **kwargs)