-
Notifications
You must be signed in to change notification settings - Fork 0
Cluster b2_* #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cluster b2_* #44
Conversation
There was a problem hiding this 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_atomandb2_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 |
8_clustering/clustering.py
Outdated
| # Plot | ||
| fig, ax = plt.subplots(figsize=(8, 6)) | ||
| sorted_labels = list(sorted(set(labels))) | ||
| colors = plt.cm.get_cmap("nipy_spectral")( |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
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.
| # 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 |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
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.
| 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 |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
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.
| 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 |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
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.
Close #40
Let me know if the copilot review was helpful or not and if there's something you wish it did.