{"id":21674253,"url":"https://github.com/robertapplin/n-body-simulations","last_synced_at":"2026-04-17T01:02:05.920Z","repository":{"id":38009010,"uuid":"299050603","full_name":"robertapplin/N-Body-Simulations","owner":"robertapplin","description":"A QWidget used for simulating a gravitational system of N bodies in two dimensions.","archived":false,"fork":false,"pushed_at":"2023-08-20T19:58:41.000Z","size":698,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T18:48:23.633Z","etag":null,"topics":["cplusplus","n-body-problem","n-body-simulator","python","qt-widget"],"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/robertapplin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-09-27T14:32:54.000Z","updated_at":"2021-12-22T18:14:22.000Z","dependencies_parsed_at":"2024-11-25T16:02:56.153Z","dependency_job_id":null,"html_url":"https://github.com/robertapplin/N-Body-Simulations","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/robertapplin/N-Body-Simulations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertapplin%2FN-Body-Simulations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertapplin%2FN-Body-Simulations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertapplin%2FN-Body-Simulations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertapplin%2FN-Body-Simulations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertapplin","download_url":"https://codeload.github.com/robertapplin/N-Body-Simulations/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertapplin%2FN-Body-Simulations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31910585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["cplusplus","n-body-problem","n-body-simulator","python","qt-widget"],"created_at":"2024-11-25T13:43:37.268Z","updated_at":"2026-04-17T01:02:05.802Z","avatar_url":"https://github.com/robertapplin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N-Body Simulator\n![windows workflow](https://github.com/robertapplin/N-Body-Simulations/actions/workflows/windows.yml/badge.svg)\n![ubuntu workflow](https://github.com/robertapplin/N-Body-Simulations/actions/workflows/ubuntu.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/robertapplin/N-Body-Simulations/badge.svg?branch=main)](https://coveralls.io/github/robertapplin/N-Body-Simulations?branch=main)\n\nThis project creates a QWidget used for simulating a gravitational system of N bodies in two dimensions.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/three-body-simulation.gif\" alt=\"animated\"\u003e\n\u003c/p\u003e\n\n## Table of contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [About](#about)\n* [Features](#features)\n\n## Installation\n\nThis widget was created using **Python v3.8**, and using **CMake v3.12**. These versions are a minimum requirement. It is also recommended that you create a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) and activate it before starting the installation process.\n\nThe first step is to clone the code in this repository using [git](https://git-scm.com/downloads):\n\n```sh\ngit clone git@github.com:robertapplin/N-Body-Simulations.git\n```\n\nThen install the python environment requirements and Qt dependencies using pip:\n\n```sh\npip install -r requirements.txt\n```\n\nNext, from within the project source directory, build and install the project. If this command fails, try running it as admin.\n\n```sh\npython setup.py install\n```\n\nThe n-body-simulations package can now be found in the site-packages of your virtual environment.\n\n## Building Locally\n\nYou can also build the code locally from git bash, from your source directory and with your virtual environment activated. Pass the following\nflags to the first cmake command below: ``-DPYTHON_EXECUTABLE``, ``Dpybind11_DIR``, ``DCMAKE_INSTALL_PREFIX``, ``DCMAKE_INSTALL_LIBDIR``\n\n```sh\ncmake --preset=vs-debug .\ncmake --build ../build\n```\n\n## Usage\n\nFrom python, you can now import and open the widget as follows:\n\n```py\nfrom n_body_simulations.startup import startup_widget\n\nstartup_widget()\n```\n\nIt is also possible to embed the widget into an existing interface.\n\n## About\n\nThe purpose of this project was to develop my programming skills by creating a maintainable and well-tested cross-platform application. In this project I have created a simulator for N-Body gravitational systems which allows the collision and merging of bodies. The **docs** folder contains example \\**.txt* files which can be loaded into this widget.\n\nThe following units have been used for this project:\n\n  |Quantity  |Measured in               |Unit|\n  |----------|--------------------------|----|\n  |Mass      |Solar masses              |M*  |\n  |Position  |Astronomical units        |au  |\n  |Time      |Days                      |d   |\n  |Velocity  |Astronomical units per day|au/d|\n\n## Features\n\nThe widget has several options which are found above the data table:\n\n  |Button                                                                            |Description                                                                    |\n  |----------------------------------------------------------------------------------|-------------------------------------------------------------------------------|\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/load_button.PNG\"\u003e            |Load a \\**.txt* file containing initial parameters for an N-Body-Simulation.   |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/save_button.PNG\"\u003e            |Save the initial parameters of an N-Body-Simulation to a \\**.txt* file.        |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/remove_button.PNG\"\u003e          |Remove the selected bodies from the simulation.                                |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/add_button.PNG\"\u003e             |Add bodies to the simulation.                                                  |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/time_options_button.PNG\"\u003e    |Adjust the time step and duration of the simulation.                           |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/plotting_options_button.PNG\"\u003e|Show or hide position labels and velocity arrows on the plot.                  |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/interactive_mode_button.PNG\"\u003e|Turn on interactive mode, allowing you to interact with the bodies on the plot.|\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/stop_button.PNG\"\u003e            |Stop the simulation.                                                           |\n  |\u003cimg align=\"centre\" width=\"25\" height=\"25\" src=\"docs/play_pause_button.PNG\"\u003e      |Play or Pause the simulation.                                                  |\n\nThe widget also includes an interactive plot where you can:\n\n  |Image                                                                 |Description                                                                          |\n  |----------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n  |\u003cimg align=\"left\" width=\"83\" height=\"25\" src=\"docs/body.PNG\"\u003e         |Adjust the colour and name used to represent a body.                                 |\n  |\u003cimg align=\"left\" width=\"83\" height=\"25\" src=\"docs/body_position.PNG\"\u003e|Adjust the position of a body by dragging the body on the interactive plot.          |\n  |\u003cimg align=\"left\" width=\"83\" height=\"25\" src=\"docs/body_velocity.PNG\"\u003e|Adjust the velocity of a body by dragging the velocity arrow on the interactive plot.|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertapplin%2Fn-body-simulations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertapplin%2Fn-body-simulations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertapplin%2Fn-body-simulations/lists"}