diff --git a/cubehandler/cube.py b/cubehandler/cube.py index 96330a6..f16c31e 100644 --- a/cubehandler/cube.py +++ b/cubehandler/cube.py @@ -140,6 +140,10 @@ def from_file(cls, filepath, read_data=True): c = cls.from_file_handle(f, read_data=read_data) return c + @classmethod + def from_content(cls, content, read_data=True): + return cls.from_file_handle(io.StringIO(content), read_data=read_data) + def write_cube_file(self, filename, low_precision=False): natoms = len(self.ase_atoms)