LAMMPS helper modules

get_clusters(data, n, seed=12)

Get k-means clusters.

Parameters:
  • data (ndarray) – The data to cluster.

  • n (int) – The number of clusters.

  • seed (int, optional) – The random seed.

Returns:

  • ndarray – The cluster id to which each data point belongs.

  • float – The silhouette score of the clustering.

load_run(odir)

Load a complete LAMMPS simulation from its directory.

The directory should contain an Allosteric network file, LAMMPS datafile, dumpfile, and logfile.

Parameters:

odir (str) – The path to the directory.

Returns:

  • allo (Allosteric) – Allosteric Class object with network set up according to provided LAMMPS datafile, with simulation history loaded from dumpfile.

  • data (ndarray) – The log data (typically printed to screen) of the simulation at each integration timestep.

  • cols (list of str) – The column names associated with each data column.

read_data(filename, graph)

Read a LAMMPS data file and update a graph based on its contents.

The bond stiffnesses and rest lengths are set based on the datafile specifications.

Parameters:
  • filename (str) – The name of the file to read.

  • graph (networkx.graph) – The graph to update.

read_dim(filename)

Read a LAMMPS input file to parse out the dimension.

Parameters:

filename (str) – The name of the file to read.

Returns:

The dimension of the system.

Return type:

int

read_dump(filename)

Read a LAMMPS dumpfile.

Parameters:

filename (str) – The name of the file to read.

Returns:

The (x,y) coordinates for each of n points over all output frames.

Return type:

ndarray

read_log(filename)

Read a LAMMPS log file.

Parameters:

filename (str) – The name of the file to read.

Returns:

  • data (ndarray) – The log data (typically printed to screen) of the simulation at each integration timestep.

  • cols (list of str) – The column names associated with each data column.

setup_run(allo, odir, prefix, lmp_path, duration, frames, applied_args, train=0, method=None, eta=1.0, alpha=0.001, vmin=0.001, temp=0, symmetric=False, dt=0.005, hours=24)

Set up a complete LAMMPS simulation in a directory.

Parameters:
  • allo (Allosteric) – The Allosteric object to simulate.

  • odir (str) – The path to the directory.

  • prefix (str) – The file prefix to use for data, input, dump, and logfiles.

  • lmp_path (str) – The path to the LAMMPS executable.

  • duration (float) – The final integration time.

  • frames (int) – The number of output frames to produce (excluding initial frame).

  • applied_args (tuple) – Simulation arguments: the source strain(s), target strain(s), and pinning stiffness.

  • train (int, optional) – Training mode. 0 = no training, 1 = l-model, 2 = k-model.

  • method (str, optional) – Training method to use. Options are ‘aging’ or ‘learning’.

  • eta (float, optional) – The learning rate by which the clamped state target strain approaches the final desired strain.

  • alpha (float, optional) – The aging rate.

  • vmin (float, optional) – The smallest allowed value for each learning degree of freedom.

  • temp (float, optional) – The temperature setting, in LJ units. If zero (default), an athermal simulation is performed.

  • symmetric (bool, optional) – Whether to introduce a symmetric state for training with a different set of boundary conditions. Default is False.

  • dt (float, optional) – Integration step size.

  • hours (int, optional) – The number of hours to allocate for the job.