mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 12:23:41 +01:00
* Replaced direct compilation in Makefile by 'setup.py' from 'distutils'
* NO_DEPRECATED_API flag was added and now 'c_plocar_io.c' does not compile
This commit is contained in:
parent
f0ae1c9927
commit
19a30034f5
@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <arrayobject.h>
|
|
||||||
|
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
||||||
|
|
||||||
|
#include <numpy/arrayobject.h>
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -32,7 +35,7 @@ static PyMethodDef c_plocar_io[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
initc_plocar_io()
|
initc_plocar_io(void)
|
||||||
{
|
{
|
||||||
(void) Py_InitModule("c_plocar_io", c_plocar_io);
|
(void) Py_InitModule("c_plocar_io", c_plocar_io);
|
||||||
import_array();
|
import_array();
|
||||||
@ -58,7 +61,7 @@ io_read_plocar(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
FILE* fh;
|
FILE* fh;
|
||||||
|
|
||||||
int isdouble, prec;
|
int prec;
|
||||||
t_params params;
|
t_params params;
|
||||||
|
|
||||||
if(!PyArg_ParseTuple(args, "|s", &fname))
|
if(!PyArg_ParseTuple(args, "|s", &fname))
|
||||||
@ -271,7 +274,7 @@ int read_arrays(FILE* fh, t_params* p, PyArrayObject* py_plo, PyArrayObject* py_
|
|||||||
ind1 = 0;
|
ind1 = 0;
|
||||||
ind2 = 0;
|
ind2 = 0;
|
||||||
for(ion = 0; ion < p->nion; ion++) {
|
for(ion = 0; ion < p->nion; ion++) {
|
||||||
fread(&nlm, 4, 1, fh);
|
if(fread(&nlm, 4, 1, fh) < 1) goto error;
|
||||||
// printf(" nlm = %d\n", nlm);
|
// printf(" nlm = %d\n", nlm);
|
||||||
for(is = 0; is < p->ns; is++)
|
for(is = 0; is < p->ns; is++)
|
||||||
for(ik = 0; ik < p->nk; ik++)
|
for(ik = 0; ik < p->nk; ik++)
|
||||||
|
@ -4,5 +4,6 @@ INC_FLAGS=-I/opt/local/Library/Frameworks/Python.framework/Versions/Current/incl
|
|||||||
LIB_FLAGS=-L/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7
|
LIB_FLAGS=-L/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7
|
||||||
|
|
||||||
c_plocar_io.so: c_plocar_io.c
|
c_plocar_io.so: c_plocar_io.c
|
||||||
$(CC) $< -fPIC -shared -o $@ $(INC_FLAGS) $(LIB_FLAGS) -lpython2.7
|
# $(CC) $< -fPIC -shared -o $@ $(INC_FLAGS) $(LIB_FLAGS) -lpython2.7
|
||||||
|
python setup.py build_ext --inplace
|
||||||
|
|
||||||
|
@ -4,5 +4,6 @@ INC_FLAGS=-I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core
|
|||||||
LIB_FLAGS=-L/usr/lib/python2.7
|
LIB_FLAGS=-L/usr/lib/python2.7
|
||||||
|
|
||||||
c_plocar_io.so: c_plocar_io.c
|
c_plocar_io.so: c_plocar_io.c
|
||||||
$(CC) $< -fPIC -shared -o $@ $(INC_FLAGS) $(LIB_FLAGS) -lpython2.7
|
# $(CC) $< -fPIC -shared -o $@ $(INC_FLAGS) $(LIB_FLAGS) -lpython2.7
|
||||||
|
python setup.py build_ext --inplace
|
||||||
|
|
||||||
|
9
python/converters/vasp/c/plocar_io/setup.py
Normal file
9
python/converters/vasp/c/plocar_io/setup.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
from distutils.core import setup, Extension
|
||||||
|
import numpy
|
||||||
|
|
||||||
|
c_plocar_io_mod = Extension('c_plocar_io', sources=['c_plocar_io.c'],
|
||||||
|
include_dirs=[numpy.get_include()])
|
||||||
|
|
||||||
|
setup(ext_modules=[c_plocar_io_mod])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user