Spaces:
Runtime error
Runtime error
def generate_xyz_text(atoms): | |
""" | |
Generate the text content of an XYZ format from a list of atoms. | |
:param atoms: List of atoms with their symbols and coordinates | |
:return: XYZ format as a string | |
""" | |
xyz_content = f"{len(atoms)}\n" | |
xyz_content += "XYZ file content generated from atoms_to_greed function\n" | |
for atom in atoms: | |
symbol, coordinates = atom | |
xyz_content += f"{symbol} {coordinates[0]:.3f} {coordinates[1]:.3f} {coordinates[2]:.3f}\n" | |
return xyz_content |