Skip to content

Conversation

@jaclark5
Copy link
Collaborator

@jaclark5 jaclark5 commented Dec 16, 2025

Close #40

Let me know if the copilot review was helpful or not and if there's something you wish it did.

@jaclark5 jaclark5 changed the base branch from benchmark-openff2.2.1 to main January 9, 2026 18:40
@jaclark5 jaclark5 marked this pull request as ready for review January 9, 2026 18:40
@jaclark5 jaclark5 requested a review from Copilot January 9, 2026 18:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements clustering analysis for force field parameters in response to issue #40. It introduces a new Python script that performs unsupervised clustering on bond and angle parameters from OFFXML force field files, identifying groups of similar parameters in (log(k), equilibrium) space.

Key Changes:

  • New clustering.py script with comprehensive documentation and CLI interface using argparse
  • Application to two force field variants: b_no_bond_with_ring_in_atom and b2_no_bond_with_ring_in_atom
  • Output generation including CSV cluster assignments and PDF visualization plots

Reviewed changes

Copilot reviewed 7 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
8_clustering/clustering.py New clustering script with HDBSCAN/DBSCAN algorithms for analyzing force field parameters
8_clustering/b_no_bond_with_ring_in_atom/run.sh Shell script to run clustering on b_no_bond_with_ring_in_atom force field
8_clustering/b_no_bond_with_ring_in_atom/log.txt Execution log showing 25 bond clusters and 7 angle clusters identified
8_clustering/b_no_bond_with_ring_in_atom/clusters/bonds_clusters.csv Bond parameter cluster assignments (554 parameters)
8_clustering/b_no_bond_with_ring_in_atom/clusters/bonds_clusters.pdf Visualization of bond parameter clusters
8_clustering/b2_no_bond_with_ring_in_atom/run.sh Shell script to run clustering on b2_no_bond_with_ring_in_atom force field
8_clustering/b2_no_bond_with_ring_in_atom/log.txt Execution log showing 35 bond clusters and 4 angle clusters identified
8_clustering/b2_no_bond_with_ring_in_atom/clusters/bonds_clusters.pdf Visualization of bond parameter clusters for b2 variant

# Plot
fig, ax = plt.subplots(figsize=(8, 6))
sorted_labels = list(sorted(set(labels)))
colors = plt.cm.get_cmap("nipy_spectral")(
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated matplotlib API usage detected. The function plt.cm.get_cmap() was deprecated in Matplotlib 3.7 and will be removed in 3.11. Update to use matplotlib.colormaps[name] or matplotlib.colormaps.get_cmap() instead.

Copilot uses AI. Check for mistakes.
# Angles tend to create concentric patterns, so use larger min_cluster_size by default
if method.lower() == "hdbscan":
if "min_cluster_size" not in kwargs_bonds:
kwargs_bonds["min_cluster_size"] = 3
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expression mutates a default value.

Copilot uses AI. Check for mistakes.
if "min_cluster_size" not in kwargs_bonds:
kwargs_bonds["min_cluster_size"] = 3
if "min_cluster_size" not in kwargs_angles:
kwargs_angles["min_cluster_size"] = 3
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expression mutates a default value.

Copilot uses AI. Check for mistakes.
if "min_cluster_size" not in kwargs_angles:
kwargs_angles["min_cluster_size"] = 3
if "min_samples" not in kwargs_angles:
kwargs_angles["min_samples"] = 5 # More conservative clustering
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expression mutates a default value.
This expression mutates a default value.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cluster parameters in (b) general bond force field

2 participants