dpgen.database package

class dpgen.database.DPPotcar(symbols=None, functional='PBE', pp_file=None, pp_lists=None)[source]

Bases: MSONable

Methods

as_dict()

A JSON serializable dict representation of an object.

from_dict(d)

param d:

Dict representation.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an hash of the current object.

validate_monty_v1(_MSONable__input_value)

Pydantic validator with correct signature for pydantic v1.x

validate_monty_v2(_MSONable__input_value, _)

Pydantic validator with correct signature for pydantic v2.x

from_file

write_file

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters:

d – Dict representation.

Returns:

MSONable class.

classmethod from_file(filename)[source]
write_file(filename)[source]
class dpgen.database.Entry(composition, calculator, inputs, data, entry_id=None, attribute=None, tag=None)[source]

Bases: MSONable

An lightweight Entry object containing key computed data for storing purpose.

Parameters:
compositionComposition

Composition of the entry. For flexibility, this can take the form of all the typical input taken by a Composition, including a {symbol: amt} dict, a string formula, and others.

inputsdict

An dict of parameters associated with the entry. Defaults to None.

datadict

An dict of any additional data associated with the entry. Defaults to None.

entry_idobj

An optional id to uniquely identify the entry.

attribute

Optional attribute of the entry. This can be used to specify that the entry is a newly found compound, or to specify a particular label for the entry, or else … Used for further analysis and plotting purposes. An attribute can be anything but must be MSONable.

Attributes:
number_element

Methods

as_dict()

A JSON serializable dict representation of an object.

from_dict(d)

param d:

Dict representation.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an hash of the current object.

validate_monty_v1(_MSONable__input_value)

Pydantic validator with correct signature for pydantic v1.x

validate_monty_v2(_MSONable__input_value, _)

Pydantic validator with correct signature for pydantic v2.x

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters:

d – Dict representation.

Returns:

MSONable class.

property number_element
class dpgen.database.VaspInput(incar, poscar, potcar, kpoints=None, optional_files=None, **kwargs)[source]

Bases: dict, MSONable

Class to contain a set of vasp input objects corresponding to a run.

Args:

incar: Incar object. kpoints: Kpoints object. poscar: Poscar object. potcar: Potcar object. optional_files: Other input files supplied as a dict of {

filename: object}. The object should follow standard pymatgen conventions in implementing a as_dict() and from_dict method.

Methods

as_dict()

A JSON serializable dict representation of an object.

clear()

copy()

from_dict(d)

param d:

Dict representation.

from_directory(input_dir[, optional_files])

Read in a set of VASP input from a directory.

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an hash of the current object.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

validate_monty_v1(_MSONable__input_value)

Pydantic validator with correct signature for pydantic v1.x

validate_monty_v2(_MSONable__input_value, _)

Pydantic validator with correct signature for pydantic v2.x

values()

write_input([output_dir, ...])

Write VASP input to a directory.

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters:

d – Dict representation.

Returns:

MSONable class.

static from_directory(input_dir, optional_files=None)[source]

Read in a set of VASP input from a directory. Note that only the standard INCAR, POSCAR, POTCAR and KPOINTS files are read unless optional_filenames is specified.

Parameters:
input_dirstr

Directory to read VASP input from.

optional_filesdict

Optional files to read in as well as a dict of {filename: Object type}. Object type must have a static method from_file.

write_input(output_dir='.', make_dir_if_not_present=True)[source]

Write VASP input to a directory.

Parameters:
output_dirstr

Directory to write to. Defaults to current directory (“.”).

make_dir_if_not_presentbool

Create the directory if not present. Defaults to True.

Submodules

dpgen.database.entry module

class dpgen.database.entry.Entry(composition, calculator, inputs, data, entry_id=None, attribute=None, tag=None)[source]

Bases: MSONable

An lightweight Entry object containing key computed data for storing purpose.

Parameters:
compositionComposition

Composition of the entry. For flexibility, this can take the form of all the typical input taken by a Composition, including a {symbol: amt} dict, a string formula, and others.

inputsdict

An dict of parameters associated with the entry. Defaults to None.

datadict

An dict of any additional data associated with the entry. Defaults to None.

entry_idobj

An optional id to uniquely identify the entry.

attribute

Optional attribute of the entry. This can be used to specify that the entry is a newly found compound, or to specify a particular label for the entry, or else … Used for further analysis and plotting purposes. An attribute can be anything but must be MSONable.

Attributes:
number_element

Methods

as_dict()

A JSON serializable dict representation of an object.

from_dict(d)

param d:

Dict representation.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an hash of the current object.

validate_monty_v1(_MSONable__input_value)

Pydantic validator with correct signature for pydantic v1.x

validate_monty_v2(_MSONable__input_value, _)

Pydantic validator with correct signature for pydantic v2.x

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters:

d – Dict representation.

Returns:

MSONable class.

property number_element

dpgen.database.run module

dpgen.database.run.db_run(args)[source]
dpgen.database.run.parsing_gaussian(path, output='dpgen_db.json')[source]
dpgen.database.run.parsing_pwscf(path, output='dpgen_db.json')[source]
dpgen.database.run.parsing_vasp(path, config_info_dict, skip_init, output='dpgen_db.json', id_prefix=None)[source]

dpgen.database.vasp module

class dpgen.database.vasp.DPPotcar(symbols=None, functional='PBE', pp_file=None, pp_lists=None)[source]

Bases: MSONable

Methods

as_dict()

A JSON serializable dict representation of an object.

from_dict(d)

param d:

Dict representation.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an hash of the current object.

validate_monty_v1(_MSONable__input_value)

Pydantic validator with correct signature for pydantic v1.x

validate_monty_v2(_MSONable__input_value, _)

Pydantic validator with correct signature for pydantic v2.x

from_file

write_file

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters:

d – Dict representation.

Returns:

MSONable class.

classmethod from_file(filename)[source]
write_file(filename)[source]
class dpgen.database.vasp.VaspInput(incar, poscar, potcar, kpoints=None, optional_files=None, **kwargs)[source]

Bases: dict, MSONable

Class to contain a set of vasp input objects corresponding to a run.

Args:

incar: Incar object. kpoints: Kpoints object. poscar: Poscar object. potcar: Potcar object. optional_files: Other input files supplied as a dict of {

filename: object}. The object should follow standard pymatgen conventions in implementing a as_dict() and from_dict method.

Methods

as_dict()

A JSON serializable dict representation of an object.

clear()

copy()

from_dict(d)

param d:

Dict representation.

from_directory(input_dir[, optional_files])

Read in a set of VASP input from a directory.

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an hash of the current object.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

validate_monty_v1(_MSONable__input_value)

Pydantic validator with correct signature for pydantic v1.x

validate_monty_v2(_MSONable__input_value, _)

Pydantic validator with correct signature for pydantic v2.x

values()

write_input([output_dir, ...])

Write VASP input to a directory.

as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
Parameters:

d – Dict representation.

Returns:

MSONable class.

static from_directory(input_dir, optional_files=None)[source]

Read in a set of VASP input from a directory. Note that only the standard INCAR, POSCAR, POTCAR and KPOINTS files are read unless optional_filenames is specified.

Parameters:
input_dirstr

Directory to read VASP input from.

optional_filesdict

Optional files to read in as well as a dict of {filename: Object type}. Object type must have a static method from_file.

write_input(output_dir='.', make_dir_if_not_present=True)[source]

Write VASP input to a directory.

Parameters:
output_dirstr

Directory to write to. Defaults to current directory (“.”).

make_dir_if_not_presentbool

Create the directory if not present. Defaults to True.