<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def force_constants(self, force_constants):
 """Set force constants Parameters force_constants : array_like Force constants matrix. If this is given in own condiguous ndarray with order='C' and dtype='double', internal copy of data is avoided. Therefore some computational resources are saved. shape=(atoms in supercell, atoms in supercell, 3, 3), dtype='double' """


        if type(force_constants) is np.ndarray:
            fc_shape = force_constants.shape
            if fc_shape[0] != fc_shape[1]:
                if self._primitive.get_number_of_atoms() != fc_shape[0]:
                    msg = ("Force constants shape disagrees with crystal "
                           "structure setting. This may be due to "
                           "PRIMITIVE_AXIS.")
                    raise RuntimeError(msg)

        self._force_constants = force_constants
        if self._primitive.get_masses() is not None:
            self._set_dynamical_matrix()