def write(self, atomdict): """ Write an atom to the file. Args: atom (dict): a dictionary describing the atom. """ from BigDFT.Atoms import Atom at = Atom(atomdict) self._handle.write(at.sym + " ") pos = at.get_position(self.units) self._handle.write(" ".join([str(x) for x in pos])) self._handle.write("\n")
def update_positions_from_dict(self, posinp): """ Update the atomic positions of a system from a posinp dictionary. This method only works if the order of atoms match. Args: posinp (dict): a posinp dictionary. """ from BigDFT.Atoms import Atom units = posinp.get("units", "angstroem") i = 0 for frag in self.values(): for at in frag: at2 = Atom(posinp["positions"][i], units=units) at.set_position(at2.get_position()) i += 1