Commit f2259af4 authored by Berk Onat's avatar Berk Onat
Browse files

molfile_plugin libraries are compiled with GCC on MacOS

parent 3b405c2e
import numpy
import ctypes
import _libpymolfile
class molatom_t(ctypes.Structure):
_fields_ = [
('name', ctypes.c_char * 16),
('type', ctypes.c_char * 16),
('resname', ctypes.c_char * 8),
('resid', ctypes.c_uint8),
('segid', ctypes.c_char * 8),
('chain', ctypes.c_char * 2),
('altloc', ctypes.c_char * 2),
('insertion', ctypes.c_char *2),
('occupancy', ctypes.c_float),
('bfactor', ctypes.c_float),
('mass', ctypes.c_float),
('charge', ctypes.c_float),
('radius', ctypes.c_float),
('atomicnumber', ctypes.c_uint8),
('ctnumber', ctypes.c_uint8),
]
class molplugin_t(ctypes.Structure):
_fields_ = [
('abiversion', ctypes.c_uint8),
('type', ctypes.c_char_p),
('name', ctypes.c_char_p),
('prettyname', ctypes.c_char_p),
('author', ctypes.c_char_p),
('majorv', ctypes.c_uint8),
('minorv', ctypes.c_uint8),
('is_reentrant', ctypes.c_uint8),
('filename_extension', ctypes.c_char_p),
('open_file_read', ctypes.CFUNCTYPE(ctypes.c_char_p,
ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint8))),
('read_structure', ctypes.CFUNCTYPE(ctypes.c_void_p,
ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(molatom_t))),
('read_bonds', ctypes.CFUNCTYPE(ctypes.c_void_p,
ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint),
ctypes.c_char_p)),
('read_next_timestep', ctypes.c_int8),
('close_file_read', ctypes.c_void_p),
('open_file_write', ctypes.c_void_p),
('write_structure', ctypes.c_int8),
('write_timestep', ctypes.c_int8),
('close_file_write', ctypes.c_void_p),
('read_volumetric_metadata', ctypes.c_int8),
('read_volumetric_data', ctypes.c_int8),
('read_volumetric_data_ex', ctypes.c_int8),
('read_rawgraphics', ctypes.c_int8),
('read_molecule_metadata', ctypes.c_int8),
('write_bonds', ctypes.c_int8),
('write_volumetric_data', ctypes.c_int8),
('write_volumetric_data_ex', ctypes.c_int8),
('read_angles', ctypes.c_int8),
('write_angles', ctypes.c_int8),
('read_qm_metadata', ctypes.c_int8),
('read_qm_rundata', ctypes.c_int8),
('read_timestep', ctypes.c_int8),
('read_timestep_metadata', ctypes.c_int8),
('read_qm_timestep_metadata', ctypes.c_int8),
('read_timestep2', ctypes.c_int8),
('read_times', ctypes.c_ssize_t),
('cons_fputs', ctypes.c_uint8)
]
class moltimestep_t(ctypes.Structure):
_fields_ = [
('coords', ctypes.POINTER(ctypes.c_float)),
('velocities', ctypes.POINTER(ctypes.c_float)),
('A', ctypes.c_float),
('B', ctypes.c_float),
('C', ctypes.c_float),
('alpha', ctypes.c_float),
('beta', ctypes.c_float),
('gamma', ctypes.c_float),
('physical_time', ctypes.c_double),
('total_energy', ctypes.c_double),
('potential_energy', ctypes.c_double),
('kinetic_energy', ctypes.c_double),
('extended_energy', ctypes.c_double),
('force_energy', ctypes.c_double),
('total_pressure', ctypes.c_double)
]
class molhandle_t(ctypes.Structure):
_fields_ = [
('plugin', ctypes.POINTER(molplugin_t)),
('file_handle', ctypes.c_void_p),
('natoms', ctypes.c_int)
]
class molnatoms(ctypes.Structure):
_fields_ = [
('natoms', ctypes.c_int)
]
#callback_t = ctypes.CFUNCTYPE(None, ctypes.POINTER(molatom_t))
def get_open_file_read(output):
ctypes.open_file_read.restype = ctypes.POINTER(molhandle_t)
ctypes.open_file_read.argtypes = [ctypes.POINTER(molplugin_t), ctypes.c_void_p, ctypes.c_uint8]
return ctypes.pythonapi.PyCapsule_GetPointer(output, "plugin")
def get_capsule(capsule):
ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p
ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object, ctypes.c_char_p]
return ctypes.pythonapi.PyCapsule_GetPointer(capsule, b"plugin")
def get_plugincapsule(capsule):
data = ctypes.POINTER(molhandle_t)
ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.POINTER(molhandle_t)
ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object, ctypes.c_char_p]
data = ctypes.pythonapi.PyCapsule_GetPointer(capsule, b"plugin")
return data
def get_plugindata(capsule):
data = ctypes.POINTER(molhandle_t)
ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.POINTER(molhandle_t)
ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object, ctypes.c_char_p]
data = ctypes.pythonapi.PyCapsule_GetPointer(capsule, b"plugin")
return data
mylib = _libpymolfile
mylist = mylib.molfile_plugin_list(200)
numlist = mylib.molfile_init()
print(numlist)
for i in range(numlist):
testplugin = mylib.molfile_plugin_info(mylist, i)
print(i, testplugin)
plugin = mylib.get_plugin(mylist, 81)
print(plugin)
natoms=0
numatoms=molnatoms(natoms)
fname="../../test/md.gro"
ftype="gro"
pluginhandle = mylib.open_file_read(plugin, fname, ftype, natoms)
print("This passed")
print(pluginhandle)
print("This passed too")
print(pluginhandle.natoms)
print("Here")
x = numpy.array([
('C1','C','ACE',0,'','','','',1.0,1.0,12.011,6,1.0,6),
('C2','C','ACE',0,'','','','',1.0,1.0,12.011,6,1.0,6)
],
dtype=[
('name', 'S16'), ('type', 'S16'), ('resname', 'S8'),
('resid', 'i4'), ('segid', 'S8'), ('chain', 'S2'),
('altloc', 'S2'), ('insertion', 'S2'), ('occupancy', 'f8'),
('bfactor', 'f8'), ('mass', 'f8'), ('charge', 'f8'),
('radius', 'f8'), ('atomicnumber', 'i4')
]
)
print(x)
print(x.__array_interface__)
print(x.__array_interface__["descr"])
print(x.__array_struct__)
#y = mylib.read_fill_structure(pluginhandle, x)
y = mylib.print_array_struct(x)
print('Test')
print(y)
#outarray = mylib.get_structure(pluginhandle)
#print(outarray)
#print(type(outarray))
#for i in outarray:
# print(i)
swig -py3 -Wall -c++ -python libpymolfile.i
g++ -fPIC -Wall -Wextra -Wunused-function -shared -g -I/labEnv3/lib/python3.6/site-packages/numpy/core/include/ -I. libpymolfile_wrap.cxx pymolfile.c -o _libpymolfile.so -Ivmd_molfile_plugins/include/ -Ilib/ -L. lib/libmolfile_plugin.a -I/labEnv3/include/python3.6m/ -L/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib -lpython3.6
g++-7 -fPIC -Wall -Wextra -shared -g -Wunused-function -Wunused-parameter -I/labEnv3/lib/python3.6/site-packages/numpy/core/include/ -I. libpymolfile_wrap.cxx pymolfile.c -o _libpymolfile.so -Ivmd_molfile_plugins/include/ -Ilib/ -L. lib/libmolfile_plugin.a -I/labEnv3/include/python3.6m/ -L/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib -lpython3.6
This diff is collapsed.
......@@ -61,33 +61,6 @@ enum { pluginOK, pluginNOINIT, pluginCLOSE, pluginNOMEM,
/* Definition of molfile_atoms_t from molfile_plugin.h */
%inline %{
/*
struct MolAtoms {
char name[16];
char type[16];
char resname[8];
int resid;
char segid[8];
char chain[2];
char altloc[2];
char insertion[2];
float occupancy;
float bfactor;
float mass;
float charge;
float radius;
float atomicnumber;
float ctnumber;
};
void del_plugin_structure(PyObject* pymolfile_atoms){
delete (MolAtoms*)PyCapsule_GetPointer(pymolfile_atoms, "plugin_structure");
}
static PyObject* alloc_plugin_structure(PyObject *self, PyObject *args) {
return PyCapsule_New((void*)new MolAtoms(), "plugin_structure", del_plugin_structure);
}
*/
void del_plugin(PyObject* pymolfile_plugin){
delete (MolObject*)PyCapsule_GetPointer(pymolfile_plugin, "plugin");
}
......@@ -192,21 +165,12 @@ PyObject * my_open_file_read(molfile_plugin_t* plugin, char* fname, char* ftype,
if (PyType_Ready(&MolObjectType) < 0)
return NULL;
PyTypeObject *type = &MolObjectType;
/*plugin_handle = PyCapsule_New((void*)new MolObject(), "plugin", del_plugin); */
/*MolObject* plugin_c = new MolObject;*/
MolObject *plugin_c;
plugin_c = (MolObject *)type->tp_alloc(type, 0);
/*PyObject * plugin_c = MolObject_new(&MolObjectType, args, kwds);*/
plugin_c->plugin = plugin;
plugin_c->file_handle = plugin->open_file_read(fname, ftype, &natoms);
plugin_c->natoms = natoms;
/* PyCapsule_SetPointer(plugin_handle, &plugin_c); */
/* PyObject* plugin_handle = PyCapsule_New((void*)plugin_c, "plugin", del_plugin); */
PyObject* plugin_handle = (PyObject *)plugin_c;
/*if(!plugin_handle) printf("Not assigned\n");*/
/*PyObject *tuple = PyTuple_New(2);
PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)natoms));
PyTuple_SET_ITEM(tuple, 1, plugin_handle);*/
return plugin_handle;
}
%}
......@@ -320,200 +284,17 @@ int structure_read(molfile_plugin_t* plugin, void* fhandle, int *options,
%}
*/
%feature("autodoc", "0") my_read_structure;
%rename (read_structure) my_read_structure;
extern PyObject * my_read_structure(PyObject* molpack);
%feature("autodoc", "0") get_structure;
extern PyObject * get_structure(PyObject* molpack);
%feature("autodoc", "0") read_fill_structure;
extern PyObject * read_fill_structure(PyObject* molpack, PyObject* prototype);
%feature("autodoc", "0") print_array_struct;
extern PyObject* print_array_struct(PyObject* prototype);
/*
%feature("autodoc", "0") my_read_structure;
%rename (read_structure) my_read_structure;
%exception my_read_structure {
$action
if (PyErr_Occurred()) SWIG_fail;
}
%inline %{
PyObject * my_read_structure(PyObject* molpack) {
int options = 0;
int i;
molfile_plugin_t* plugin;
void* file_handle;
molfile_atom_t* atoms;
int numatoms, status;
char** atom_names;
char** atom_types;
PyObject *npatoms = NULL; */
/*MolObject* plugin_handle = (MolObject*)PyCapsule_GetPointer(molpack, "plugin");*/
/* MolObject* plugin_handle = (MolObject*)molpack;
plugin = plugin_handle->plugin;
file_handle = plugin_handle->file_handle;
numatoms = plugin_handle->natoms;
atoms = (molfile_atom_t *)calloc(numatoms,sizeof(molfile_atom_t));
printf("Test1\n");
status = plugin->read_structure(file_handle, &options, atoms);
printf("Test2 %d\n",status);
if (status!=0){
PyErr_Format(PyExc_IOError, "Error copying molfile_atom_t into Python.");
return NULL;
}
printf("Test3\n");
npy_intp natoms[1] = { numatoms };
PyArrayObject* oresid;
int64_t* cresid;
int typenum;
int nd = 1;
npy_intp dims[1] = { numatoms }; */
/*dims[0] = numatoms;*/
/* oresid = (PyArrayObject*) PyArray_SimpleNew(nd, dims, NPY_INT64);
npy_intp* n = PyArray_DIMS(oresid);
printf("dimensions %ld\n", n[0]);
cresid = (int64_t*) PyArray_DATA(oresid);
PyObject* npatomresid = NULL;
char** MolAtom_name = (char **)malloc(numatoms*sizeof(char*));
char** MolAtom_type = (char **)malloc(numatoms*sizeof(char*));
int64_t* MolAtom_resid = NULL; */
/*int64_t* MolAtom_resid = (int64_t *)malloc(numatoms*sizeof(int64_t));*/
/* float* MolAtom_mass = (float *)malloc(numatoms*sizeof(float));
float* MolAtom_atomicnumber = (float *)malloc(numatoms*sizeof(float));
for (i=0;i<numatoms;i++){
MolAtom_name[i] = atoms[i].name;
MolAtom_type[i] = atoms[i].type;
cresid[i] = (int64_t) atoms[i].resid;
MolAtom_mass[i] = atoms[i].mass;
MolAtom_atomicnumber[i] = atoms[i].atomicnumber;
} */
/*Py_DECREF( obj );*/
/*npy_intp dims[3];*/ /* PyArray_AsCArray is for ndim <= 3 */
/* PyArray_Descr *descr;
npatoms = PyArray_SimpleNewFromData(1, natoms, NPY_USERDEF, atoms);
printf("Test4 numatoms=%d\n", numatoms);
PyObject* npatomname = NULL;
npatomname = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, MolAtom_name[0]);
PyObject* npatomtype = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, MolAtom_type); */
/*PyObject* npatomresname = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, atoms->resname);*/
/*PyObject* npatomsegid = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, atoms->segid);*/
/*PyObject* npatomchain = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, atoms->chain);*/
/*PyObject* npatomaltloc = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, atoms->altloc);*/
/*PyObject* npatominsert = PyArray_SimpleNewFromData(1, natoms, NPY_STRING, atoms->insertion);*/
/*PyObject* npatomoccup = PyArray_SimpleNewFromData(1, natoms, NPY_FLOAT64, &atoms->occupancy);*/
/*PyObject* npatombfact = PyArray_SimpleNewFromData(1, natoms, NPY_FLOAT64, &atoms->bfactor);*/
/* PyObject* npatommass = PyArray_SimpleNewFromData(1, natoms, NPY_FLOAT64, MolAtom_mass); */
/*PyObject* npatomcharge = PyArray_SimpleNewFromData(1, natoms, NPY_FLOAT64, &atoms->charge);*/
/*PyObject* npatomradius = PyArray_SimpleNewFromData(1, natoms, NPY_FLOAT64, &atoms->radius);*/
/* PyObject* npatomicnumber = PyArray_SimpleNewFromData(1, natoms, NPY_INT64, MolAtom_atomicnumber); */
/*if (npatomname==NULL || npatomtype==NULL || npatomresname==NULL ||
npatomresid==NULL || npatomsegid==NULL || npatomchain==NULL )
{
free(atoms);
Py_XDECREF(npatomname); Py_XDECREF(npatomtype);
Py_XDECREF(npatomresname); Py_XDECREF(npatomresid); Py_XDECREF(npatomsegid);
Py_XDECREF(npatomchain); Py_XDECREF(npatomaltloc); Py_XDECREF(npatominsert);
Py_XDECREF(npatomoccup); Py_XDECREF(npatombfact); Py_XDECREF(npatommass);
Py_XDECREF(npatomcharge); Py_XDECREF(npatomradius); Py_XDECREF(npatomicnumber);
PyErr_Format(PyExc_IOError, "Error copying molfile_atom_t into Python.");
return 0;
}
PyArray_BASE(npatomname) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomtype) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomresname) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomresid) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomsegid) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomchain) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomaltloc) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatominsert) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomoccup) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatombfact) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatommass) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomcharge) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomradius) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatomicnumber) = PyCObject_FromVoidPtr(*atoms, free);
PyArray_BASE(npatoms) = PyCObject_FromVoidPtr(atoms, free);
PyArray_BASE((PyArrayObject *)npatoms) = PyCapsule_New(atoms, "atoms", del_atoms);*/
/*PyArray_BASE((PyArrayObject *)npatoms); */
/* printf("Test4-2\n"); */
/*PyObject* Py_MolAtom_name = PyCapsule_New((void*)MolAtom_name, "atomname", del_atomname);*/
/*PyObject* Py_MolAtom_name;
Py_INCREF(Py_MolAtom_name);*/
/* printf("Test4-3\n"); */
/*PyArray_SetBaseObject((PyArrayObject *)npatomname, Py_MolAtom_name);*/
/*PyArray_SetBaseObject((PyArrayObject *)npatomtype, MolAtom_type);
PyArray_SetBaseObject((PyArrayObject *)npatomresid, MolAtom_resid);
PyArray_SetBaseObject((PyArrayObject *)npatommass, MolAtom_mass);
PyArray_SetBaseObject((PyArrayObject *)npatomicnumber, MolAtom_atomicnumber); */
/* printf("Test5\n");
PyObject *tuple = PyTuple_New(2);
PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)natoms));
printf("Test6\n");
PyTuple_SET_ITEM(tuple, 1, npatomname); */
/*PyTuple_SET_ITEM(tuple, 2, npatomtype);
PyTuple_SET_ITEM(tuple, 3, npatomresid);
PyTuple_SET_ITEM(tuple, 4, npatommass);
PyTuple_SET_ITEM(tuple, 5, npatomicnumber);
PyObject* vars = PyDict_New();
printf("Test7\n");
PyDict_SetItemString( vars, "name", npatomname ); */
/* printf("Test8\n"); */
/*PyDict_SetItemString( vars, "resid", npatomresid ); */
/*return Py_BuildValue("O", oresid); */
/*return PyArray_FromArray(oresid, PyArray_DESCR(oresid), 0);*/
/* return 0;
}
%}
*/
/*
python wrappers for functions
and structure data in molfile_plugin.h
*/
/* molfile_atom_t
char name[16]; required atom name string
char type[16]; required atom type string
char resname[8]; required residue name string
int resid; required integer residue ID
char segid[8]; required segment name string, or ""
char chain[2]; required chain name, or ""
char altloc[2]; optional PDB alternate location code
char insertion[2]; optional PDB insertion code
float occupancy; optional occupancy value
float bfactor; optional B-factor value
float mass; optional mass value
float charge; optional charge value
float radius; optional radius value
int atomicnumber; optional element atomic number
int ctnumber; mae ct block, 0-based, including meta
*/
/* molfile_plugin_t */
/*
%feature("autodoc", "0") molfile_open_file_read;
%rename (open_file_read) molfile_open_file_read;
%exception molfile_open_file_read {
$action
if (PyErr_Occurred()) SWIG_fail;
}
%inline %{
PyObject * molfile_open_file_read(molfile_plugin_t* plugin, char *fname, int natoms) {
int *plugno = &plugin_no;
return plugin;
}
%}
*/
/*
void *(* open_file_read)(const char *filepath, const char *filetype,
int *natoms);
......
......@@ -154,21 +154,9 @@ def open_file_read(plugin: 'molfile_plugin_t *', fname: 'char *', ftype: 'char *
"""open_file_read(plugin, fname, ftype, natoms) -> PyObject *"""
return _libpymolfile.open_file_read(plugin, fname, ftype, natoms)
def read_structure(molpack: 'PyObject *') -> "PyObject *":
"""read_structure(molpack) -> PyObject *"""
return _libpymolfile.read_structure(molpack)
def get_structure(molpack: 'PyObject *') -> "PyObject *":
"""get_structure(molpack) -> PyObject *"""
return _libpymolfile.get_structure(molpack)
def read_fill_structure(molpack: 'PyObject *', prototype: 'PyObject *') -> "PyObject *":
"""read_fill_structure(molpack, prototype) -> PyObject *"""
return _libpymolfile.read_fill_structure(molpack, prototype)
def print_array_struct(prototype: 'PyObject *') -> "PyObject *":
"""print_array_struct(prototype) -> PyObject *"""
return _libpymolfile.print_array_struct(prototype)
# This file is compatible with both classic and new-style classes.
......@@ -3148,33 +3148,6 @@ SWIGINTERNINLINE PyObject*
/*
struct MolAtoms {
char name[16];
char type[16];
char resname[8];
int resid;
char segid[8];
char chain[2];
char altloc[2];
char insertion[2];
float occupancy;
float bfactor;
float mass;
float charge;
float radius;
float atomicnumber;
float ctnumber;
};
void del_plugin_structure(PyObject* pymolfile_atoms){
delete (MolAtoms*)PyCapsule_GetPointer(pymolfile_atoms, "plugin_structure");
}
static PyObject* alloc_plugin_structure(PyObject *self, PyObject *args) {
return PyCapsule_New((void*)new MolAtoms(), "plugin_structure", del_plugin_structure);
}
*/
void del_plugin(PyObject* pymolfile_plugin){
delete (MolObject*)PyCapsule_GetPointer(pymolfile_plugin, "plugin");
}
......@@ -3400,21 +3373,12 @@ PyObject * my_open_file_read(molfile_plugin_t* plugin, char* fname, char* ftype,
if (PyType_Ready(&MolObjectType) < 0)
return NULL;
PyTypeObject *type = &MolObjectType;
/*plugin_handle = PyCapsule_New((void*)new MolObject(), "plugin", del_plugin); */
/*MolObject* plugin_c = new MolObject;*/
MolObject *plugin_c;
plugin_c = (MolObject *)type->tp_alloc(type, 0);
/*PyObject * plugin_c = MolObject_new(&MolObjectType, args, kwds);*/
plugin_c->plugin = plugin;
plugin_c->file_handle = plugin->open_file_read(fname, ftype, &natoms);
plugin_c->natoms = natoms;
/* PyCapsule_SetPointer(plugin_handle, &plugin_c); */
/* PyObject* plugin_handle = PyCapsule_New((void*)plugin_c, "plugin", del_plugin); */
PyObject* plugin_handle = (PyObject *)plugin_c;
/*if(!plugin_handle) printf("Not assigned\n");*/
/*PyObject *tuple = PyTuple_New(2);
PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)natoms));
PyTuple_SET_ITEM(tuple, 1, plugin_handle);*/
return plugin_handle;
}
......@@ -3785,38 +3749,6 @@ fail:
}
SWIGINTERN PyObject *_wrap_read_structure(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PyObject *arg1 = (PyObject *) 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:read_structure",&obj0)) SWIG_fail;
arg1 = obj0;
result = (PyObject *)my_read_structure(arg1);
resultobj = result;
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_get_structure(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PyObject *arg1 = (PyObject *) 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:get_structure",&obj0)) SWIG_fail;
arg1 = obj0;
result = (PyObject *)get_structure(arg1);
resultobj = result;
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_read_fill_structure(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PyObject *arg1 = (PyObject *) 0 ;
......@@ -3836,22 +3768,6 @@ fail:
}
SWIGINTERN PyObject *_wrap_print_array_struct(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PyObject *arg1 = (PyObject *) 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:print_array_struct",&obj0)) SWIG_fail;
arg1 = obj0;
result = (PyObject *)print_array_struct(arg1);
resultobj = result;
return resultobj;
fail:
return NULL;
}
static PyMethodDef SwigMethods[] = {
{ (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
{ (char *)"del_plugin", _wrap_del_plugin, METH_VARARGS, NULL},
......@@ -3864,10 +3780,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"get_plugin", _wrap_get_plugin, METH_VARARGS, (char *)"get_plugin(plugin_list, plugin_no) -> molfile_plugin_t *"},
{ (char *)"molfile_plugin_info", _wrap_molfile_plugin_info, METH_VARARGS, (char *)"molfile_plugin_info(plugin_list, plugin_no) -> PyObject *"},
{ (char *)"open_file_read", _wrap_open_file_read, METH_VARARGS, (char *)"open_file_read(plugin, fname, ftype, natoms) -> PyObject *"},
{ (char *)"read_structure", _wrap_read_structure, METH_VARARGS, (char *)"read_structure(molpack) -> PyObject *"},
{ (char *)"get_structure", _wrap_get_structure, METH_VARARGS, (char *)"get_structure(molpack) -> PyObject *"},
{ (char *)"read_fill_structure", _wrap_read_fill_structure, METH_VARARGS, (char *)"read_fill_structure(molpack, prototype) -> PyObject *"},
{ (char *)"print_array_struct", _wrap_print_array_struct, METH_VARARGS, (char *)"print_array_struct(prototype) -> PyObject *"},
{ NULL, NULL, 0, NULL }
};
......
This diff is collapsed.
/* Hey emacs this is -*- C -*- and this is my editor vim.
*
* molfile.c : C and Fortran interfaces for molfile_plugins
* Copyright (c) Berk Onat <b.onat@warwick.ac.uk> 2017
*
* This program is under BSD LICENSE
*/
/*
* The code is written following the plugin test
* context of f77_molfile.c by Axel Kohlmeyer and
* in molfile_plugin/src/f77 and catdcd.c by
* Justin Gullingsrud of VMD plugins.
*/
#ifndef _MOLFILE_H_
#define _MOLFILE_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include "molfile_plugin.h"
#include "libmolfile_plugin.h"