flag to reset energy after each cycle

This commit is contained in:
Daniel Bauer
2018-06-18 09:39:58 +02:00
parent 240d2b0028
commit e52f8738d1

View File

@@ -17,6 +17,7 @@ class UmbrellaRunner():
E_max (float, default=inf): Final energy. Umbrella sampling is stopped if no frames with E < E_max are found E_max (float, default=inf): Final energy. Umbrella sampling is stopped if no frames with E < E_max are found
E_incr (float, default=1): E_min is incremented by this until E_max is reached E_incr (float, default=1): E_min is incremented by this until E_max is reached
max_iterations (int, default=-1): Max. number of iterations before umbrella sampling stops. -1 for infinite sampling max_iterations (int, default=-1): Max. number of iterations before umbrella sampling stops. -1 for infinite sampling
reset_E (boolean, default=False): Wether the energy should be reset to E_min at the start of each cycle
""" """
@@ -25,6 +26,7 @@ class UmbrellaRunner():
self.E_min = 0 self.E_min = 0
self.E_max = np.inf self.E_max = np.inf
self.E_incr = 1 self.E_incr = 1
self.reset_E = False
def _get_pmf_shape(self): def _get_pmf_shape(self):
""" returns the shape of the pmf according to the cvs """ """ returns the shape of the pmf according to the cvs """
@@ -148,13 +150,17 @@ class UmbrellaRunner():
self.num_iterations = 0 self.num_iterations = 0
self.E = self.E_min # TODO move this in the loop? self.E = self.E_min
# outer main loop: increase E and calculate PMF until E > E_max # outer main loop: increase E and calculate PMF until E > E_max
while True: while True:
self.num_iterations += 1 self.num_iterations += 1
if reset_E:
self.E = self.E_min
print("~~~~~~~~~~~~~~~ Iteration {}/{} ~~~~~~~~~~~~~~~~".format(self.num_iterations, self.max_iterations)) print("~~~~~~~~~~~~~~~ Iteration {}/{} ~~~~~~~~~~~~~~~~".format(self.num_iterations, self.max_iterations))
print("Energy: {}".format(self.E))
# find frames to sample # find frames to sample
if self.num_iterations == 1: if self.num_iterations == 1: