sisl.io.vasp.SileCDFVASP

class sisl.io.vasp.SileCDFVASP(filename, mode='r', lvl=0, access=1, *args, **kwargs)

Bases: sisl.io.SileCDF

Methods

close()

dir_file([filename, filename_base])

File of the current Sile

geometry_group(geometry[, ret_index])

Order atoms in geometry according to species such that all of one specie is consecutive

iter([group, dimension, variable, levels, root])

Iterator on all groups, variables and dimensions.

read(*args, **kwargs)

Generic read method which should be overloaded in child-classes

write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

base_file

File of the current Sile

file

File of the current Sile

__init__(filename, mode='r', lvl=0, access=1, *args, **kwargs)
property base_file

File of the current Sile

close()
dir_file(filename=None, filename_base='')

File of the current Sile

property file

File of the current Sile

static geometry_group(geometry, ret_index=False)

Order atoms in geometry according to species such that all of one specie is consecutive

When creating VASP input files (poscarSileVASP for instance) the equivalent POTCAR file needs to contain the pseudos for each specie as they are provided in blocks.

I.e. for a geometry like this: .. code:

[Atom(6), Atom(4), Atom(6)]

the resulting POTCAR needs to contain the pseudo for Carbon twice.

This method will re-order atoms according to the species”

Parameters
  • geometry (Geometry) – geometry to be re-ordered

  • ret_index (bool, optional) – return sorted indices

Returns

geometry

Return type

reordered geometry

iter(group=True, dimension=True, variable=True, levels=- 1, root=None)

Iterator on all groups, variables and dimensions.

This iterator iterates through all groups, variables and dimensions in the Dataset

The generator sequence will _always_ be:

  1. Group

  2. Dimensions in group

  3. Variables in group

As the dimensions are generated before the variables it is possible to copy groups, dimensions, and then variables such that one always ensures correct dependencies in the generation of a new SileCDF.

Parameters
  • group (bool (True)) – whether the iterator yields Group instances

  • dimension (bool (True)) – whether the iterator yields Dimension instances

  • variable (bool (True)) – whether the iterator yields Variable instances

  • levels (int (-1)) – number of levels to traverse, with respect to root variable, i.e. number of sub-groups this iterator will return.

  • root (str (None)) – the base root to start iterating from.

Examples

Script for looping and checking each instance.

>>> for gv in self.iter():
...     if self.isGroup(gv):
...         # is group
...     elif self.isDimension(gv):
...         # is dimension
...     elif self.isVariable(gv):
...         # is variable
read(*args, **kwargs)

Generic read method which should be overloaded in child-classes

Parameters

kwargs – keyword arguments will try and search for the attribute read_<> and call it with the remaining **kwargs as arguments.

write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

Parameters

**kwargs – keyword arguments will try and search for the attribute write_ and call it with the remaining **kwargs as arguments.