Skip to content
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

arriving into the present with the public branch #140

Merged
merged 167 commits into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
0f7cdd7
eng of day0: first attempt, unsuccessful
stenczelt Jan 7, 2019
8b9ca22
attempt_2 Makefile updatess: VPATH in main one, tabs and // in quipp…
stenczelt Jan 8, 2019
5a03577
managed to compile one module
stenczelt Jan 8, 2019
4d6c376
managed to compile Atoms.f95 with skipping three subroutines: [atoms_…
stenczelt Jan 8, 2019
5ea6b9b
unsuccessful attempt to compile Potential.f95, BUT error.inc copied t…
stenczelt Jan 8, 2019
2947709
compiled Potential.f95 and added debug-quippy option to makefile
stenczelt Jan 9, 2019
f29009c
addition (typo fix) to previous commit
stenczelt Jan 9, 2019
d8cba33
compiled Atoms.f95 with atoms_finalise in it, only omitting the atoms…
stenczelt Jan 9, 2019
8c6d499
compiling potential too, still has errors
stenczelt Jan 9, 2019
37dbbf5
removing old quippy files to start from scratch
stenczelt Jan 9, 2019
2c9323f
initial atoms.py
stenczelt Jan 9, 2019
fd62115
empty init.py and updates on atoms object
stenczelt Jan 9, 2019
6563fed
wrapping Table.f95 (f90wrap updates in py3 branch are needed for this)
stenczelt Jan 10, 2019
67b97ee
wrapping System.f95 and adding some to init.py
stenczelt Jan 10, 2019
45e073b
wrapping Dictionary.f95 and adding some reformat of code by PyCharm
stenczelt Jan 10, 2019
5484d18
conversion between fortran and ase atoms, untested
stenczelt Jan 10, 2019
70a329d
simple calculator, untested
stenczelt Jan 10, 2019
4c71414
imports of packages for __init__.py
stenczelt Jan 10, 2019
c0921e4
potential works for the simple things we did by hand earlier
stenczelt Jan 10, 2019
ea0f991
changing names to be consistent, using quip everywhere
stenczelt Jan 10, 2019
7eb031f
remove a few unneeded old files
stenczelt Jan 10, 2019
9615806
a few notebooks used for testing
stenczelt Jan 10, 2019
71e36e0
try wrapping descriptors -- fail, log in root dir
stenczelt Jan 10, 2019
d690f4f
use 4-space indentation, reformat code by PyCharm
stenczelt Jan 10, 2019
ecec154
rename dictionary_get_array -> dictionary__array__
jameskermode Jan 10, 2019
b15ae6a
hard-code numpy dtype codes for dictionary__array__
jameskermode Jan 10, 2019
bd76543
Merge branch 'py3' of github.com:libAtoms/QUIP into py3
stenczelt Jan 11, 2019
d6ba994
utils to retrieve arrays from quip dictionary
stenczelt Jan 11, 2019
f353156
all parameters calculated by potential object, tested in notebook
stenczelt Jan 11, 2019
0ca1130
stress calculation with potential object
stenczelt Jan 11, 2019
df0524c
check property inputs for implemented ones
stenczelt Jan 11, 2019
5d33b33
al simple properties implemented in potential
stenczelt Jan 11, 2019
df21131
remove print statements
stenczelt Jan 11, 2019
20c29f0
bugfixes
stenczelt Jan 11, 2019
a01c72b
getter functions for all implemented properties
stenczelt Jan 11, 2019
35785d0
indentation to 4
stenczelt Jan 11, 2019
a1c4339
wrapping Dictionary.f95 and adding some reformat of code by PyCharm
stenczelt Jan 11, 2019
b06c238
default properties
stenczelt Jan 11, 2019
db04599
passing on the arguments to the calculator
stenczelt Jan 11, 2019
6ce57ed
rearrange args for ase internal compatibility,
stenczelt Jan 12, 2019
ccac6be
bugfix
stenczelt Jan 12, 2019
77227f5
avoid shadowing default name
stenczelt Jan 12, 2019
743908e
update base class used for testing
stenczelt Jan 12, 2019
b92013a
testing the potential, modified test_ase.py
stenczelt Jan 12, 2019
c9d30e6
rename test_ase.py to test_pot.py
stenczelt Jan 12, 2019
6dd53b7
removing outdated tests
stenczelt Jan 12, 2019
04bd149
bugfix
stenczelt Jan 12, 2019
e1204bc
buugfix
stenczelt Jan 12, 2019
a71f4f2
test running with python3 --- only runs one test now
stenczelt Jan 12, 2019
43856fa
handle name matching for "force" and "forces"
stenczelt Jan 12, 2019
7864980
makefile names back to normal
stenczelt Jan 12, 2019
015f6e3
update to python3 in travis.yml
stenczelt Jan 12, 2019
ef391d4
default properties
stenczelt Jan 12, 2019
f5796ac
update license header to 2019
stenczelt Jan 12, 2019
80afd9e
getting rid of class inherited from ase.atoms, it is not used at all
stenczelt Jan 12, 2019
13f1611
copying of properties and arrays
stenczelt Jan 12, 2019
3c4b9d9
copying of all the properties and params to the atoms object's info a…
stenczelt Jan 12, 2019
969ebe2
ase copies the atoms, so check if atoms is given and only then copy t…
stenczelt Jan 12, 2019
5cdfc87
putting the properties and paras into both the given atoms and the copy
stenczelt Jan 12, 2019
5b16bc2
minor changes left out earlier
stenczelt Feb 20, 2019
a7a4676
flagging lines which were modified for local debugging only
stenczelt Mar 13, 2019
5c0e855
one more initialiser wrapped
stenczelt Mar 14, 2019
8cf5e0e
change branch of f90wrap to py3
stenczelt Mar 14, 2019
7ecd67b
dont skip potential_sum
stenczelt Mar 14, 2019
87320f2
hotfix to handle potential files
stenczelt Mar 14, 2019
9b5d4e0
test running potential from xml file
stenczelt Mar 14, 2019
b3882a8
trying to wrap descriptors, failing
stenczelt Mar 14, 2019
4b0e81a
successfully wrapping descriptors
stenczelt Mar 15, 2019
7a0c14e
testing the potential object with a 2b-gap potential
stenczelt Mar 15, 2019
2393b1b
removing old log
stenczelt Mar 15, 2019
6edab7f
cleaning up the makefiles
stenczelt Mar 15, 2019
b45eb29
minimal travis.yml see if it goes through
stenczelt Mar 15, 2019
ba3ec0f
update f90wrap to current state
stenczelt Mar 15, 2019
a1e8766
fix travis fail: python3 syntax instead of py2
stenczelt Mar 15, 2019
fdbdb71
Merge branch 'py3' of github.com:libAtoms/QUIP into py3
stenczelt Mar 15, 2019
f5b63d8
debug travis: SIZEOF_FORTRAN_T explicitly given with debug statements
stenczelt Mar 15, 2019
e6d1ea3
explicitly including SIZEOF_FORTRAN_T
stenczelt Mar 16, 2019
8275380
installing f90wrap in travis -- might need to move it to makefiles l…
stenczelt Mar 16, 2019
5e69636
update f90wrap
stenczelt Mar 17, 2019
ddf5f60
explicitly including set_cutoff which was private
stenczelt Mar 17, 2019
19853c5
update f90wrap
stenczelt Mar 17, 2019
74b8d1d
test for descriptors --- will need to be extended later
stenczelt Mar 17, 2019
53fd20a
removing local directory reference from tests
stenczelt Mar 17, 2019
4a5065d
old potential test disabled, could be reused later so lets not delete…
stenczelt Mar 17, 2019
3b78b74
set branch of f90wrap in .gitmodules
stenczelt Mar 17, 2019
1ff4164
update f90wrap
stenczelt Mar 17, 2019
2900751
update library reference in test suite
stenczelt Mar 17, 2019
d18bd08
'moving other old tests too, decide if reuseing them makes sense'
stenczelt Mar 17, 2019
6a083ba
'including all working tests in the test runner'
stenczelt Mar 17, 2019
a210936
added total_elements parameter instead of hardcoded integers
albapa Jan 23, 2019
b12a81f
updated to use total_elements parameter
albapa Jan 26, 2019
d550478
'pulling GAP in travis build'
stenczelt May 28, 2019
91d73f7
'debug in .travis.yml for more error info'
stenczelt May 28, 2019
55edfc7
'try this again'
stenczelt May 28, 2019
b3cc3ed
'debug the makefile, see what is the retun value the end of the full …
stenczelt May 28, 2019
fb1bddc
'run the test script quickly in travis'
stenczelt May 28, 2019
6268150
'quick test in travis gives more info'
stenczelt May 28, 2019
cb1137e
'removing debug statements from makefile'
stenczelt May 28, 2019
49904ea
'setting up a testing makefile.inc in rules'
stenczelt May 28, 2019
d29b4fa
'restructure travis.yml to have before-install and script section'
stenczelt May 28, 2019
06bc499
'clenup main makefile'
stenczelt May 28, 2019
60b057e
'clenup quippy Makefile'
stenczelt May 28, 2019
1ae953e
'updates to the main makefile clering install option, travis.yml to r…
stenczelt May 28, 2019
dd273a8
'trying with openmp'
stenczelt Jun 3, 2019
da55944
'new dockerfile with python3 base'
stenczelt Jun 3, 2019
cc159eb
'travis set up for docker py3'
stenczelt Jun 3, 2019
9356a60
'fix travis, wrong keyword'
stenczelt Jun 3, 2019
707d494
'serial with gfortran only'
stenczelt Jun 4, 2019
65c3f9e
'install for appropriate stages'
stenczelt Jun 4, 2019
be38520
'merge build and test script jobs'
stenczelt Jun 4, 2019
7fc984e
'Resolved merge conflicts locally'
stenczelt Jun 7, 2019
73f0e2d
'makefile cleaned up after wrong chouce on merge, by Gabor'
stenczelt Jun 7, 2019
0c11cf1
'try openmp installation'
stenczelt Jun 7, 2019
3bf5b4c
'install f90wrap with quippy'
stenczelt Jun 8, 2019
bf49d5d
'shorten f90wrap output'
stenczelt Jun 8, 2019
9d71e4a
'try running travis with similar instructions as in public'
stenczelt Jun 8, 2019
bf3f62f
'more output in travis for build'
stenczelt Jun 8, 2019
a6b2089
'typos in .travis.yml Makefile'
stenczelt Jun 8, 2019
93f7cac
'try without openmp flagging support'
stenczelt Jun 8, 2019
05aa55b
'adding openmp compatibility'
stenczelt Jun 8, 2019
0259916
'coverter for descriptor_data_mono'
stenczelt Jul 2, 2019
26eec05
'minimal working descriptor object, it calculates but the result is a…
stenczelt Jul 2, 2019
e447e4a
'add descriptors in init.py'
stenczelt Jul 2, 2019
2d1bea9
using the ase converter for arguments (written by James as well) whic…
stenczelt Jul 8, 2019
4f2c527
'descriptor patch, to return a dict as result instead of a list of di…
stenczelt Jul 8, 2019
7535309
handle empty results of descriptor calc
stenczelt Jul 8, 2019
f145513
'merge public in for GAP changes to work'
stenczelt Jul 8, 2019
e9db880
'merge + update travis.yml to include email notification'
stenczelt Jul 9, 2019
2982323
arg_strings are expanded by init_args and calc_args on relevant places
stenczelt Jul 10, 2019
f5110ff
clenup of comments
stenczelt Jul 10, 2019
d74a8c5
bugfix for arg strings
stenczelt Jul 10, 2019
ccce0a8
rename init_args to init_kwargs and calc_args to calc_kwargs
stenczelt Jul 10, 2019
cc57f86
adding __len__() method to descriptor
stenczelt Jul 10, 2019
d6f8627
matching the changes of f90wrap for the error args in descriptors.py
stenczelt Jul 30, 2019
2a6fb6e
matching the changes of f90wrap for the error args in utils.py
stenczelt Jul 30, 2019
3a1349f
now workaround for accessing the energy of the calculation, now with …
stenczelt Jul 30, 2019
557dfd7
fixed the test of descriptors, now that errors are not passed and err…
stenczelt Jul 30, 2019
35015a3
reformat files
stenczelt Jul 30, 2019
6b94eba
capitalising potential calculator class name
stenczelt Jul 30, 2019
a8dd63a
descriptor object name capitalised
stenczelt Jul 30, 2019
8e95fe3
'build in travis using the deploy key'
stenczelt Jul 30, 2019
c83a29f
converter updated to handle velocities too, needed for DynamicalSystems
stenczelt Jul 31, 2019
bc004f2
wrap DynamicalSystems.f95
stenczelt Jul 31, 2019
4705d01
'the old works around the dynamical systems'
stenczelt Jul 31, 2019
34a1367
change the imports and the source of units
stenczelt Jul 31, 2019
5228a14
remove old runner, will need to write new
stenczelt Jul 31, 2019
f6b235c
use hidden quip atoms object
stenczelt Jul 31, 2019
281039e
inherit from ase.optimize.optimize.Dynamics instead of object
stenczelt Jul 31, 2019
33b32d7
reformat the file by PyCharm
stenczelt Jul 31, 2019
b3001b7
accelerations added
stenczelt Jul 31, 2019
146f817
use two converters between velocities and ONLY those from now on
stenczelt Jul 31, 2019
2779890
update self.atoms to self.ase_atoms for clarity
stenczelt Jul 31, 2019
2c7d55b
update __init__(), very unfinished now
stenczelt Jul 31, 2019
1f540a4
update the step logic, update py2 syntax, raise NotImplenemtedError i…
stenczelt Jul 31, 2019
807524a
'take the old dynamical systems tester'
stenczelt Jul 31, 2019
078d0cf
'reformat file with PyCharm'
stenczelt Jul 31, 2019
2e717bb
unfinished test
stenczelt Jul 31, 2019
63667dd
'adding an f90wrap plugin for docstring generation'
stenczelt Aug 1, 2019
3e57a57
inferring type of the arguments in the documentation table making and…
stenczelt Aug 1, 2019
d820560
update the plugin
stenczelt Aug 1, 2019
7fa1a79
merging convert and utils, cleaning up init, updating docstrings
stenczelt Aug 1, 2019
6e845d6
update the plugin and use in makefile
stenczelt Aug 1, 2019
3838d17
remove obsolete files
stenczelt Aug 1, 2019
0e60ae0
'f90wrap updated to newly released master'
stenczelt Aug 1, 2019
b9d4c26
descriptor gradient output reshaped to the same shape as earlier in py2
stenczelt Aug 1, 2019
c9f7fb4
updated headers of quippy files and added myself to the readme
stenczelt Aug 1, 2019
f78825a
update .travis.yml to only do documentation on archived_py2
stenczelt Aug 1, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
[submodule "src/f90wrap"]
path = src/f90wrap
url = https://github.com/jameskermode/f90wrap
branch = py3
fetchRecursiveSubmodules = on-demand
29 changes: 21 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: python
python:
- "2.7"
- "3.6"
env:
matrix:
- QUIP_ARCH=linux_x86_64_gfortran QUIP_INC=Makefile.nogap.inc
Expand All @@ -11,7 +11,9 @@ env:

stages:
- test
- documentation
- name: documentation
# freezing the python2.7 version fot this at first
if: branch = archived_py2
- name: release
if: branch = public

Expand All @@ -34,7 +36,12 @@ before_install:
libhdf5-serial-dev
python-numpy

- git clone https://${GITHUB_TOKEN}@github.com/libAtoms/GAP.git src/GAP
# Clone the private gap repository using deploy key
- echo $github_deploy_key | base64 -d > ~/.ssh/github_deploy_key
- chmod 0600 ~/.ssh/github_deploy_key
- eval $(ssh-agent -s)
- ssh-add ~/.ssh/github_deploy_key
- git clone --depth 1 git@github.com:libAtoms/GAP.git src/GAP
# Make the build directory manually for rules
- mkdir -p build/${QUIP_ARCH}
# Copy the rules file (rather than make config)
Expand All @@ -59,6 +66,7 @@ script: # Compile QUIP, libquip and quippy, if a non-skipped build.
jobs:
include:
- stage: documentation
# freezing the python2.7 version fot this at first
python:
- "2.7"
env: # serial version of QUIP
Expand All @@ -78,16 +86,21 @@ jobs:
libgsl0-dev
libxpm-dev
pandoc

- git clone https://${GITHUB_TOKEN}@github.com/libAtoms/GAP.git src/GAP
# Clone the private gap repository using deploy key
- echo $github_deploy_key | base64 -d > ~/.ssh/github_deploy_key
- chmod 0600 ~/.ssh/github_deploy_key
- eval $(ssh-agent -s)
- ssh-add ~/.ssh/github_deploy_key
- git clone --depth 1 git@github.com:libAtoms/GAP.git src/GAP
# Make the build directory manually for rules
- mkdir -p build/${QUIP_ARCH}
# Copy the rules file (rather than make config)
- cp travis/${QUIP_INC} build/${QUIP_ARCH}/Makefile.inc

install: # packages for building docs
- pip install
ase
ase==3.17.0
docutils==0.14
sphinx
sphinx-rtd-theme
nbsphinx
Expand All @@ -97,8 +110,8 @@ jobs:
- pip install 'nbconvert[execute]' 'ipython<6'

# quippy is working, install it
- make &> build.log
- make install-quippy &> build.log
- make &> /dev/null
- make install-quippy &> /dev/null

# Install atomeye from src
- export QUIP_ROOT=`pwd`
Expand Down
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# H0 X
# H0 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


.PHONY: config doc clean deepclean distclean install test quippy doc install-structures install-dtds install-Tools install-build.QUIP_ARCH install-quippy libquip

ifndef QUIP_ARCH
Expand Down Expand Up @@ -96,7 +95,7 @@ GAP += GAP
GAP_PROGRAMS = gap_programs
else
GAP =
GAP_PROGRAMS =
GAP_PROGRAMS =
endif

# now add the rest of the modules
Expand Down Expand Up @@ -144,7 +143,7 @@ FOX_STATIC_LIBFILE_OBJS = $(shell for i in ${FOX_STATIC_LIBFILES}; do ar -t $$i;

${MODULES}: ${BUILDDIR}/Makefile.inc ${BUILDDIR} ${FOX}
@echo "********************************************"
@echo ""
@echo ""
@echo " Making $@ "
@echo ""
@echo "********************************************"
Expand All @@ -159,7 +158,7 @@ ${MODULES}: ${BUILDDIR}/Makefile.inc ${BUILDDIR} ${FOX}

Programs/% src/Programs/% : ${MODULES}
@echo "********************************************"
@echo ""
@echo ""
@echo " Making Programs "
@echo ""
@echo "********************************************"
Expand All @@ -176,7 +175,7 @@ endif

gap_programs: ${MODULES}
@echo "********************************************"
@echo ""
@echo ""
@echo " Making GAP programs "
@echo ""
@echo "********************************************"
Expand All @@ -196,18 +195,27 @@ libatoms: libAtoms

libquip: libquip.a

libquip.a: ${MODULES}
libquip.a: ${MODULES}
LIBQUIP_OBJS="$(shell for i in ${BUILDDIR}/libquiputils.a ${BUILDDIR}/libquip_core.a $(addprefix ${BUILDDIR}/,${GAP_LIBFILE}) ${BUILDDIR}/libatoms.a $(addprefix ${BUILDDIR}/,${THIRDPARTY_LIBS}) ${FOX_STATIC_LIBFILES}; do ar -t $$i; done | grep \.o)" && \
cd ${BUILDDIR} && for i in ${FOX_STATIC_LIBFILES}; do ar -x $$i; done && ar -rcs $@ $$LIBQUIP_OBJS

${BUILDDIR}:
@if [ ! -d build/${QUIP_ARCH}${QUIP_ARCH_SUFFIX} ] ; then mkdir -p build/${QUIP_ARCH}${QUIP_ARCH_SUFFIX} ; fi

quippy: libquip.a ${GAP_PROGRAMS}
${MAKE} -C quippy -I${PWD} -I${PWD}/arch build
@echo "********************************************"
@echo ""
@echo " Making quippy "
@echo ""
@echo "********************************************"
# fixme: restore the old functionality with commands like:
# ${MAKE} -C quippy -I${PWD} -I${PWD}/arch clean
rm -f ${BUILDDIR}/Makefile
cp ${PWD}/quippy/Makefile ${BUILDDIR}/Makefile
${MAKE} -C ${BUILDDIR} QUIP_ROOT=${QUIP_ROOT} -I${PWD} -I${PWD}/arch build
rm ${BUILDDIR}/Makefile

install-quippy: quippy
${MAKE} -C quippy -I${PWD} -I${PWD}/arch install

clean-quippy:
${MAKE} -C quippy -I${PWD} -I${PWD}/arch clean
Expand Down Expand Up @@ -242,7 +250,7 @@ ifeq (${QUIP_INSTALLDIR},)
@echo "'make install' needs QUIP_INSTALLDIR to be defined to install "
@echo "programs"
else
@if [ ! -d ${QUIP_INSTALLDIR} ]; then \
if [ ! -d ${QUIP_INSTALLDIR} ]; then \
echo "make install: QUIP_INSTALLDIR '${QUIP_INSTALLDIR}' doesn't exist or isn't a directory"; \
exit 1; \
else \
Expand All @@ -256,6 +264,9 @@ else
endif

test: quippy
#- cd tests
#- make
#- cd ..
${MAKE} -C tests -I${PWD} -I${PWD}/arch -I${BUILDDIR}

GIT_SUBDIRS=src/GAP src/ThirdParty
Expand All @@ -271,6 +282,3 @@ distribution:
bzip2 ../QUIP.distribution.`date +%Y-%m-%d`.tar
rm GIT_VERSION
@for d in ${GIT_SUBDIRS}; do if [ -d $$d ]; then pushd $$d; git archive HEAD | bzip2 > ../../$$d.distribution.`date +%Y-%m-%d`.tar.bz2; popd; fi; done



4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Silvia Cereda, Gabor Csanyi, Alessio Comisso, Tom Daff, ST John,
Chiara Gattinoni, Gianpietro Moras, James Kermode, Letif Mones,
Alan Nichol, David Packwood, Lars Pastewka, Giovanni Peralta, Ivan
Solt, Oliver Strickson, Wojciech Szlachta, Csilla Varnai, Steven
Winfield.
Winfield, Tamas K Stenczel.

Copyright 2006-2018.
Copyright 2006-2019.

Most of the publicly available version is released under the GNU
General Public license, version 2, with some portions in the public
Expand Down
4 changes: 0 additions & 4 deletions quippy/.f2py_f2cmap

This file was deleted.

19 changes: 19 additions & 0 deletions quippy/KIND_MAP
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# mapping from Fortran kinds to C types
{
'real': {'4': 'float',
'8': 'double',
'dp': 'double',
'DP': 'double',
'16': 'long_double',
'qp': 'double',
'c_double': 'double'}, # qp is usually double, not quad...
'complex' : {'8': 'complex_double',
'dp': 'complex_double'},
'integer' : {'': 'int',
'8': 'long_long',
'dp': 'long_long',
'c_intptr_t': 'long_long',
'c_int': 'long_long'}
}


5 changes: 0 additions & 5 deletions quippy/MANIFEST.in

This file was deleted.

97 changes: 78 additions & 19 deletions quippy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# HQ X
# HQ X quippy: Python interface to QUIP atomistic simulation library
# HQ X
# HQ X Copyright James Kermode 2010
# HQ X Portions of this code were written by
# HQ X Tamas K. Stenczel, James Kermode
# HQ X
# HQ X Copyright 2019
# HQ X
# HQ X These portions of the source code are released under the GNU General
# HQ X Public License, version 2, http://www.gnu.org/copyleft/gpl.html
Expand All @@ -12,10 +15,11 @@
# HQ X
# HQ X When using this software, please cite the following reference:
# HQ X
# HQ X http://www.jrkermode.co.uk/quippy
# HQ X https://warwick.ac.uk/fac/sci/eng/staff/jrk
# HQ X
# HQ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


# include other makefiles and export env variables
export QUIP_ARCH

Expand All @@ -26,27 +30,82 @@ include Makefile.${QUIP_ARCH}
include ${BUILDDIR}/Makefile.inc
include Makefile.rules

# Test if the 'python' in the path is a Python 2, if not then
# explicitly call python2
# This is a workaround for old virtualenv versions that don't create the
# 'python2' symlink.
python_version := $(word 2, $(subst ., , $(shell python -V 2>&1)))
ifeq (${python_version},2)
PYTHON := python
else
PYTHON := python2
# working on python3 only
PYTHON := python3

QUIPPY_SRC_DIR := ../../quippy

FPP = gfortran -E -cpp ${QUIPPY_F90FLAGS}
CFLAGS = -fPIC ${QUIPPY_CFLAGS}


# The following files will be wrapped
LIBATOMS_SOURCES = Atoms_types.f95 Atoms.f95 System.f95 Dictionary.f95 DynamicalSystem.f95
POT_SOURCES = Potential.f95
GAP_SOURCES = descriptors.f95

LIBATOMS_FILES = $(addprefix ../../src/libAtoms/,${LIBATOMS_SOURCES})
POT_FILES = $(addprefix ../../src/Potentials/,${POT_SOURCES})
GAP_FILES = $(addprefix ../../src/GAP/,${GAP_SOURCES})

WRAP_SOURCES = ${LIBATOMS_SOURCES} ${POT_SOURCES}
WRAP_FILES = ${LIBATOMS_FILES} ${POT_FILES}

ifeq (${HAVE_GAP},1)
WRAP_SOURCES += ${GAP_SOURCES}
WRAP_FILES += ${GAP_FILES}
endif

.PHONY: build install clean test
WRAP_FPP_FILES = $(addsuffix .fpp,$(basename ${WRAP_SOURCES}))

build:
LD=${LINKER} CC=${CC} F90=${F90} F77=${F77} QUIP_ROOT=${QUIP_ROOT} ${PYTHON} setup.py build
F90WRAP_FILES = $(addsuffix .f90,$(addprefix f90wrap_,$(basename ${WRAP_SOURCES}))) #f90wrap_toplevel.f90

F2PY_LINK_ARGS = $(shell python -c 'import sys; print(" ".join([arg for arg in sys.argv if arg.startswith("-l") or arg.startswith("-L")]))' ${SYSLIBS} ${QUIPPY_LDFLAGS})


#################################
.PHONY: build clean install f90wrap

install: build

f90wrap:
@echo "********************************************"
@echo ""
@echo " Making f90wrap "
@echo ""
@echo "********************************************"
@echo ""
@echo "Attempting to automatically clone f90wrap submodule"
git submodule update --init ${QUIP_ROOT}/src/f90wrap || \
{ echo "f90wrap clone failed. Download it manually" ; exit 1 ; }

cd ${QUIP_ROOT}/src/f90wrap ; ${PYTHON} setup.py install

install:
LD=${LINKER} CC=${CC} F90=${F90} F77=${F77} QUIP_ROOT=${QUIP_ROOT} ${PYTHON} setup.py install ${QUIPPY_INSTALL_OPTIONS}

clean:
LD=${LINKER} CC=${CC} F90=${F90} F77=${F77} QUIP_ROOT=${QUIP_ROOT} ${PYTHON} setup.py clean
rm _quippy.so
rm _castep.so ${F90WRAP_FILES} ${WRAP_FPP_FILES}
rm -r castep
rm -r f90wrap_*.o
rm -rf src.*

${WRAP_FPP_FILES}: ${WRAP_FILES}
for f in ${WRAP_FILES}; do \
echo ${FPP} -D'SIZEOF_FORTRAN_T=2' $$f > $$(basename $${f%.*}).fpp ; \
${FPP} -D'SIZEOF_FORTRAN_T=2' $$f > $$(basename $${f%.*}).fpp ; \
done

build: f90wrap ${WRAP_FPP_FILES}
if [ -d "quippy" ] ; then rm -r quippy; fi
mkdir quippy
cp -r ${QUIPPY_SRC_DIR}/quippy/* quippy
f90wrap -m quippy ${WRAP_FPP_FILES} -P -a c_error_abort \
--init-file ${QUIPPY_SRC_DIR}/init.py --move-methods \
--shorten-routine-names -k ${QUIPPY_SRC_DIR}/KIND_MAP -s ${QUIPPY_SRC_DIR}/STRING_LENGTHS -S 10240 \
--skip atoms_shallowcopy atoms_initialise_ptr atoms_finalise_multi \
potential_initialise_inoutput \
cplx_2d cplx_2d_array1_finalise --skip-types spherical_harmonics_type --force-public set_cutoff \
--documentation-plugin ${QUIPPY_SRC_DIR}/doc_plugin.py

test:
LD=${LINKER} CC=${CC} F90=${F90} F77=${F77} QUIP_ROOT=${QUIP_ROOT} ${PYTHON} setup.py test ${QUIPPY_TEST_OPTIONS}
f2py-f90wrap --build-dir . -c -m _quippy ${F90WRAP_FILES} ${F2PY_LINK_ARGS} \
-L. -lquip --link-lapack --f90flags="${QUIPPY_F90FLAGS}" -lgomp
Loading