class transform.CachedNeighborList(*args: Any, **kwargs: Any)[source]

Dynamic caching of neighbor lists. This wraps a neighbor list and stores the results the first time it is called for a dataset entry with the pid provided by AtomsDataset. Particularly, for large systems, this speeds up training significantly.


The provided cache location should be unique to the used dataset. Otherwise, wrong neighborhoods will be provided. The caching location can be reused across multiple runs, by setting keep_cache=True.

  • cache_path – Path of caching directory.

  • neighbor_list – the neighbor list to use

  • nbh_transforms – transforms for manipulating the neighbor lists provided by neighbor_list

  • keep_cache – Keep cache at cache_location at the end of training, or copy built/updated cache there from cache_workdir (if set). A pre-existing cache at cache_location will not be deleted, while a temporary cache at cache_workdir will always be removed.

  • cache_workdir – If this is set, the cache will be build here, e.g. a cluster scratch space for faster performance. An existing cache at cache_location is copied here at the beginning of training, and afterwards (if keep_cache=True) the final cache is copied to cache_workdir.