Window class

Code author: Niklaus Johner <niklaus.johner@a3.epfl.ch>

This file contains the Window object which represents a simulation window.

class Window(system, cv_values, spring_constants, cv_shifts=None, parent=None, window_name=None)

This class is second in the hierarchical structure used in SiPMF. The System contains several (usually many) class:Window which correspond to the System restrained to a small region of the CV space using a quadratic restraining potential. The restraining potential has to be of the form 1/2 spring_constant(x-cv_value). Notice the 1/2 in the definition used here, whereas some MD codes do not have this factor. Carefully check that the potential defined here matches the potential defined in the MD code you are using!

Parameters:
  • system (System) – The system to which the window belongs
  • cv_values (list (float)) – The centers of the quadratic potentials restraining the CVs.
  • spring_constants (list (float)) – The spring constants of the potentials restraining the CVs
  • parent (Window) – The parent window
FindPhase(phase_name)
Initialize()
ReadDataFile()

Reads the datafile of the window and returns a tuple with the list of times as the first element. The second element in the tuple is a list containing one list of values for each CV.

SubmitNextPhase(environment)

Automatically creates the appropriate next Phase and corresponding Job and submits it to the cluster. What the appropriate next phase is, is determined as follows:

  • If the window does not have a parent and does not contain any phase yet, the new phase will be

a run phase using as restart the System.init_restartdir - If the window has a parent phase does not contain any phase yet, the new phase will be an initialization phase using as restart the last phase of the parent phase. - If the window already contains one or several phases, the new phase will be an run phase using as restart the last phase of this window.

Parameters:environment (Environment) – The environment used to submit the job to the cluster.
UpdateDataCount()

Update the total number of data accumulated for this window (sum over the data in each phase of the window).

UpdateDataFile(n_skip=0, n_tot=-1, new_only=True)

Updates the window’s datafile. It takes the data from all the run phases and writes it into its own datafile, skipping the first n_skip data points and adding a maximum of n_tot data points. n_tot=-1 means there is no maximal number of data points.

Parameters:
  • n_skip (int) – The number of data points to skip.
  • n_tot (int) – The total number of data points used to calculate the PMF.
  • new_only (bool) – Only add the data from phases that have not yet been added to the data files.