{"id":17358594,"url":"https://github.com/niess/gdnp","last_synced_at":"2025-03-27T15:22:43.919Z","repository":{"id":111397354,"uuid":"139906364","full_name":"niess/gdnp","owner":"niess","description":"Convert a GDML geometry to an MCNP card","archived":false,"fork":false,"pushed_at":"2018-07-06T08:25:15.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T19:14:25.168Z","etag":null,"topics":["converter","gdml","mcnp"],"latest_commit_sha":null,"homepage":null,"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/niess.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}},"created_at":"2018-07-05T22:24:07.000Z","updated_at":"2023-10-02T02:48:27.000Z","dependencies_parsed_at":"2023-05-18T14:33:17.621Z","dependency_job_id":null,"html_url":"https://github.com/niess/gdnp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niess%2Fgdnp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niess%2Fgdnp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niess%2Fgdnp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niess%2Fgdnp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niess","download_url":"https://codeload.github.com/niess/gdnp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245868557,"owners_count":20685671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["converter","gdml","mcnp"],"created_at":"2024-10-15T19:06:07.000Z","updated_at":"2025-03-27T15:22:43.891Z","avatar_url":"https://github.com/niess.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GDNP\n(**GD**ML to MC**NP** converter)\n\n\n**Warning** : _this is a work in progress. See the [Contributing](#contributing)\nsection._\n\n## Description\nThe [gdnp.py](gdnp.py) Python script converts a GDML geometry description to an\nMCNP card. Usage is as following:\n```bash\n./gdnp.py FILE.GDML\n```\nThis will dump the result to `stdout`. Optionally, an output file can also be\nprovided as 2\u003csup\u003end\u003c/sup\u003e argument:\n```bash\n./gdnp.py FILE.GDML MCNP.CARD\n```\nAn example of [converted geometry](examples/volcano.card) is available in the\n[examples](examples) folder. The corresponding\n[input GDML](examples/volcano.gdml) is also provided.\n\nNote that the script is implemented in bare **Python 2.7**, i.e. **without\ndependencies**. However, note also that it was only tested on Linux so far.\n\n\n## Contributing\nCurrently, the converter only supports a **limited number of GDML geometries**:\n_tube_ (_closed, centered_), _ellipsoid_ and _intersection_. ~~Rotations~~ are\nnot implemented as well. In addition, the materials data needs to be manually\nfilled in at the end of the card. Note that the materials index are properly\nmapped, though.\n\nAdditional geometries can be added by defining a *convert\\_gdml\\___{{volume}}__*\nfunction, where **{{volume}}** must be substituted by the GDML name of the\nvolume to convert. This function must return the MCNP bounding surfaces of the\nvolume as a list of tuples. See for example the *convert\\_gdml\\_tube* function.\nThe snippet below illustrates the syntax by converting a GDML centered Orb:\n```python\ndef convert_gdml_orb(volume, placement):\n    \"\"\"Convert a centered GDML orb to MCNP surfaces\n    \"\"\"\n    r = volume[\"r\"]\n    if (placement[0] != 0) or (placement[1] != 0) or (placement[2] != 0):\n        raise NotImplemented(\"offset orb\")\n    else:\n        return [(-1, \"SO\", r)]\n```\nEach line of the returned list corresponds to a bounding surface. Note that\nthe first item of the surface definition **must** indicate the surface sign\nfor being inside the volume, see e.g. pages 3 and 4 of the\n[MCNP primer](https://www.mne.k-state.edu/~jks/MCNPprmr.pdf).\n\n## License\nThe [gdnp.py](gdnp.py) utility is under the MIT license. See the provided\n[LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniess%2Fgdnp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniess%2Fgdnp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniess%2Fgdnp/lists"}