def _prepare_cif(self, trajectory_index=None): """ Write the given trajectory to a string of format CIF. """ import CifFile from aiida.orm.data.cif \ import ase_loops, cif_from_ase, pycifrw_from_cif cif = "" indices = range(self.numsteps) if trajectory_index is not None: indices = [trajectory_index] for idx in indices: structure = self.get_step_structure(idx) ciffile = pycifrw_from_cif(cif_from_ase(structure.get_ase()), ase_loops) cif = cif + ciffile.WriteOut() return cif
def _prepare_cif(self, trajectory_index=None, main_file_name=""): """ Write the given trajectory to a string of format CIF. """ import CifFile from aiida.orm.data.cif \ import ase_loops, cif_from_ase, pycifrw_from_cif from aiida.common.utils import HiddenPrints cif = "" indices = range(self.numsteps) if trajectory_index is not None: indices = [trajectory_index] for idx in indices: structure = self.get_step_structure(idx) ciffile = pycifrw_from_cif(cif_from_ase(structure.get_ase()), ase_loops) with HiddenPrints(): cif = cif + ciffile.WriteOut() return cif.encode('utf-8'), {}