dpgen2.exploration.selector package#

Submodules#

dpgen2.exploration.selector.conf_filter module#

class dpgen2.exploration.selector.conf_filter.ConfFilter[source]#

Bases: ABC

Methods

batched_check(frames)

Check if a list of configurations are valid.

check(frame)

Check if the configuration is valid.

batched_check(frames: List[System]) → List[bool][source]#

Check if a list of configurations are valid.

Parameters:
framesList[dpdata.System]

A list of dpdata.System each containing a single frame

Returns:
validList[bool]

True if the configuration is a valid configuration, else False.

abstract check(frame: System) → bool[source]#

Check if the configuration is valid.

Parameters:
framedpdata.System

A dpdata.System containing a single frame

Returns:
validbool

True if the configuration is a valid configuration, else False.

class dpgen2.exploration.selector.conf_filter.ConfFilters[source]#

Bases: object

Methods

add

check

add(conf_filter: ConfFilter) → ConfFilters[source]#
check(ms: MultiSystems) → MultiSystems[source]#

dpgen2.exploration.selector.conf_selector module#

class dpgen2.exploration.selector.conf_selector.ConfSelector[source]#

Bases: ABC

Select configurations from trajectory and model deviation files.

Methods

select

abstract select(trajs: List[Path] | List[HDF5Dataset], model_devis: List[Path] | List[HDF5Dataset], type_map: List[str] | None = None, optional_outputs: List[Path] | None = None, plm_outputs: List[Path] | None = None) → Tuple[List[Path], ExplorationReport][source]#

dpgen2.exploration.selector.conf_selector_frame module#

class dpgen2.exploration.selector.conf_selector_frame.ConfSelectorFrames(traj_render: TrajRender, report: ExplorationReport, max_numb_sel: int | None = None, conf_filters: ConfFilters | None = None, plumed_cv_filter: PlumedCVFilter | None = None)[source]#

Bases: ConfSelector

Select frames from trajectories as confs.

Parameters: trust_level: TrustLevel

The trust level

conf_filter: ConfFilters

The configuration filter

Methods

select(trajs, model_devis[, type_map, ...])

Select configurations

select(trajs: List[Path] | List[HDF5Dataset], model_devis: List[Path] | List[HDF5Dataset], type_map: List[str] | None = None, optional_outputs: List[Path] | None = None, plm_outputs: List[Path] | None = None) → Tuple[List[Path], ExplorationReport][source]#

Select configurations

Parameters:
trajsList[Path]

A list of Path to trajectory files generated by LAMMPS

model_devisList[Path]

A list of Path to model deviation files generated by LAMMPS. Format: each line has 7 numbers they are used as # frame_id md_v_max md_v_min md_v_mean md_f_max md_f_min md_f_mean where md stands for model deviation, v for virial and f for force DeePMD outputs may append an eighth devi_e column, which does not change the first seven columns consumed here.

type_mapList[str]

The type_map of the systems

optional_outputsList[Path]

Optional outputs of the exploration

Returns:
confsList[Path]

The selected confgurations, stored in a folder in deepmd/npy format, can be parsed as dpdata.MultiSystems. The list only has one item.

reportExplorationReport

The exploration report recoding the status of the exploration.

dpgen2.exploration.selector.distance_conf_filter module#

class dpgen2.exploration.selector.distance_conf_filter.BoxLengthFilter(max_workers=None, length_ratio=5.0)[source]#

Bases: ConfFilter

Methods

args()

The argument definition of the ConfFilter.

batched_check(frames)

Check if a list of configurations are valid.

check(frame)

Check if the configuration is valid.

static args() → List[Argument][source]#

The argument definition of the ConfFilter.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of the ConfFilter.

batched_check(frames: List[System])[source]#

Check if a list of configurations are valid.

Parameters:
framesList[dpdata.System]

A list of dpdata.System each containing a single frame

Returns:
validList[bool]

True if the configuration is a valid configuration, else False.

check(frame: System)[source]#

Check if the configuration is valid.

Parameters:
framedpdata.System

A dpdata.System containing a single frame

Returns:
validbool

True if the configuration is a valid configuration, else False.

class dpgen2.exploration.selector.distance_conf_filter.BoxSkewnessConfFilter(max_workers=None, theta=60.0)[source]#

Bases: ConfFilter

Methods

args()

The argument definition of the ConfFilter.

batched_check(frames)

Check if a list of configurations are valid.

check(frame)

Check if the configuration is valid.

static args() → List[Argument][source]#

The argument definition of the ConfFilter.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of the ConfFilter.

batched_check(frames: List[System])[source]#

Check if a list of configurations are valid.

Parameters:
framesList[dpdata.System]

A list of dpdata.System each containing a single frame

Returns:
validList[bool]

True if the configuration is a valid configuration, else False.

check(frame: System)[source]#

Check if the configuration is valid.

Parameters:
framedpdata.System

A dpdata.System containing a single frame

Returns:
validbool

True if the configuration is a valid configuration, else False.

class dpgen2.exploration.selector.distance_conf_filter.DistanceConfFilter(max_workers=None, custom_safe_dist=None, safe_dist_ratio=1.0)[source]#

Bases: ConfFilter

Methods

args()

The argument definition of the ConfFilter.

batched_check(frames)

Check if a list of configurations are valid.

check(frame)

Check if the configuration is valid.

static args() → List[Argument][source]#

The argument definition of the ConfFilter.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of the ConfFilter.

batched_check(frames: List[System])[source]#

Check if a list of configurations are valid.

Parameters:
framesList[dpdata.System]

A list of dpdata.System each containing a single frame

Returns:
validList[bool]

True if the configuration is a valid configuration, else False.

check(frame: System)[source]#

Check if the configuration is valid.

Parameters:
framedpdata.System

A dpdata.System containing a single frame

Returns:
validbool

True if the configuration is a valid configuration, else False.

dpgen2.exploration.selector.distance_conf_filter.check_multiples(a, b, c, multiple)[source]#

dpgen2.exploration.selector.plumed_cv_filter module#

class dpgen2.exploration.selector.plumed_cv_filter.PlumedCVFilter(regions: List[Dict], sampling: Dict | None = None, time_alignment: Dict | None = None)[source]#

Bases: object

Select frames in a union of PLUMED CV regions.

Each region maps exact field labels from #! FIELDS to a lower-inclusive, upper-exclusive interval. Labels are matched by name, not column position, and are otherwise arbitrary. Fields within a region are ANDed; regions are ORed. A region may use the legacy bare mapping or the named form {"name": ..., "conditions": {...}}.

Methods

audit_candidate_ids(files, nframes, ...[, ...])

Audit filtering followed by the report's existing sampling policy.

load_outputs(files, nframes)

Parse and validate PLUMED outputs once for a selection pass.

select_candidate_ids(files, nframes, ...[, ...])

Filter model-deviation candidates and apply configured sampling.

select_candidate_ids_with_audit(files, ...)

Return sampled IDs plus selected-frame records and aggregate counts.

args

get_selected_ids

write_audit

static args() → List[Argument][source]#
audit_candidate_ids(files: List[Path], nframes: List[int], candidate_ids: List[List[int]], selected_ids: List[List[int]], max_devi_f: List[ndarray] | None = None, loaded_outputs: List[Tuple[List[str], ndarray]] | None = None)[source]#

Audit filtering followed by the report’s existing sampling policy.

get_selected_ids(files: List[Path], nframes: List[int], loaded_outputs: List[Tuple[List[str], ndarray]] | None = None) → List[List[int]][source]#
load_outputs(files: List[Path], nframes: List[int]) → List[Tuple[List[str], ndarray]][source]#

Parse and validate PLUMED outputs once for a selection pass.

select_candidate_ids(files: List[Path], nframes: List[int], candidate_ids: List[List[int]], max_nframes: int | None, max_devi_f: List[ndarray] | None = None) → List[List[int]][source]#

Filter model-deviation candidates and apply configured sampling.

select_candidate_ids_with_audit(files: List[Path], nframes: List[int], candidate_ids: List[List[int]], max_nframes: int | None, max_devi_f: List[ndarray] | None = None)[source]#

Return sampled IDs plus selected-frame records and aggregate counts.

static write_audit(out_path: Path, records, summary)[source]#