Skip to content

Commit

Permalink
Merge branch 'main' into update/petar_binary_reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
rieder authored Jul 12, 2024
2 parents cef5575 + cf040fe commit da28e16
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 29 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup MPI
id: setup-mpi
Expand All @@ -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'
Expand Down Expand Up @@ -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@v3.1.1
uses: actions/upload-artifact@v4
with:
name: buildlog
path: build.log
name: buildlog-${{ matrix.mpi }}-${{ matrix.python }}
path: build-${{ matrix.mpi }}-${{ matrix.python }}.log

- name: test core_tests
run: |
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/community-seba.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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@v3.1.1
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions packages/amuse-hermite-grx/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions packages/amuse-hermite-grx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This package installs the Hermite-GRX community code for AMUSE.
2 changes: 2 additions & 0 deletions packages/amuse-hermite-grx/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools>=65.0.0", "wheel>=0.30", "amuse-framework>=2024.3.0"]
65 changes: 65 additions & 0 deletions packages/amuse-hermite-grx/setup.py
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'
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,
)
1 change: 1 addition & 0 deletions packages/amuse-hermite-grx/src/amuse/community/hermite_grx
1 change: 1 addition & 0 deletions packages/amuse-hermite-grx/support
2 changes: 1 addition & 1 deletion src/amuse/community/hermite_grx/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# generated file
from .interface import Hermitegrx
11 changes: 8 additions & 3 deletions src/amuse/community/hermite_grx/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/amuse/community/seba/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 14 additions & 11 deletions src/amuse/ext/solarsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit da28e16

Please sign in to comment.