mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-05 19:08:52 +01:00
Added scripts
This commit is contained in:
parent
6c29d22aa2
commit
d649150543
63
scripts/check_dependencies.sh
Executable file
63
scripts/check_dependencies.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# check_dependencies.sh MOs AOs Electrons
|
||||||
|
#
|
||||||
|
# Checks that the list of dependencies given in
|
||||||
|
# argument is consistent. If the dependencies
|
||||||
|
# are OK the exit code is 0, otherwise it is 1.
|
||||||
|
# If no argument is given, the dependencies are
|
||||||
|
# read in the Makefile.
|
||||||
|
# Thu Apr 3 01:44:23 CEST 2014
|
||||||
|
|
||||||
|
function unique_list()
|
||||||
|
{
|
||||||
|
for d in $@
|
||||||
|
do
|
||||||
|
echo $d
|
||||||
|
done | sort | uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -z $1 ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "-" ]]
|
||||||
|
then
|
||||||
|
COMMAND_LINE=$(grep -e "^INCLUDE_DIRS" Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||||
|
else
|
||||||
|
COMMAND_LINE=$(unique_list $@)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for d in $COMMAND_LINE
|
||||||
|
do
|
||||||
|
if [[ ! -d ${SCI_ROOT}/src/$d ]]
|
||||||
|
then
|
||||||
|
echo Error: Directory $d does not exist
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS_LONG=""
|
||||||
|
for i in $COMMAND_LINE
|
||||||
|
do
|
||||||
|
DEPS_LONG+=" $i "
|
||||||
|
DEPS_LONG+=$(grep -e '^INCLUDE_DIRS' ${SCI_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS=$(unique_list $DEPS_LONG)
|
||||||
|
|
||||||
|
if [[ ! "$COMMAND_LINE" == "$DEPS" ]]
|
||||||
|
then
|
||||||
|
DEPS=$(check_dependencies.sh $DEPS)
|
||||||
|
fi
|
||||||
|
echo $DEPS
|
||||||
|
|
||||||
|
if [[ "$COMMAND_LINE" == "$DEPS" ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
48
scripts/create_Makefile.sh
Executable file
48
scripts/create_Makefile.sh
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# create_Makefile.sh MOs AOs Electrons
|
||||||
|
# Creates the Makefile with the dependencies on other modules given
|
||||||
|
# in the command line. This command is supposed to be run in a module
|
||||||
|
# directory and searches the dependencies in ../
|
||||||
|
# Thu Apr 3 01:44:41 CEST 2014
|
||||||
|
|
||||||
|
DEPS_LONG=""
|
||||||
|
for i in $@
|
||||||
|
do
|
||||||
|
DEPS_LONG+=" $i "
|
||||||
|
DEPS_LONG+=$(grep 'INCLUDE_DIRS' ${SCI_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS=($(
|
||||||
|
for d in $DEPS_LONG
|
||||||
|
do
|
||||||
|
echo $d
|
||||||
|
done | sort | uniq
|
||||||
|
))
|
||||||
|
|
||||||
|
# Create the Makefile
|
||||||
|
cat << EOF > Makefile
|
||||||
|
default: all
|
||||||
|
|
||||||
|
# Define here all other modules on which the current module depends
|
||||||
|
INCLUDE_DIRS = ${DEPS[@]}
|
||||||
|
|
||||||
|
# Define here all new external source files and objects.Don't forget to prefix the
|
||||||
|
# object files with IRPF90_temp/
|
||||||
|
SRC=
|
||||||
|
OBJ=
|
||||||
|
|
||||||
|
include Makefile.depend
|
||||||
|
include \$(SCI_ROOT)/src/Makefile.config
|
||||||
|
include \$(SCI_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)
|
||||||
|
|
||||||
|
Makefile.depend: Makefile
|
||||||
|
\$(SCI_ROOT)/scripts/create_Makefile_depend.sh
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
36
scripts/create_Makefile_depend.sh
Executable file
36
scripts/create_Makefile_depend.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script is automatically invoked by Makefiles and should not be invoked
|
||||||
|
# by users.
|
||||||
|
# Creates the Makefile.depend file. This file contains all the external source
|
||||||
|
# files included by including other modules.
|
||||||
|
# Thu Apr 3 01:44:09 CEST 2014
|
||||||
|
|
||||||
|
SRC=""
|
||||||
|
OBJ=""
|
||||||
|
DEPS=$(grep "INCLUDE_DIRS" Makefile 2>/dev/null | cut -d '=' -f 2)
|
||||||
|
|
||||||
|
for M in ${DEPS}
|
||||||
|
do
|
||||||
|
# X is the list of external source files
|
||||||
|
X=$(grep 'SRC=' ${SCI_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2)
|
||||||
|
for f in ${X}
|
||||||
|
do
|
||||||
|
SRC+=" ${M}/${f}"
|
||||||
|
done
|
||||||
|
X=$(grep 'OBJ=' ${SCI_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2)
|
||||||
|
for f in ${X}
|
||||||
|
do
|
||||||
|
OBJ+=" IRPF90_temp/${M}/${f/IRPF90_temp//}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create the Makefile.depend
|
||||||
|
cat << EOF > Makefile.depend
|
||||||
|
# This file was created by the $0 script. Do not modify it by hand.
|
||||||
|
|
||||||
|
SRC+=${SRC}
|
||||||
|
OBJ+=${OBJ}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
28
scripts/create_module.sh
Executable file
28
scripts/create_module.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# create_module.sh MOs AOs Electrons
|
||||||
|
# Prepares all the files for the creation of a new module.
|
||||||
|
# The first argument is the name of the module
|
||||||
|
# All remaining aruments are dependencies.
|
||||||
|
# Thu Apr 3 01:44:58 CEST 2014
|
||||||
|
|
||||||
|
MODULE=$1
|
||||||
|
shift
|
||||||
|
DEPS=$@
|
||||||
|
|
||||||
|
# Check if module already exists
|
||||||
|
if [ -d ${MODULE} ]
|
||||||
|
then
|
||||||
|
echo "Error: Module $MODULE already exists"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create module directory and go into it
|
||||||
|
mkdir ${MODULE}
|
||||||
|
cd ${MODULE}
|
||||||
|
|
||||||
|
# Create the Makefile
|
||||||
|
${SCI_ROOT}/create_Makefile.sh
|
||||||
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# This script is used by module Makefiles, and should not be used by users.
|
||||||
# Checks if all the other module directories are properly linked in the
|
# Checks if all the other module directories are properly linked in the
|
||||||
# current directory. If not, the links are created.
|
# current directory. If not, the links are created.
|
||||||
|
# Wed Apr 2 14:35:42 CEST 2014
|
||||||
|
|
||||||
for dir in $@
|
for dir in $@
|
||||||
do
|
do
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# This script is used by the MOs module, and should not be used by users.
|
||||||
|
# It copies the EZFIO/mo_basis directory in the save/EZFIO/mo_basis/xxx
|
||||||
|
# directory, where xxx is the corresponding mo_label.
|
||||||
|
# Wed Apr 2 14:35:15 CEST 2014
|
||||||
|
|
||||||
EZFIO=$1
|
EZFIO=$1
|
||||||
|
|
||||||
|
77
src/coding_rules.rst
Normal file
77
src/coding_rules.rst
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
======================
|
||||||
|
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…
Reference in New Issue
Block a user