VOLT

K-means Clustering

Separate crystalline atoms from grain-boundary atoms in a nanocrystalline metal by K-means clustering of per-atom von Mises stress, potential energy and atomic volume.

K-means Clustering classifies atoms with per-atom physical quantities instead of their geometry. Following Amigo (2020), it clusters the atoms by von Mises stress, potential energy and atomic volume, which differ clearly between crystal interiors and grain boundaries. The cluster with the lowest stress is labeled FCC and the others grain boundary. Use it on nanocrystalline FCC metals when you already write these quantities from your simulation, and as a cutoff-free comparison with geometric methods.

KeyVersionBuilds
kmeans-clustering1.1.0Linux, macOS, Windows

K-means Clustering is a Python plugin with no browser build, so it can't be installed on a machine that runs in the browser or the desktop app. The machine running it creates a virtual environment and installs its requirements (numpy, pandas, pyarrow, scikit-learn) the first time.

How it works

  1. The plugin reads the three feature columns from the frame and scales each one to the range 0–10 (min-max scaling).
  2. It runs K-means with k-means++ initialization (Elkan's algorithm, up to 200 iterations), repeated K-means initializations times, and keeps the best run.
  3. The cluster whose centroid has the lowest von Mises stress is labeled FCC. With two clusters the other one is Grain Boundary; with more they are Grain Boundary 1, Grain Boundary 2, and so on.

Inputs

The frame must have the columns id, x, y, z and the three feature columns, under the names you set. These usually come from your LAMMPS dump, for example the von Mises stress computed from compute stress/atom, the potential energy from compute pe/atom and the atomic volume from compute voronoi/atom. A missing column fails the stage with Columns [...] not found in dump, which lists the columns available.

Arguments

ArgumentTypeDefaultAllowed valuesDescription
Number of clusters n_clustersnumber2≥ 2, step 1Number of clusters. 2 separates crystal from grain boundary.
K-means initializations n_initnumber50≥ 1, step 1How many times K-means runs from different starting centroids; the run with the lowest inertia is kept.
Random seed seednumber36≥ 0, step 1Seed of the centroid initialization, for reproducible clusters.
Von Mises stress column col_svmstringSvmA column name of the frameColumn with the per-atom von Mises stress. It also decides which cluster is FCC.
Potential energy column col_epotstringEpotA column name of the frameColumn with the per-atom potential energy.
Atomic volume column col_volstringVolA column name of the frameColumn with the per-atom volume.

Outputs

ExposureWhat you get
K-means ClusteringA listing with the number of atoms and clusters and the stress column used, and a clusters sub-listing: cluster_id, label, count, percentage, and the minimum, maximum and mean von Mises stress of the cluster.
K-means ModelA listing, and a 3D model of the atoms grouped by label (FCC, Grain Boundary, …).

The workflow declares the per-atom properties cluster_id (Cluster ID), Svm (Von Mises stress), Epot (Potential energy) and Vol (Atomic volume). If you rename the columns, the table carries your names instead.

Reference

N. Amigo, "Crystalline structure and grain boundary identification in nanocrystalline aluminum using K-means clustering" (2020), submitted to Modelling Simul. Mater. Sci. Eng.

On this page