pyprocar.pyposcar.Poscar — PyProcar 6.2.1 documentation

Skip to main content
`Ctrl`+`K`

# pyprocar.pyposcar.Poscar

class pyprocar.pyposcar.Poscar(filename: str = 'POSCAR', verbose: bool = False)

  A low-level class to store a crystal structure input (tailored for VASP).

  If modified manually, the ‘Cartesian’ and ‘direct’ coords must be updated together all the time by using _set_cartesian or _set_direct.

  The scaling factor, is internally set to 1.0, always. ie, the scaling is included into the lattice.

  The units are Angstroms.

  Methods:

  parse(self) # loads the whole file _set_cartesian(self) # set direct -> cartesian (internal) _set_direct(self) # set cartesian -> direct (internal) _unparse(self, direct) # data to string, use write() instead write(self, filename, direct) # saves the class to a POSCAR-like file xyz(self, filename) # saves a xyz file from the data sort(self) # sorts the atoms, grouping them by element remove() # removes one or more atoms from poscar add(position, element, direct) # add one atom, only one each the time

  Methods

  `Poscar.__init__`([filename, verbose]) | The file is not automatically loaded, you need to run self.parse()
  `Poscar.add`(position, element[, direct, ...]) | Adds one atom to the class.
  `Poscar.load_from_data`(direct_positions, ...) | It loades the Poscar class with essencial data.
  `Poscar.parse`([fromString]) | Loads into memory all the content of the POSCAR file.
  `Poscar.remove`(atoms) | Remove one or more atoms.
  `Poscar.sort`() | This method updates the internal arrays related to elements and atoms per element.
  `Poscar.write`([filename, direct]) | Writes a poscar file with the information stored in the class.
  `Poscar.xyz`(filename) | Writes an xyz file, the lattice is written as a comment line