Skip to content

Clustering

Summary This script will generate files to cluster a SubPEx run

calculate_clusters_per_bin(bins, settings)

Calculates the number of clusters per bin. Updates bin in place.

PARAMETER DESCRIPTION
bins

A dictionary with the bins and the walkers in each bin.

TYPE: dict

settings

The settings dictionary.

TYPE: dict

create_bin_cpptraj_files(bins, settings, directory)

Creates the cpptraj files for each bin.

PARAMETER DESCRIPTION
bins

A dictionary with the bins and the walkers in each bin.

TYPE: dict

settings

The settings dictionary.

TYPE: dict

directory

The directory where the cpptraj files will be created.

TYPE: str

create_cpptraj_file_bins(bins, settings, directory, key, selection_string)

Creates the cpptraj file for a bin.

PARAMETER DESCRIPTION
bins

A dictionary with the bins and the walkers in each bin.

TYPE: dict

settings

The settings dictionary.

TYPE: dict

directory

The directory where the cpptraj files will be created.

TYPE: str

key

The name of the bin.

TYPE: str

selection_string

The selection string that will be used.

TYPE: str

get_bins_dictionary(west, settings)

Creates a dictionary with the bins and the walkers in each bin.

PARAMETER DESCRIPTION
west

The west.h5 file as a dictionary.

TYPE: dict

settings

The settings dictionary.

TYPE: dict

RETURNS DESCRIPTION
dict

A dictionary with the bins and the walkers in each bin.

TYPE: MutableMapping[str, Any]

get_clustering_bins_cpptraj(west, settings, directory)

Creates the input files (sh) for cpptraj to cluster the bins.

PARAMETER DESCRIPTION
west

The west.h5 file.

TYPE: dict

settings

The settings dictionary.

TYPE: dict

directory

The directory where the input files will be created.

TYPE: str

get_clustering_command_cpptraj(method, num_clusters, selection_string)

Creates the clustering command for cpptraj.

PARAMETER DESCRIPTION
method

the clustering method to use. Currently, only hierarchical is implemented.

TYPE: str

num_clusters

The number of clusters to use.

TYPE: int

selection_string

The selection string for cpptraj.

TYPE: str

RETURNS DESCRIPTION
str

The clustering command for cpptraj.

TYPE: str

get_clustering_generation_cpptraj(west_file, settings, directory)

Creates the cpptraj files for each bin.

PARAMETER DESCRIPTION
west_file

The west.h5 file contents.

TYPE: dict

settings

The settings dictionary.

TYPE: dict

directory

The directory where the cpptraj files will be created.

TYPE: str

get_generation_walkers_list(directory_gen)

Gets the list of walkers for a given generation.

PARAMETER DESCRIPTION
directory_gen

The directory where the generation is.

TYPE: str

RETURNS DESCRIPTION
List[str]

List[str]: The list of walkers.

get_number_clusters_generation(west_file, max_clusters, min_clusters=3)

Gets the number of clusters for each generation.

PARAMETER DESCRIPTION
west_file

The west.h5 file.

TYPE: dict

max_clusters

The maximum number of clusters to use.

TYPE: int

min_clusters

The minimum number of clusters to use. Defaults to 3.

TYPE: int DEFAULT: 3

RETURNS DESCRIPTION
List[int]

List[int]: The number of clusters for each generation.

get_selection_cpptraj(filename)

Takes the filename of the selection string used in SubPEx and returns a selection string formated for cpptraj. The selection will take all heavy atoms of each of the residues.

PARAMETER DESCRIPTION
filename

The filename of the selection string used in SubPEx.

TYPE: str

RETURNS DESCRIPTION
str

The selection string formated for cpptraj.

TYPE: str

make_input_file_cpptraj(directory, walkers_list, settings, num_clusters, selection_string)

Creates the input file for cpptraj.

PARAMETER DESCRIPTION
directory

The directory where the input file will be created.

TYPE: str

walkers_list

The list of walkers for the generation.

TYPE: List[str]

settings

The settings dictionary.

TYPE: dict

selection_string

The selection string for cpptraj.

TYPE: str

run_clustering()