Potential

class ase2sprkkr.potentials.potentials.Potential(atoms=None, definition=None, set_from_atoms=True)[source]

It holds data form SPR-KKR potential file

It, in addition to being a containers for their sections, can read/write its properties from/to an ASE atoms object.

Class hierarchy

Inheritance diagram of ase2sprkkr.potentials.potentials.Potential

Constructor

__init__(atoms=None, definition=None, set_from_atoms=True)[source]

Use Potential.from_atoms to reuse already created Potential object stored in atoms

read_from_file(file, atoms=None, allow_dangerous=False)[source]

Read data from a file

Parameters:
  • file (str or file) – File to read the data from

  • clear_first – Clear the container first. Otherwise, the data in the sections that are not present in the file are preserved.

  • allow_dangerous – Allow to load dangerous_values, i.e. the values that do not pass the requirements for the input values (e.g. of a different type or constraint-violating)

make_complete()[source]

Call this function, if you set manually all the properties necessary to create the atoms object

property atoms
update_atoms(atoms=None)[source]

Update the ASE object from the values contained in the sections of the potential

set_from_atoms(atoms=None, io_data=None)[source]

Set the sections’ values of the potential according to the given ASE atoms object.

Parameters:
  • atoms – The atoms object, from which the data will be set. If it is None, the atoms property of the potential (self.atoms) is used.

  • io_data (WriteIoData) – The additional (in the time of the creation frozen) state of the atoms object, that contains e.g. numbering of the sites, atomic types etc. If is not set, it is created from the atoms.

potential_definition = <POTENTIAL FILE PotentialDefinition>
static from_file(filename, atoms=None, allow_dangerous=False)[source]

Create a potential from a given potential file.

classmethod from_string(string, atoms=None, allow_dangerous=False)[source]

Create a potential from a string containing a content of a potential file.

Parameters:

string (str)

classmethod from_atoms(atoms)[source]

Create a potential, that describes the given atoms object.

reset(update_atoms=True)[source]
save_to_file(file, atoms=None, *, validate='save')[source]

Save the configuration to a file in a given format.

This routine do some basic stuff and then call _save_to_file routine, that contains the implementation specific for the type of the configuration container/value.

Parameters:
  • file (str or file) – File to read the data from

  • validate (str | bool) – Validate the data in the container first and raise an exception, if there is an error (e.g. the the data are not complete). The string value can be used to select the type of validation save means the full check (same as the default value True), use set to allow some missing values.