pymatgen.io.adf module

class AdfInput(task)[source]

Bases: object

A basic ADF input file writer.

Initialization method.

Parameters

task (AdfTask) – An ADF task.

write_file(molecule, inpfile)[source]

Write an ADF input file.

Parameters
  • molecule (Molecule) – The molecule for this task.

  • inpfile (str) – The name where the input file will be saved.

exception AdfInputError[source]

Bases: Exception

The default error class for ADF.

class AdfKey(name, options=None, subkeys=None)[source]

Bases: monty.json.MSONable

The basic input unit for ADF. A key is a string of characters that does not contain a delimiter (blank, comma or equal sign). A key may have multiple subkeys and a set of options.

Initialization method.

Parameters
  • name (str) – The name of this key.

  • options (Sized) – The options for this key. Each element can be a primitive object or a tuple/list with two elements: the first is the name and the second is a primitive object.

  • subkeys (Sized) – The subkeys for this key.

Raises

ValueError – If elements in subkeys are not AdfKey objects.

add_option(option)[source]

Add a new option to this key.

Parameters

option (Sized or str or int or float) – A new option to add. This must have the same format with exsiting options.

Raises

TypeError – If the format of the given option is different.

add_subkey(subkey)[source]

Add a new subkey to this key.

Parameters

subkey (AdfKey) – A new subkey.

Notes

Duplicate check will not be performed if this is an ‘Atoms’ block.

as_dict()[source]

A JSON serializable dict representation of self.

block_keys = {'A1FIT', 'ANALYTICALFREQ', 'ATOMS', 'BASIS', 'CHARGE', 'EXACTDENSITY', 'GEOMETRY', 'INTEGRATION', 'OCCUPATIONS', 'RELATIVISTIC', 'SAVE', 'SCF', 'SYMMETRY', 'TITLE', 'TOTALENERGY', 'UNITS', 'UNRESTRICTED', 'XC', 'ZLMFIT'}
classmethod from_dict(d)[source]

Construct a MSONable AdfKey object from the JSON dict.

Parameters

d (dict) – A dict of saved attributes.

Returns

adfkey – An AdfKey object recovered from the JSON dict d.

Return type

AdfKey

static from_string(string)[source]

Construct an AdfKey object from the string.

Parameters

string (str) – A string.

Returns

adfkey – An AdfKey object recovered from the string.

Return type

AdfKey

Raises

ValueError – Currently nested subkeys are not supported. If subend was found a ValueError would be raised.

Notes

Only the first block key will be returned.

has_option(option)[source]

Return True if the option is included in this key.

Parameters

option (str) – The option.

Returns

has – True if the option can be found. Otherwise False will be returned.

Return type

bool

has_subkey(subkey)[source]

Return True if this AdfKey contains the given subkey.

Parameters

subkey (str or AdfKey) – A key name or an AdfKey object.

Returns

has – True if this key contains the given key. Otherwise False.

Return type

bool

is_block_key()[source]

Return True if this key is a block key.

key

Return the name of this key. If this is a block key, the name will be converted to upper cases.

remove_option(option)[source]

Remove an option.

Parameters

option (str or int) – The name (str) or index (int) of the option to remove.

Raises

TypeError – If the option has a wrong type.

remove_subkey(subkey)[source]

Remove the given subkey, if existed, from this AdfKey.

Parameters

subkey (str or AdfKey) – The subkey to remove.

sub_keys = {'AtomDepQuality'}
to_json()[source]

Return a json string representation of the MSONable AdfKey object.

class AdfOutput(filename)[source]

Bases: object

A basic ADF output file parser.

is_failed

True is the ADF job is terminated without success. Otherwise False.

Type

bool

is_internal_crash

True if the job is terminated with internal crash. Please read ‘TAPE13’ of the ADF manual for more detail.

Type

bool

error

The error description.

Type

str

run_type

The RunType of this ADF job. Possible options are: ‘SinglePoint’, ‘GeometryOptimization’, ‘AnalyticalFreq’ and ‘NUmericalFreq’.

Type

str

final_energy

The final molecule energy (a.u).

Type

float

final_structure

The final structure of the molecule.

Type

GMolecule

energies

The energy of each cycle.

Type

Sized

structures

The structure of each cycle If geometry optimization is performed.

Type

Sized

frequencies

The frequencies of the molecule.

Type

array_like

normal_modes

The normal modes of the molecule.

Type

array_like

freq_type

Either ‘Analytical’ or ‘Numerical’.

Type

str

Initialization method.

Parameters

filename (str) – The ADF output file to parse.

exception AdfOutputError[source]

Bases: Exception

The default error class for errors raised by AdfOutput.

class AdfTask(operation='energy', basis_set=None, xc=None, title='ADF_RUN', units=None, geo_subkeys=None, scf=None, other_directives=None)[source]

Bases: monty.json.MSONable

Basic task for ADF. All settings in this class are independent of molecules.

Notes

Unlike other quantum chemistry packages (NWChem, Gaussian, …), ADF does not support calculating force/gradient.

Initialization method.

Parameters
  • operation (str) – The target operation.

  • basis_set (AdfKey) – The basis set definitions for this task. Defaults to ‘DZ/Large’.

  • xc (AdfKey) – The exchange-correlation functionals. Defaults to PBE.

  • title (str) – The title of this ADF task.

  • units (AdfKey) – The units. Defaults to Angstroms/Degree.

  • geo_subkeys (Sized) – The subkeys for the block key ‘GEOMETRY’.

  • scf (AdfKey) – The scf options.

  • other_directives (Sized) – User-defined directives.

as_dict()[source]

A JSON serializable dict representation of self.

classmethod from_dict(d)[source]

Construct a MSONable AdfTask object from the JSON dict.

Parameters

d (dict) – A dict of saved attributes.

Returns

task – An AdfTask object recovered from the JSON dict d.

Return type

AdfTask

static get_default_basis_set()[source]
static get_default_geo()[source]
static get_default_scf()[source]
static get_default_units()[source]
static get_default_xc()[source]
operations = {'energy': 'Evaluate the single point energy.', 'freq': 'Same as frequencies.', 'frequencies': 'Compute second derivatives and print out an analysis of molecular vibrations.', 'numerical_frequencies': 'Compute molecular frequencies using numerical method.', 'optimize': 'Minimize the energy by varying the molecular structure.'}
to_json()[source]

Return a json string representation of the MSONable AdfTask object.

is_numeric(s)[source]

Return True is the string s is a numeric string.

Parameters

s (str) – A string.

Returns

res – If True, s is a numeric string and can be converted to an int or a float. Otherwise False will be returned.

Return type

bool

iterlines(s)[source]

A generator form of s.split(‘

‘) for reducing memory overhead.

sstr

A multi-line string.

linestr

A string.