mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 12:23:56 +01:00
Merging org files
This commit is contained in:
parent
2467214b3a
commit
e774a725b9
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@ -8,3 +8,4 @@
|
||||
*.so
|
||||
Makefile.generated
|
||||
test_qmckl
|
||||
merged_qmckl.org
|
||||
|
30
src/Makefile
30
src/Makefile
@ -1,23 +1,24 @@
|
||||
CC=gcc -g
|
||||
CFLAGS=-fPIC -fexceptions -Wall -Werror -Wpedantic -Wextra
|
||||
CFLAGS=-fPIC -fexceptions -Wall -Werror -Wpedantic -Wextra
|
||||
|
||||
FC=gfortran -g
|
||||
FFLAGS=-fPIC -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan
|
||||
|
||||
LIBS=-lgfortran -lm
|
||||
|
||||
#CC=icc
|
||||
#CFLAGS=-fPIC -g
|
||||
#
|
||||
#FC=ifort
|
||||
#FFLAGS=-fPIC -g
|
||||
#CC=icc -xHost
|
||||
#CFLAGS=-fPIC -g -O2
|
||||
#
|
||||
#LIBS=-lm -lifcore -lirc
|
||||
#FC=ifort -xHost
|
||||
#FFLAGS=-fPIC -g -O2
|
||||
#
|
||||
#LIBS=-lm -lifcore -lirc
|
||||
|
||||
|
||||
export CC CFLAGS FC FFLAGS LIBS
|
||||
|
||||
ORG_SOURCE_FILES=$(wildcard qmckl*.org) test_qmckl.org
|
||||
MERGED_ORG=merged_qmckl.org
|
||||
ORG_SOURCE_FILES=$(wildcard *.org)
|
||||
OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES)))
|
||||
|
||||
.PHONY: clean
|
||||
@ -29,12 +30,15 @@ libqmckl.so: Makefile.generated
|
||||
test: Makefile.generated
|
||||
$(MAKE) -f Makefile.generated test
|
||||
|
||||
doc:$(ORG_SOURCE_FILES)
|
||||
./create_doc.sh README.org $(ORG_SOURCE_FILES)
|
||||
$(MERGED_ORG): $(ORG_SOURCE_FILES)
|
||||
./merge_org.sh
|
||||
|
||||
doc:$(MERGED_ORG)
|
||||
./create_doc.sh $(MERGED_ORG)
|
||||
|
||||
clean:
|
||||
rm -f qmckl.h test_qmckl_* test_qmckl.c test_qmckl qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h Makefile.generated libqmckl.so *.html *.fh
|
||||
rm -f qmckl.h test_qmckl_* test_qmckl.c test_qmckl qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h Makefile.generated libqmckl.so *.html *.fh *.mod
|
||||
|
||||
Makefile.generated: $(ORG_SOURCE_FILES) Makefile create_makefile.sh
|
||||
./create_makefile.sh $(ORG_SOURCE_FILES)
|
||||
Makefile.generated: $(MERGED_ORG) Makefile create_makefile.sh
|
||||
./create_makefile.sh $(MERGED_ORG)
|
||||
|
||||
|
@ -1,23 +1,13 @@
|
||||
#!/bin/bash
|
||||
INPUT=$1
|
||||
#emacs merged_qmckl.org --batch --eval "(require 'htmlize)" -f org-html-export-to-html --kill
|
||||
emacs \
|
||||
$INPUT \
|
||||
--batch \
|
||||
--eval "(package-initialize)" \
|
||||
-f org-html-export-to-html \
|
||||
--kill
|
||||
|
||||
# Tangle org files
|
||||
|
||||
emacsclient -a "" \
|
||||
--socket-name=org_to_code \
|
||||
--eval "(load-file \"config.el\")"
|
||||
|
||||
for INPUT in $@ ; do
|
||||
echo $INPUT
|
||||
emacsclient \
|
||||
--no-wait \
|
||||
--socket-name=org_to_code \
|
||||
--eval "(find-file \"$INPUT\")" \
|
||||
--eval "(org-html-export-to-html)"
|
||||
done
|
||||
mv *.html ../docs
|
||||
|
||||
emacsclient \
|
||||
--no-wait \
|
||||
--socket-name=org_to_code \
|
||||
--eval '(kill-emacs)'
|
||||
|
||||
|
@ -1,24 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
INPUT=$1
|
||||
OUTPUT=Makefile.generated
|
||||
|
||||
# Tangle org files
|
||||
|
||||
emacsclient -a "" \
|
||||
--socket-name=org_to_code \
|
||||
--eval "(require 'org)"
|
||||
|
||||
for INPUT in $@ ; do
|
||||
emacsclient \
|
||||
--no-wait \
|
||||
--socket-name=org_to_code \
|
||||
--eval "(org-babel-tangle-file \"$INPUT\")"
|
||||
done
|
||||
|
||||
emacsclient \
|
||||
--no-wait \
|
||||
--socket-name=org_to_code \
|
||||
--eval '(kill-emacs)'
|
||||
emacs \
|
||||
$INPUT \
|
||||
--batch \
|
||||
-f org-babel-tangle \
|
||||
--kill
|
||||
|
||||
|
||||
|
||||
@ -68,7 +58,7 @@ libqmckl.so: \$(OBJECT_FILES)
|
||||
%.o: %.c
|
||||
\$(CC) \$(CFLAGS) -c \$*.c -o \$*.o
|
||||
|
||||
%.o: %.f90
|
||||
%.o: %.f90 qmckl_f.o
|
||||
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
|
||||
|
||||
test_qmckl: test_qmckl.c libqmckl.so \$(TESTS) \$(TESTS_F)
|
||||
|
12
src/merge_org.sh
Executable file
12
src/merge_org.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in README.org \
|
||||
qmckl.org \
|
||||
qmckl_memory.org \
|
||||
qmckl_context.org \
|
||||
qmckl_distance.org \
|
||||
qmckl_ao.org \
|
||||
test_qmckl.org
|
||||
do
|
||||
cat $i >> merged_qmckl.org
|
||||
done
|
@ -12,6 +12,8 @@
|
||||
This file produces the =qmckl.h= header file, which is included in all
|
||||
other C header files. It is the main entry point to the library.
|
||||
|
||||
We also create the =qmckl_f.f90= which is the Fortran equivalent.
|
||||
|
||||
#+BEGIN_SRC C :tangle qmckl.h
|
||||
#ifndef QMCKL_H
|
||||
#define QMCKL_H
|
||||
@ -19,6 +21,11 @@ other C header files. It is the main entry point to the library.
|
||||
#include <stdint.h>
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC f90 :tangle qmckl_f.f90
|
||||
module qmckl
|
||||
use, intrinsic :: iso_c_binding
|
||||
#+END_SRC
|
||||
|
||||
* Constants
|
||||
|
||||
** Success/failure
|
||||
@ -35,6 +42,10 @@ typedef int64_t qmckl_context ;
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC f90 :tangle qmckl_f.f90
|
||||
integer, parameter :: QMCKL_SUCCESS = 0
|
||||
integer, parameter :: QMCKL_FAILURE = 0
|
||||
#+END_SRC
|
||||
|
||||
** Precision-related constants
|
||||
|
||||
@ -47,6 +58,11 @@ typedef int64_t qmckl_context ;
|
||||
#define QMCKL_DEFAULT_RANGE 11
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC f90 :tangle qmckl_f.f90
|
||||
integer, parameter :: QMCKL_DEFAULT_PRECISION = 53
|
||||
integer, parameter :: QMCKL_DEFAULT_RANGE = 11
|
||||
#+END_SRC
|
||||
|
||||
* Header files
|
||||
|
||||
All the functions expoed in the API are defined in the following
|
||||
@ -61,6 +77,13 @@ typedef int64_t qmckl_context ;
|
||||
#include "qmckl_ao.h"
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC f90 :tangle qmckl_f.f90
|
||||
! include 'qmckl_memory.fh'
|
||||
include 'qmckl_context.fh'
|
||||
include 'qmckl_distance.fh'
|
||||
include 'qmckl_ao.fh'
|
||||
#+END_SRC
|
||||
|
||||
* End of header
|
||||
|
||||
#+BEGIN_SRC C :tangle qmckl.h
|
||||
@ -68,3 +91,14 @@ typedef int64_t qmckl_context ;
|
||||
#+END_SRC
|
||||
|
||||
|
||||
#+BEGIN_SRC f90 :tangle qmckl_f.f90
|
||||
end module qmckl
|
||||
#+END_SRC
|
||||
|
||||
|
||||
* Include all other org files here :noexport:
|
||||
|
||||
#+INCLUDE: qmckl_memory.org
|
||||
#+INCLUDE: qmckl_context.org
|
||||
#+INCLUDE: qmckl_distance.org
|
||||
#+INCLUDE: qmckl_ao.org
|
||||
|
@ -160,10 +160,8 @@ end function qmckl_ao_powers
|
||||
*** Test :noexport:
|
||||
#+BEGIN_SRC f90 :comments link :tangle test_qmckl_ao_f.f90
|
||||
integer(c_int32_t) function test_qmckl_ao_powers(context) bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
use qmckl
|
||||
implicit none
|
||||
include 'qmckl_context.fh'
|
||||
include 'qmckl_ao.fh'
|
||||
|
||||
integer(c_int64_t), intent(in), value :: context
|
||||
|
||||
@ -401,10 +399,8 @@ end function qmckl_ao_polynomial_vgl
|
||||
*** Test :noexport:
|
||||
#+BEGIN_SRC f90 :comments link :tangle test_qmckl_ao_f.f90
|
||||
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
use qmckl
|
||||
implicit none
|
||||
include 'qmckl_context.fh'
|
||||
include 'qmckl_ao.fh'
|
||||
|
||||
integer(c_int64_t), intent(in), value :: context
|
||||
|
||||
@ -643,10 +639,8 @@ end function qmckl_ao_gaussians_vgl
|
||||
*** Test :noexport:
|
||||
#+BEGIN_SRC f90 :comments link :tangle test_qmckl_ao_f.f90
|
||||
integer(c_int32_t) function test_qmckl_ao_gaussians_vgl(context) bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
use qmckl
|
||||
implicit none
|
||||
include 'qmckl_context.fh'
|
||||
include 'qmckl_ao.fh'
|
||||
|
||||
integer(c_int64_t), intent(in), value :: context
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user