mirror of
https://github.com/LCPQ/quantum_package
synced 2025-04-15 21:19:40 +02:00
Make all_modules and all_clean compiles in parallel. Added NEEDED_MODULES
This commit is contained in:
parent
c5ac0c5970
commit
f9f3fac7ff
@ -1,3 +1,4 @@
|
||||
===============
|
||||
Quantum package
|
||||
===============
|
||||
|
||||
|
@ -25,7 +25,7 @@ fi
|
||||
|
||||
if [[ $1 == "-" ]]
|
||||
then
|
||||
COMMAND_LINE=$(grep -e "^INCLUDE_DIRS" Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||
COMMAND_LINE=$(cat NEEDED_MODULES)
|
||||
else
|
||||
COMMAND_LINE=$(unique_list $@)
|
||||
fi
|
||||
@ -44,7 +44,7 @@ DEPS_LONG=""
|
||||
for i in $COMMAND_LINE
|
||||
do
|
||||
DEPS_LONG+=" $i "
|
||||
DEPS_LONG+=$(grep -e '^INCLUDE_DIRS' ${QPACKAGE_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||
DEPS_LONG+=$(cat ${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES)
|
||||
done
|
||||
|
||||
DEPS=$(unique_list $DEPS_LONG)
|
||||
|
@ -11,7 +11,7 @@ DEPS_LONG=""
|
||||
for i in $@
|
||||
do
|
||||
DEPS_LONG+=" $i "
|
||||
DEPS_LONG+=$(grep 'INCLUDE_DIRS' ${QPACKAGE_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||
DEPS_LONG+=$(cat ${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES)
|
||||
done
|
||||
|
||||
DEPS=($(
|
||||
@ -21,12 +21,16 @@ do
|
||||
done | sort | uniq
|
||||
))
|
||||
|
||||
# Create the NEEDED_MODULES file
|
||||
cat << EOF > NEEDED_MODULES
|
||||
${DEPS[@]}
|
||||
EOF
|
||||
|
||||
# Create the Makefile
|
||||
cat << EOF > Makefile
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS = ${DEPS[@]}
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -38,7 +42,7 @@ include \$(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include \$(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: \$(filter-out IRPF90_temp/%, \$(wildcard */*.irp.f)) \$(wildcard *.irp.f) \$(wildcard *.inc.f) Makefile \$(EZFIO)
|
||||
irpf90.make: \$(filter-out IRPF90_temp/%, \$(wildcard */*.irp.f)) \$(wildcard *.irp.f) \$(wildcard *.inc.f) Makefile \$(EZFIO) NEEDED_MODULES
|
||||
\$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
SRC=""
|
||||
OBJ=""
|
||||
DEPS=$(grep "INCLUDE_DIRS" Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||
DEPS=$(cat NEEDED_MODULES)
|
||||
|
||||
for M in ${DEPS}
|
||||
do
|
||||
|
@ -7,10 +7,35 @@
|
||||
# All remaining aruments are dependencies.
|
||||
# Thu Apr 3 01:44:58 CEST 2014
|
||||
|
||||
DEBUG=0
|
||||
|
||||
# If DEBUG=1, the print debug info.
|
||||
function debug()
|
||||
{
|
||||
if [[ $DEBUG -eq 1 ]]
|
||||
then
|
||||
function debug()
|
||||
{
|
||||
echo "$@"
|
||||
}
|
||||
else
|
||||
function debug()
|
||||
{
|
||||
}
|
||||
fi
|
||||
debug $@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
MODULE=$1
|
||||
shift
|
||||
DEPS=$@
|
||||
|
||||
|
||||
|
||||
|
||||
# Check if module already exists
|
||||
if [ -d ${MODULE} ]
|
||||
then
|
||||
@ -18,11 +43,57 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
debug "Module does not already exist: OK"
|
||||
|
||||
|
||||
# Set up dependencies
|
||||
ALL_MODULES=$(cat NEEDED_MODULES)
|
||||
|
||||
|
||||
|
||||
if [[ 1 -eq 0 ]] ; then # TODO
|
||||
|
||||
# Create module directory and go into it
|
||||
mkdir ${MODULE}
|
||||
cd ${MODULE}
|
||||
if [[ ! mkdir ${QPACKAGE_ROOT}/src/${MODULE} ]]
|
||||
then
|
||||
print "Unable to create module directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d ${QPACKAGE_ROOT}/src/${MODULE} ]]
|
||||
then
|
||||
print "Something strange happened: the"
|
||||
print ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
print "directory was not created."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
if [[ ${PWD} != ${QPACKAGE_ROOT}/src/${MODULE} ]]
|
||||
then
|
||||
print "Something strange happened: we should be in"
|
||||
print ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
print "but we are in"
|
||||
print ${PWD}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
debug "Module directory is created."
|
||||
|
||||
|
||||
fi # TODO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Create the Makefile
|
||||
${QPACKAGE_ROOT}/create_Makefile.sh
|
||||
|
||||
|
||||
# Update module list in main NEEDED_MODULES
|
||||
ALL_MODULES+=" ${MODULE}"
|
||||
cd ${QPACKAGE_ROOT}/src
|
||||
echo ${ALL_MODULES} > NEEDED_MODULES
|
||||
debug "Updated NEEDED_MODULES"
|
||||
|
||||
|
2
src/.gitignore
vendored
2
src/.gitignore
vendored
@ -6,4 +6,4 @@ Makefile.config
|
||||
*tags
|
||||
*.o
|
||||
*.mod
|
||||
*/Makefile.depend
|
||||
*Makefile.depend
|
||||
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS = Ezfio_files Nuclei Utils
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/AOs/NEEDED_MODULES
Normal file
1
src/AOs/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
Ezfio_files Nuclei Utils
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS = AOs Electrons Ezfio_files MOs Nuclei Utils
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/Bitmask/NEEDED_MODULES
Normal file
1
src/Bitmask/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
AOs Electrons Ezfio_files MOs Nuclei Utils
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS = Ezfio_files
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/Electrons/NEEDED_MODULES
Normal file
1
src/Electrons/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
Ezfio_files
|
3
src/Electrons/README.rst
Normal file
3
src/Electrons/README.rst
Normal file
@ -0,0 +1,3 @@
|
||||
This module contains the data relative to electrons: the number of alpha and beta electrons.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS =
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
0
src/Ezfio_files/NEEDED_MODULES
Normal file
0
src/Ezfio_files/NEEDED_MODULES
Normal file
@ -1,5 +1,20 @@
|
||||
integer function getUnitAndOpen(f,mode)
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! :f:
|
||||
! file name
|
||||
!
|
||||
! :mode:
|
||||
! 'R' : READ, UNFORMATTED
|
||||
! 'W' : WRITE, UNFORMATTED
|
||||
! 'r' : READ, FORMATTED
|
||||
! 'w' : WRITE, FORMATTED
|
||||
! 'a' : APPEND, FORMATTED
|
||||
! 'x' : READ/WRITE, FORMATTED
|
||||
!
|
||||
END_DOC
|
||||
|
||||
character*(*) :: f
|
||||
character*(128) :: new_f
|
||||
integer :: iunit
|
||||
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS = AOs Ezfio_files Nuclei Utils
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/MOs/NEEDED_MODULES
Normal file
1
src/MOs/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
AOs Ezfio_files Nuclei Utils
|
12
src/MOs/README.rst
Normal file
12
src/MOs/README.rst
Normal file
@ -0,0 +1,12 @@
|
||||
Modifying MOs
|
||||
=============
|
||||
|
||||
When modifying MOs, the label of the current MOs should change accordingly by changing the mo_label. For example:
|
||||
|
||||
.. code-block:: fortran
|
||||
|
||||
mo_coef = new_mo_coef
|
||||
mo_label = "MyNewLabel"
|
||||
TOUCH mo_coef mo_label
|
||||
|
||||
|
36
src/Makefile
36
src/Makefile
@ -1,23 +1,29 @@
|
||||
default: all
|
||||
INCLUDE_DIRS = Ezfio_files Nuclei Utils AOs Electrons MonoInts BiInts MOs Output Bitmask
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
include Makefile.common
|
||||
include Makefile.config
|
||||
|
||||
LIB+=$(MKL)
|
||||
|
||||
SRC=BiInts/map_module.f90 Bitmask/bitmasks_module.f90
|
||||
OBJ=IRPF90_temp/BiInts/map_module.o IRPF90_temp/Bitmask/bitmasks_module.o
|
||||
PYTHON_SCRIPTS=
|
||||
SRC=
|
||||
OBJ=
|
||||
|
||||
include Makefile.depend
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
all:$(ALL) $(PYTHON_SCRIPTS)
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
all:$(ALL)
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
all_clean:
|
||||
for i in */ ; do unset INCLUDE_DIRS ; $(MAKE) -C $$i veryclean && $(MAKE) -C $$i clean_links ; done
|
||||
Makefile.depend: Makefile NEEDED_MODULES
|
||||
$(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh
|
||||
|
||||
all_clean:
|
||||
@for i in $(NEEDED_MODULES) ; do cd $$i ; make veryclean ; make clean_links ; cd .. ; done
|
||||
|
||||
all_modules: $(NEEDED_MODULES)
|
||||
|
||||
FORCE:
|
||||
|
||||
$(NEEDED_MODULES): FORCE
|
||||
@cd $@ ; unset NEEDED_MODULES INCLUDE_DIRS ; make
|
||||
|
||||
all_modules:
|
||||
for i in */ ; do unset INCLUDE_DIRS ; $(MAKE) -C $$i || exit 1 ; done
|
||||
|
@ -2,11 +2,11 @@ ifndef QPACKAGE_ROOT
|
||||
$(error QPACKAGE_ROOT undefined. Run the setup_environment.sh script)
|
||||
endif
|
||||
|
||||
INCLUDE_DIRS_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(INCLUDE_DIRS)` && echo OK || echo $$X)
|
||||
ifneq ($(INCLUDE_DIRS_OK),OK)
|
||||
NEEDED_MODULES_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(NEEDED_MODULES)` && echo OK || echo $$X)
|
||||
ifneq ($(NEEDED_MODULES_OK),OK)
|
||||
$(info ---------------------)
|
||||
$(info Your INCLUDE_DIRS variable is inconsistent. It should be:)
|
||||
$(info INCLUDE_DIRS = $(INCLUDE_DIRS_OK))
|
||||
$(info Your NEEDED_MODULES file is inconsistent. It should be:)
|
||||
$(info $(NEEDED_MODULES))
|
||||
$(info ---------------------)
|
||||
$(error )
|
||||
endif
|
||||
@ -31,13 +31,13 @@ $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_
|
||||
@cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config
|
||||
@cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python
|
||||
|
||||
INCLUDE_DIRS+=include
|
||||
INCLUDE_DIRS=$(NEEDED_MODULES) include
|
||||
|
||||
|
||||
ifneq ($(PWD),$(QPACKAGE_ROOT)/src)
|
||||
$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS))
|
||||
clean_links:
|
||||
rm $(INCLUDE_DIRS) $$(basename $$PWD)
|
||||
rm -f $(INCLUDE_DIRS) $$(basename $$PWD)
|
||||
else
|
||||
clean_links:
|
||||
endif
|
||||
|
1
src/NEEDED_MODULES
Normal file
1
src/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
AOs Bitmask Electrons Ezfio_files MOs Nuclei Output Utils
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS = Ezfio_files Utils
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/Nuclei/NEEDED_MODULES
Normal file
1
src/Nuclei/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
Ezfio_files Utils
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS =
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/Output/NEEDED_MODULES
Normal file
1
src/Output/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
|
105
src/README.rst
Normal file
105
src/README.rst
Normal file
@ -0,0 +1,105 @@
|
||||
======================
|
||||
Programming guidelines
|
||||
======================
|
||||
|
||||
Each module (directory) contains the following:
|
||||
|
||||
* A ``README.rst`` file to document the current module.
|
||||
* An ``ASSUMPTIONS.rst`` file. This file should document all the implicit
|
||||
assumptions used in the module. For example, if the atomic orbitals are
|
||||
assumed to be normalized, this should be mentioned in the
|
||||
``AOs/ASSUMPTIONS.rst`` file.
|
||||
* A ``NEEDED_MODULES`` file which contains the list of modules on which the
|
||||
current module depends
|
||||
* A set of ``.irp.f`` files containing provider, subroutines and functions
|
||||
* A ``tests`` directory that should contain the test programs of the module
|
||||
(see testing section)
|
||||
* A ``Makefile`` that should compile
|
||||
* Optionally some ``*.ezfio_config`` configuration files for the EZFIO
|
||||
library
|
||||
|
||||
A new module may be created by invoking the ``create_module.sh`` script.
|
||||
|
||||
Every subroutine, function or provider should be documented using the
|
||||
BEGIN_DOC ... END_DOC block. The documentation should be written in
|
||||
ReStructured Text format to enable the automatic generation of the Sphinx
|
||||
documentation.
|
||||
|
||||
When the current module depends on other modules, the list of modules should
|
||||
be added in the Makefile in the ``INCLUDE_DIRS`` variable.
|
||||
|
||||
|
||||
Creating a new module
|
||||
=====================
|
||||
|
||||
Every new module should be created using the interactive ``create_module.sh``
|
||||
script located in the ``${QPACKAGE_ROOT}/scripts`` directory. This will create
|
||||
all the required files with correct templates.
|
||||
|
||||
|
||||
Makefiles
|
||||
=========
|
||||
|
||||
Use the structure of Makefiles provided by the ``create_module.sh`` script. If
|
||||
you need to re-create the Makefile, you can use the ``create_Makefile.sh``
|
||||
script in the current module directory.
|
||||
|
||||
If you need to add some Fortran or C files that should not be tracked by IRPF90,
|
||||
you have to add them manually to the Makefile in the ``SRC`` variable.
|
||||
You also need to add the corresponding ``*.o`` file prefixed by ``IRPF90_temp/``.
|
||||
For example
|
||||
|
||||
.. code-block:: Makefile
|
||||
|
||||
SRC=map_module.f90
|
||||
OBJ=IRPF90_temp/map_module.o
|
||||
|
||||
|
||||
|
||||
Testing
|
||||
=======
|
||||
|
||||
Each module contains a ``tests/`` directory which contains the test script.
|
||||
Each module should be tested by running::
|
||||
|
||||
make test
|
||||
|
||||
Before merging into the master branch, the module should pass **all** the tests.
|
||||
This enables the possibility to use ``git bisect`` to quickly find bugs.
|
||||
|
||||
|
||||
Input data
|
||||
==========
|
||||
|
||||
Every program is supposed to use an EZFIO database containing all the
|
||||
persistent data. This database can be modified in using the generated Fortran
|
||||
functions or the generated Python module.
|
||||
|
||||
The definition of the data needed by the module should be put in the
|
||||
``*.ezfio_config`` file.
|
||||
|
||||
Input data can also be read from the standard input to enable the use of
|
||||
a program with a pipe, but the read statements should be present **only** in
|
||||
the main program.
|
||||
|
||||
|
||||
Output data
|
||||
===========
|
||||
|
||||
Print to stdout statements should only appear in programs, not in providers,
|
||||
subroutines or functions. This enables the possibility easily use the programs
|
||||
with pipes.
|
||||
|
||||
To print, you should write in an output file provided by the ``Output``
|
||||
module.
|
||||
|
||||
|
||||
Creating a shell script
|
||||
=======================
|
||||
|
||||
Shell scripts should be located in the ``${QPACKAGE_ROOT}/scripts`` directory.
|
||||
Relative paths should be avoided as much as possible, and the result of commands
|
||||
should be always checked. For example, when creating a directory the existence
|
||||
of the directory has to be checked.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
default: all
|
||||
|
||||
# Define here all other modules on which the current module depends
|
||||
INCLUDE_DIRS =
|
||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||
|
||||
# Define here all new external source files and objects.Don't forget to prefix the
|
||||
# object files with IRPF90_temp/
|
||||
@ -13,7 +13,7 @@ include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||
include $(QPACKAGE_ROOT)/src/Makefile.common
|
||||
include irpf90.make
|
||||
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO)
|
||||
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
||||
$(IRPF90)
|
||||
|
||||
Makefile.depend: Makefile
|
||||
|
1
src/Utils/NEEDED_MODULES
Normal file
1
src/Utils/NEEDED_MODULES
Normal file
@ -0,0 +1 @@
|
||||
|
@ -1,77 +0,0 @@
|
||||
======================
|
||||
Programming guidelines
|
||||
======================
|
||||
|
||||
Each module (directory) contains the following:
|
||||
|
||||
* A :file:`README.rst` file to document the current module.
|
||||
* An :file:`ASSUMPTIONS.rst` file. This file should document all the implicit
|
||||
assumptions used in the module. For example, if the atomic orbitals are
|
||||
assumed to be normalized, this should be mentioned in the
|
||||
:file:`AOs/ASSUMPTIONS.rst` file.
|
||||
* A set of :file:`.irp.f` files containing provider, subroutines and functions
|
||||
* A :file:`tests` directory that should contain the test programs of the module
|
||||
(see testing section)
|
||||
* A :file:`Makefile` that should compile
|
||||
* Optionally some :file:`*.ezfio_config` configuration files for the EZFIO
|
||||
library
|
||||
|
||||
A new module may be created by invoking the :file:`create_module.sh` script.
|
||||
|
||||
Every subroutine, function or provider should be documented using the
|
||||
BEGIN_DOC ... END_DOC block. The documentation should be written in
|
||||
ReStructured Text format to enable the automatic generation of the Sphinx
|
||||
documentation.
|
||||
|
||||
|
||||
Testing
|
||||
=======
|
||||
|
||||
Each module contains a :file:`tests` directory which contains the test script.
|
||||
Each module should be tested by running::
|
||||
|
||||
make test
|
||||
|
||||
Before merging into the master branch, the module should pass **all** the tests.
|
||||
This enables the possibility tu use :command:`git bisect` to quickly find bugs.
|
||||
|
||||
|
||||
Input data
|
||||
==========
|
||||
|
||||
Every program is supposed to use an EZFIO database containing all the
|
||||
persistent data. This database can be modified in using the generated Fortran
|
||||
functions or the generated Python module.
|
||||
|
||||
The definition of the data needed by the module should be put in the
|
||||
:file:`*.ezfio_config` file.
|
||||
|
||||
Input data can also be read from the standard input to enable the use of
|
||||
a program with a pipe, but the read statements should be present **only** in
|
||||
the main program.
|
||||
|
||||
|
||||
Output data
|
||||
===========
|
||||
|
||||
Print to stdout statements should only appear in programs, not in providers,
|
||||
subroutines or functions. This enables the possibility easily use the programs
|
||||
with pipes.
|
||||
|
||||
To print, you should write in an output file provided by the :file:`Output`
|
||||
module.
|
||||
|
||||
|
||||
|
||||
Modifying MOs
|
||||
=============
|
||||
|
||||
When modifying MOs, the label of the current MOs should change accordingly by changing the mo_label. For example:
|
||||
|
||||
.. code-block:: fortran
|
||||
|
||||
mo_coef = new_mo_coef
|
||||
mo_label = "MyNewLabel"
|
||||
TOUCH mo_coef mo_label
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user