function to exclude frames

This commit is contained in:
Daniel Bauer
2019-08-16 14:10:00 +02:00
parent 074d399984
commit 3f5100b779
2 changed files with 9 additions and 3 deletions

View File

@@ -3,4 +3,4 @@ from .runner import UmbrellaRunner
from .wham2d import WHAM2DRunner from .wham2d import WHAM2DRunner
__all__ = ['AdaptiveUmbrella'] __all__ = ['AdaptiveUmbrella']
__version__ = "0.3.6" __version__ = "0.3.8"

View File

@@ -111,6 +111,12 @@ class UmbrellaRunner():
return False return False
return True return True
def is_valid_frame(self, frame):
""" Allows to filter out frames that should not be sampled depending
on some condition """
# do not allow frames that are not inside pmf boundaries
return self._is_in_pmf(frame)
def _get_new_frames(self, pmf, frames, root_frames): def _get_new_frames(self, pmf, frames, root_frames):
""" returns a dict of all frames surrounding the root_frames """ returns a dict of all frames surrounding the root_frames
that have not an assigned energy yet, as well as their corresponding root that have not an assigned energy yet, as well as their corresponding root
@@ -121,8 +127,8 @@ class UmbrellaRunner():
for frame in root_frames: for frame in root_frames:
neighbors = self._generate_neighbor_list(frame) neighbors = self._generate_neighbor_list(frame)
# remove neighbors that are not inside the pmf # remove neighbors if they are not valid (i.e not part of the pmf)
neighbors = [n for n in neighbors if self._is_in_pmf(n)] neighbors = [n for n in neighbors if self.is_valid_frame(n)]
# for each neighbor, check if its already in the list and compare root frame energy # for each neighbor, check if its already in the list and compare root frame energy
for n in neighbors: for n in neighbors: