<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_file(self, filename, distance=6, velocity=8, charge=3):
 """ Writes LammpsData to file. Args: filename (str):
 Filename. distance (int):
 No. of significant figures to output for box settings (bounds and tilt) and atomic coordinates. Default to 6. velocity (int):
 No. of significant figures to output for velocities. Default to 8. charge (int):
 No. of significant figures to output for charges. Default to 3. """

        with open(filename, "w") as f:
            f.write(self.get_string(distance=distance, velocity=velocity,
                                    charge=charge))