Class PhReplicaExchange

java.lang.Object
ffx.algorithms.dynamics.PhReplicaExchange
All Implemented Interfaces:
Terminatable

public class PhReplicaExchange extends Object implements Terminatable
The PhReplicaExchange implements pH replica exchange. Adapted from "ReplicaExchange.java" by Timothy D. Fenn and Michael J. Schnieders
Since:
1.0
Author:
Matthew Speranza and Andrew Thiel
  • Constructor Details

    • PhReplicaExchange

      public PhReplicaExchange(MolecularDynamics molecularDynamics, File structureFile, double pH, double[] pHLadder, double temp, ExtendedSystem extendedSystem, double[] x, int worldSize) throws Exception
      pHReplicaExchange constructor.
      Parameters:
      molecularDynamics - a MolecularDynamics object.
      pH - pH = pKa will be changed from this initial value
      pHLadder - range of pH's that replicas are created for
      temp - temperature of replica
      extendedSystem - extended system attached to this process
      Throws:
      Exception
    • PhReplicaExchange

      public PhReplicaExchange(MolecularDynamics molecularDynamics, File structureFile, double pH, double[] pHLadder, double temp, ExtendedSystem extendedSystem, @Nullable double[] x, @Nullable MolecularDynamicsOpenMM molecularDynamicsOpenMM, @Nullable Potential potential, int worldSize) throws Exception
      OpenMM cycled pHReplicaExchange constructor.
      Parameters:
      molecularDynamics - a MolecularDynamics object.
      pH - pH = pKa will be changed from this initial value
      pHLadder - range of pH's that replicas are created for
      temp - temperature of replica
      extendedSystem - extended system attached to this process
      x - array of coordinates
      molecularDynamicsOpenMM - for running config steps on GPU
      Throws:
      Exception
  • Method Details

    • manageFilesAndRestart

      public boolean manageFilesAndRestart(File structureFile)
      This deals with anything having to do with restarts and backup files. Is identical between CPU and GPU.

      Restart Rules:

      1. Checks for existence of primary restart files in all directories.

      2. Check for even sums of esv samples.

      3. Check for unique pH values in esv files.

      4. Fall back and repeat 1-3 with backup files if primary backup failed.

      5. Return true if all checks pass, false if any fail in both primary and backup.

      Treats as fresh start if no restart files are found or if the primary are found, fail, and backups are not found.

      Parameters:
      structureFile - pdb file
      Returns:
      whether the restart was successful or not
    • sample

      public void sample(int cycles, long nSteps, double timeStep, double printInterval, double trajInterval, int initTitrDynamics)
      Sample. Restart file write-outs are entirely handled by this method based on how many steps are per cycle. User command input is ignored.
      Parameters:
      cycles - The number of cycles to run.
      nSteps - The number of steps per cycle.
      timeStep - The time step.
      printInterval - The print interval.
    • sample

      public void sample(int cycles, long titrSteps, long confSteps, double timeStep, double printInterval, double trajInterval, int initDynamics)
    • setEvenSpacePhLadder

      public static double[] setEvenSpacePhLadder(double pHGap, double pH, int nReplicas)
      Sets an even pH ladder based on the pH gap.
    • terminate

      public void terminate()
      This should be implemented as a blocking interrupt; when the method returns the Terminatable algorithm has reached a clean termination point. For example, between minimize or molecular dynamics steps.

      This should be implemented as a blocking interrupt; when the method returns the Terminatable algorithm has reached a clean termination point. For example, between minimize or molecular dynamics steps.

      Specified by:
      terminate in interface Terminatable
    • setTestingParametersAndExchangeOnce

      public int[] setTestingParametersAndExchangeOnce()