def spmwrite(self, method="", nmode="", inputs="", inputlabels="",
             outputs="", outputlabels="", nic="", velacckey="",
             fileformat="", **kwargs):
    """Calculates the state-space matrices and writes them to the SPM file.

    APDL Command: SPMWRITE

    Parameters
    ----------
    method
        Reduction method for the calculation of the state-space matrices.

        MODAL - Method based on modal analysis results from LANB, LANPCG, SNODE, or SUBSP
                eigensolver (default).

    nmode
        Number of modes to be used. Defaults to all modes.

    inputs
        Definition of the inputs. Defaults to all load vectors on the MODE
        file.

    inputlabels
        Definition of the input labels. Defaults to the load vector numbers
        or input definition (node and degree of freedom array parameter),
        depending on the Inputs specification.

    outputs
        Definition of the outputs. Defaults to the inputs.

    outputlabels
        Definition of the output labels. Defaults to the output definition
        (node and degree of freedom) if used, else defaults to the
        InputLabels.

    nic
        Load vector on the MODE file used for the calculation of the
        initial conditions. Defaults to no initial condition.

    velacckey
        Output velocities and accelerations key.

        OFF - Output displacements only (default).

        ON - Output displacements, velocities and accelerations.

    fileformat
        The format of the SPM file.

        0 - Dense format.

        1 - Matrix Market Exchange format (non-zero terms only).

        2 - Simplorer SML format without reference (default).

        3 - Simplorer SML format with common reference.

        4 - Simplorer SML format with independent references.

    Notes
    -----
    The SPMWRITE generates the file Jobname.SPM containing the state-space
    matrices and other information.

    The following applies to the SML formats (FileFormat = 2, 3, and 4):

    For conservative systems where the outputs are equal to the inputs
    (Outputs is left blank):

    The labels for the inputs (InputLabels) are required.

    The Inputs must use the array parameter option so that the input
    degrees of freedom (DOFs) are known.

    For non-conservative systems where the outputs are not equal to the
    inputs:

    The labels for the outputs (OutputLabels) are required.

    The file formats with references (FileFormat = 3 and 4) do not apply.

    Velocity and acceleration results are not included in the state-space
    matrices calculation (VelAccKey = OFF)

    File format with common reference (FileFormat = 3) does not apply if
    the inputs are based on DOFs of a different nature.  All input DOFs
    must be either all rotational or all translational and not a mix of the
    two.

    A graphics file (Jobname_SPM.PNG) is generated. It contains an element
    plot of the model.

    For more details about the reduction method and the generation of the
    state-space matrices, see Reduced-Order Modeling for State-Space
    Matrices Export in the Mechanical APDL Theory Reference.

    For examples of the command usage, see State-Space Matrices Export.
    """
    command = f"SPMWRITE,{method},{nmode},{inputs},{inputlabels},{outputs},{outputlabels},{nic},{velacckey},{fileformat}"
    return self.run(command, **kwargs)