From 3f5100b7791fe56956fcf6b9bde124a67bf2d928 Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Fri, 16 Aug 2019 14:10:00 +0200 Subject: [PATCH] function to exclude frames --- adaptiveumbrella/__init__.py | 2 +- adaptiveumbrella/runner.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/adaptiveumbrella/__init__.py b/adaptiveumbrella/__init__.py index 2c12eed..e5d3cf7 100644 --- a/adaptiveumbrella/__init__.py +++ b/adaptiveumbrella/__init__.py @@ -3,4 +3,4 @@ from .runner import UmbrellaRunner from .wham2d import WHAM2DRunner __all__ = ['AdaptiveUmbrella'] -__version__ = "0.3.6" +__version__ = "0.3.8" diff --git a/adaptiveumbrella/runner.py b/adaptiveumbrella/runner.py index 18e4171..fefe551 100755 --- a/adaptiveumbrella/runner.py +++ b/adaptiveumbrella/runner.py @@ -111,6 +111,12 @@ class UmbrellaRunner(): return False 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): """ returns a dict of all frames surrounding the root_frames that have not an assigned energy yet, as well as their corresponding root @@ -121,8 +127,8 @@ class UmbrellaRunner(): for frame in root_frames: neighbors = self._generate_neighbor_list(frame) - # remove neighbors that are not inside the pmf - neighbors = [n for n in neighbors if self._is_in_pmf(n)] + # remove neighbors if they are not valid (i.e not part of the pmf) + 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 n in neighbors: