Ejemplo n.º 1
0
    def asdict(self):
        """Return a dictionary representation of the calculator state.
        Does NOT contain information on the ``command``, ``txt`` or
        ``directory`` keywords.
        Contains the following keys:

            - ``ase_version``
            - ``vasp_version``
            - ``inputs``
            - ``results``
            - ``atoms`` (Only if the calculator has an ``Atoms`` object)
        """
        # Get versions
        asevers = ase.__version__
        vaspvers = self.get_version()

        self._store_param_state()  # Update param state
        # Store input parameters which have been set
        inputs = {key: value for param_dct in self.param_state.values()
                  for key, value in param_dct.items()
                  if value is not None}

        dct = {'ase_version': asevers,
               'vasp_version': vaspvers,
               # '__ase_objtype__': self.ase_objtype,
               'inputs': inputs,
               'results': self.results.copy()}

        if self.atoms:
            # Encode atoms as dict
            from ase.db.row import atoms2dict
            dct['atoms'] = atoms2dict(self.atoms)

        return dct
Ejemplo n.º 2
0
 def __init__(self, atoms):
     self.bigdct = {1: atoms2dict(atoms)}