{"id":50738208,"url":"https://github.com/radi0sus/advanced_cshm-cc","last_synced_at":"2026-06-10T15:32:12.448Z","repository":{"id":361631300,"uuid":"1255028441","full_name":"radi0sus/advanced_cshm-cc","owner":"radi0sus","description":"Computes CShM (shape measures) and other geometric indices from crystallographic information files (CIFs) or xyz files, which may contain single or multiple entries.","archived":false,"fork":false,"pushed_at":"2026-05-31T14:31:51.000Z","size":205,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T16:20:18.715Z","etag":null,"topics":["chemistry","cif","continuous-shape-measures","coordination","coordination-chemistry","crystallography","cshm","geometry-index","javascript","o","octahedricity","tau","tau4","tau5","xyz","xyz-files"],"latest_commit_sha":null,"homepage":"https://radi0sus.github.io/advanced_cshm-cc/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/radi0sus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T10:03:30.000Z","updated_at":"2026-05-31T14:31:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/radi0sus/advanced_cshm-cc","commit_stats":null,"previous_names":["radi0sus/advanced_cshm-cc"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/radi0sus/advanced_cshm-cc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fadvanced_cshm-cc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fadvanced_cshm-cc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fadvanced_cshm-cc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fadvanced_cshm-cc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radi0sus","download_url":"https://codeload.github.com/radi0sus/advanced_cshm-cc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fadvanced_cshm-cc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34159250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemistry","cif","continuous-shape-measures","coordination","coordination-chemistry","crystallography","cshm","geometry-index","javascript","o","octahedricity","tau","tau4","tau5","xyz","xyz-files"],"created_at":"2026-06-10T15:32:10.236Z","updated_at":"2026-06-10T15:32:12.441Z","avatar_url":"https://github.com/radi0sus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# advanced_cshm-cc\n\nBrowser-based CShM analyzer for coordination compounds.\n\nThis project is a web-app companion to the Python command-line tool\n[`cshm-cc`](https://github.com/radi0sus/cshm-cc). It calculates Continuous Shape\nMeasures (CShM), selected geometry indices, polyhedral volumes, and coordination\nspheres from CIF and XYZ structure files directly in the browser.\n\nThe app is designed to work without a local server:\n\n```console\nopen index.html\n```\n\nIt can also be hosted as a static web page, e.g. via GitHub Pages.  \n\n[`https://radi0sus.github.io/advanced_cshm-cc/`](https://radi0sus.github.io/advanced_cshm-cc/)\n\n---\n\n## Relation to the Python CLI tool\n\nThe original Python tool is:\n\n[`cshm-cc`](https://github.com/radi0sus/cshm-cc)\n\nThis browser version follows the same general purpose:\n\n- automatic detection of central metal sites,\n- coordination-sphere generation,\n- CShM calculation for CN 2–6,\n- τ₄, τ₄′, τ₅, and octahedricity *O*,\n- polyhedral volume,\n- XYZ export of coordination spheres with the metal atom at the origin.\n\nHowever, the implementation and workflow differ.\n\n---\n\n## Main differences from `cshm-cc`\n\n### 1. Browser-only, no Python dependencies\n\nThe web app uses plain JavaScript and bundled browser libraries.\n\n### 2. No direct COD import\n\nThe Python CLI can download structures from the Crystallography Open Database\n(COD) by COD ID.\n\nThe browser app cannot directly fetch CIF files from COD.\n\nRecommended workflow for COD structures:\n\n1. download the CIF manually from COD,\n2. drop the CIF file into the web app.\n\n### 3. CIF and XYZ files are loaded locally\n\nThe web app accepts:\n\n```text\n.cif\n.xyz\n```\n\nvia drag-and-drop or file picker.\n\nMulti-block CIF files are supported. Multi-XYZ files are also supported.\n\n### 4. Interactive coordination-sphere editing\n\nUnlike the CLI tool, the web app allows interactive inspection and adjustment:\n\n- select/deselect detected metal sites,\n- change the bond-radius tolerance per site,\n- include/exclude H atoms,\n- include/exclude metal–metal contacts,\n- manually toggle individual ligand atoms in a coordination sphere,\n- immediately update CN, CShM, geometry indices, viewer and exports.\n\n### 5. CShM optimization\n\nThe Python CLI has two modes:\n\n- fast mode with a configurable number of random trials,\n- exact mode using all permutations.\n\nThe browser version currently uses an exact permutation-based approach for\nCN 2–6. Therefore, there is no \"number of trials\" setting in the web app.\n\nFor CN 2–6 this is feasible because the maximum number of points is 7\n(central atom + 6 ligands):\n\n| CN | points | permutations |\n|---:|-------:|-------------:|\n| 2 | 3 | 6 |\n| 3 | 4 | 24 |\n| 4 | 5 | 120 |\n| 5 | 6 | 720 |\n| 6 | 7 | 5040 |\n\nThis makes the browser result deterministic and closer to the exact mode of the\nPython tool.\n\n### 6. Symmetry handling\n\nThe Python version uses `gemmi` for crystallographic symmetry and periodic\nboundary handling.\n\nThe browser version implements CIF symmetry operators and periodic-image\nsearching in JavaScript. It supports symmetry-equivalent and translated ligand\npositions and stores symmetry information for each ligand.\n\nBecause this is not `gemmi`, small differences may occur for difficult CIFs,\nunusual symmetry settings, disorder, or edge cases.\n\n### 7. Polyhedral volume\n\nThe Python CLI uses SciPy/Qhull:\n\n```python\nscipy.spatial.ConvexHull\n```\n\nThe browser version uses a small JavaScript convex-hull volume implementation.\nFor common CN 4–6 coordination polyhedra it should give useful values, but it\nmay not be as robust as Qhull for degenerate or nearly coplanar point sets.\n\n---\n\n## Features\n\n- Load local `.cif` and `.xyz` files.\n- Supports multi-block CIF files.\n- Supports multi-XYZ files.\n- Automatic central atom detection.\n- Interactive selection of metal sites.\n- Per-site bond-radius tolerance slider.\n- Optional inclusion of hydrogen ligands.\n- Optional inclusion of metal–metal contacts.\n- Clickable ligand chips:\n  - all ligands are active by default,\n  - clicking a ligand toggles it on/off,\n  - CShM, CN, geometry indices and viewer update immediately.\n- 3Dmol.js viewer for coordination spheres.\n- Export results as Markdown.\n- Export coordination spheres as XYZ with the central atom at:\n\n```text\n0.000000  0.000000  0.000000\n```\n\n---\n\n## Usage\n\nOpen the app locally:\n\n```console\nopen index.html\n```\n\nor host the repository as a static website.\n\nThen:\n\n1. drop a CIF or XYZ file into the dropzone,\n2. select/deselect metal sites if needed,\n3. adjust options,\n4. inspect the CShM and geometry results,\n5. optionally export Markdown or XYZ.\n\n---\n\n## Input\n\n### CIF\n\nThe app reads atom labels, atom types, fractional coordinates, unit-cell\nparameters and symmetry operations from CIF files. It supports CIFs with single or multiple\nstructure entries.\n\n### XYZ\n\nSingle XYZ:\n\n```xyz\n5\nexample\nFe1  0.000  0.000  0.000\nN1   2.000  0.000  0.000\nN2  -2.000  0.000  0.000\nO1   0.000  2.000  0.000\nO2   0.000 -2.000  0.000\n```\n\nMulti-XYZ:\n\n```xyz\n5\nfragment 1\nFe1  0.000  0.000  0.000\nN1   2.000  0.000  0.000\nN2  -2.000  0.000  0.000\nO1   0.000  2.000  0.000\nO2   0.000 -2.000  0.000\n\n5\nfragment 2\nCu1  0.000  0.000  0.000\nN1   2.000  0.000  0.000\nN2  -2.000  0.000  0.000\nCl1  0.000  2.000  0.000\nCl2  0.000 -2.000  0.000\n```\n\nThe parser accepts atom labels such as `Fe1`, `N2`, `Cl1` and normalizes the\nelement symbol internally.\n\n---\n\n## Output\n\n### Markdown export\n\nThe Markdown export contains one section per metal site, including:\n\n- CN,\n- τ₄, τ₄′, τ₅, *O*, where applicable,\n- polyhedral volume,\n- CShM table,\n- ligand table with distances and symmetry information.\n\nIf the input file is:\n\n```text\nexample.cif\n```\n\nthe Markdown export should be named:\n\n```text\nexample.md\n```\n\nIf the input file is:\n\n```text\nexample.xyz\n```\n\nthe Markdown export should also be named:\n\n```text\nexample.md\n```\n\n### XYZ export\n\nThe XYZ export contains the selected coordination spheres.\n\nFor CIF input:\n\n```text\nexample.cif → example.xyz\n```\n\nFor XYZ input, the export should avoid overwriting the original file, for\nexample:\n\n```text\nexample.xyz → example_spheres.xyz\n```\n\nEach exported coordination sphere is centered on the metal atom:\n\n```xyz\n7\nexample-Fe1 CN=6\nFe     0.000000     0.000000     0.000000\nO     -0.616592    -1.061741    -1.501215\nO      0.959974     1.212008    -1.158622\nO      0.571590     1.007982     1.743717\nO     -1.724182     1.000584     0.126840\nN     -0.704425    -1.596884     1.194038\nN      1.895974    -0.970502     0.221754\n```\n\n---\n\n## Geometry indices\n\nThe following indices are calculated where applicable.\n\n### τ₄\n\nFor four-coordinate compounds:\n\n```math\n\\tau_4 = \\frac{360^\\circ-(\\alpha+\\beta)}{141^\\circ}\n```\n\nSquare planar geometry:\n\n```text\nτ₄ = 0\n```\n\nTetrahedral geometry:\n\n```text\nτ₄ = 1\n```\n\nSeesaw geometry:\n\n```text\nτ₄ ≈ 0.43\n```\n\n### τ₄′\n\nImproved four-coordinate geometry index:\n\n```math\n\\tau'_4 =\n\\frac{\\beta-\\alpha}{250.5^\\circ}\n+\n\\frac{180^\\circ-\\beta}{70.5^\\circ}\n```\n\nSquare planar geometry:\n\n```text\nτ₄′ = 0\n```\n\nTetrahedral geometry:\n\n```text\nτ₄′ = 1\n```\n\nSeesaw geometry:\n\n```text\nτ₄′ ≈ 0.24\n```\n\n### τ₅\n\nFor five-coordinate compounds:\n\n```math\n\\tau_5 = \\frac{\\beta-\\alpha}{60^\\circ}\n```\n\nSquare pyramidal geometry:\n\n```text\nτ₅ = 0\n```\n\nTrigonal bipyramidal geometry:\n\n```text\nτ₅ = 1\n```\n\nHere, α and β are the two largest ligand-metal-ligand angles, with:\n\n```text\nβ \u003e α\n```\n\n### Octahedricity O\n\nFor six-coordinate compounds:\n\n```math\nO =\n\\sqrt{\n\\frac{1}{15}\n\\sum_{i=1}^{15}\n(\\hat{\\theta_i}-\\theta_i)^2\n}\n```\n\nwhere:\n\n```text\nθ̂ᵢ = 180° for trans angles\nθ̂ᵢ =  90° for cis angles\nθᵢ  = experimental ligand-metal-ligand angle\n```\n\n*O* is close to zero for an almost ideal octahedron.\n\n---\n\n## CShM reference shapes\n\nThe app currently supports CShM for CN 2–6.\n\n### CN 2\n\n```text\nL-2\nvT-2\nvOC-2\n```\n\n### CN 3\n\n```text\nTP-3\nvT-3\nfvOC-3\nmvOC-3\n```\n\n### CN 4\n\n```text\nSP-4\nT-4\nSS-4\nvTBPY-4\n```\n\n### CN 5\n\n```text\nPP-5\nvOC-5\nTBPY-5\nSPY-5\nJTBPY-5\n```\n\n### CN 6\n\n```text\nHP-6\nPPY-6\nOC-6\nTPR-6\nJPPY-6\n```\n\nThe reference coordinates are based on ideal structures used by `cosymlib` and\nrelated Continuous Shape Measure tools.\n\n---\n\n## Bond detection\n\nPossible coordinating atoms are detected using covalent radii.\n\nThe default radius table follows the \"maximum radii\" approach used in the\nPython `cshm-cc` tool, based on tested values from Alvarez, SHELX and Jmol-style\nradii. A default bond tolerance is applied to the sum of the central-atom and\nligand radii.\n\nThe per-card slider changes this tolerance interactively.\n\nHydrogen ligands are excluded by default unless enabled.\n\nMetal–metal contacts are excluded by default unless enabled.\n\n---\n\n## Metal–metal contacts\n\nBy default, metal atoms are not considered as ligands. This avoids automatic\ninclusion of metal-metal contacts or symmetry-equivalent metal atoms in the\ncoordination sphere.\n\nThe option:\n\n```text\nInclude metal–metal bonds\n```\n\nallows metal atoms to be considered as ligands if they fall within the current\nbond cutoff.\n\nThe exact same labelled atom as the central atom is always excluded.\n\n---\n\n## Limitations\n\n- Direct COD loading is not available in the browser.\n- The browser CIF handling is not `gemmi`; difficult CIFs may behave differently\n  from the Python CLI.\n- Symmetry and periodic boundary handling are implemented in JavaScript and may\n  not cover all crystallographic edge cases.\n- Polyhedral volume is calculated with a browser-side convex-hull routine and\n  may differ from SciPy/Qhull in degenerate cases.\n- Estimated standard deviations on bond lengths and angles are not calculated.\n- CShM is currently implemented for CN 2–6.\n- Very large CIFs or many metal sites may be slower in the browser.\n\n---\n\n## Third-party software\n\n### 3Dmol.js\n\nThe web app uses 3Dmol.js for molecular visualization.\n\nProject:\n\n```text\nhttps://3dmol.csb.pitt.edu/\n```\n\nReference:\n\n\u003e Nicholas Rego and David Koes,  \n\u003e \"3Dmol.js: molecular visualization with WebGL\",  \n\u003e *Bioinformatics* **2015**, *31*, 1322–1324.  \n\u003e DOI: https://doi.org/10.1093/bioinformatics/btu829\n\n### CIF parser\n\nThe app uses a JavaScript CIF parser derived from `cif.js` by Gert-Jan Bekker.\n\nProject/source:\n\n```text\nhttps://gitlab.com/pdbjapan/tools/cif-parsers\n```\n\nLicense:\n\n```text\nMIT\n```\n\nThe license header in `static/js/cif.js` should be kept.\n\n### Shape reference structures\n\nIdeal reference structures are based on:\n\n```text\nhttps://github.com/GrupEstructuraElectronicaSimetria/cosymlib/blob/master/cosymlib/shape/ideal_structures_center.yaml\n```\n\n---\n\n## References\n\nIf you use τ₄, τ₄′, τ₅, *O*, or CShM to describe coordination geometries,\nplease cite the relevant literature.\n\n### τ₄\n\n\u003e Lei Yang, Douglas R. Powell, Robert P. Houser,  \n\u003e \"Structural variation in copper(i) complexes with pyridylmethylamide ligands:\n\u003e structural analysis with a new four-coordinate geometry index, τ₄\",  \n\u003e *Dalton Transactions* **2007**, 955–964.  \n\u003e DOI: https://doi.org/10.1039/B617136B\n\n### τ₄′\n\n\u003e Andrzej Okuniewski, Damian Rosiak, Jarosław Chojnacki, Barbara Becker,  \n\u003e \"Coordination polymers and molecular structures among complexes of\n\u003e mercury(II) halides with selected 1-benzoylthioureas\",  \n\u003e *Polyhedron* **2015**, *90*, 47–57.  \n\u003e DOI: https://doi.org/10.1016/j.poly.2015.01.035\n\n### τ₅\n\n\u003e Anthony W. Addison, T. Nageswara Rao, Jan Reedijk, Jacobus van Rijn,\n\u003e Gerrit C. Verschoor,  \n\u003e \"Synthesis, structure, and spectroscopic properties of copper(II) compounds\n\u003e containing nitrogen–sulphur donor ligands; the crystal and molecular structure\n\u003e of aqua[1,7-bis(N-methylbenzimidazol-2′-yl)-2,6-dithiaheptane]copper(II)\n\u003e perchlorate\",  \n\u003e *Journal of the Chemical Society, Dalton Transactions* **1984**, 1349–1356.  \n\u003e DOI: https://doi.org/10.1039/DT9840001349\n\n### Octahedricity O\n\n\u003e Christopher M. Brown, Nicole E. Arsenault, Trevor N. K. Cross, Duane Hean,\n\u003e Zhen Xu, Michael O. Wolf,  \n\u003e \"Structural, electrochemical and photophysical behavior of Ru(II) complexes\n\u003e with large bite angle sulfur-bridged terpyridyl ligands\",  \n\u003e *Inorganic Chemistry Frontiers* **2020**, *7*, 117–127.  \n\u003e DOI: https://doi.org/10.1039/C9QI01009B\n\n### Continuous Shape Measures\n\n\u003e Mark Pinsky, David Avnir,  \n\u003e \"Continuous Symmetry Measures. 5. The Classical Polyhedra\",  \n\u003e *Inorganic Chemistry* **1998**, *37*, 5575–5582.  \n\u003e DOI: https://doi.org/10.1021/ic9804925\n\n\u003e Santiago Alvarez, Pere Alemany, David Casanova, Jordi Cirera, Miquel Llunell,\n\u003e David Avnir,  \n\u003e \"Shape maps and polyhedral interconversion paths in transition metal chemistry\",  \n\u003e *Coordination Chemistry Reviews* **2005**, *249*, 1693–1708.  \n\u003e DOI: https://doi.org/10.1016/j.ccr.2005.03.031\n\n### Covalent radii\n\n\u003e Beatriz Cordero, Verónica Gómez, Ana E. Platero-Prats, Marc Revés,\n\u003e Jorge Echeverría, Eduard Cremades, Flavia Barragán, Santiago Alvarez,  \n\u003e \"Covalent radii revisited\",  \n\u003e *Dalton Transactions* **2008**, 2832–2838.  \n\u003e DOI: https://doi.org/10.1039/B801115J\n\n### 3Dmol.js\n\n\u003e Nicholas Rego and David Koes,  \n\u003e \"3Dmol.js: molecular visualization with WebGL\",  \n\u003e *Bioinformatics* **2015**, *31*, 1322–1324.  \n\u003e DOI: https://doi.org/10.1093/bioinformatics/btu829\n\n---\n\n## Related projects\n\n- Python CLI tool:  \n  https://github.com/radi0sus/cshm-cc\n\n- Manual atom-selection geometry tool:  \n  https://github.com/radi0sus/tau-calc\n\n- Continuous Symmetry Measure / Shape code:  \n  https://github.com/continuous-symmetry-measure/shape\n\n- SHAPE program:  \n  https://www.ee.ub.edu/downloads/\n\n- Online CSM calculator:  \n  https://csm.ouproj.org.il/molecule\n\n---\n\n## Notes on licenses and attribution\n\nThis repository contains original project code and third-party JavaScript\nlibraries.\n\nKeep license headers in bundled third-party files, especially:\n\n```text\nstatic/js/cif.js\nstatic/vendor/3Dmol-min.js\n```\n\nIf redistributing the app, include appropriate license information for all\nthird-party components.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradi0sus%2Fadvanced_cshm-cc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradi0sus%2Fadvanced_cshm-cc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradi0sus%2Fadvanced_cshm-cc/lists"}