diff --git a/deepmd/entrypoints/neighbor_stat.py b/deepmd/entrypoints/neighbor_stat.py index 87ec101c70..8840851b91 100644 --- a/deepmd/entrypoints/neighbor_stat.py +++ b/deepmd/entrypoints/neighbor_stat.py @@ -2,6 +2,7 @@ import logging from typing import ( List, + Optional, ) from deepmd.backend.backend import ( @@ -21,7 +22,7 @@ def neighbor_stat( *, system: str, rcut: float, - type_map: List[str], + type_map: Optional[List[str]], mixed_type: bool = False, backend: str = "tensorflow", **kwargs, @@ -88,6 +89,8 @@ def neighbor_stat( rcut=rcut, type_map=type_map, ) + if type_map is None: + log.info(f"type_map: {data.get_type_map()}") data.get_batch() nei = NeighborStat(data.get_ntypes(), rcut, mixed_type=mixed_type) min_nbor_dist, max_nbor_size = nei.get_stat(data) diff --git a/deepmd/main.py b/deepmd/main.py index 964521b77e..777bfd3aa3 100644 --- a/deepmd/main.py +++ b/deepmd/main.py @@ -655,8 +655,8 @@ def main_parser() -> argparse.ArgumentParser: "--type-map", type=str, nargs="+", - required=True, - help="type map", + required=False, + help="Type map. If not provided, the type map of data will be used.", ) parser_neighbor_stat.add_argument( "--mixed-type",