dpgen2.conf package#

Submodules#

dpgen2.conf.alloy_conf module#

class dpgen2.conf.alloy_conf.AlloyConf(lattice: System | Tuple[str, float], type_map: List[str], replicate: List[int] | Tuple[int, int, int] | int | None = None)[source]#

Bases: object

Parameters:
lattice Union[dpdata.System, Tuple[str,float]]

Lattice of the alloy confs. can be dpdata.System: lattice in dpdata.System Tuple[str, float]: pair of lattice type and lattice constant. lattice type can be “bcc”, “fcc”, “hcp”, “sc” or “diamond”

replicate Union[List[int], Tuple[int], int]

replicate of the lattice

type_map List[str]

The type map

Methods

generate_file_content(numb_confs[, ...])

generate_systems(numb_confs[, ...])

generate_file_content(numb_confs, concentration: List[List[float]] | List[float] | None = None, cell_pert_frac: float = 0.0, atom_pert_dist: float = 0.0, fmt: str = 'lammps/lmp') List[str][source]#
Parameters:
numb_confs int

Number of configurations to generate

concentration List[List[float]] or List[float] or None

If List[float], the concentrations of each element. The length of the list should be the same as the type_map. If List[List[float]], a list of concentrations (List[float]) is randomly picked from the List. If None, the elements are assumed to be of equal concentration.

cell_pert_frac float

fraction of cell perturbation

atom_pert_dist float

the atom perturbation distance (unit angstrom).

fmt str

the format of the returned conf strings. Should be one of the formats supported by dpdata

Returns:
conf_list List[str]

A list of file content of configurations.

generate_systems(numb_confs, concentration: List[List[float]] | List[float] | None = None, cell_pert_frac: float = 0.0, atom_pert_dist: float = 0.0) List[System][source]#
Parameters:
numb_confs int

Number of configurations to generate

concentration List[List[float]] or List[float] or None

If List[float], the concentrations of each element. The length of the list should be the same as the type_map. If List[List[float]], a list of concentrations (List[float]) is randomly picked from the List. If None, the elements are assumed to be of equal concentration.

cell_pert_frac float

fraction of cell perturbation

atom_pert_dist float

the atom perturbation distance (unit angstrom).

Returns:
conf_list List[dpdata.System]

A list of generated confs in dpdata.System.

class dpgen2.conf.alloy_conf.AlloyConfGenerator(numb_confs, lattice: System | Tuple[str, float], replicate: List[int] | Tuple[int, int, int] | int | None = None, concentration: List[List[float]] | List[float] | None = None, cell_pert_frac: float = 0.0, atom_pert_dist: float = 0.0)[source]#

Bases: ConfGenerator

Parameters:
numb_confs int

Number of configurations to generate

lattice Union[dpdata.System, Tuple[str,float]]

Lattice of the alloy confs. can be dpdata.System: lattice in dpdata.System Tuple[str, float]: pair of lattice type and lattice constant. lattice type can be “bcc”, “fcc”, “hcp”, “sc” or “diamond”

replicate Union[List[int], Tuple[int], int]

replicate of the lattice

concentration List[List[float]] or List[float] or None

If List[float], the concentrations of each element. The length of the list should be the same as the type_map. If List[List[float]], a list of concentrations (List[float]) is randomly picked from the List. If None, the elements are assumed to be of equal concentration.

cell_pert_frac float

fraction of cell perturbation

atom_pert_dist float

the atom perturbation distance (unit angstrom).

Methods

generate(type_map)

Method of generating configurations.

get_file_content(type_map[, fmt])

Get the file content of configurations

normalize_config([data, strict])

Normalized the argument.

args

doc

static args() List[Argument][source]#
static doc() str[source]#
generate(type_map) MultiSystems[source]#

Method of generating configurations.

Parameters:
type_mapList[str]

The type map.

Returns:
confs: dpdata.MultiSystems

The returned configurations in dpdata.MultiSystems format

dpgen2.conf.alloy_conf.gen_doc(*, make_anchor=True, make_link=True, **kwargs)[source]#
dpgen2.conf.alloy_conf.generate_alloy_conf_args()[source]#
dpgen2.conf.alloy_conf.generate_alloy_conf_file_content(lattice: System | Tuple[str, float], type_map: List[str], numb_confs, replicate: List[int] | Tuple[int, int, int] | int | None = None, concentration: List[List[float]] | List[float] | None = None, cell_pert_frac: float = 0.0, atom_pert_dist: float = 0.0, fmt: str = 'lammps/lmp')[source]#
dpgen2.conf.alloy_conf.normalize(data)[source]#

dpgen2.conf.conf_generator module#

class dpgen2.conf.conf_generator.ConfGenerator[source]#

Bases: ABC

Methods

generate(type_map)

Method of generating configurations.

get_file_content(type_map[, fmt])

Get the file content of configurations

normalize_config([data, strict])

Normalized the argument.

args

abstract static args() List[Argument][source]#
abstract generate(type_map) MultiSystems[source]#

Method of generating configurations.

Parameters:
type_mapList[str]

The type map.

Returns:
confs: dpdata.MultiSystems

The returned configurations in dpdata.MultiSystems format

get_file_content(type_map, fmt='lammps/lmp') List[str][source]#

Get the file content of configurations

Parameters:
type_mapList[str]

The type map.

Returns:
conf_list: List[str]

A list of file content of configurations.

classmethod normalize_config(data: Dict = {}, strict: bool = True) Dict[source]#

Normalized the argument.

Parameters:
dataDict

The input dict of arguments.

strictbool

Strictly check the arguments.

Returns:
data: Dict

The normalized arguments.

dpgen2.conf.file_conf module#

class dpgen2.conf.file_conf.FileConfGenerator(files: str | List[str], fmt: str = 'auto', prefix: str | None = None, remove_pbc: bool | None = False)[source]#

Bases: ConfGenerator

Methods

generate(type_map)

Method of generating configurations.

get_file_content(type_map[, fmt])

Get the file content of configurations

normalize_config([data, strict])

Normalized the argument.

args

doc

generate_mixed

generate_std

static args() List[Argument][source]#
static doc() str[source]#
generate(type_map) MultiSystems[source]#

Method of generating configurations.

Parameters:
type_mapList[str]

The type map.

Returns:
confs: dpdata.MultiSystems

The returned configurations in dpdata.MultiSystems format

generate_mixed(type_map) MultiSystems[source]#
generate_std(type_map) MultiSystems[source]#

dpgen2.conf.unit_cells module#

class dpgen2.conf.unit_cells.BCC[source]#

Bases: object

Methods

gen_box

numb_atoms

poscar_unit

gen_box()[source]#
numb_atoms()[source]#
poscar_unit(latt)[source]#
class dpgen2.conf.unit_cells.DIAMOND[source]#

Bases: object

Methods

gen_box

numb_atoms

poscar_unit

gen_box()[source]#
numb_atoms()[source]#
poscar_unit(latt)[source]#
class dpgen2.conf.unit_cells.FCC[source]#

Bases: object

Methods

gen_box

numb_atoms

poscar_unit

gen_box()[source]#
numb_atoms()[source]#
poscar_unit(latt)[source]#
class dpgen2.conf.unit_cells.HCP[source]#

Bases: object

Methods

gen_box

numb_atoms

poscar_unit

gen_box()[source]#
numb_atoms()[source]#
poscar_unit(latt)[source]#
class dpgen2.conf.unit_cells.SC[source]#

Bases: object

Methods

gen_box

numb_atoms

poscar_unit

gen_box()[source]#
numb_atoms()[source]#
poscar_unit(latt)[source]#
dpgen2.conf.unit_cells.generate_unit_cell(crystal: str, latt: float = 1.0) System[source]#