AdaptivePELE – Package Description

adaptiveSampling Module

AdaptivePELE.adaptiveSampling.buildNewClusteringAndWriteInitialStructuresInNewSimulation(debug, controlFile, outputPathConstants, clusteringBlock, spawningParams, initialStructures, simulationRunner, processManager)[source]

Build the clustering object and copies initial structures from control file. Returns the clustering object to use and the initial structures filenames as string

Parameters
  • debug (bool) – In debug, it will not remove the simulations

  • controlFile (str) – Adaptive sampling control file

  • outputPathConstants (OutputPathConstants) – Contains outputPath-related constants

  • clusteringBlock (json) – Contains the new clustering block

  • spawningParams (SpawningParams) – Spawning params

  • initialStructures (list) – Control file initial structures

  • simulationRunner (SimulationRunner) – SimulationRunner Simulation runner object

  • processManager (ProcessesManager) – Object to synchronize the possibly multiple processes

Returns

Clustering, str – The clustering method to use in the adaptive sampling simulation and the initial structures filenames

AdaptivePELE.adaptiveSampling.buildNewClusteringAndWriteInitialStructuresInRestart(firstRun, outputPathConstants, clusteringBlock, spawningParams, spawningCalculator, simulationRunner, topologies, processManager)[source]

It reads the previous clustering method, and if there are changes (clustering method or related to thresholds), reclusters the previous trajectories. Returns the clustering object to use, and the initial structure filenames as strings

Parameters
  • firstRun (int) – New epoch to run

  • outputPathConstants (str) – Contains outputPath-related constants

  • clusteringBlock (json) – Contains the new clustering block

  • spawningParams (SpawningParams) – Spawning params

  • spawningCalculator (SpawningCalculator) – Spawning calculator object

  • simulationRunner (SimulationRunner) – SimulationRunner Simulation runner object

  • topologies (Topology) – Topology object containing the set of topologies needed for the simulation

  • processManager (ProcessesManager) – Object to synchronize the possibly multiple processes

Returns

Clustering, str – The clustering method to use in the adaptive sampling simulation and the initial structures filenames

AdaptivePELE.adaptiveSampling.checkIntegrityClusteringObject(objectPath)[source]

Test whether the found clustering object to reload is a valid object

Parameters

objectPath (str) – Clustering object path

Returns

bool – True if the found clustering object is valid

AdaptivePELE.adaptiveSampling.checkMetricExitConditionMultipleTrajsinRestart(firstRun, outputFolder, simulationRunner)[source]

Check the previous simulation data when restarting a simulation with a multiple trajectory metric exit condition

Parameters
  • firstRun (int) – First epoch to be run in restart simulation

  • outputFolder (str) – Folder of the previous simulation data

  • simulationRunner (SimulationRunner) – Simulation runner object

AdaptivePELE.adaptiveSampling.checkSymmetryDict(clusteringBlock, initialStructures, resname, reschain, resnum)[source]

Check if the symmetries dictionary is valid for the ligand

Parameters
  • clusteringBlock (json) – JSON block with the clustering-related parameters

  • initialStructures (list) – List with initial structures

  • resname (str) – Residue name of the ligand in the system pdb

  • reschain (str) – Chain name of the ligand in the system pdb

  • resnum (int) – Residue number of the ligand in the system pdb

Raises

AssertionError – If atoms are not found in the structure

AdaptivePELE.adaptiveSampling.cleanPreviousSimulation(output_path, allTrajs)[source]

Clean the uneeded data from a previous simulation

Parameters
  • output_path (str) – Path where the data is stored

  • allTrajs (str) – Path where the discretized trajectories for MSM are stored

AdaptivePELE.adaptiveSampling.cleanProcessesFiles(folder)[source]

Clean the processes files from a previous simulation :param folder: Folder where the files are stored :type folder: str

AdaptivePELE.adaptiveSampling.clusterEpochTrajs(clusteringMethod, epoch, epochOutputPathTempletized, topologies, outputPathConstants=None)[source]

Cluster the trajecotories of a given epoch

Parameters
  • clusteringMethod (Clustering) – Clustering object

  • epoch (int) – Number of the epoch to cluster

  • epochOutputPathTempletized (str) – Path where to find the trajectories

  • topologies (Topology) – Topology object containing the set of topologies needed for the simulation

  • outputPathConstants (OutputPathConstants) – Contains outputPath-related constants

AdaptivePELE.adaptiveSampling.clusterPreviousEpochs(clusteringMethod, finalEpoch, epochOutputPathTempletized, simulationRunner, topologies, outputPathConstants=None)[source]

Cluster all previous epochs using the clusteringMethod object

Parameters
  • clusteringMethod (Clustering) – Clustering object

  • finalEpoch (int) – Last epoch to cluster (not included)

  • epochOutputPathTempletized (str) – Path where to find the trajectories

  • simulationRunner (SimulationRunner) – Simulation runner object

  • topologies (Topology) – Topology object containing the set of topologies needed for the simulatioies

  • outputPathConstants (OutputPathConstants) – Contains outputPath-related constants

AdaptivePELE.adaptiveSampling.copyInitialStructures(initialStructures, tmpInitialStructuresTemplate, iteration)[source]

Copies the initial structures from a certain iteration

Parameters
  • initialStructures (list of str) – Name of the initial structures to copy

  • tmpInitialStructuresTemplate (str) – Template with the name of the initial strutctures

  • iteration (int) – Epoch number

AdaptivePELE.adaptiveSampling.createMappingForFirstEpoch(initialStructures, topologies, processors)[source]

Create the topology mapping for the first iteration

Parameters
  • initialStructures (list) – List of the initial structures for the first iteration

  • topologies (Topology) – Topology object containing the set of topologies needed for the simulation

  • processors (int) – Number of trajectories

AdaptivePELE.adaptiveSampling.expandInitialStructuresWildcard(initialStructuresWildcard)[source]

Returns the initial structures after expanding the initial structures wildcard

Parameters

initialStructureWildcard (str) – Wildcard that matches the initial structures

Returns

list of str – The expanded initial structures

AdaptivePELE.adaptiveSampling.findFirstRun(outputPath, clusteringOutputObject, simulationRunner, restart)[source]

Find the last epoch that was properly simulated and clusterized and and return the first epoch to run in case of restart

Parameters
  • outputPath (str) – Simulation output path

  • clusteringOutputObject (str) – Templetized name of the clustering object

  • simulationRunner (SimulationRunner) – Simulation runner object

  • restart (bool) – Whether to restart a previous simulation

Returns

int – Current epoch

AdaptivePELE.adaptiveSampling.fixReportsSymmetry(outputPath, resname, reschain, resnum, nativeStructure, symmetries, topologies)[source]

Adds a new column in the report file with the RMSD that takes into account symmetries. New reports are stored in the fixedReport_i where i is the number of the report

Parameters
  • outputPath (str) – Path where trajectories are found

  • resname (str) – Residue name of the ligand in the system pdb

  • reschain (str) – Chain name of the ligand in the system pdb

  • resnum (int) – Residue number of the ligand in the system pdb

  • nativeStructure (str) – Path to the native structure pdb

  • symmetries (dict) – Dictionary containg the symmetries of the ligand

  • topologies (Topology) – Topology object containing the set of topologies needed for the simulation

Raises

IndexError – If original report file not found in output folder

AdaptivePELE.adaptiveSampling.generateTrajectorySelectionString(epoch, epochOutputPathTempletized)[source]

Generates the template for the name of the trajectories in a given epoch

Parameters
  • epoch (int) – Epoch number

  • epochOutputPathTempletized (str) – Templetized path where the trajectories of any epoch are stored

Returns

str – Template for the name of the trajectories in a given epoch

AdaptivePELE.adaptiveSampling.getClusteringLigandInfo(clustering_block_json)[source]

Get the ligand information (resname, resnum and chain from the clustering parameters block in the control file)

Parameters

clustering_block_json (json) – JSON block with the clustering-related parameters

Returns

str, int, str – Residue name, residue number and chain of the molecule to use for the clutering

AdaptivePELE.adaptiveSampling.getWorkingClusteringObjectAndReclusterIfNecessary(firstRun, outputPathConstants, clusteringBlock, spawningParams, simulationRunner, topologies, processManager)[source]

It reads the previous clustering method, and, if there are changes, it reclusters the previous trajectories. Returns the clustering object to use

Parameters
  • firstRun (int) – New epoch to run

  • outputPathConstants (OutputPathConstants) – Contains outputPath-related constants

  • clusteringBlock (json) – Contains the new clustering block

  • spawningParams (SpawningParams) – Spawning params, to know what reportFile and column to read

  • topologies (Topology) – Topology object containing the set of topologies needed for the simulation

  • processManager (ProcessesManager) – Object to synchronize the possibly multiple processes

Returns

Clustering – The clustering method to use in the adaptive sampling simulation

AdaptivePELE.adaptiveSampling.loadParams(jsonParams)[source]

Read the control file in JSON format and extract the blocks of simulation, general parameters, clustering and spawning

Parameters

jsonParams (json str) – Control file in JSON format from where the parameters will be read

AdaptivePELE.adaptiveSampling.main(jsonParams, clusteringHook=None)[source]

Main body of the adaptive sampling program.

Parameters

jsonParams (str) – A string with the name of the control file to use

AdaptivePELE.adaptiveSampling.mergeFilteredClustersAccordingToBox(degeneracy, clustersFiltering)[source]

Merge the (possibly) partial degeneracy to obtain a complete list, the partial list comes from the clusters excluded by the moving box :param degeneracy: Degeneracy of the clusters :param degeneracy: list :param clustersFiltering: List of bools indicating whether a cluster was filtered or not :param clustersFiltering: list

Returns list

– complete list of cluster degeneracies

AdaptivePELE.adaptiveSampling.needToRecluster(oldClusteringMethod, newClusteringMethod)[source]

Check if the parameters have changed in a restart and we need to redo the clustering. In particular: type of clustering, theshold calculator or distance

Parameters
  • oldClusteringMethod (Clustering) – Clustering in a previous simulation before the restart

  • newClusteringMethod (Clustering) – Clustering in the restarted simulation

Returns

bool – If clustering needs to be redone

AdaptivePELE.adaptiveSampling.parseArgs()[source]
AdaptivePELE.adaptiveSampling.printRunInfo(restart, debug, simulationRunner, spawningCalculator, clusteringBlock, outputPath, initialStructuresWildcard)[source]

Print a summary of the run paramaters

Parameters
  • restart (bool) – Flag on whether to continue a previous simulation

  • debug (bool) – Flag to mark whether simulation is run in debug mode

  • simulationRunner (SimulationRunner) – Simulation runner object

  • spawningCalculator (SpawningCalculator) – Spawning calculator object

  • clusteringBlock (dict) – Block of the control file with clustering options

  • outputPath (str) – Path where to write the simulation output

  • initialStructuresWildcard (str) – Wildcard expression to find the initial structures

AdaptivePELE.adaptiveSampling.saveInitialControlFile(jsonParams, originalControlFile)[source]

Save the adaptive control file jsonParams in originalControlFile

Parameters
  • jsonParams (str) – Input control file in JSON format

  • originalControlFile (str) – Path where to save the control file

AdaptivePELE.adaptiveSampling.writeTopologyFiles(topologies, destination)[source]

Write the topology files to the desired destination

Parameters
  • topologies (list) – List of topology files

  • destination (str) – Path where to copy the toplogy files

automateRoundsAdaptive Module

AdaptivePELE.automateRoundsAdaptive.automateSimulation(args)[source]

Run multiple AdaptivePELE simulation with the same parameters, changing only the seed

Parameters

args (object) – Object containing the command line arguments

AdaptivePELE.automateRoundsAdaptive.main()[source]

Run the multiple simulations

AdaptivePELE.automateRoundsAdaptive.parseArguments()[source]

Parse the command line arguments