-
Notifications
You must be signed in to change notification settings - Fork 109
UCLchem interface #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
UCLchem interface #1070
Changes from all commits
5f643f4
0bb77b6
023112c
6559751
90f5262
8fcca37
f42a23e
880957a
5106c21
e9cb411
fad317a
e8163f6
8b2115e
2f7160a
09d1859
50772e2
80dd3d4
8531d7c
fa82e5f
73972b6
14cda95
87372eb
01b1770
e7ba25b
1afbe2d
adb3a5a
bac7174
9a2e306
2629eff
3878d08
0b1360e
2cf6975
dd53f43
1cdb866
10cd893
94390f0
a5a3115
f9188d3
cd0b1cb
20ef590
286d28f
3a45249
e9141d4
91b0597
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| -include config.mk | ||
|
|
||
| PYTHON ?= python | ||
| CLEAN ?= yes | ||
|
|
||
| export PATH := ${PATH}:$(PWD)/bin | ||
| export PYTHONPATH := $(PYTHONPATH):$(PWD)/src:$(PWD)/test | ||
|
|
||
| python_version_full := $(wordlist 2,4,$(subst ., ,$(shell $(PYTHON) --version 2>&1))) | ||
| python_version_major := $(word 1,${python_version_full}) | ||
| python_version_minor := $(word 2,${python_version_full}) | ||
| python_version_patch := $(word 3,${python_version_full}) | ||
|
|
||
| all: config.mk | ||
| @-mkdir -p test_results | ||
| $(PYTHON) setup.py generate_main | ||
| $(PYTHON) setup.py build_codes --inplace | ||
|
|
||
| framework: config.mk | ||
| @-mkdir -p test_results | ||
| $(PYTHON) setup.py generate_main | ||
| $(PYTHON) setup.py build_libraries --inplace | ||
|
|
||
| allinbuild: | ||
| $(PYTHON) setup.py build | ||
|
|
||
| build: | ||
| $(PYTHON) setup.py build | ||
|
|
||
| # should pick up prefix from configure? | ||
| install: | ||
| $(PYTHON) setup.py install | ||
|
|
||
| docclean: | ||
| make -C doc clean | ||
|
|
||
| clean: | ||
| $(PYTHON) setup.py clean | ||
| $(PYTHON) setup.py clean_codes --inplace | ||
|
|
||
| oclean: | ||
| $(PYTHON) setup.py clean | ||
|
|
||
| distclean: | ||
| -rm -f src/amuse/config.mk | ||
| -rm -f amuse.sh | ||
| -rm -f iamuse.sh | ||
| -rm -f ibis-deploy.sh | ||
| -rm -f bin/amusifier | ||
| -rm -rf test_results src/amuse.egg-info | ||
|
|
||
| -rm -f test/*.000 test/fort.* test/perr test/pout test/test.h5 test/*.log | ||
| -rm -f test/codes_tests/perr test/codes_tests/pout | ||
| -rm -f test/core_tests/plummer_back_100.ini | ||
| -rm -f test/test_python_implementation test/twobody | ||
|
|
||
| $(PYTHON) setup.py clean | ||
| $(PYTHON) setup.py dist_clean | ||
| $(PYTHON) setup.py clean_codes --inplace | ||
| $(PYTHON) setup.py dist_clean --inplace | ||
|
|
||
| make -C doc clean | ||
| -find ./ -name "*.pyc" -exec rm \{} \; | ||
| -find ./ -type d -name "__pycache__" -exec rm -Rf \{} \; | ||
| -find ./ -type d -name "ccache" -exec rm -Rf \{} \; | ||
| -rm -Rf build | ||
| -rm -f config.mk | ||
| -rm -f config.log build.log config.status | ||
| -rm -f amuse.cfg | ||
| -rm -f test*.pickle test.csv | ||
|
|
||
| tests: | ||
| $(PYTHON) setup.py tests | ||
|
|
||
| doc: | ||
| $(PYTHON) setup.py -q build_latex | ||
|
|
||
| html: | ||
| make -C doc html | ||
|
|
||
| latexpdf: | ||
| make -C doc latexpdf | ||
|
|
||
| %.code: | ||
| ifneq (,$(findstring s,$(MAKEFLAGS))) | ||
| $(PYTHON) setup.py build_code --inplace --clean=$(CLEAN) --code-name=$* | ||
| else | ||
| $(PYTHON) setup.py -v build_code --inplace --clean=$(CLEAN) --code-name=$* | ||
| endif | ||
|
|
||
| help: | ||
| @echo "brief overview of most important make options:" | ||
| @echo "make - build all AMUSE libraries and community codes " | ||
| @echo "make <name>.code - clean & build the community code <name> (or matching name*)" | ||
| @echo "make clean - clean codes and libraries" | ||
| @echo "make distclean - clean codes and libraries and all configuration files" |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not be part of this PR |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| [output] | ||
| printing_strategy=simple | ||
| #[output] | ||
| #printing_strategy=simple |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs cleanup / more flexibility |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not be part of this PR |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [channel] | ||
| # debugger=gdb |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not be part of this PR |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs updating to new build system |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ifeq ($(origin AMUSE_DIR), undefined) | ||
| AMUSE_DIR := $(shell amusifier --get-amuse-dir) | ||
| endif | ||
| -include ${AMUSE_DIR}/config.mk | ||
|
|
||
|
|
||
| CLASSNAME=UCLchemInterface | ||
|
|
||
| FFLAGS += $(FCFLAGS) -std=legacy -O2 -ffree-line-length-none | ||
| INCL = -I./src/ | ||
| export FFLAGS | ||
|
|
||
| all: uclchem_worker | ||
|
|
||
| .PHONY: src/libchem.a | ||
| src/libchem.a: | ||
| $(MAKE) -C src/ libchem.a | ||
|
|
||
| worker_code.f90: interface.py | ||
| $(CODE_GENERATOR) --type=f90 $< $(CLASSNAME) -o $@ | ||
|
|
||
| uclchem_worker: src/libchem.a worker_code.f90 interface.o | ||
| $(MPIFC) $(FFLAGS) $(INCL) $(FS_FLAGS) $(LDFLAGS) worker_code.f90 interface.o -o $@ src/libchem.a $(LIBS) $(FS_LIBS) $(LIBS) | ||
|
|
||
| interface.o: src/libchem.a | ||
|
|
||
| %.o: %.f90 | ||
| $(MPIFC) $(FFLAGS) $(INCL) -c -o $@ $< | ||
|
|
||
| clean: | ||
| make -C src/ clean | ||
| rm -f *.pyc | ||
| rm -f interface.o uclchem_worker.f90 worker_code.f90 | ||
| rm -f uclchem_worker | ||
|
|
||
| distclean: clean | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from .interface import UCLchem |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| function initialize_code() result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| ret=chem_initialize() | ||
| end function | ||
|
|
||
| function cleanup_code() result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| ret=chem_end() | ||
| end function | ||
|
|
||
| function commit_particles() result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| ret=chem_commit_particles() | ||
| end function | ||
|
|
||
| function recommit_particles() result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| ret=chem_commit_particles() | ||
| end function | ||
|
|
||
| function commit_parameters() result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| ret=chem_commit_parameters() | ||
| end function | ||
|
|
||
| function new_particle(id,dens,temperature,ionrate,uvrad) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret,id | ||
| double precision :: dens,temperature,ionrate,uvrad | ||
| ret=add_particle(id,dens,temperature,ionrate,uvrad) | ||
| end function | ||
|
|
||
| function set_state(id,dens,temperature,ionrate,uvrad) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret,id | ||
| double precision :: dens,temperature,ionrate,uvrad | ||
| ret=set_particle_state(id,dens,temperature,ionrate,uvrad) | ||
| end function | ||
|
|
||
| function get_state(id,dens,temperature,ionrate,uvrad) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret,id | ||
| double precision :: dens,temperature,ionrate,uvrad | ||
| ret=get_particle_state(id,dens,temperature,ionrate,uvrad) | ||
| end function | ||
|
|
||
| function get_abundance(id,aid,x) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret,id,aid | ||
| double precision :: x | ||
| ret=get_particle_abundance(id,aid,x) | ||
| end function | ||
|
|
||
| function set_abundance(id,aid,x) result(ret) | ||
| use uclchemhelper | ||
| integer ret,id,aid | ||
| double precision x | ||
| ret=set_particle_abundance(id,aid,x) | ||
| end function | ||
|
|
||
| function get_firstlast_abundance(first,last) result(ret) | ||
| use network | ||
| integer :: ret,first,last | ||
| first=1 | ||
| last=nSpec | ||
| ret=0 | ||
| end function | ||
|
|
||
| function get_name_of_species(index,s) result(ret) | ||
| use network | ||
| integer ret,index | ||
| character*16 :: ss(nSpec),s | ||
| index = index + 1 | ||
| if(index.LT.1.OR.index.GT.nSpec) then | ||
| ret=-1 | ||
| return | ||
| endif | ||
| ss=specname | ||
| s=ss(index) | ||
| ret=0 | ||
| end function | ||
|
|
||
| function get_index_of_species(s,index) result(ret) | ||
| use network | ||
| integer ret,index | ||
| character*16 s | ||
| if (any(specname == s)) then | ||
| index = FINDLOC(specname, s, dim=1) - 1 | ||
| ret = 0 | ||
| else | ||
| ret = 1 | ||
| end if | ||
| end function | ||
|
|
||
| function run_model(dictionary) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| character(len=*) :: dictionary(nparticle) | ||
| ret=simple_evolution(dictionary, out_species) | ||
| end function | ||
|
|
||
| function get_time(time) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| double precision :: time | ||
| ret=get_current_time(time) | ||
| end function | ||
|
|
||
| function delete_particle(id) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret,id | ||
| ret=remove_particle(id) | ||
| end function | ||
|
|
||
| function set_species(species) result(ret) | ||
| use uclchemhelper | ||
| integer :: ret | ||
| character(len=*) :: species | ||
| out_species = species | ||
| ret = 0 | ||
| end function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obsolete after recent update to AMUSE installation method