{"id":45680557,"url":"https://github.com/briling/xyz2svg","last_synced_at":"2026-02-24T14:21:10.030Z","repository":{"id":187054723,"uuid":"676240715","full_name":"briling/xyz2svg","owner":"briling","description":"A lightweight script to make vector images of molecules","archived":false,"fork":false,"pushed_at":"2025-10-17T18:52:36.000Z","size":229,"stargazers_count":13,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-18T20:51:02.461Z","etag":null,"topics":["computational-chemistry","molecular-graphics","molecular-visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briling.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":"2023-08-08T18:46:32.000Z","updated_at":"2025-10-17T18:52:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"807210f3-262f-490e-98ce-95bc93e7998b","html_url":"https://github.com/briling/xyz2svg","commit_stats":null,"previous_names":["briling/xyz2svg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/briling/xyz2svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briling%2Fxyz2svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briling%2Fxyz2svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briling%2Fxyz2svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briling%2Fxyz2svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briling","download_url":"https://codeload.github.com/briling/xyz2svg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briling%2Fxyz2svg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29785304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T10:45:18.109Z","status":"ssl_error","status_checked_at":"2026-02-24T10:45:09.911Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["computational-chemistry","molecular-graphics","molecular-visualization"],"created_at":"2026-02-24T14:21:05.305Z","updated_at":"2026-02-24T14:21:10.025Z","avatar_url":"https://github.com/briling.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xyz2svg\n\nLightweight script to make vector images of molecules\n\n## Requirements\n- `python\u003e=3.6`\n- [briling/v](https://github.com/briling/v) or something capable of printing atom positions and connectivity\n\n\n## Basic usage\n\n```\nv mol/caffeine.xyz | ./mol2svg.py \u003e caffeine.svg\n```\nOpen an xyz file with `v`, rotate the molecule as you like and press `p`, then `x` to exit\n\n![vector balls-and-sticks image of caffeine](figures/caffeine.svg)\n\n## Input file modification\nFor a water dimer\n```\nv mol/kj-H2O_1--H3O+.xyz \u003e input/kj-H2O_1--H3O+.inp\n```\nprints\n```\natom   8   -1.1697501   -0.1527130    0.0202511\natom   1   -1.8639331    0.4812310   -0.1588469\natom   1   -1.6335311   -0.9640680    0.2263131\natom   8    1.1960949    0.3707430   -0.0773079\natom   1    0.2351029    0.2036530   -0.0496909\natom   1    1.6046709    0.2360230    0.7985351\natom   1    1.6313459   -0.1748690   -0.7592539\nbond   1   2\nbond   1   3\nbond   4   5\nbond   4   6\nbond   4   7\n```\nThis file contains atomic numbers and coordinates in Å and list of bonds (base 1).\nWe can add a hydrogen bond between atoms 1–5:\n```\nbond 1 5 -1\n```\n(see [input/kj-H2O_1--H3O+.inp](input/kj-H2O_1--H3O+.inp)). Then \n```\n./mol2svg.py \u003c input/kj-H2O_1--H3O+.inp \u003e figures/kj-H2O_1--H3O+.svg\n```\ngives\u003cbr\u003e\n![vector balls-and-sticks image of a water dimer](figures/kj-H2O_1--H3O+.svg)\n\nOne can also add (positive or negative) bond orders ([input/caffeine_v2.inp](input/caffeine_v2.inp)):\n![vector balls-and-sticks image of caffeine with double bonds](figures/caffeine_v2.svg)\n\n## Drawing options\n\nRun \n```\n./mol2svg.py --help\n```\nto get help:\n```\n  --num                                                 add atom numbers\n  --elements                                            add element symbols\n  --canvas-size CANVAS_SIZE                             basic canvas size (default 80)\n  -wa ATOM_BORDER, --atom-border ATOM_BORDER            atom border width (default 5.0)\n  -wb BOND_WIDTH, --bond-width BOND_WIDTH               bond width (default 5.0)\n  -db BOND_DISTANCE, --bond-distance BOND_DISTANCE      line distance in multiple bonds (default 0.05)\n  -rs ATOM_SIZE, --atom_size ATOM_SIZE                  scaling factor for atom radii\n  -r%d ATOM_%d_RADIUS                                   sets basic radius for a specific element (in Å)\n  -g, --gradient                                        fill atoms with radial gradients (pseudo-3D mode)\n  --fog                                                 enable fog for depth perspective\n  --fog-strength FOG_STRENGTH                           fog strength (default 0.8, between 0.0 and 1.0)\n  --light-hydrogen                                      use a lighter color for H\n  --hide-H                                              hide C–H hydrogens (optionally specifying 1-indexed atom indices to keep, e.g. --hide-H 5 12)\n  --cpk                                                 use CPK coloring scheme\n  -fs FONT_SIZE, --font-size FONT_SIZE                  font size (default 24)\n  -fn FONT_NAME, --font-name FONT_NAME                  font name (default monospace)\n  --bond-color BOND_COLOR                               bond line color (default black - hex)\n  --atom-stroke-color ATOM_STROKE_COLOR                 atom stroke color (default black - hex)\n  --text-stroke-color TEXT_STROKE_COLOR                 text stroke color (default white - hex)\n  --text-color TEXT_COLOR                               text fill color (default black - hex)\n  --text-weight TEXT_WEIGHT                             text weight (default bold)\n  --text-style TEXT_STYLE                               text style (default normal)\n  --text-stroke-width TEXT_STROKE_WIDTH                 text stroke width (default 8)\n  --value-gradient VALUE_GRADIENT VALUE_GRADIENT        starting and finishing colors for value gradient (default [\"#000000\", \"#FF0000\"]\n  --value-radius VALUE_RADIUS                           radius of value gradient circles (default 0.2 Å)\n```\nThe same caffeine with options:\n```\n./mol2svg.py -rs 3.5 -wa 10 -wb 10 -db 0.1 \u003c input/caffeine_v2.inp \u003e figures/caffeine_v3.svg\n```\n![vector balls-and-sticks image of caffeine with double bonds and looks nice](figures/caffeine_v3.svg)\n\n\n### @iribirii's pseudo-3D mode:\n```\n./mol2svg.py -rs 3.5 -wb 10 -g \u003c input/caffeine.inp \u003e figures/caffeine_v4.svg\n```\n![vector balls-and-sticks image of caffeine with a pseudo 3D effect](figures/caffeine_v4.svg)\n\n### @aligfellow's fog depth perspective option:\n```\n./mol2svg.py -wb 10 --fog --fog-strength 0.8 -wa 4 \u003c input/C60-Ih.inp \u003e figures/C60-Ih.svg\n```\n![vector balls-and-sticks image of fullerene with fog depth perspective](figures/C60-Ih.svg)\n\n- currently incompatible with gradiented 3D mode\n\n\n### @aligfellow's option to hide C–H hydrodens:\n```\n./mol2svg.py -wb 10 --fog --fog-strength 0.9 -wa 4 --hide-H\n```\nwith an optional list of relevant hydrogens to keep:\n```\n./mol2svg.py -wb 10 --fog --fog-strength 0.9 -wa 4 --hide-H 68\n```\n![balls-and-sticks image of catalytic center structure](figures/502628045-acbd9488-c32d-4c8b-8ffe-e062d2cd986e.png)\n\n\n### Extended input\n\nAdd values to atoms, e.g.\n```\nlabel 1     0.009\n```\nto add them as text:\n```\n./mol2svg.py \u003c input/C3-7-6-7_v2.inp \u003e figures/C3-7-6-7_v2.svg\n```\n![vector balls-and-sticks image with additional text representing value](figures/C3-7-6-7_v2.svg)\n\n\nAdd ghost atom coordinates and corresponding values, e.g.\n```\nvalue   4.3721492    1.2190677   -0.9878959    0.009\n```\nto add circles representing them:\n```\n./mol2svg.py -rs 2.5  --value-gradient '#00FF00' '#FF0000' \u003c input/C3-7-6-7_v3.inp \u003e figures/C3-7-6-7_v3.svg\n```\n![vector balls-and-sticks image with additional circles colored with respect to a value](figures/C3-7-6-7_v3.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriling%2Fxyz2svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriling%2Fxyz2svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriling%2Fxyz2svg/lists"}