Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymolfile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
pymolfile
Commits
b4415d5c
Commit
b4415d5c
authored
7 years ago
by
Berk Onat
Browse files
Options
Downloads
Patches
Plain Diff
Fixed numpy initialization bug at C functions.
parent
f3504d61
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pymolfile/molfile/pymolfile.cxx
+16
-5
16 additions, 5 deletions
pymolfile/molfile/pymolfile.cxx
pymolfile/molfile/pymolfile.h
+6
-0
6 additions, 0 deletions
pymolfile/molfile/pymolfile.h
with
22 additions
and
5 deletions
pymolfile/molfile/pymolfile.cxx
+
16
−
5
View file @
b4415d5c
...
...
@@ -38,7 +38,12 @@ molfile_plugin_t** plugin_list;
#define PyInt_AsLong PyLong_AsLong
#define PyString_FromString PyBytes_FromString
#define PyInt_FromLong PyLong_FromLong
int
initNumpyArray
(
void
){
if
(
PyArray_API
==
NULL
)
{
import_array
();
}
}
void
del_molfile_plugin_list
(
PyObject
*
molcapsule
)
{
plugin_list
=
(
molfile_plugin_t
**
)
PyMolfileCapsule_AsVoidPtr
(
molcapsule
);
...
...
@@ -52,6 +57,12 @@ void del_molfile_file_handle(PyObject* molcapsule)
Py_XDECREF
(
molcapsule
);
}
#else
void
initNumpyArray
(
void
){
if
(
PyArray_API
==
NULL
)
{
import_array
();
}
}
void
del_molfile_plugin_list
(
void
*
molcapsule
)
{
plugin_list
=
(
molfile_plugin_t
**
)
PyMolfileCapsule_AsVoidPtr
((
PyObject
*
)
molcapsule
);
...
...
@@ -201,7 +212,7 @@ PyObject * molfile_plugin_info(PyObject* molcapsule, int plugin_no) {
PyObject
*
read_fill_structure
(
PyObject
*
molpack
,
PyObject
*
prototype
)
{
//Py_Initialize();
i
mport_a
rray
();
i
nitNumpyA
rray
();
int
options
=
0
;
molfile_plugin_t
*
plugin
;
void
*
file_handle
;
...
...
@@ -264,7 +275,7 @@ PyObject* read_fill_structure(PyObject* molpack, PyObject* prototype)
PyObject
*
read_fill_bonds
(
PyObject
*
molpack
)
{
i
mport_a
rray
();
i
nitNumpyA
rray
();
int
options
=
0
;
molfile_plugin_t
*
plugin
;
void
*
file_handle
;
...
...
@@ -359,7 +370,7 @@ PyObject* read_fill_bonds(PyObject* molpack)
PyObject
*
read_fill_angles
(
PyObject
*
molpack
)
{
i
mport_a
rray
();
i
nitNumpyA
rray
();
int
options
=
0
;
molfile_plugin_t
*
plugin
;
void
*
file_handle
;
...
...
@@ -558,7 +569,7 @@ PyObject* read_fill_angles(PyObject* molpack)
PyObject
*
read_fill_next_timestep
(
PyObject
*
molpack
)
{
i
mport_a
rray
();
i
nitNumpyA
rray
();
molfile_plugin_t
*
plugin
;
void
*
file_handle
;
int
numatoms
,
status
;
...
...
This diff is collapsed.
Click to expand it.
pymolfile/molfile/pymolfile.h
+
6
−
0
View file @
b4415d5c
...
...
@@ -22,6 +22,12 @@ extern "C"
#endif
#if PY_VERSION_HEX >= 0x03000000
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
#else
#define NUMPY_IMPORT_ARRAY_RETVAL
#endif
#include
"molfile_plugin.h"
#include
"libmolfile_plugin.h"
#include
"vmdplugin.h"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment