From defdae270394605b57c3b9f8a0f4dc213412b4b0 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 1 May 2024 15:34:03 -0400 Subject: [PATCH 01/10] Create .editorconfig (#1049) * Create .editorconfig Co-authored-by: Lourens Veen --- .editorconfig | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..143b0b3da3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines and UTF-8 everywhere +[*] +end_of_line = lf +trim_trailing_whitespace = true +charset = utf-8 + +# 2 space indentation +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + +# 4 space indentation +[*.py] +indent_style = space +indent_size = 4 + +# Tab indentation (no size specified) +[Makefile] +indent_style = tab From b008016946f3d2d976c4bd19963ebab8cdb47a51 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 3 May 2024 13:18:27 -0400 Subject: [PATCH 02/10] Refactoring apr2024 (#1051) * don't allow SeBa to evolve back in time (would cause a stall) * move from optparse to argparse --- src/amuse/community/seba/interface.cc | 4 ++++ src/amuse/ext/solarsystem.py | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/amuse/community/seba/interface.cc b/src/amuse/community/seba/interface.cc index 0604274e0d..2fd2a1595f 100644 --- a/src/amuse/community/seba/interface.cc +++ b/src/amuse/community/seba/interface.cc @@ -844,6 +844,10 @@ int get_number_of_particles(int * number_of_particles){ int evolve_system(double end_time) { int n_steps = 1; int n_steps_per_phase = 10; + // cannot evolve for a negative time + if (end_time < seba_time) { + return 0; + } real delta_t = (end_time - seba_time)/((real)n_steps); real out_time; nodeptr bi; diff --git a/src/amuse/ext/solarsystem.py b/src/amuse/ext/solarsystem.py index efff81b83f..3ec1cfefb0 100644 --- a/src/amuse/ext/solarsystem.py +++ b/src/amuse/ext/solarsystem.py @@ -324,17 +324,20 @@ def new_solar_system(Julian_date=-1|units.day): else: return solar_system_in_time(Julian_date) -def new_option_parser(): - from amuse.units.optparse import OptionParser - result = OptionParser() - result.add_option("-d", dest="Julian_date", unit=units.day, - type=float, default = 2438871.5|units.day, - help="julian date [%default]") +def new_argument_parser(): + import argparse + result = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + result.add_argument( + "-d", dest="Julian_date", unit=units.day, + type=units.day, default=2438871.5 | units.day, + help="julian date" + ) return result -if __name__ in ('__main__', '__plot__'): - o, arguments = new_option_parser().parse_args() - solar_system = new_solar_system(o.Julian_date) - print(solar_system) - +if __name__ == '__main__': + arguments = new_argument_parser().parse_args() + solar_system = new_solar_system(arguments.Julian_date) + print(solar_system) From 7cd0438f1fa448eb761a54ddcd01ca0250679ea8 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 18 Jun 2024 00:30:02 +0200 Subject: [PATCH 03/10] Update ci.yml updated actions --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e42cc1aca9..8e4e68c940 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup MPI id: setup-mpi @@ -53,13 +53,13 @@ jobs: if: ${{ matrix.mpi == 'openmpi' }} - name: Set up JDK 1.8 - uses: actions/setup-java@v3.9.0 + uses: actions/setup-java@v4 with: distribution: 'zulu' # See 'Supported distributions' for available options java-version: '17' - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} cache: 'pip' @@ -90,7 +90,7 @@ jobs: pip list - name: archive build log - uses: actions/upload-artifact@v3.1.1 + uses: actions/upload-artifact@v4 with: name: buildlog path: build.log From 3b1a977394e310d9a9ee10433111efc3f60e671d Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 18 Jun 2024 00:30:49 +0200 Subject: [PATCH 04/10] Update community-seba.yml actions --- .github/workflows/community-seba.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/community-seba.yml b/.github/workflows/community-seba.yml index 3c7b682f69..bfe7848da3 100644 --- a/.github/workflows/community-seba.yml +++ b/.github/workflows/community-seba.yml @@ -21,18 +21,18 @@ jobs: java-version: [ '17' ] name: Test AMUSE with ${{ matrix.mpi }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup MPI uses: mpi4py/setup-mpi@v1 with: mpi: ${{ matrix.mpi }} - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3.9.0 + uses: actions/setup-java@v4 with: distribution: 'zulu' # See 'Supported distributions' for available options java-version: ${{ matrix.java-version }} - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install dependencies @@ -55,7 +55,7 @@ jobs: amusifier --get-amuse-configmk pip list - name: archive build log - uses: actions/upload-artifact@v3.1.1 + uses: actions/upload-artifact@v4 with: name: buildlog path: build.log From 7f61c9c19f119b2ba68c68e745536cfc462de3c7 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 18 Jun 2024 00:31:38 +0200 Subject: [PATCH 05/10] Update lint.yml actions --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 99cade12b4..badf75711c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,10 +15,10 @@ jobs: steps: - name: Check out Git repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.8 From 6ccba646ea2087efd426021309fd311276d2dc27 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 18 Jun 2024 00:43:04 +0200 Subject: [PATCH 06/10] Update ci.yml (#1060) save unique artifacts --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e4e68c940..5646b231dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,11 +89,14 @@ jobs: amusifier --get-amuse-configmk pip list + - name: move build log + run: | + mv build.log build-${{ matrix.mpi }}-${{ matrix.python }}.log - name: archive build log uses: actions/upload-artifact@v4 with: name: buildlog - path: build.log + path: build-${{ matrix.mpi }}-${{ matrix.python }}.log - name: test core_tests run: | From cdd21cc5cb06e40ccf5ecb86d513d211634e2689 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 18 Jun 2024 00:53:01 +0200 Subject: [PATCH 07/10] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5646b231dd..0058ea1032 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: - name: archive build log uses: actions/upload-artifact@v4 with: - name: buildlog + name: buildlog-${{ matrix.mpi }}-${{ matrix.python }} path: build-${{ matrix.mpi }}-${{ matrix.python }}.log - name: test core_tests From 36bd94940c6f3ca3e7eda19bb9d3bc7e968eeb61 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 2 Jul 2024 14:38:34 +0200 Subject: [PATCH 08/10] add hermite-grx package --- packages/amuse-hermite-grx/MANIFEST.in | 9 +++ packages/amuse-hermite-grx/README.md | 1 + packages/amuse-hermite-grx/pyproject.toml | 2 + packages/amuse-hermite-grx/setup.py | 65 +++++++++++++++++++ .../src/amuse/community/hermite_grx | 1 + packages/amuse-hermite-grx/support | 1 + 6 files changed, 79 insertions(+) create mode 100644 packages/amuse-hermite-grx/MANIFEST.in create mode 100644 packages/amuse-hermite-grx/README.md create mode 100644 packages/amuse-hermite-grx/pyproject.toml create mode 100644 packages/amuse-hermite-grx/setup.py create mode 120000 packages/amuse-hermite-grx/src/amuse/community/hermite_grx create mode 120000 packages/amuse-hermite-grx/support diff --git a/packages/amuse-hermite-grx/MANIFEST.in b/packages/amuse-hermite-grx/MANIFEST.in new file mode 100644 index 0000000000..ab64602564 --- /dev/null +++ b/packages/amuse-hermite-grx/MANIFEST.in @@ -0,0 +1,9 @@ +include support/__init__.py +include support/setup_codes.py +include support/version.py +include support/classifiers.py +include pyproject.toml + +recursive-include src * +recursive-exclude src *.pyc *.o *~ .pc ccache *.a + diff --git a/packages/amuse-hermite-grx/README.md b/packages/amuse-hermite-grx/README.md new file mode 100644 index 0000000000..cf8f7fb5cf --- /dev/null +++ b/packages/amuse-hermite-grx/README.md @@ -0,0 +1 @@ +This package installs the Hermite-GRX community code for AMUSE. diff --git a/packages/amuse-hermite-grx/pyproject.toml b/packages/amuse-hermite-grx/pyproject.toml new file mode 100644 index 0000000000..ce072292f5 --- /dev/null +++ b/packages/amuse-hermite-grx/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["setuptools>=65.0.0", "wheel>=0.30", "amuse-framework>=2024.3.0"] diff --git a/packages/amuse-hermite-grx/setup.py b/packages/amuse-hermite-grx/setup.py new file mode 100644 index 0000000000..f3a71a7d49 --- /dev/null +++ b/packages/amuse-hermite-grx/setup.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +from support.classifiers import classifiers + +from setuptools import setup + +import support +support.use("system") +from support.setup_codes import setup_commands + +name = 'amuse-hermite-grx' +author = 'The AMUSE team' +author_email = 'info@amusecode.org' +license_ = "Apache License 2.0" +url = 'http://www.amusecode.org/' +install_requires = [ + 'amuse-framework', +] +description = 'The Astrophysical Multipurpose Software Environment - Hermite-GRX' +with open("README.md", "r") as fh: + long_description = fh.read() +long_description_content_type = "text/markdown" + +extensions = [] + +all_data_files = [] + +packages = [ + 'amuse.community.hermite_grx', +] + +package_data = { +} + +mapping_from_command_name_to_command_class = setup_commands() + +setup_requires = ['setuptools_scm'] +use_scm_version = { + "root": "../..", + "relative_to": __file__, + "version_file": "src/amuse/community/hermite_grx/_version.py", +} + +setup( + name=name, + use_scm_version=use_scm_version, + setup_requires=setup_requires, + classifiers=classifiers, + url=url, + author_email=author_email, + author=author, + license=license_, + description=description, + long_description=long_description, + long_description_content_type=long_description_content_type, + install_requires=install_requires, + python_requires=">=3.7", + cmdclass=mapping_from_command_name_to_command_class, + ext_modules=extensions, + package_dir={ + 'amuse.community.hermite_grx': 'src/amuse/community/hermite_grx', + }, + packages=packages, + package_data=package_data, + data_files=all_data_files, +) diff --git a/packages/amuse-hermite-grx/src/amuse/community/hermite_grx b/packages/amuse-hermite-grx/src/amuse/community/hermite_grx new file mode 120000 index 0000000000..92d789ba48 --- /dev/null +++ b/packages/amuse-hermite-grx/src/amuse/community/hermite_grx @@ -0,0 +1 @@ +../../../../../src/amuse/community/hermite_grx \ No newline at end of file diff --git a/packages/amuse-hermite-grx/support b/packages/amuse-hermite-grx/support new file mode 120000 index 0000000000..321fcb594c --- /dev/null +++ b/packages/amuse-hermite-grx/support @@ -0,0 +1 @@ +../../support \ No newline at end of file From 9e1120c73919ca8b97f938dc82842beaaaf883f2 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 2 Jul 2024 16:08:24 +0200 Subject: [PATCH 09/10] standardise HermiteGRX imports --- src/amuse/community/hermite_grx/__init__.py | 2 +- src/amuse/community/hermite_grx/interface.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/amuse/community/hermite_grx/__init__.py b/src/amuse/community/hermite_grx/__init__.py index 23871721dc..9f33442ba6 100755 --- a/src/amuse/community/hermite_grx/__init__.py +++ b/src/amuse/community/hermite_grx/__init__.py @@ -1 +1 @@ -# generated file +from .interface import Hermitegrx diff --git a/src/amuse/community/hermite_grx/interface.py b/src/amuse/community/hermite_grx/interface.py index 13e8554d11..9de91912b6 100755 --- a/src/amuse/community/hermite_grx/interface.py +++ b/src/amuse/community/hermite_grx/interface.py @@ -3,7 +3,7 @@ from amuse.community.interface.stopping_conditions import * -class HermiteGRXInterface( +class HermitegrxInterface( CodeInterface, GravitationalDynamicsInterface, StoppingConditionInterface ): include_headers = ["worker_code.h", "stopcond.h"] @@ -423,11 +423,11 @@ def set_jerk(): return function -class HermiteGRX(GravitationalDynamics): +class Hermitegrx(GravitationalDynamics): def __init__(self, convert_nbody=None, **options): self.stopping_conditions = StoppingConditions(self) - legacy_interface = HermiteGRXInterface(**options) + legacy_interface = HermitegrxInterface(**options) GravitationalDynamics.__init__(self, legacy_interface, convert_nbody, **options) def define_state(self, object): @@ -597,3 +597,8 @@ def define_particle_sets(self, object): object.add_getter("small_particles", "get_jerk") self.stopping_conditions.define_particle_set(object) + + +# for backwards compatibility reasons +HermiteGRXInterface = HermitegrxInterface +HermiteGRX = Hermitegrx From cf040fecfa0e9d9824dc7fc44c5fc1f402928056 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 2 Jul 2024 16:18:44 +0200 Subject: [PATCH 10/10] Update community-seba.yml (#1062) --- .github/workflows/community-seba.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/community-seba.yml b/.github/workflows/community-seba.yml index bfe7848da3..eba55621d7 100644 --- a/.github/workflows/community-seba.yml +++ b/.github/workflows/community-seba.yml @@ -54,11 +54,14 @@ jobs: run: | amusifier --get-amuse-configmk pip list + - name: move build log + run: | + mv build.log build-${{ matrix.mpi }}-${{ matrix.python }}.log - name: archive build log uses: actions/upload-artifact@v4 with: - name: buildlog - path: build.log + name: buildlog-${{ matrix.python }}-${{ matrix.mpi }} + path: build-${{ matrix.mpi }}-${{ matrix.python }}.log - name: test seba run: | pytest --pyargs amuse.test.suite.codes_tests.test_seba -sv