import copy
from collections import (
Counter,
)
from pathlib import (
Path,
)
from typing import (
List,
Optional,
Tuple,
)
from ase import Atoms
from pfd.exploration.render import (
TrajRender,
)
from pfd.utils.ase2xyz import train_test_split
from . import (
ConfFilters,
ConfSelector,
)
import logging
[docs]
class ConfSelectorFrames(ConfSelector):
"""Select frames from trajectories as confs.
Parameters:
trust_level: TrustLevel
The trust level
conf_filter: ConfFilters
The configuration filter
"""
def __init__(
self,
traj_render: TrajRender,
max_numb_sel: Optional[int] = None,
conf_filters: Optional[ConfFilters] = None,
):
self.max_numb_sel = max_numb_sel
self.conf_filters = conf_filters
self.traj_render = traj_render
# self.report = report
[docs]
def select(
self,
trajs: List[Path],
optional_outputs: Optional[List[Path]] = None,
) -> List[Atoms]:
"""Select configurations
Parameters
----------
trajs : List[Path]
A `list` of `Path` to trajectory files generated by exploration stage
optional_outputs : List[Path]
Optional outputs of the exploration
Returns
-------
confs : List[Path]
The selected confgurations, stored in a single file of extxyz format.
report : ExplorationReport
The exploration report recoding the status of the exploration.
"""
# self.report.clear()
# id_cand_list = self.report.get_candidate_ids(self.max_numb_sel)
atoms_list = self.traj_render.get_confs(
trajs,
self.conf_filters,
optional_outputs,
)
return atoms_list