diff --git a/pymolfile/libpymolfile-old/AUTHORS b/pymolfile/libpymolfile-old/AUTHORS deleted file mode 100644 index fadaded083b607c3f29dbb0fa4feebaa5565f9ee..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/AUTHORS +++ /dev/null @@ -1,42 +0,0 @@ -libvmdmolfile -====================================== - -All the modified files mentioned below are part of libvmdmolfile and are published under -the GNU GENERAL PUBLIC LICENSE Version 2 (or higher): - - * vmdmolfile.c - * vmdmolfile.h - * libvmdmolfile.i - * libvmdmolfile_wrap.c - * libvmdmolfile.py - - -numpy SWIG interface -==================== - -Bill Spotz wrote - - * numpy.i - -which was obtained from the trunk of the numpy distribution, -2010-03-25. As it appears in numpy it is presumably licensed under the -`BSD Licence <http://opensource.org/licenses/bsd-license.php>`_. - - -Berk Onat wrote - - * libvmdmolfile.i - -``libvmdmolfile_wrap.c`` and ``libvmdmolfile.py`` are -generated from ``libvmdmolfile.i`` with: - - swig -python -outdir . libxdrfile.i - -Up to and including MDAnalysis version 0.7.7 the files - - * libvmdmolfile.i - * libvmdmolfile_wrap.c - * libvmdmolfile.py - -are published under the GNU GENERAL PUBLIC LICENSE Version 3 (or higher). - diff --git a/pymolfile/libpymolfile-old/COPYING b/pymolfile/libpymolfile-old/COPYING deleted file mode 100644 index d159169d1050894d3ea3b98e1c965c4058208fe1..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/pymolfile/libpymolfile-old/README b/pymolfile/libpymolfile-old/README deleted file mode 100644 index 4b7658f9f08062a3d80721d8efd12b7b58ed1de9..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/README +++ /dev/null @@ -1,49 +0,0 @@ -libxdrfile2 -============= - -This library allows to read GROMACS trr and xtc files and also to -convert from one format to another. libxdrfile2 is a derivative of the -`libxdrfile library`_ written by the Gromacs developers. For MDAnalysis we -added Python bindings (generated with SWIG_). For libxdrfile2 we added -new indexing and seeking capabilities to the library. - -.. _`libxdr library`: - http://www.gromacs.org/Developer_Zone/Programming_Guide/XTC_Library -.. _SWIG: - http://www.swig.org/ - - -Licensing -========= - -libxdrfile is provided by the Gromacs developers under the GNU Lesser -General Public License version 3. -While under development together with the MDAnalysis code, the library -was enhanced to provide xtc/trr frame indexing and seeking. This derivative -version of the library, named libxdrfile2, is now provided under the GNU -General Public License version 2. Read the AUTHORS and COPYING files -for details. - - -Python bindings -=============== - -Although the whole ``xdrfile`` package is distributed together with -`MDAnalysis <http://mdanalysis.googlecode.com>` it is also possible to -use it as a stand-alone library. Build the library from the src -directory:: - - mv xdrfile/setup_py setup.py - mv xdrfile/__init___py xdrfile/__init__.py - swig -python xdrfile/libxdrfile2.i # or copy libxdrfile2.py to xdrfile/ - python setup.py build --build-lib=. - -(This does an in-place build but you can also do a normal ``python -setup.py install``.) - -Note that in order to import the module you will have to do: - - from xdrfile import libxdrfile2 - - - diff --git a/pymolfile/libpymolfile-old/__init__.py b/pymolfile/libpymolfile-old/__init__.py deleted file mode 100644 index 584c3db77a365e537797219d8d866cef43fdd84e..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ - -# Stand-alone python bindings for libvmdmolfile -# Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> -# Published under the GNU GENERAL PUBLIC LICENSE Version 2 (or higher) -"""Stand-alone vmdmolfile library. - -""" diff --git a/pymolfile/libpymolfile-old/libvmdmolfile.i b/pymolfile/libpymolfile-old/libvmdmolfile.i deleted file mode 100644 index 5bc26bba13286284a3c168a6d2394d526c215668..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/libvmdmolfile.i +++ /dev/null @@ -1,665 +0,0 @@ -/* -*- C -*- (not really, but good for syntax highlighting) */ -/* SWIG interface for libvmdmolfile of VMD molfile_plugins - Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> - Published under the GNU GENERAL PUBLIC LICENSE Version 2 (or higher) - - swig -python -outdir MDAnalysis/coordinates/xdrfile src/xdrfile/libxdrfile2.i -*/ -%define DOCSTRING -" -:Author: Berk Onat <b.onat@warwick.ac.uk> -:Year: 2017 -:Licence: GNU GENERAL PUBLIC LICENSE Version 2 (or higher) - - -The Gromacs XTC/TRR library :mod:`libxdrfile2` -============================================== - -:mod:`libxdrfile2`, a derivative of the Gromacs_ `libxdrfile library`_, provides an -interface to some high-level functions for XTC/TRR trajectory handling. -Only functions required for reading and processing whole trajectories are exposed at -the moment; low-level routines to read individual numbers are not provided. In -addition, :mod:`libxdrfile2` exposes functions to allow fast frame indexing and XDR -file seeking. - -The functions querying the numbers of atoms in a trajectory frame -(:func:`read_xtc_natoms` and :func:`read_trr_natoms`) open a file themselves and -only require the file name. - -All other functions operate on a *XDRFILE* object, which is a special file -handle for xdr files. Any xdr-based trajectory file (XTC or TRR format) always -has to be opened with :func:`xdrfile_open`. When done, close the trajectory -with :func:`xdrfile_close`. - -The functions fill or read existing arrays of coordinates; they never allocate -these arrays themselves. Hence they need to be setup outside libxdrfile2 as -numpy arrays. The exception to these are the indexing ones functions that take -care of array allocation and transference to a garbage-collectable memory object. - - -.. _Gromacs: http://www.gromacs.org -.. _libxdrfile library: http://www.gromacs.org/Developer_Zone/Programming_Guide/XTC_Library - -.. versionchanged:: 0.8.0 - :mod:`libxdrfile2` is now used instead of :mod:`libxdrfile`. :mod:`libxdrfile2` is - based on :mod:`libxdrfile` but has xdr seeking and indexing capabilities. - Unlike :mod:`libxdrfile` before it, :mod:`libxdrfile2` is distributed under the GNU - GENERAL PUBLIC LICENSE, version 2 (or higher). - - -Example: Reading from a XTC ---------------------------- - -In the example we read coordinate frames from an existing XTC trajectory:: - - import numpy as np - from libxdrfile2 import xdrfile_open, xdrfile_close, read_xtc_natoms, read_xtc, DIM, exdrOK - xtc = 'md.xtc' - - # get number of atoms - natoms = read_xtc_natoms(xtc) - - # allocate coordinate array of the right size and type - # (the type float32 is crucial to match the underlying C-code!!) - x = np.zeros((natoms, DIM), dtype=np.float32) - # allocate unit cell box - box = np.zeros((DIM, DIM), dtype=np.float32) - - # open file - XTC = xdrfile_open(xtc, 'r') - - # loop through file until return status signifies end or a problem - # (it should become exdrENDOFFILE on the last iteration) - status = exdrOK - while status == exdrOK: - status,step,time,prec = read_xtc(XTC, box, x) - # do something with x - centre = x.mean(axis=0) - print 'Centre of geometry at %(time)g ps: %(centre)r' % vars() - - # finally close file - xdrfile_close(XTC) - -Note that only the *contents* of the coordinate and unitcell arrays *x* and -*box* change. - - -Functions and constants ------------------------ - -The module defines a number of constants such as :data:`DIM` or the -`Status symbols`_. - -.. data:: DIM - - The number of cartesian dimensions for which the underlying C-code - was compiled; this is most certainly 3. - - -Status symbols -~~~~~~~~~~~~~~ - -A number of symbols are exported; they all start with the letters -``exdr``. Important ones are: - -.. data:: exdrOK - - Success of xdr file read/write operation. - -.. data:: exdrCLOSE - - xdr file is closed - -.. data:: exdrENDOFFILE - - end of file was reached (response of :func:`read_xtc` and - :func:`read_trr` after the last read frame) - -.. data:: exdrFILENOTFOUND - - :func:`xdrfile_open` cannot find the requested file - -Other symbols that are used internally are: - -.. data:: exdrHEADER - - header - -.. data:: exdrSTRING - - string - -.. data:: exdrDOUBLE - - double precision floating point number - -.. data:: exdrINT - - integer - -.. data:: exdrFLOAT - - floating point number - -.. data:: exdrUINT - - unsigned integer - -.. data:: exdr3DX - - compressed 3D coordinates - -.. data:: exdrMAGIC - - magic number - -.. data:: exdrNOMEM - - not enough memory to allocate space for a XDR data structure. - -Opening and closing of XDR files -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Two low-level functions are used to obtain a *XDRFILE* object (a file handle) -to access xdr files such as XTC or TRR trajectories. - -.. function:: xdrfile_open(path, mode) -> XDRFILE - - Open *path* and returns a *XDRFILE* handle that is required by other - functions. - - :Arguments: - *path* - file name - *mode* - 'r' for reading and 'w' for writing - :Returns: *XDRFILE* handle - -.. function:: xdrfile_close(XDRFILE) -> status - - Close the xdrfile pointed to by *XDRFILE*. - - .. Warning:: Closing an already closed file will lead to a - crash with a double-free pointer error. - -XTC functions -~~~~~~~~~~~~~ - -The XTC trajectory format is a lossy compression format that only stores -coordinates. Compression level is determined by the *precision* argument to the -:func:`write_xtc` function. Coordinates (Gromacs_ uses nm natively) are -multiplied by *precision* and truncated to the integer part. A typical value is -1000.0, which gives an accuracy of 1/100 of an Angstroem. - -The advantage of XTC over TRR is its significantly reduced size. - - -.. function:: read_xtc_natoms(fn) -> natoms - - Read the number of atoms *natoms* from a xtc file *fn*. - - :Arguments: - *fn* - file name of an xtc file - - :Raises: :exc:`IOError` if the supplied filed is not a XTC - or if it is not readable. - -.. function:: read_xtc_numframes(fn) -> (numframes, offsets) - - Read through the whole trajectory headers to obtain the total number of frames. - The process is speeded up by reading frame headers for the amount of data in the frame, - and then skipping directly to the next header. An array of frame offsets is also - returned, which can later be used to seek direcly to arbitrary frames in the trajectory. - - :Arguments: - *fn* - file name of an xtc file - - :Returns: - a tuple containing: - *numframes* - an int with the total frame count in the trajectory - *offsets* - a numpy array of int64 recording the starting byte offset of each frame - - :Raises: :exc:`IOError` if the supplied filed is not a XTC - or if it is not readable. - -.. function:: read_xtc(XDRFILE, box, x) -> (status, step, time, precision) - - Read the next frame from the opened xtc trajectory into *x*. - - :Arguments: - *XDRFILE* - open *XDRFILE* object - *box* - pre-allocated numpy ``array((DIM,DIM),dtype=numpy.float32)`` which - is filled with the unit cell box vectors - *x* - pre-allocated numpy ``array((natoms, DIM),dtype=numpy.float32)`` - which is updated with the coordinates from the frame - - :Returns: - a tuple containing: - *status* - integer status (0 = exdrOK), see `Status symbols`_ for other - values) - *step* - simulation step - *time* - simulation time in ps - *precision* - precision of the lossy xtc format (typically 1000.0) - -.. function:: write_xtc(XDRFILE, step, time, box, x, prec) -> status - - Write the next frame *x* to the opened xtc trajectory. - - :Arguments: - *XDRFILE* - open *XDRFILE* object (writable) - *step* - simulation step - *time* - time step in ps - *box* - numpy ``array((DIM,DIM),dtype=numpy.float32)`` which contains - the unit cell box vectors - *x* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the coordinates from the frame - *precision* - precision of the lossy xtc format (typically 1000.0) - - :Returns: *status*, integer status (0 = OK), see the ``libxdrfile2.exdr*`` - constants under `Status symbols`_ for other values) - -TRR functions -~~~~~~~~~~~~~ - -TRR is the Gromacs_ native full-feature trajectory storage format. It can contain position -coordinates, velocities and forces, and the lambda value for free energy perturbation -calculations. Velocities and forces are optional in the sense that they can be all zero. - -.. function:: read_trr_natoms(fn) -> natoms - - Read the number of atoms *natoms* from a trr file *fn*. - - :Arguments: - *fn* - file name of a trr file - - :Raises: :exc:`IOError` if the supplied filed is not a TRR - or if it is not readable. - -.. function:: read_trr_numframes(fn) -> (numframes, offsets) - - Read through the whole trajectory headers to obtain the total number of frames. - The process is speeded up by reading frame headers for the amount of data in the frame, - and then skipping directly to the next header. An array of frame offsets is also - returned, which can later be used to seek direcly to arbitrary frames in the trajectory. - - :Arguments: - *fn* - file name of an xtc file - - :Returns: - a tuple containing: - *numframes* - an int with the total frame count in the trajectory - *offsets* - a numpy array of int64 recording the starting byte offset of each frame - - :Raises: :exc:`IOError` if the supplied filed is not a TRR or if it is not readable. - -.. function:: read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda) - - Read the next frame from the opened trr trajectory into *x*, *v*, and *f*. - - :Arguments: - *XDRFILE* - open *XDRFILE* object - *box* - pre-allocated numpy ``array((DIM,DIM),dtype=numpy.float32)`` which - is filled with the unit cell box vectors - *x* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **coordinates** from the frame - *v* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **velocities** from the frame - *f* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **forces** from the frame - - :Returns: - a tuple containing: - *status* - integer status (0 = exdrOK), see the ``libxdrfile2.exdr*`` constants - under `Status symbols`_ for other values) - *step* - simulation step - *time* - simulation time in ps - *lambda* - current lambda value (only interesting for free energy perturbation) - *has_x* - boolean indicating whether coordinates were read from the TRR - *has_v* - boolean indicating whether velocities were read from the TRR - *has_f* - boolean indicating whether forces were read from the TRR - -.. function:: write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status - - Write the next frame to the opened trr trajectory. - - :Arguments: - *XDRFILE* - open *XDRFILE* object (writable) - *step* - simulation step - *time* - time step in ps - *lambda* - free energy lambda value (typically 0.0) - *box* - numpy ``array((DIM,DIM),dtype=numpy.float32)`` which contains - the unit cell box vectors - *x* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **coordinates** from the frame - *v* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **velocities** from the frame - *f* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **forces** from the frame - - .. versionchanged:: 0.8.0 - either one of *x*, *v*, or *f* can now be set as a natom,0-DIM - numpy ``array((natom, 0),dtype=nump.float32)``. This will cause the - corresponding property to be skipped when writing to file. - - :Returns: *status*, integer status (0 = OK), see the ``libxdrfile2.exdr*`` - constants under `Status symbols`_ for other values) - -" -%enddef - -%module(docstring=DOCSTRING) libvmdmolfile - - -%{ -/* Python SWIG interface to molfile_plugin of VMD version 1.9.3 - Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> - Published under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 (or higher) - */ -#define SWIG_FILE_WITH_INIT -#include <stdio.h> -#include "molfile_plugin.h" -%} - -%include "numpy.i" - -%init %{ -import_array(); -%} - - -/* - - I am only wrapping 'high level' functions and modify call - signatures so that one does not need anything like pointers from - python. -*/ - - -/* status codes */ -enum { exdrOK, exdrHEADER, exdrSTRING, exdrDOUBLE, - exdrINT, exdrFLOAT, exdrUINT, exdr3DX, exdrCLOSE, exdrMAGIC, - exdrNOMEM, exdrENDOFFILE, exdrFILENOTFOUND, exdrNR }; - -/* These com from stdio.h, for file seeking. Gives all the flexibility to _fseek(). */ -enum { SEEK_SET, SEEK_CUR, SEEK_END }; - -/* open/close xdr files */ -%feature("autodoc", "0") xdrfile_open; -extern XDRFILE* xdrfile_open(const char *path, const char *mode); - -%feature("autodoc", "0") xdrfile_close; -extern int xdrfile_close(XDRFILE *fp); - - -/* from xdrfile_xtc.c */ -/* This function returns the number of atoms in the xtc file in *natoms - extern int read_xtc_natoms(char *fn,int *natoms); - ... but the wrapped function returns natoms as the python return value -*/ -%feature("autodoc", "0") my_read_xtc_natoms; -%rename (read_xtc_natoms) my_read_xtc_natoms; -%exception my_read_xtc_natoms { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ - int my_read_xtc_natoms(char *fn) { - int natoms; - int status; - status = read_xtc_natoms(fn, &natoms); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading natoms from xtc '%s'", status, fn); - return 0; - } - return natoms; - } -%} - -%feature("autodoc", "0") my_read_xtc_numframes; -%rename (read_xtc_numframes) my_read_xtc_numframes; -%exception my_read_xtc_numframes { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ -PyObject * my_read_xtc_numframes(char *fn) { - int numframes, status; - int64_t *offsets[1]; - PyObject *npoffsets = NULL; - status = read_xtc_numframes(fn, &numframes, offsets); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading numframes by seeking through xtc '%s'", status, fn); - return 0; - } - npy_intp nfrms[1] = { numframes }; - npoffsets = PyArray_SimpleNewFromData(1, nfrms, NPY_INT64, *offsets); - if (npoffsets==NULL) - { - free(*offsets); - Py_XDECREF(npoffsets); - PyErr_Format(PyExc_IOError, "Error copying frame index into Python."); - return 0; - } - /* From http://web.archive.org/web/20130304224839/http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ */ - PyArray_BASE(npoffsets) = PyCObject_FromVoidPtr(*offsets, free); - PyObject *tuple = PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)numframes)); - PyTuple_SET_ITEM(tuple, 1, npoffsets); - return tuple; - } -%} - - -/* This function returns the number of atoms in the trr file in *natoms - extern int read_trr_natoms(char *fn,int *natoms); - ... but the wrapped function returns natoms as the python return value -*/ -%feature("autodoc", "0") my_read_trr_natoms; -%rename (read_trr_natoms) my_read_trr_natoms; -%exception my_read_trr_natoms { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ - int my_read_trr_natoms(char *fn) { - int natoms; - int status; - status = read_trr_natoms(fn, &natoms); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading natoms from trr '%s'", status, fn); - return 0; - } - return natoms; - } -%} - - -%feature("autodoc", "0") my_read_trr_numframes; -%rename (read_trr_numframes) my_read_trr_numframes; -%exception my_read_trr_numframes { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ -PyObject * my_read_trr_numframes(char *fn) { - int numframes, status; - int64_t *offsets[1]; - PyObject *npoffsets = NULL; - status = read_trr_numframes(fn, &numframes, offsets); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading numframes by seeking through trr '%s'", status, fn); - return 0; - } - npy_intp nfrms[1] = { numframes }; - npoffsets = PyArray_SimpleNewFromData(1, nfrms, NPY_INT64, *offsets); - if (npoffsets==NULL) - { - free(*offsets); - Py_XDECREF(npoffsets); - PyErr_Format(PyExc_IOError, "Error copying frame index into Python."); - return 0; - } - /* From http://web.archive.org/web/20130304224839/http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ */ - PyArray_BASE(npoffsets) = PyCObject_FromVoidPtr(*offsets, free); - PyObject *tuple = PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)numframes)); - PyTuple_SET_ITEM(tuple, 1, npoffsets); - return tuple; - } -%} - - - -#define DIM 3 -typedef float matrix[DIM][DIM]; -typedef float rvec[DIM]; - - -/* Reading from xdr files */ - -%apply (float INPLACE_ARRAY2[ANY][ANY]) {(matrix box)} -%apply (int DIM1, int DIM2, float* INPLACE_ARRAY2) {(int natoms, int _DIM, float *x), - (int vnatoms, int v_DIM, float *v), - (int fnatoms, int f_DIM, float *f)} - -/* Read one frame of an open xtc file */ -/* -extern int read_xtc(XDRFILE *xd,int natoms,int *step,float *time, - matrix box,rvec *x,float *prec); -*/ -%feature("autodoc", "read_xtc(XDRFILE, box, x) -> (status, step, time, precision)") my_read_xtc; -%rename (read_xtc) my_read_xtc; -%inline %{ -PyObject * my_read_xtc(XDRFILE *xd, matrix box, int natoms, int _DIM, float *x) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - int status, step; - float time, prec; - PyObject *tuple = PyTuple_New(4); - status = read_xtc(xd, natoms, &step, &time, box, (rvec *)x, &prec); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)status)); - PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)step)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble((double)time)); - PyTuple_SET_ITEM(tuple, 3, PyFloat_FromDouble((double)prec)); - return tuple; // return (status, step, time, prec) -} -%} - -%feature("autodoc", "read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda)") my_read_trr; -%rename (read_trr) my_read_trr; -%inline %{ -PyObject * my_read_trr(XDRFILE *xd, matrix box, - int natoms, int _DIM, float *x, - int vnatoms, int v_DIM, float *v, - int fnatoms, int f_DIM, float *f) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - int status, step, has_prop=0; - float time, lmbda; - PyObject *tuple = PyTuple_New(7); - status = read_trr(xd, natoms, &step, &time, &lmbda, box, (rvec *)x, (rvec *)v, (rvec *)f, &has_prop); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)status)); - PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)step)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble((double)time)); - PyTuple_SET_ITEM(tuple, 3, PyFloat_FromDouble((double)lmbda)); - PyTuple_SET_ITEM(tuple, 4, PyBool_FromLong((long)(has_prop & HASX))); - PyTuple_SET_ITEM(tuple, 5, PyBool_FromLong((long)(has_prop & HASV))); - PyTuple_SET_ITEM(tuple, 6, PyBool_FromLong((long)(has_prop & HASF))); - return tuple; // return (status, step, time, lmbda, has_x, has_v, has_f) -} -%} - -%clear (matrix box); -%clear (int natoms, int _DIM, float *x); -%clear (int vnatoms, int v_DIM, float *v); -%clear (int fnatoms, int f_DIM, float *f); - - -/* Writing of xdr files */ - -%apply (float IN_ARRAY2[ANY][ANY]) {(matrix box)} -%apply (int DIM1, int DIM2, float* IN_ARRAY2) {(int natoms, int _DIM, float *x), - (int vnatoms, int v_DIM, float *v), - (int fnatoms, int f_DIM, float *f)} - -/* Write a frame to xtc file */ -/* -extern int write_xtc(XDRFILE *xd, int natoms,int step,float time, - matrix box,rvec *x,float prec); -*/ -%feature("autodoc", "write_xtc(XDRFILE, step, time, box, x, prec) -> status") my_write_xtc; -%rename (write_xtc) my_write_xtc; -%inline %{ -int my_write_xtc(XDRFILE *xd, int step, float time, - matrix box, int natoms, int _DIM, float *x, float prec) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - return write_xtc(xd, natoms, step, time, box, (rvec *)x, prec); -} -%} - -%feature("autodoc", "write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status") my_write_trr; -%rename (write_trr) my_write_trr; -%inline %{ -int my_write_trr(XDRFILE *xd, int step, float time, float lmbda, matrix box, - int natoms, int _DIM, float *x, - int vnatoms, int v_DIM, float *v, - int fnatoms, int f_DIM, float *f) { - /* Preparing for the case of empty arrays - NULL pointers tell the library to skip this property. */ - if (_DIM == 0) x = NULL; - if (v_DIM == 0) v = NULL; - if (f_DIM == 0) f = NULL; - return write_trr(xd, natoms, step, time, lmbda, box, (rvec *)x, (rvec *)v, (rvec *)f); -} -%} - -%feature("autodoc", "0") xdr_seek; -extern int xdr_seek(XDRFILE *xd, long long pos, int whence); - -%feature("autodoc", "0") xdr_tell; -extern long long xdr_tell(XDRFILE *xd); - -%clear (matrix box); -%clear (int natoms, int _DIM, float *x); -%clear (int vnatoms, int v_DIM, float *v); -%clear (int fnatoms, int f_DIM, float *f); - - diff --git a/pymolfile/libpymolfile-old/libvmdmolfile.py b/pymolfile/libpymolfile-old/libvmdmolfile.py deleted file mode 100644 index 87a2c6692427936a46427739df076f2582fc4fef..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/libvmdmolfile.py +++ /dev/null @@ -1,487 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 2.0.11 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - - - - -""" - -:Author: Oliver Beckstein <orbeckst@gmail.com> -:Author: Manuel Melo <manuel.nuno.melo@gmail.com> -:Year: 2014 -:Licence: GNU GENERAL PUBLIC LICENSE Version 2 (or higher) - - -The Gromacs XTC/TRR library :mod:`libxdrfile2` -============================================== - -:mod:`libxdrfile2`, a derivative of the Gromacs_ `libxdrfile library`_, provides an -interface to some high-level functions for XTC/TRR trajectory handling. -Only functions required for reading and processing whole trajectories are exposed at -the moment; low-level routines to read individual numbers are not provided. In -addition, :mod:`libxdrfile2` exposes functions to allow fast frame indexing and XDR -file seeking. - -The functions querying the numbers of atoms in a trajectory frame -(:func:`read_xtc_natoms` and :func:`read_trr_natoms`) open a file themselves and -only require the file name. - -All other functions operate on a *XDRFILE* object, which is a special file -handle for xdr files. Any xdr-based trajectory file (XTC or TRR format) always -has to be opened with :func:`xdrfile_open`. When done, close the trajectory -with :func:`xdrfile_close`. - -The functions fill or read existing arrays of coordinates; they never allocate -these arrays themselves. Hence they need to be setup outside libxdrfile2 as -numpy arrays. The exception to these are the indexing ones functions that take -care of array allocation and transference to a garbage-collectable memory object. - - -.. _Gromacs: http://www.gromacs.org -.. _libxdrfile library: http://www.gromacs.org/Developer_Zone/Programming_Guide/XTC_Library - -.. versionchanged:: 0.8.0 - :mod:`libxdrfile2` is now used instead of :mod:`libxdrfile`. :mod:`libxdrfile2` is - based on :mod:`libxdrfile` but has xdr seeking and indexing capabilities. - Unlike :mod:`libxdrfile` before it, :mod:`libxdrfile2` is distributed under the GNU - GENERAL PUBLIC LICENSE, version 2 (or higher). - - -Example: Reading from a XTC ---------------------------- - -In the example we read coordinate frames from an existing XTC trajectory:: - - import numpy as np - from libxdrfile2 import xdrfile_open, xdrfile_close, read_xtc_natoms, read_xtc, DIM, exdrOK - xtc = 'md.xtc' - - # get number of atoms - natoms = read_xtc_natoms(xtc) - - # allocate coordinate array of the right size and type - # (the type float32 is crucial to match the underlying C-code!!) - x = np.zeros((natoms, DIM), dtype=np.float32) - # allocate unit cell box - box = np.zeros((DIM, DIM), dtype=np.float32) - - # open file - XTC = xdrfile_open(xtc, 'r') - - # loop through file until return status signifies end or a problem - # (it should become exdrENDOFFILE on the last iteration) - status = exdrOK - while status == exdrOK: - status,step,time,prec = read_xtc(XTC, box, x) - # do something with x - centre = x.mean(axis=0) - print 'Centre of geometry at %(time)g ps: %(centre)r' % vars() - - # finally close file - xdrfile_close(XTC) - -Note that only the *contents* of the coordinate and unitcell arrays *x* and -*box* change. - - -Functions and constants ------------------------ - -The module defines a number of constants such as :data:`DIM` or the -`Status symbols`_. - -.. data:: DIM - - The number of cartesian dimensions for which the underlying C-code - was compiled; this is most certainly 3. - - -Status symbols -~~~~~~~~~~~~~~ - -A number of symbols are exported; they all start with the letters -``exdr``. Important ones are listed here: - -.. data:: exdrOK - - Success of xdr file read/write operation. - -.. data:: exdrCLOSE - - xdr file is closed - -.. data:: exdrENDOFFILE - - end of file was reached (response of :func:`read_xtc` and - :func:`read_trr` after the last read frame) - -.. data:: exdrFILENOTFOUND - - :func:`xdrfile_open` cannot find the requested file - - -Opening and closing of XDR files -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Two low-level functions are used to obtain a *XDRFILE* object (a file handle) -to access xdr files such as XTC or TRR trajectories. - -.. function:: xdrfile_open(path, mode) -> XDRFILE - - Open *path* and returns a *XDRFILE* handle that is required by other - functions. - - :Arguments: - *path* - file name - *mode* - 'r' for reading and 'w' for writing - :Returns: *XDRFILE* handle - -.. function:: xdrfile_close(XDRFILE) -> status - - Close the xdrfile pointed to by *XDRFILE*. - - .. Warning:: Closing an already closed file will lead to a - crash with a double-free pointer error. - -XTC functions -~~~~~~~~~~~~~ - -The XTC trajectory format is a lossy compression format that only stores -coordinates. Compression level is determined by the *precision* argument to the -:func:`write_xtc` function. Coordinates (Gromacs_ uses nm natively) are -multiplied by *precision* and truncated to the integer part. A typical value is -1000.0, which gives an accuracy of 1/100 of an Angstroem. - -The advantage of XTC over TRR is its significantly reduced size. - - -.. function:: read_xtc_natoms(fn) -> natoms - - Read the number of atoms *natoms* from a xtc file *fn*. - - :Arguments: - *fn* - file name of an xtc file - - :Raises: :exc:`IOError` if the supplied filed is not a XTC - or if it is not readable. - -.. function:: read_xtc_numframes(fn) -> (numframes, offsets) - - Read through the whole trajectory headers to obtain the total number of frames. - The process is speeded up by reading frame headers for the amount of data in the frame, - and then skipping directly to the next header. An array of frame offsets is also - returned, which can later be used to seek direcly to arbitrary frames in the trajectory. - - :Arguments: - *fn* - file name of an xtc file - - :Returns: - a tuple containing: - *numframes* - an int with the total frame count in the trajectory - *offsets* - a numpy array of int64 recording the starting byte offset of each frame - - :Raises: :exc:`IOError` if the supplied filed is not a XTC - or if it is not readable. - -.. function:: read_xtc(XDRFILE, box, x) -> (status, step, time, precision) - - Read the next frame from the opened xtc trajectory into *x*. - - :Arguments: - *XDRFILE* - open *XDRFILE* object - *box* - pre-allocated numpy ``array((DIM,DIM),dtype=numpy.float32)`` which - is filled with the unit cell box vectors - *x* - pre-allocated numpy ``array((natoms, DIM),dtype=numpy.float32)`` - which is updated with the coordinates from the frame - - :Returns: - a tuple containing: - *status* - integer status (0 = exdrOK), see `Status symbols`_ for other - values) - *step* - simulation step - *time* - simulation time in ps - *precision* - precision of the lossy xtc format (typically 1000.0) - -.. function:: write_xtc(XDRFILE, step, time, box, x, prec) -> status - - Write the next frame *x* to the opened xtc trajectory. - - :Arguments: - *XDRFILE* - open *XDRFILE* object (writable) - *step* - simulation step - *time* - time step in ps - *box* - numpy ``array((DIM,DIM),dtype=numpy.float32)`` which contains - the unit cell box vectors - *x* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the coordinates from the frame - *precision* - precision of the lossy xtc format (typically 1000.0) - - :Returns: *status*, integer status (0 = OK), see the ``libxdrfile2.exdr*`` - constants under `Status symbols`_ for other values) - -TRR functions -~~~~~~~~~~~~~ - -TRR is the Gromacs_ native full-feature trajectory storage format. It can contain position -coordinates, velocities and forces, and the lambda value for free energy perturbation -calculations. Velocities and forces are optional in the sense that they can be all zero. - -.. function:: read_trr_natoms(fn) -> natoms - - Read the number of atoms *natoms* from a trr file *fn*. - - :Arguments: - *fn* - file name of a trr file - - :Raises: :exc:`IOError` if the supplied filed is not a TRR - or if it is not readable. - -.. function:: read_trr_numframes(fn) -> (numframes, offsets) - - Read through the whole trajectory headers to obtain the total number of frames. - The process is speeded up by reading frame headers for the amount of data in the frame, - and then skipping directly to the next header. An array of frame offsets is also - returned, which can later be used to seek direcly to arbitrary frames in the trajectory. - - :Arguments: - *fn* - file name of an xtc file - - :Returns: - a tuple containing: - *numframes* - an int with the total frame count in the trajectory - *offsets* - a numpy array of int64 recording the starting byte offset of each frame - - :Raises: :exc:`IOError` if the supplied filed is not a TRR or if it is not readable. - -.. function:: read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda) - - Read the next frame from the opened trr trajectory into *x*, *v*, and *f*. - - :Arguments: - *XDRFILE* - open *XDRFILE* object - *box* - pre-allocated numpy ``array((DIM,DIM),dtype=numpy.float32)`` which - is filled with the unit cell box vectors - *x* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **coordinates** from the frame - *v* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **velocities** from the frame - *f* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **forces** from the frame - - :Returns: - a tuple containing: - *status* - integer status (0 = exdrOK), see the ``libxdrfile2.exdr*`` constants - under `Status symbols`_ for other values) - *step* - simulation step - *time* - simulation time in ps - *lambda* - current lambda value (only interesting for free energy perturbation) - *has_x* - boolean indicating whether coordinates were read from the TRR - *has_v* - boolean indicating whether velocities were read from the TRR - *has_f* - boolean indicating whether forces were read from the TRR - -.. function:: write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status - - Write the next frame to the opened trr trajectory. - - :Arguments: - *XDRFILE* - open *XDRFILE* object (writable) - *step* - simulation step - *time* - time step in ps - *lambda* - free energy lambda value (typically 0.0) - *box* - numpy ``array((DIM,DIM),dtype=numpy.float32)`` which contains - the unit cell box vectors - *x* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **coordinates** from the frame - *v* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **velocities** from the frame - *f* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **forces** from the frame - - .. versionchanged:: 0.8.0 - either one of *x*, *v*, or *f* can now be set as a natom,0-DIM - numpy ``array((natom, 0),dtype=nump.float32)``. This will cause the - corresponding property to be skipped when writing to file. - - :Returns: *status*, integer status (0 = OK), see the ``libxdrfile2.exdr*`` - constants under `Status symbols`_ for other values) - - -""" - - -from sys import version_info -if version_info >= (2,6,0): - def swig_import_helper(): - from os.path import dirname - import imp - fp = None - try: - fp, pathname, description = imp.find_module('_libxdrfile2', [dirname(__file__)]) - except ImportError: - import _libxdrfile2 - return _libxdrfile2 - if fp is not None: - try: - _mod = imp.load_module('_libxdrfile2', fp, pathname, description) - finally: - fp.close() - return _mod - _libxdrfile2 = swig_import_helper() - del swig_import_helper -else: - import _libxdrfile2 -del version_info -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. -def _swig_setattr_nondynamic(self,class_type,name,value,static=1): - if (name == "thisown"): return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name,None) - if method: return method(self,value) - if (not static): - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - -def _swig_setattr(self,class_type,name,value): - return _swig_setattr_nondynamic(self,class_type,name,value,0) - -def _swig_getattr(self,class_type,name): - if (name == "thisown"): return self.this.own() - method = class_type.__swig_getmethods__.get(name,None) - if method: return method(self) - raise AttributeError(name) - -def _swig_repr(self): - try: strthis = "proxy of " + self.this.__repr__() - except: strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -try: - _object = object - _newclass = 1 -except AttributeError: - class _object : pass - _newclass = 0 - - -exdrOK = _libxdrfile2.exdrOK -exdrHEADER = _libxdrfile2.exdrHEADER -exdrSTRING = _libxdrfile2.exdrSTRING -exdrDOUBLE = _libxdrfile2.exdrDOUBLE -exdrINT = _libxdrfile2.exdrINT -exdrFLOAT = _libxdrfile2.exdrFLOAT -exdrUINT = _libxdrfile2.exdrUINT -exdr3DX = _libxdrfile2.exdr3DX -exdrCLOSE = _libxdrfile2.exdrCLOSE -exdrMAGIC = _libxdrfile2.exdrMAGIC -exdrNOMEM = _libxdrfile2.exdrNOMEM -exdrENDOFFILE = _libxdrfile2.exdrENDOFFILE -exdrFILENOTFOUND = _libxdrfile2.exdrFILENOTFOUND -exdrNR = _libxdrfile2.exdrNR -SEEK_SET = _libxdrfile2.SEEK_SET -SEEK_CUR = _libxdrfile2.SEEK_CUR -SEEK_END = _libxdrfile2.SEEK_END - -def xdrfile_open(*args): - """xdrfile_open(path, mode) -> XDRFILE *""" - return _libxdrfile2.xdrfile_open(*args) - -def xdrfile_close(*args): - """xdrfile_close(fp) -> int""" - return _libxdrfile2.xdrfile_close(*args) - -def read_xtc_natoms(*args): - """read_xtc_natoms(fn) -> int""" - return _libxdrfile2.read_xtc_natoms(*args) - -def read_xtc_numframes(*args): - """read_xtc_numframes(fn) -> PyObject *""" - return _libxdrfile2.read_xtc_numframes(*args) - -def read_trr_natoms(*args): - """read_trr_natoms(fn) -> int""" - return _libxdrfile2.read_trr_natoms(*args) - -def read_trr_numframes(*args): - """read_trr_numframes(fn) -> PyObject *""" - return _libxdrfile2.read_trr_numframes(*args) -DIM = _libxdrfile2.DIM - -def read_xtc(*args): - """read_xtc(XDRFILE, box, x) -> (status, step, time, precision)""" - return _libxdrfile2.read_xtc(*args) - -def read_trr(*args): - """read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda)""" - return _libxdrfile2.read_trr(*args) - -def write_xtc(*args): - """write_xtc(XDRFILE, step, time, box, x, prec) -> status""" - return _libxdrfile2.write_xtc(*args) - -def write_trr(*args): - """write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status""" - return _libxdrfile2.write_trr(*args) - -def xdr_seek(*args): - """xdr_seek(xd, pos, whence) -> int""" - return _libxdrfile2.xdr_seek(*args) - -def xdr_tell(*args): - """xdr_tell(xd) -> long long""" - return _libxdrfile2.xdr_tell(*args) -# This file is compatible with both classic and new-style classes. - - diff --git a/pymolfile/libpymolfile-old/numpy.i b/pymolfile/libpymolfile-old/numpy.i deleted file mode 100644 index ec649b942fac2682d78bf8a99edcccbb698c7d17..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/numpy.i +++ /dev/null @@ -1,1638 +0,0 @@ -/* -*- C -*- (not really, but good for syntax highlighting) */ -#ifdef SWIGPYTHON - -%{ -#ifndef SWIG_FILE_WITH_INIT -# define NO_IMPORT_ARRAY -#endif -#include "stdio.h" -#include <numpy/arrayobject.h> -%} - -/**********************************************************************/ - -%fragment("NumPy_Backward_Compatibility", "header") -{ -/* Support older NumPy data type names -*/ -%#if NDARRAY_VERSION < 0x01000000 -%#define NPY_BOOL PyArray_BOOL -%#define NPY_BYTE PyArray_BYTE -%#define NPY_UBYTE PyArray_UBYTE -%#define NPY_SHORT PyArray_SHORT -%#define NPY_USHORT PyArray_USHORT -%#define NPY_INT PyArray_INT -%#define NPY_UINT PyArray_UINT -%#define NPY_LONG PyArray_LONG -%#define NPY_ULONG PyArray_ULONG -%#define NPY_LONGLONG PyArray_LONGLONG -%#define NPY_ULONGLONG PyArray_ULONGLONG -%#define NPY_FLOAT PyArray_FLOAT -%#define NPY_DOUBLE PyArray_DOUBLE -%#define NPY_LONGDOUBLE PyArray_LONGDOUBLE -%#define NPY_CFLOAT PyArray_CFLOAT -%#define NPY_CDOUBLE PyArray_CDOUBLE -%#define NPY_CLONGDOUBLE PyArray_CLONGDOUBLE -%#define NPY_OBJECT PyArray_OBJECT -%#define NPY_STRING PyArray_STRING -%#define NPY_UNICODE PyArray_UNICODE -%#define NPY_VOID PyArray_VOID -%#define NPY_NTYPES PyArray_NTYPES -%#define NPY_NOTYPE PyArray_NOTYPE -%#define NPY_CHAR PyArray_CHAR -%#define NPY_USERDEF PyArray_USERDEF -%#define npy_intp intp - -%#define NPY_MAX_BYTE MAX_BYTE -%#define NPY_MIN_BYTE MIN_BYTE -%#define NPY_MAX_UBYTE MAX_UBYTE -%#define NPY_MAX_SHORT MAX_SHORT -%#define NPY_MIN_SHORT MIN_SHORT -%#define NPY_MAX_USHORT MAX_USHORT -%#define NPY_MAX_INT MAX_INT -%#define NPY_MIN_INT MIN_INT -%#define NPY_MAX_UINT MAX_UINT -%#define NPY_MAX_LONG MAX_LONG -%#define NPY_MIN_LONG MIN_LONG -%#define NPY_MAX_ULONG MAX_ULONG -%#define NPY_MAX_LONGLONG MAX_LONGLONG -%#define NPY_MIN_LONGLONG MIN_LONGLONG -%#define NPY_MAX_ULONGLONG MAX_ULONGLONG -%#define NPY_MAX_INTP MAX_INTP -%#define NPY_MIN_INTP MIN_INTP - -%#define NPY_FARRAY FARRAY -%#define NPY_F_CONTIGUOUS F_CONTIGUOUS -%#endif -} - -/**********************************************************************/ - -/* The following code originally appeared in - * enthought/kiva/agg/src/numeric.i written by Eric Jones. It was - * translated from C++ to C by John Hunter. Bill Spotz has modified - * it to fix some minor bugs, upgrade from Numeric to numpy (all - * versions), add some comments and functionality, and convert from - * direct code insertion to SWIG fragments. - */ - -%fragment("NumPy_Macros", "header") -{ -/* Macros to extract array attributes. - */ -%#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) -%#define array_type(a) (int)(PyArray_TYPE(a)) -%#define array_numdims(a) (((PyArrayObject *)a)->nd) -%#define array_dimensions(a) (((PyArrayObject *)a)->dimensions) -%#define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) -%#define array_data(a) (((PyArrayObject *)a)->data) -%#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a)) -%#define array_is_native(a) (PyArray_ISNOTSWAPPED(a)) -%#define array_is_fortran(a) (PyArray_ISFORTRAN(a)) -} - -/**********************************************************************/ - -%fragment("NumPy_Utilities", "header") -{ - /* Given a PyObject, return a string describing its type. - */ - const char* pytype_string(PyObject* py_obj) { - if (py_obj == NULL ) return "C NULL value"; - if (py_obj == Py_None ) return "Python None" ; - if (PyCallable_Check(py_obj)) return "callable" ; - if (PyString_Check( py_obj)) return "string" ; - if (PyInt_Check( py_obj)) return "int" ; - if (PyFloat_Check( py_obj)) return "float" ; - if (PyDict_Check( py_obj)) return "dict" ; - if (PyList_Check( py_obj)) return "list" ; - if (PyTuple_Check( py_obj)) return "tuple" ; - #if PY_MAJOR_VERSION < 3 - if (PyFile_Check( py_obj)) return "file" ; - #endif - if (PyModule_Check( py_obj)) return "module" ; - #if PY_MAJOR_VERSION < 3 - if (PyInstance_Check(py_obj)) return "instance" ; - #endif - - return "unkown type"; - } - - /* Given a NumPy typecode, return a string describing the type. - */ - const char* typecode_string(int typecode) { - static const char* type_names[25] = {"bool", "byte", "unsigned byte", - "short", "unsigned short", "int", - "unsigned int", "long", "unsigned long", - "long long", "unsigned long long", - "float", "double", "long double", - "complex float", "complex double", - "complex long double", "object", - "string", "unicode", "void", "ntypes", - "notype", "char", "unknown"}; - return typecode < 24 ? type_names[typecode] : type_names[24]; - } - - /* Make sure input has correct numpy type. Allow character and byte - * to match. Also allow int and long to match. This is deprecated. - * You should use PyArray_EquivTypenums() instead. - */ - int type_match(int actual_type, int desired_type) { - return PyArray_EquivTypenums(actual_type, desired_type); - } -} - -/**********************************************************************/ - -%fragment("NumPy_Object_to_Array", "header", - fragment="NumPy_Backward_Compatibility", - fragment="NumPy_Macros", - fragment="NumPy_Utilities") -{ - /* Given a PyObject pointer, cast it to a PyArrayObject pointer if - * legal. If not, set the python error string appropriately and - * return NULL. - */ - PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) - { - PyArrayObject* ary = NULL; - if (is_array(input) && (typecode == NPY_NOTYPE || - PyArray_EquivTypenums(array_type(input), typecode))) - { - ary = (PyArrayObject*) input; - } - else if is_array(input) - { - const char* desired_type = typecode_string(typecode); - const char* actual_type = typecode_string(array_type(input)); - PyErr_Format(PyExc_TypeError, - "Array of type '%s' required. Array of type '%s' given", - desired_type, actual_type); - ary = NULL; - } - else - { - const char * desired_type = typecode_string(typecode); - const char * actual_type = pytype_string(input); - PyErr_Format(PyExc_TypeError, - "Array of type '%s' required. A '%s' was given", - desired_type, actual_type); - ary = NULL; - } - return ary; - } - - /* Convert the given PyObject to a NumPy array with the given - * typecode. On success, return a valid PyArrayObject* with the - * correct type. On failure, the python error string will be set and - * the routine returns NULL. - */ - PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, - int* is_new_object) - { - PyArrayObject* ary = NULL; - PyObject* py_obj; - if (is_array(input) && (typecode == NPY_NOTYPE || - PyArray_EquivTypenums(array_type(input),typecode))) - { - ary = (PyArrayObject*) input; - *is_new_object = 0; - } - else - { - py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_DEFAULT); - /* If NULL, PyArray_FromObject will have set python error value.*/ - ary = (PyArrayObject*) py_obj; - *is_new_object = 1; - } - return ary; - } - - /* Given a PyArrayObject, check to see if it is contiguous. If so, - * return the input pointer and flag it as not a new object. If it is - * not contiguous, create a new PyArrayObject using the original data, - * flag it as a new object and return the pointer. - */ - PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object, - int min_dims, int max_dims) - { - PyArrayObject* result; - if (array_is_contiguous(ary)) - { - result = ary; - *is_new_object = 0; - } - else - { - result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary, - array_type(ary), - min_dims, - max_dims); - *is_new_object = 1; - } - return result; - } - - /* Given a PyArrayObject, check to see if it is Fortran-contiguous. - * If so, return the input pointer, but do not flag it as not a new - * object. If it is not Fortran-contiguous, create a new - * PyArrayObject using the original data, flag it as a new object - * and return the pointer. - */ - PyArrayObject* make_fortran(PyArrayObject* ary, int* is_new_object, - int min_dims, int max_dims) - { - PyArrayObject* result; - if (array_is_fortran(ary)) - { - result = ary; - *is_new_object = 0; - } - else - { - Py_INCREF(ary->descr); - result = (PyArrayObject*) PyArray_FromArray(ary, ary->descr, NPY_FORTRAN); - *is_new_object = 1; - } - return result; - } - - /* Convert a given PyObject to a contiguous PyArrayObject of the - * specified type. If the input object is not a contiguous - * PyArrayObject, a new one will be created and the new object flag - * will be set. - */ - PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, - int typecode, - int* is_new_object) - { - int is_new1 = 0; - int is_new2 = 0; - PyArrayObject* ary2; - PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, - &is_new1); - if (ary1) - { - ary2 = make_contiguous(ary1, &is_new2, 0, 0); - if ( is_new1 && is_new2) - { - Py_DECREF(ary1); - } - ary1 = ary2; - } - *is_new_object = is_new1 || is_new2; - return ary1; - } - - /* Convert a given PyObject to a Fortran-ordered PyArrayObject of the - * specified type. If the input object is not a Fortran-ordered - * PyArrayObject, a new one will be created and the new object flag - * will be set. - */ - PyArrayObject* obj_to_array_fortran_allow_conversion(PyObject* input, - int typecode, - int* is_new_object) - { - int is_new1 = 0; - int is_new2 = 0; - PyArrayObject* ary2; - PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, - &is_new1); - if (ary1) - { - ary2 = make_fortran(ary1, &is_new2, 0, 0); - if (is_new1 && is_new2) - { - Py_DECREF(ary1); - } - ary1 = ary2; - } - *is_new_object = is_new1 || is_new2; - return ary1; - } - -} /* end fragment */ - - -/**********************************************************************/ - -%fragment("NumPy_Array_Requirements", "header", - fragment="NumPy_Backward_Compatibility", - fragment="NumPy_Macros") -{ - /* Test whether a python object is contiguous. If array is - * contiguous, return 1. Otherwise, set the python error string and - * return 0. - */ - int require_contiguous(PyArrayObject* ary) - { - int contiguous = 1; - if (!array_is_contiguous(ary)) - { - PyErr_SetString(PyExc_TypeError, - "Array must be contiguous. A non-contiguous array was given"); - contiguous = 0; - } - return contiguous; - } - - /* Require that a numpy array is not byte-swapped. If the array is - * not byte-swapped, return 1. Otherwise, set the python error string - * and return 0. - */ - int require_native(PyArrayObject* ary) - { - int native = 1; - if (!array_is_native(ary)) - { - PyErr_SetString(PyExc_TypeError, - "Array must have native byteorder. " - "A byte-swapped array was given"); - native = 0; - } - return native; - } - - /* Require the given PyArrayObject to have a specified number of - * dimensions. If the array has the specified number of dimensions, - * return 1. Otherwise, set the python error string and return 0. - */ - int require_dimensions(PyArrayObject* ary, int exact_dimensions) - { - int success = 1; - if (array_numdims(ary) != exact_dimensions) - { - PyErr_Format(PyExc_TypeError, - "Array must have %d dimensions. Given array has %d dimensions", - exact_dimensions, array_numdims(ary)); - success = 0; - } - return success; - } - - /* Require the given PyArrayObject to have one of a list of specified - * number of dimensions. If the array has one of the specified number - * of dimensions, return 1. Otherwise, set the python error string - * and return 0. - */ - int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) - { - int success = 0; - int i; - char dims_str[255] = ""; - char s[255]; - for (i = 0; i < n && !success; i++) - { - if (array_numdims(ary) == exact_dimensions[i]) - { - success = 1; - } - } - if (!success) - { - for (i = 0; i < n-1; i++) - { - sprintf(s, "%d, ", exact_dimensions[i]); - strcat(dims_str,s); - } - sprintf(s, " or %d", exact_dimensions[n-1]); - strcat(dims_str,s); - PyErr_Format(PyExc_TypeError, - "Array must have %s dimensions. Given array has %d dimensions", - dims_str, array_numdims(ary)); - } - return success; - } - - /* Require the given PyArrayObject to have a specified shape. If the - * array has the specified shape, return 1. Otherwise, set the python - * error string and return 0. - */ - int require_size(PyArrayObject* ary, npy_intp* size, int n) - { - int i; - int success = 1; - int len; - char desired_dims[255] = "["; - char s[255]; - char actual_dims[255] = "["; - for(i=0; i < n;i++) - { - if (size[i] != -1 && size[i] != array_size(ary,i)) - { - success = 0; - } - } - if (!success) - { - for (i = 0; i < n; i++) - { - if (size[i] == -1) - { - sprintf(s, "*,"); - } - else - { - sprintf(s, "%ld,", (long int)size[i]); - } - strcat(desired_dims,s); - } - len = strlen(desired_dims); - desired_dims[len-1] = ']'; - for (i = 0; i < n; i++) - { - sprintf(s, "%ld,", (long int)array_size(ary,i)); - strcat(actual_dims,s); - } - len = strlen(actual_dims); - actual_dims[len-1] = ']'; - PyErr_Format(PyExc_TypeError, - "Array must have shape of %s. Given array has shape of %s", - desired_dims, actual_dims); - } - return success; - } - - /* Require the given PyArrayObject to to be FORTRAN ordered. If the - * the PyArrayObject is already FORTRAN ordered, do nothing. Else, - * set the FORTRAN ordering flag and recompute the strides. - */ - int require_fortran(PyArrayObject* ary) - { - int success = 1; - int nd = array_numdims(ary); - int i; - if (array_is_fortran(ary)) return success; - /* Set the FORTRAN ordered flag */ - ary->flags = NPY_FARRAY; - /* Recompute the strides */ - ary->strides[0] = ary->strides[nd-1]; - for (i=1; i < nd; ++i) - ary->strides[i] = ary->strides[i-1] * array_size(ary,i-1); - return success; - } -} - -/* Combine all NumPy fragments into one for convenience */ -%fragment("NumPy_Fragments", "header", - fragment="NumPy_Backward_Compatibility", - fragment="NumPy_Macros", - fragment="NumPy_Utilities", - fragment="NumPy_Object_to_Array", - fragment="NumPy_Array_Requirements") { } - -/* End John Hunter translation (with modifications by Bill Spotz) - */ - -/* %numpy_typemaps() macro - * - * This macro defines a family of 41 typemaps that allow C arguments - * of the form - * - * (DATA_TYPE IN_ARRAY1[ANY]) - * (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) - * (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) - * - * (DATA_TYPE IN_ARRAY2[ANY][ANY]) - * (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) - * (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) - * - * (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) - * (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) - * (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) - * - * (DATA_TYPE INPLACE_ARRAY1[ANY]) - * (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) - * (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) - * - * (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) - * (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) - * (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) - * - * (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) - * (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) - * (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3) - * - * (DATA_TYPE ARGOUT_ARRAY1[ANY]) - * (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) - * (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) - * - * (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) - * - * (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) - * - * (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1) - * (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) - * - * (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) - * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) - * (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) - * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) - * - * (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) - * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) - * (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) - * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) - * - * where "DATA_TYPE" is any type supported by the NumPy module, and - * "DIM_TYPE" is any int-like type suitable for specifying dimensions. - * The difference between "ARRAY" typemaps and "FARRAY" typemaps is - * that the "FARRAY" typemaps expect FORTRAN ordering of - * multidimensional arrays. In python, the dimensions will not need - * to be specified (except for the "DATA_TYPE* ARGOUT_ARRAY1" - * typemaps). The IN_ARRAYs can be a numpy array or any sequence that - * can be converted to a numpy array of the specified type. The - * INPLACE_ARRAYs must be numpy arrays of the appropriate type. The - * ARGOUT_ARRAYs will be returned as new numpy arrays of the - * appropriate type. - * - * These typemaps can be applied to existing functions using the - * %apply directive. For example: - * - * %apply (double* IN_ARRAY1, int DIM1) {(double* series, int length)}; - * double prod(double* series, int length); - * - * %apply (int DIM1, int DIM2, double* INPLACE_ARRAY2) - * {(int rows, int cols, double* matrix )}; - * void floor(int rows, int cols, double* matrix, double f); - * - * %apply (double IN_ARRAY3[ANY][ANY][ANY]) - * {(double tensor[2][2][2] )}; - * %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY]) - * {(double low[2][2][2] )}; - * %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY]) - * {(double upp[2][2][2] )}; - * void luSplit(double tensor[2][2][2], - * double low[2][2][2], - * double upp[2][2][2] ); - * - * or directly with - * - * double prod(double* IN_ARRAY1, int DIM1); - * - * void floor(int DIM1, int DIM2, double* INPLACE_ARRAY2, double f); - * - * void luSplit(double IN_ARRAY3[ANY][ANY][ANY], - * double ARGOUT_ARRAY3[ANY][ANY][ANY], - * double ARGOUT_ARRAY3[ANY][ANY][ANY]); - */ - -%define %numpy_typemaps(DATA_TYPE, DATA_TYPECODE, DIM_TYPE) - -/************************/ -/* Input Array Typemaps */ -/************************/ - -/* Typemap suite for (DATA_TYPE IN_ARRAY1[ANY]) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE IN_ARRAY1[ANY]) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE IN_ARRAY1[ANY]) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[1] = { $1_dim0 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 1) || - !require_size(array, size, 1)) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} -%typemap(freearg) - (DATA_TYPE IN_ARRAY1[ANY]) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[1] = { -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 1) || - !require_size(array, size, 1)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); -} -%typemap(freearg) - (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[1] = {-1}; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 1) || - !require_size(array, size, 1)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DATA_TYPE*) array_data(array); -} -%typemap(freearg) - (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE IN_ARRAY2[ANY][ANY]) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE IN_ARRAY2[ANY][ANY]) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE IN_ARRAY2[ANY][ANY]) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[2] = { $1_dim0, $1_dim1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 2) || - !require_size(array, size, 2)) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} -%typemap(freearg) - (DATA_TYPE IN_ARRAY2[ANY][ANY]) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[2] = { -1, -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 2) || - !require_size(array, size, 2)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); -} -%typemap(freearg) - (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[2] = { -1, -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 2) || - !require_size(array, size, 2)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DATA_TYPE*) array_data(array); -} -%typemap(freearg) - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[2] = { -1, -1 }; - array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 2) || - !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); -} -%typemap(freearg) - (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[2] = { -1, -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 2) || - !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DATA_TYPE*) array_data(array); -} -%typemap(freearg) - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 3) || - !require_size(array, size, 3)) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} -%typemap(freearg) - (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, - * DIM_TYPE DIM3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[3] = { -1, -1, -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 3) || - !require_size(array, size, 3)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); - $4 = (DIM_TYPE) array_size(array,2); -} -%typemap(freearg) - (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, - * DATA_TYPE* IN_ARRAY3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[3] = { -1, -1, -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 3) || - !require_size(array, size, 3)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DIM_TYPE) array_size(array,2); - $4 = (DATA_TYPE*) array_data(array); -} -%typemap(freearg) - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, - * DIM_TYPE DIM3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[3] = { -1, -1, -1 }; - array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 3) || - !require_size(array, size, 3) | !require_fortran(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); - $4 = (DIM_TYPE) array_size(array,2); -} -%typemap(freearg) - (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, - * DATA_TYPE* IN_FARRAY3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) -{ - $1 = is_array($input) || PySequence_Check($input); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) - (PyArrayObject* array=NULL, int is_new_object=0) -{ - npy_intp size[3] = { -1, -1, -1 }; - array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, - &is_new_object); - if (!array || !require_dimensions(array, 3) || - !require_size(array, size, 3) || !require_fortran(array)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DIM_TYPE) array_size(array,2); - $4 = (DATA_TYPE*) array_data(array); -} -%typemap(freearg) - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) -{ - if (is_new_object$argnum && array$argnum) - { Py_DECREF(array$argnum); } -} - -/***************************/ -/* In-Place Array Typemaps */ -/***************************/ - -/* Typemap suite for (DATA_TYPE INPLACE_ARRAY1[ANY]) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE INPLACE_ARRAY1[ANY]) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE INPLACE_ARRAY1[ANY]) - (PyArrayObject* array=NULL) -{ - npy_intp size[1] = { $1_dim0 }; - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,1) || !require_size(array, size, 1) || - !require_contiguous(array) || !require_native(array)) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} - -/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) - (PyArrayObject* array=NULL, int i=1) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,1) || !require_contiguous(array) - || !require_native(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = 1; - for (i=0; i < array_numdims(array); ++i) $2 *= array_size(array,i); -} - -/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) - (PyArrayObject* array=NULL, int i=0) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,1) || !require_contiguous(array) - || !require_native(array)) SWIG_fail; - $1 = 1; - for (i=0; i < array_numdims(array); ++i) $1 *= array_size(array,i); - $2 = (DATA_TYPE*) array_data(array); -} - -/* Typemap suite for (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) - (PyArrayObject* array=NULL) -{ - npy_intp size[2] = { $1_dim0, $1_dim1 }; - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,2) || !require_size(array, size, 2) || - !require_contiguous(array) || !require_native(array)) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} - -/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,2) || !require_contiguous(array) - || !require_native(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,2) || !require_contiguous(array) || - !require_native(array)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DATA_TYPE*) array_data(array); -} - -/* Typemap suite for (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,2) || !require_contiguous(array) - || !require_native(array) || !require_fortran(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,2) || !require_contiguous(array) || - !require_native(array) || !require_fortran(array)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DATA_TYPE*) array_data(array); -} - -/* Typemap suite for (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) - (PyArrayObject* array=NULL) -{ - npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 }; - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,3) || !require_size(array, size, 3) || - !require_contiguous(array) || !require_native(array)) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} - -/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, - * DIM_TYPE DIM3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,3) || !require_contiguous(array) || - !require_native(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); - $4 = (DIM_TYPE) array_size(array,2); -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, - * DATA_TYPE* INPLACE_ARRAY3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,3) || !require_contiguous(array) - || !require_native(array)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DIM_TYPE) array_size(array,2); - $4 = (DATA_TYPE*) array_data(array); -} - -/* Typemap suite for (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, - * DIM_TYPE DIM3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,3) || !require_contiguous(array) || - !require_native(array) || !require_fortran(array)) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); - $2 = (DIM_TYPE) array_size(array,0); - $3 = (DIM_TYPE) array_size(array,1); - $4 = (DIM_TYPE) array_size(array,2); -} - -/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, - * DATA_TYPE* INPLACE_FARRAY3) - */ -%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, - fragment="NumPy_Macros") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3) -{ - $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), - DATA_TYPECODE); -} -%typemap(in, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3) - (PyArrayObject* array=NULL) -{ - array = obj_to_array_no_conversion($input, DATA_TYPECODE); - if (!array || !require_dimensions(array,3) || !require_contiguous(array) - || !require_native(array) || !require_fortran(array)) SWIG_fail; - $1 = (DIM_TYPE) array_size(array,0); - $2 = (DIM_TYPE) array_size(array,1); - $3 = (DIM_TYPE) array_size(array,2); - $4 = (DATA_TYPE*) array_data(array); -} - -/*************************/ -/* Argout Array Typemaps */ -/*************************/ - -/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY1[ANY]) - */ -%typemap(in,numinputs=0, - fragment="NumPy_Backward_Compatibility,NumPy_Macros") - (DATA_TYPE ARGOUT_ARRAY1[ANY]) - (PyObject * array = NULL) -{ - npy_intp dims[1] = { $1_dim0 }; - array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); - if (!array) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} -%typemap(argout) - (DATA_TYPE ARGOUT_ARRAY1[ANY]) -{ - $result = SWIG_Python_AppendOutput($result,array$argnum); -} - -/* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) - */ -%typemap(in,numinputs=1, - fragment="NumPy_Fragments") - (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) - (PyObject * array = NULL) -{ - npy_intp dims[1]; - if (!PyInt_Check($input)) - { - const char* typestring = pytype_string($input); - PyErr_Format(PyExc_TypeError, - "Int dimension expected. '%s' given.", - typestring); - SWIG_fail; - } - $2 = (DIM_TYPE) PyInt_AsLong($input); - dims[0] = (npy_intp) $2; - array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); - if (!array) SWIG_fail; - $1 = (DATA_TYPE*) array_data(array); -} -%typemap(argout) - (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) -{ - $result = SWIG_Python_AppendOutput($result,array$argnum); -} - -/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) - */ -%typemap(in,numinputs=1, - fragment="NumPy_Fragments") - (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) - (PyObject * array = NULL) -{ - npy_intp dims[1]; - if (!PyInt_Check($input)) - { - const char* typestring = pytype_string($input); - PyErr_Format(PyExc_TypeError, - "Int dimension expected. '%s' given.", - typestring); - SWIG_fail; - } - $1 = (DIM_TYPE) PyInt_AsLong($input); - dims[0] = (npy_intp) $1; - array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); - if (!array) SWIG_fail; - $2 = (DATA_TYPE*) array_data(array); -} -%typemap(argout) - (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) -{ - $result = SWIG_Python_AppendOutput($result,array$argnum); -} - -/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) - */ -%typemap(in,numinputs=0, - fragment="NumPy_Backward_Compatibility,NumPy_Macros") - (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) - (PyObject * array = NULL) -{ - npy_intp dims[2] = { $1_dim0, $1_dim1 }; - array = PyArray_SimpleNew(2, dims, DATA_TYPECODE); - if (!array) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} -%typemap(argout) - (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) -{ - $result = SWIG_Python_AppendOutput($result,array$argnum); -} - -/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) - */ -%typemap(in,numinputs=0, - fragment="NumPy_Backward_Compatibility,NumPy_Macros") - (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) - (PyObject * array = NULL) -{ - npy_intp dims[3] = { $1_dim0, $1_dim1, $1_dim2 }; - array = PyArray_SimpleNew(3, dims, DATA_TYPECODE); - if (!array) SWIG_fail; - $1 = ($1_ltype) array_data(array); -} -%typemap(argout) - (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) -{ - $result = SWIG_Python_AppendOutput($result,array$argnum); -} - -/*****************************/ -/* Argoutview Array Typemaps */ -/*****************************/ - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1 ) - (DATA_TYPE* data_temp , DIM_TYPE dim_temp) -{ - $1 = &data_temp; - $2 = &dim_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility") - (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1) -{ - npy_intp dims[1] = { *$2 }; - PyObject * array = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$1)); - if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,array); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1 , DATA_TYPE** ARGOUTVIEW_ARRAY1) - (DIM_TYPE dim_temp, DATA_TYPE* data_temp ) -{ - $1 = &dim_temp; - $2 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility") - (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) -{ - npy_intp dims[1] = { *$1 }; - PyObject * array = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$2)); - if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,array); -} - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 ) - (DATA_TYPE* data_temp , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp) -{ - $1 = &data_temp; - $2 = &dim1_temp; - $3 = &dim2_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility") - (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) -{ - npy_intp dims[2] = { *$2, *$3 }; - PyObject * array = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1)); - if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,array); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEW_ARRAY2) - (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp ) -{ - $1 = &dim1_temp; - $2 = &dim2_temp; - $3 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility") - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) -{ - npy_intp dims[2] = { *$1, *$2 }; - PyObject * array = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3)); - if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,array); -} - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 ) - (DATA_TYPE* data_temp , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp) -{ - $1 = &data_temp; - $2 = &dim1_temp; - $3 = &dim2_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") - (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) -{ - npy_intp dims[2] = { *$2, *$3 }; - PyObject * obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1)); - PyArrayObject * array = (PyArrayObject*) obj; - if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEW_FARRAY2) - (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp ) -{ - $1 = &dim1_temp; - $2 = &dim2_temp; - $3 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) -{ - npy_intp dims[2] = { *$1, *$2 }; - PyObject * obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3)); - PyArrayObject * array = (PyArrayObject*) obj; - if (!array || !require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, - DIM_TYPE* DIM3) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) - (DATA_TYPE* data_temp, DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp) -{ - $1 = &data_temp; - $2 = &dim1_temp; - $3 = &dim2_temp; - $4 = &dim3_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility") - (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) -{ - npy_intp dims[3] = { *$2, *$3, *$4 }; - PyObject * array = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1)); - if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,array); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, - DATA_TYPE** ARGOUTVIEW_ARRAY3) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) - (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp) -{ - $1 = &dim1_temp; - $2 = &dim2_temp; - $3 = &dim3_temp; - $4 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility") - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) -{ - npy_intp dims[3] = { *$1, *$2, *$3 }; - PyObject * array = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$3)); - if (!array) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,array); -} - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, - DIM_TYPE* DIM3) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) - (DATA_TYPE* data_temp, DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp) -{ - $1 = &data_temp; - $2 = &dim1_temp; - $3 = &dim2_temp; - $4 = &dim3_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") - (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) -{ - npy_intp dims[3] = { *$2, *$3, *$4 }; - PyObject * obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1)); - PyArrayObject * array = (PyArrayObject*) obj; - if (!array || require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, - DATA_TYPE** ARGOUTVIEW_FARRAY3) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) - (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp) -{ - $1 = &dim1_temp; - $2 = &dim2_temp; - $3 = &dim3_temp; - $4 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) -{ - npy_intp dims[3] = { *$1, *$2, *$3 }; - PyObject * obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$3)); - PyArrayObject * array = (PyArrayObject*) obj; - if (!array || require_fortran(array)) SWIG_fail; - $result = SWIG_Python_AppendOutput($result,obj); -} - -%enddef /* %numpy_typemaps() macro */ -/* *************************************************************** */ - -/* Concrete instances of the %numpy_typemaps() macro: Each invocation - * below applies all of the typemaps above to the specified data type. - */ -%numpy_typemaps(signed char , NPY_BYTE , int) -%numpy_typemaps(unsigned char , NPY_UBYTE , int) -%numpy_typemaps(short , NPY_SHORT , int) -%numpy_typemaps(unsigned short , NPY_USHORT , int) -%numpy_typemaps(int , NPY_INT , int) -%numpy_typemaps(unsigned int , NPY_UINT , int) -%numpy_typemaps(long , NPY_LONG , int) -%numpy_typemaps(unsigned long , NPY_ULONG , int) -%numpy_typemaps(long long , NPY_LONGLONG , int) -%numpy_typemaps(unsigned long long, NPY_ULONGLONG, int) -%numpy_typemaps(float , NPY_FLOAT , int) -%numpy_typemaps(double , NPY_DOUBLE , int) - -/* *************************************************************** - * The follow macro expansion does not work, because C++ bool is 4 - * bytes and NPY_BOOL is 1 byte - * - * %numpy_typemaps(bool, NPY_BOOL, int) - */ - -/* *************************************************************** - * On my Mac, I get the following warning for this macro expansion: - * 'swig/python detected a memory leak of type 'long double *', no destructor found.' - * - * %numpy_typemaps(long double, NPY_LONGDOUBLE, int) - */ - -/* *************************************************************** - * Swig complains about a syntax error for the following macro - * expansions: - * - * %numpy_typemaps(complex float, NPY_CFLOAT , int) - * - * %numpy_typemaps(complex double, NPY_CDOUBLE, int) - * - * %numpy_typemaps(complex long double, NPY_CLONGDOUBLE, int) - */ - -#endif /* SWIGPYTHON */ diff --git a/pymolfile/libpymolfile-old/python_molfile.i b/pymolfile/libpymolfile-old/python_molfile.i deleted file mode 100644 index 5b041181d1894e9efaa5df64dd52b5a3658ac8e5..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/python_molfile.i +++ /dev/null @@ -1,386 +0,0 @@ - -/* SWIG interface for libvmdmolfile of VMD molfile_plugins - Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> - Published under the GNU GENERAL PUBLIC LICENSE Version 2 (or higher) - - swig -python -outdir MDAnalysis/coordinates/xdrfile src/xdrfile/libxdrfile2.i -*/ -%define DOCSTRING -" -:Author: Berk Onat <b.onat@warwick.ac.uk> -:Year: 2017 -:Licence: GNU GENERAL PUBLIC LICENSE Version 2 (or higher) - -" -%enddef - -%module(docstring=DOCSTRING) libvmdmolfile - - - -/************************************************************ - * the molfile f77 interface in VMD plugins distribution * - ************************************************************/ - -/* - * molfile fortran interface - * $Id: f77_molfile.c,v 1.1 2006/03/10 22:48:49 johns Exp $ - * (c) 2006 Axel Kohlmeyer <akohlmey@cmm.chem.upenn.edu> - */ - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -#include "molfile_plugin.h" -#include "libmolfile_plugin.h" -#include "vmdplugin.h" - -#define F77TESTME 1 - -/* fortran name mangling */ -#if defined(_F77_NO_UNDERSCORE) -#define FNAME(n) n -#elif defined(_F77_F2C_UNDERSCORE) -#define FNAME(n) n ## __ -#else -#define FNAME(n) n ## _ -#endif - -/* interface typedef magic */ -typedef int int4; - -struct molfile_f77_handle -{ - void *handle; - const char *fname; - const char *ftype; - molfile_plugin_t *plugin; -}; -typedef struct molfile_f77_handle f77_fd; - -/* plugin list */ -#ifndef MAXPLUGINS -#define MAXPLUGINS 200 -#endif -static int numplugins=0; -static molfile_plugin_t *plugin_list[MAXPLUGINS]; - -/* we maintain a static list of assigned handles */ -#ifndef MAXHADNLES -#define MAXHANDLES 200 -#endif -static int4 numhandles=0; -static f77_fd handle_list[MAXHANDLES]; - -/* helper functions */ -/* helper function to copy fortran style (a la sun fortran) strings into - * valid c style strings. just using the string pointers will not work, - * since the strings are NOT zero terminated. - * - * WARNING: do not forget to free(2) them later, - * or you'll have a memory leak! - */ -static char *f77strdup(const char *s,const int sz) -{ - char *r; - - r = (char *)malloc(sz + 1); - r = (char *)memcpy(r, s, sz); - r[sz] = '\0'; - return r; -} - -/* trim off whitespace at the end of a string */ -static void f77trim(char *s,const int sz) -{ - int i; - - i=1; - while( (i++ < sz) && isspace(s[sz-i]) ) { - s[sz-i] ='\0'; - } -} - -/* get the filename extension */ -static const char *f77getfnext(const char *s) -{ - int i,len; - - len = strlen(s); - for (i=len; i>=0; --i) { - if(s[i] == '.') { - return &s[i+1]; - } - } - return NULL; -} - -/* check validity of plugins and register them. */ -static int f77register(void *ptr, vmdplugin_t *plugin) { - - if (!plugin->type || !plugin->name || !plugin->author) { - fprintf(stderr," skipping plugin with incomplete header\n"); - return -1; - } - -#if F77TESTME - fprintf(stderr, " trying to register plugin #%d: %s, type: %s/%d\n" - " written by: %s\n\n", numplugins+1, plugin->name, - plugin->type, plugin->abiversion, plugin->author); -#endif - - if (plugin->abiversion != vmdplugin_ABIVERSION) { - fprintf(stderr, " skipping plugin with incompatible ABI:%d/%d\n", - plugin->abiversion, vmdplugin_ABIVERSION); - return -2; - } - - if (0 != strncmp(plugin->type, "mol file", 8)) { - fprintf(stderr, " skipping plugin of incompatible type:%s\n", - plugin->type); - return -3; - } - - if (numplugins < MAXPLUGINS) { - plugin_list[numplugins] = (molfile_plugin_t *) plugin; - ++numplugins; - return 0; - } - - fprintf(stderr, " too many plugins: %d. increase MAXPLUGINS, " - "recompile, and try again.\n", numplugins); - - return -4; -} - - -/* the official fortran API */ - -/* register all available plugins and clear handles. */ -void FNAME(f77_molfile_init)(void) -{ - int i; - - MOLFILE_INIT_ALL; - - for (i=0; i<MAXHANDLES; ++i) { - handle_list[i].handle = NULL; - } - - MOLFILE_REGISTER_ALL(NULL,f77register); - - /* - * FIXME: check all plugins and make - * sure the babel plugin(s) are last. - */ -} - -/* unregister all available plugins */ -void FNAME(f77_molfile_finish)(void) -{ -#if 0 - int i; - - /* FIXME: add code to close and nullify all open handles */ - for (i=0; i<MAXHANDLES; ++i) { - handle_list[i] = NULL; - } -#endif - - MOLFILE_FINI_ALL; -} - - -/* open a file and provide file descriptor */ -void FNAME(f77_molfile_open_read)(int4 *handle, int4 *natoms, - const char *infile, const char *intype, - const int len_if, const int len_it) -{ - char *fname, *ftype; - molfile_plugin_t *plugin; - int i; - - if (numhandles >= MAXHANDLES) { - fprintf(stderr, "too many molfile f77 handles.\n"); - *handle = -666; - return; - } - - fname = f77strdup(infile, len_if); - f77trim(fname,len_if); - - ftype = f77strdup(intype, len_it); - f77trim(ftype,len_it); - - fprintf(stderr, " %s: trying for: %s/%d, %s/%d\n", - __FUNCTION__, fname, len_if, ftype, len_it); - - plugin = NULL; - /* determine plugin type automatically */ - if(0 == strncmp(intype, "auto", 4)) { - const char *fext; - - fext = f77getfnext(fname); - if (fext == NULL) { - fprintf(stderr, " could not determine file name extension " - "for automatic plugin guess\n"); - *handle = -111; - return; - } -#if F77TESTME - fprintf(stderr, " filename extension: %s\n", fext); -#endif - - for (i=0; (i<numplugins) && plugin==NULL; ++i) { -#if F77TESTME - fprintf(stderr, " tying filename extension: %s\n", - plugin_list[i]->filename_extension); -#endif - if (0 == strcmp(plugin_list[i]->filename_extension, fext)) { - fprintf(stderr, " using plugin: %s\n", - plugin_list[i]->prettyname); - - plugin = plugin_list[i]; - } - } - if (plugin == NULL) { - fprintf(stderr, " could not determine matching plugin type" - "from file name extension\n"); - *handle = -222; - return; - } - } else { - - for (i=0; (i<numplugins) && (plugin==NULL); ++i) { -#if F77TESTME - fprintf(stderr, " tying plugin type: %s\n", - plugin_list[i]->name); -#endif - if (0 == strcmp(plugin_list[i]->name, ftype)) { - fprintf(stderr, " using plugin: %s\n", - plugin_list[i]->prettyname); - plugin = plugin_list[i]; - } - } - if (plugin == NULL) { - fprintf(stderr, " could not find plugin for type %s\n",ftype); - *handle = -333; - return; - } - } - - if(plugin == NULL) { /* this should not happen, but... */ - fprintf(stderr, " no plugin found.\n"); - *handle = -444; - return; - } - - /* build handle */ - ++numhandles; - for (i=0; i<numhandles; ++i) { - if(handle_list[i].plugin == NULL) { - *handle = i; - handle_list[i].fname=fname; - handle_list[i].ftype=plugin->name; - handle_list[i].plugin=plugin; - } - } - - /* open file for reading and detect number of atoms */ - *natoms=MOLFILE_NUMATOMS_UNKNOWN; - handle_list[*handle].handle= - plugin->open_file_read(fname,plugin->name,natoms); - if(handle_list[*handle].handle == NULL) { - fprintf(stderr, " open of %s-plugin for file %s failed\n", - plugin->type, fname); - --numhandles; - handle_list[*handle].plugin=NULL; - *handle=-777; - return; - } - - return; -} - -/* read next time step */ -void FNAME(f77_molfile_read_next)(int4 *handle, int4 *natoms, float *xyz, - float *box, int4 *status) -{ - molfile_plugin_t *plugin; - molfile_timestep_t step; - int retval; - - /* do some sanity checks on the handle */ - if((*handle < 0) || (*handle >= MAXHANDLES)) { - fprintf(stderr, " %s: illegal handle: %d\n", - __FUNCTION__, *handle); - *status = 0; - return; - } - - plugin = handle_list[*handle].plugin; - if(plugin==NULL) { - fprintf(stderr, " %s: inactive handle: %d\n", - __FUNCTION__, *handle); - *status = 0; - return; - } - - /* skip or read the timestep as demanded */ - if(status == 0) { - retval = plugin->read_next_timestep(handle_list[*handle].handle, - *natoms, NULL); - } else { - step.coords = xyz; - retval = plugin->read_next_timestep(handle_list[*handle].handle, - *natoms, &step); - } - - /* copy the box parameters */ - if (retval == MOLFILE_SUCCESS) { - *status = 1; - box[0]=step.A; - box[1]=step.B; - box[2]=step.C; - box[3]=step.alpha; - box[4]=step.beta; - box[5]=step.gamma; - } else { - *status = 0; - } -} - -/* close a read file descriptor */ -void FNAME(f77_molfile_close_read)(int4 *handle) -{ - molfile_plugin_t *plugin; - - /* do some sanity checks on the handle */ - if((*handle < 0) || (*handle >= MAXHANDLES)) { - fprintf(stderr, " %s: illegal handle: %d\n", - __FUNCTION__, *handle); - *handle = -111; - return; - } - - plugin = handle_list[*handle].plugin; - if(plugin==NULL) { - fprintf(stderr, " %s: inactive handle: %d\n", - __FUNCTION__, *handle); - *handle = -222; - return; - } - -#if F77TESTME - fprintf(stderr, " %s: trying to close handle %d" - " for file %s\n", __FUNCTION__, *handle, - handle_list[*handle].fname); -#endif - - plugin->close_file_read(handle_list[*handle].handle); - --numhandles; - handle_list[*handle].plugin=NULL; - *handle=-1; -} diff --git a/pymolfile/libpymolfile-old/xdrfile.c b/pymolfile/libpymolfile-old/xdrfile.c deleted file mode 100644 index 4aa69ce7acb88664b70717f7a6d0114084c0a357..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/xdrfile.c +++ /dev/null @@ -1,2624 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- - * - * $Id$ - * - * Copyright (c) Erik Lindahl, David van der Spoel 2003,2004. - * Copyright (c) Manuel Melo <manuel.nuno.melo@gmail.com> 2013,2014. - * Coordinate compression (c) by Frans van Hoesel. - * XTC/TRR seeking and indexing (c) Manuel Melo. - * - * This file is part of libxdrfile2. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -/* Get HAVE_RPC_XDR_H, F77_FUNC from config.h if available */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <limits.h> - -/* get fixed-width types if we are using ANSI C99 */ -#ifdef HAVE_STDINT_H -# include <stdint.h> -#elif (defined HAVE_INTTYPES_H) -# include <inttypes.h> -#endif - -#ifdef HAVE_RPC_XDR_H -# include <rpc/rpc.h> -# include <rpc/xdr.h> -#endif - -#include "xdrfile.h" - -/* Default FORTRAN name mangling is: lower case name, append underscore */ -#ifndef F77_FUNC -#define F77_FUNC(name,NAME) name ## _ -#endif - -char *exdr_message[exdrNR] = { - "OK", - "Header", - "String", - "Double", - "Integer", - "Float", - "Unsigned integer", - "Compressed 3D coordinate", - "Closing file", - "Magic number", - "Not enough memory", - "End of file", - "File not found" -}; - -/* - * Declare our own XDR routines statically if no libraries are present. - * Actual implementation is at the end of this file. - * - * We don't want the low-level XDR implementation as part of the Gromacs - * documentation, so skip it for doxygen too... - */ -#if (!defined HAVE_RPC_XDR_H && !defined DOXYGEN) - -enum xdr_op -{ - XDR_ENCODE = 0, - XDR_DECODE = 1, - XDR_FREE = 2 -}; - - -/* We need integer types that are guaranteed to be 4 bytes wide. - * If ANSI C99 headers were included they are already defined - * as int32_t and uint32_t. Check, and if not define them ourselves. - * Since it is just our workaround for missing ANSI C99 types, avoid adding - * it to the doxygen documentation. - */ -#if !(defined INT32_MAX || defined DOXYGEN) -# if (INT_MAX == 2147483647) -# define int32_t int -# define uint32_t unsigned int -# define INT32_MAX 2147483647 -# elif (LONG_MAX == 2147483647) -# define int32_t long -# define uint32_t unsigned long -# define INT32_MAX 2147483647L -# else -# error ERROR: No 32 bit wide integer type found! -# error Use system XDR libraries instead, or update xdrfile.c -# endif -#endif - -typedef struct XDR XDR; - -struct XDR -{ - enum xdr_op x_op; - struct xdr_ops - { - int (*x_getlong) (XDR *__xdrs, int32_t *__lp); - int (*x_putlong) (XDR *__xdrs, int32_t *__lp); - int (*x_getbytes) (XDR *__xdrs, char *__addr, unsigned int __len); - int (*x_putbytes) (XDR *__xdrs, char *__addr, unsigned int __len); - /* two next routines are not 64-bit IO safe - don't use! */ - unsigned int (*x_getpostn) (XDR *__xdrs); - int (*x_setpostn) (XDR *__xdrs, off_t __pos); - void (*x_destroy) (XDR *__xdrs); - } - *x_ops; - char *x_private; -}; - -static int xdr_char (XDR *xdrs, char *ip); -static int xdr_u_char (XDR *xdrs, unsigned char *ip); -static int xdr_short (XDR *xdrs, short *ip); -static int xdr_u_short (XDR *xdrs, unsigned short *ip); -static int xdr_int (XDR *xdrs, int *ip); -static int xdr_u_int (XDR *xdrs, unsigned int *ip); -static int xdr_float (XDR *xdrs, float *ip); -static int xdr_double (XDR *xdrs, double *ip); -static int xdr_string (XDR *xdrs, char **ip, unsigned int maxsize); -static int xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt); -static void xdrstdio_create (XDR *xdrs, FILE *fp, enum xdr_op xop); - -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_destroy(xdrs) \ - do { \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs); \ - } while (0) -#endif /* end of our own XDR declarations */ - - - - - -/** Contents of the abstract XDRFILE data structure. - * - * @internal - * - * This structure is used to provide an XDR file interface that is - * virtual identical to the standard UNIX fopen/fread/fwrite/fclose. - */ -struct XDRFILE -{ - FILE * fp; /**< pointer to standard C library file handle */ - XDR * xdr; /**< pointer to corresponding XDR handle */ - char mode; /**< r=read, w=write, a=append */ - int * buf1; /**< Buffer for internal use */ - int buf1size; /**< Current allocated length of buf1 */ - int * buf2; /**< Buffer for internal use */ - int buf2size; /**< Current allocated length of buf2 */ -}; - - - - -/************************************************************* - * Implementation of higher-level routines to read/write * - * portable data based on the XDR standard. These should be * - * called from C - see further down for Fortran77 wrappers. * - *************************************************************/ - -XDRFILE * -xdrfile_open(const char *path, const char *mode) -{ - char newmode[5]; - enum xdr_op xdrmode; - XDRFILE *xfp; - - /* make sure XDR files are opened in binary mode... */ - if(*mode=='w' || *mode=='W') - { - sprintf(newmode,"wb+"); - xdrmode=XDR_ENCODE; - } else if(*mode == 'a' || *mode == 'A') - { - sprintf(newmode,"ab+"); - xdrmode = XDR_ENCODE; - } else if(*mode == 'r' || *mode == 'R') - { - sprintf(newmode,"rb"); - xdrmode = XDR_DECODE; - } else /* cannot determine mode */ - return NULL; - - if((xfp=(XDRFILE *)malloc(sizeof(XDRFILE)))==NULL) - return NULL; - if((xfp->fp=fopen(path,newmode))==NULL) - { - free(xfp); - return NULL; - } - if((xfp->xdr=(XDR *)malloc(sizeof(XDR)))==NULL) - { - fclose(xfp->fp); - free(xfp); - return NULL; - } - xfp->mode=*mode; - xdrstdio_create((XDR *)(xfp->xdr),xfp->fp,xdrmode); - xfp->buf1 = xfp->buf2 = NULL; - xfp->buf1size = xfp->buf2size = 0; - return xfp; -} - -int -xdrfile_close(XDRFILE *xfp) -{ - int ret=exdrCLOSE; - if(xfp) - { - /* flush and destroy XDR stream */ - if(xfp->xdr) - xdr_destroy((XDR *)(xfp->xdr)); - free(xfp->xdr); - /* close the file */ - ret=fclose(xfp->fp); - if(xfp->buf1size) - free(xfp->buf1); - if(xfp->buf2size) - free(xfp->buf2); - free(xfp); - } - return ret; /* return 0 if ok */ -} - - - -int -xdrfile_read_int(int *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_int((XDR *)(xfp->xdr),ptr+i)) - i++; - - return i; -} - -int -xdrfile_write_int(int *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_int((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - - -int -xdrfile_read_uint(unsigned int *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_u_int((XDR *)(xfp->xdr),ptr+i)) - i++; - - return i; -} - -int -xdrfile_write_uint(unsigned int *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_u_int((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_read_char(char *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_char((XDR *)(xfp->xdr),ptr+i)) - i++; - - return i; -} - -int -xdrfile_write_char(char *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_char((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - - -int -xdrfile_read_uchar(unsigned char *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_u_char((XDR *)(xfp->xdr),ptr+i)) - i++; - - return i; -} - -int -xdrfile_write_uchar(unsigned char *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_u_char((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_read_short(short *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_short((XDR *)(xfp->xdr),ptr+i)) - i++; - - return i; -} - -int -xdrfile_write_short(short *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_short((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - - -int -xdrfile_read_ushort(unsigned short *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_u_short((XDR *)(xfp->xdr),ptr+i)) - i++; - - return i; -} - -int -xdrfile_write_ushort(unsigned short *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_u_short((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_read_float(float *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_float((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_write_float(float *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_float((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_read_double(double *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_double((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_write_double(double *ptr, int ndata, XDRFILE* xfp) -{ - int i=0; - /* read write is encoded in the XDR struct */ - while(i<ndata && xdr_double((XDR *)(xfp->xdr),ptr+i)) - i++; - return i; -} - -int -xdrfile_read_string(char *ptr, int maxlen, XDRFILE* xfp) -{ - int i; - if(xdr_string((XDR *)(xfp->xdr),&ptr,maxlen)) { - i=0; - while(i<maxlen && ptr[i]!=0) - i++; - if(i==maxlen) - return maxlen; - else - return i+1; - } else - return 0; -} - -int -xdrfile_write_string(char *ptr, XDRFILE* xfp) -{ - int len=strlen(ptr)+1; - - if(xdr_string((XDR *)(xfp->xdr),&ptr,len)) - return len; - else - return 0; -} - - -int -xdrfile_read_opaque(char *ptr, int cnt, XDRFILE* xfp) -{ - if(xdr_opaque((XDR *)(xfp->xdr),ptr,cnt)) - return cnt; - else - return 0; -} - - -int -xdrfile_write_opaque(char *ptr, int cnt, XDRFILE* xfp) -{ - if(xdr_opaque((XDR *)(xfp->xdr),ptr,cnt)) - return cnt; - else - return 0; -} - - -/* Internal support routines for reading/writing compressed coordinates - * sizeofint - calculate smallest number of bits necessary - * to represent a certain integer. - */ -static int -sizeofint(int size) { - unsigned int num = 1; - int num_of_bits = 0; - - while (size >= num && num_of_bits < 32) - { - num_of_bits++; - num <<= 1; - } - return num_of_bits; -} - - -/* - * sizeofints - calculate 'bitsize' of compressed ints - * - * given a number of small unsigned integers and the maximum value - * return the number of bits needed to read or write them with the - * routines encodeints/decodeints. You need this parameter when - * calling those routines. - * (However, in some cases we can just use the variable 'smallidx' - * which is the exact number of bits, and them we dont need to call - * this routine). - */ -static int -sizeofints(int num_of_ints, unsigned int sizes[]) -{ - int i, num; - unsigned int num_of_bytes, num_of_bits, bytes[32], bytecnt, tmp; - num_of_bytes = 1; - bytes[0] = 1; - num_of_bits = 0; - for (i=0; i < num_of_ints; i++) - { - tmp = 0; - for (bytecnt = 0; bytecnt < num_of_bytes; bytecnt++) - { - tmp = bytes[bytecnt] * sizes[i] + tmp; - bytes[bytecnt] = tmp & 0xff; - tmp >>= 8; - } - while (tmp != 0) - { - bytes[bytecnt++] = tmp & 0xff; - tmp >>= 8; - } - num_of_bytes = bytecnt; - } - num = 1; - num_of_bytes--; - while (bytes[num_of_bytes] >= num) - { - num_of_bits++; - num *= 2; - } - return num_of_bits + num_of_bytes * 8; - -} - - -/* - * encodebits - encode num into buf using the specified number of bits - * - * This routines appends the value of num to the bits already present in - * the array buf. You need to give it the number of bits to use and you had - * better make sure that this number of bits is enough to hold the value. - * Num must also be positive. - */ -static void -encodebits(int buf[], int num_of_bits, int num) -{ - - unsigned int cnt, lastbyte; - int lastbits; - unsigned char * cbuf; - - cbuf = ((unsigned char *)buf) + 3 * sizeof(*buf); - cnt = (unsigned int) buf[0]; - lastbits = buf[1]; - lastbyte =(unsigned int) buf[2]; - while (num_of_bits >= 8) - { - lastbyte = (lastbyte << 8) | ((num >> (num_of_bits -8)) /* & 0xff*/); - cbuf[cnt++] = lastbyte >> lastbits; - num_of_bits -= 8; - } - if (num_of_bits > 0) - { - lastbyte = (lastbyte << num_of_bits) | num; - lastbits += num_of_bits; - if (lastbits >= 8) - { - lastbits -= 8; - cbuf[cnt++] = lastbyte >> lastbits; - } - } - buf[0] = cnt; - buf[1] = lastbits; - buf[2] = lastbyte; - if (lastbits>0) - { - cbuf[cnt] = lastbyte << (8 - lastbits); - } -} - -/* - * encodeints - encode a small set of small integers in compressed format - * - * this routine is used internally by xdr3dfcoord, to encode a set of - * small integers to the buffer for writing to a file. - * Multiplication with fixed (specified maximum) sizes is used to get - * to one big, multibyte integer. Allthough the routine could be - * modified to handle sizes bigger than 16777216, or more than just - * a few integers, this is not done because the gain in compression - * isn't worth the effort. Note that overflowing the multiplication - * or the byte buffer (32 bytes) is unchecked and whould cause bad results. - * THese things are checked in the calling routines, so make sure not - * to remove those checks... - */ - -static void -encodeints(int buf[], int num_of_ints, int num_of_bits, - unsigned int sizes[], unsigned int nums[]) -{ - - int i; - unsigned int bytes[32], num_of_bytes, bytecnt, tmp; - - tmp = nums[0]; - num_of_bytes = 0; - do - { - bytes[num_of_bytes++] = tmp & 0xff; - tmp >>= 8; - } while (tmp != 0); - - for (i = 1; i < num_of_ints; i++) - { - if (nums[i] >= sizes[i]) - { - fprintf(stderr,"major breakdown in encodeints - num %u doesn't " - "match size %u\n", nums[i], sizes[i]); - abort(); - } - /* use one step multiply */ - tmp = nums[i]; - for (bytecnt = 0; bytecnt < num_of_bytes; bytecnt++) - { - tmp = bytes[bytecnt] * sizes[i] + tmp; - bytes[bytecnt] = tmp & 0xff; - tmp >>= 8; - } - while (tmp != 0) - { - bytes[bytecnt++] = tmp & 0xff; - tmp >>= 8; - } - num_of_bytes = bytecnt; - } - if (num_of_bits >= num_of_bytes * 8) - { - for (i = 0; i < num_of_bytes; i++) - { - encodebits(buf, 8, bytes[i]); - } - encodebits(buf, num_of_bits - num_of_bytes * 8, 0); - } - else - { - for (i = 0; i < num_of_bytes-1; i++) - { - encodebits(buf, 8, bytes[i]); - } - encodebits(buf, num_of_bits- (num_of_bytes -1) * 8, bytes[i]); - } -} - - -/* - * decodebits - decode number from buf using specified number of bits - * - * extract the number of bits from the array buf and construct an integer - * from it. Return that value. - * - */ - -static int -decodebits(int buf[], int num_of_bits) -{ - - int cnt, num; - unsigned int lastbits, lastbyte; - unsigned char * cbuf; - int mask = (1 << num_of_bits) -1; - - cbuf = ((unsigned char *)buf) + 3 * sizeof(*buf); - cnt = buf[0]; - lastbits = (unsigned int) buf[1]; - lastbyte = (unsigned int) buf[2]; - - num = 0; - while (num_of_bits >= 8) - { - lastbyte = ( lastbyte << 8 ) | cbuf[cnt++]; - num |= (lastbyte >> lastbits) << (num_of_bits - 8); - num_of_bits -=8; - } - if (num_of_bits > 0) - { - if (lastbits < num_of_bits) - { - lastbits += 8; - lastbyte = (lastbyte << 8) | cbuf[cnt++]; - } - lastbits -= num_of_bits; - num |= (lastbyte >> lastbits) & ((1 << num_of_bits) -1); - } - num &= mask; - buf[0] = cnt; - buf[1] = lastbits; - buf[2] = lastbyte; - return num; -} - -/* - * decodeints - decode 'small' integers from the buf array - * - * this routine is the inverse from encodeints() and decodes the small integers - * written to buf by calculating the remainder and doing divisions with - * the given sizes[]. You need to specify the total number of bits to be - * used from buf in num_of_bits. - * - */ - -static void -decodeints(int buf[], int num_of_ints, int num_of_bits, - unsigned int sizes[], int nums[]) -{ - - int bytes[32]; - int i, j, num_of_bytes, p, num; - - bytes[1] = bytes[2] = bytes[3] = 0; - num_of_bytes = 0; - while (num_of_bits > 8) - { - bytes[num_of_bytes++] = decodebits(buf, 8); - num_of_bits -= 8; - } - if (num_of_bits > 0) - { - bytes[num_of_bytes++] = decodebits(buf, num_of_bits); - } - for (i = num_of_ints-1; i > 0; i--) - { - num = 0; - for (j = num_of_bytes-1; j >=0; j--) - { - num = (num << 8) | bytes[j]; - p = num / sizes[i]; - bytes[j] = p; - num = num - p * sizes[i]; - } - nums[i] = num; - } - nums[0] = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24); -} - - -static const int magicints[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 12, 16, 20, 25, 32, 40, 50, 64, - 80, 101, 128, 161, 203, 256, 322, 406, 512, 645, 812, 1024, 1290, - 1625, 2048, 2580, 3250, 4096, 5060, 6501, 8192, 10321, 13003, - 16384, 20642, 26007, 32768, 41285, 52015, 65536,82570, 104031, - 131072, 165140, 208063, 262144, 330280, 416127, 524287, 660561, - 832255, 1048576, 1321122, 1664510, 2097152, 2642245, 3329021, - 4194304, 5284491, 6658042, 8388607, 10568983, 13316085, 16777216 -}; - -#define FIRSTIDX 9 -/* note that magicints[FIRSTIDX-1] == 0 */ -#define LASTIDX (sizeof(magicints) / sizeof(*magicints)) - -/* Compressed coordinate routines - modified from the original - * implementation by Frans v. Hoesel to make them threadsafe. - */ -int -xdrfile_decompress_coord_float(float *ptr, - int *size, - float *precision, - XDRFILE* xfp) -{ - int minint[3], maxint[3], *lip; - int smallidx, minidx, maxidx; - unsigned sizeint[3], sizesmall[3], bitsizeint[3], size3; - int k, *buf1, *buf2, lsize, flag; - int smallnum, smaller, larger, i, is_smaller, run; - float *lfp, inv_precision; - int tmp, *thiscoord, prevcoord[3]; - unsigned int bitsize; - - bitsizeint[0] = 0; - bitsizeint[1] = 0; - bitsizeint[2] = 0; - - if(xfp==NULL || ptr==NULL) - return -1; - tmp=xdrfile_read_int(&lsize,1,xfp); - if(tmp==0) - return -1; /* return if we could not read size */ - if (*size < lsize) - { - fprintf(stderr, "Requested to decompress %d coords, file contains %d\n", - *size, lsize); - return -1; - } - *size = lsize; - size3 = *size * 3; - if(size3>xfp->buf1size) - { - if((xfp->buf1=(int *)malloc(sizeof(int)*size3))==NULL) - { - fprintf(stderr,"Cannot allocate memory for decompressing coordinates.\n"); - return -1; - } - xfp->buf1size=size3; - xfp->buf2size=size3*1.2; - if((xfp->buf2=(int *)malloc(sizeof(int)*xfp->buf2size))==NULL) - { - fprintf(stderr,"Cannot allocate memory for decompressing coordinates.\n"); - return -1; - } - } - /* Dont bother with compression for three atoms or less */ - if(*size<=9) - { - return xdrfile_read_float(ptr,size3,xfp)/3; - /* return number of coords, not floats */ - } - /* Compression-time if we got here. Read precision first */ - xdrfile_read_float(precision,1,xfp); - - /* avoid repeated pointer dereferencing. */ - buf1=xfp->buf1; - buf2=xfp->buf2; - /* buf2[0-2] are special and do not contain actual data */ - buf2[0] = buf2[1] = buf2[2] = 0; - xdrfile_read_int(minint,3,xfp); - xdrfile_read_int(maxint,3,xfp); - - sizeint[0] = maxint[0] - minint[0]+1; - sizeint[1] = maxint[1] - minint[1]+1; - sizeint[2] = maxint[2] - minint[2]+1; - - /* check if one of the sizes is to big to be multiplied */ - if ((sizeint[0] | sizeint[1] | sizeint[2] ) > 0xffffff) - { - bitsizeint[0] = sizeofint(sizeint[0]); - bitsizeint[1] = sizeofint(sizeint[1]); - bitsizeint[2] = sizeofint(sizeint[2]); - bitsize = 0; /* flag the use of large sizes */ - } - else - { - bitsize = sizeofints(3, sizeint); - } - - if (xdrfile_read_int(&smallidx,1,xfp) == 0) - return 0; /* not sure what has happened here or why we return... */ - tmp=smallidx+8; - maxidx = (LASTIDX<tmp) ? LASTIDX : tmp; - minidx = maxidx - 8; /* often this equal smallidx */ - tmp = smallidx-1; - tmp = (FIRSTIDX>tmp) ? FIRSTIDX : tmp; - smaller = magicints[tmp] / 2; - smallnum = magicints[smallidx] / 2; - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx] ; - larger = magicints[maxidx]; - - /* buf2[0] holds the length in bytes */ - - if (xdrfile_read_int(buf2,1,xfp) == 0) - return 0; - if (xdrfile_read_opaque((char *)&(buf2[3]),(unsigned int)buf2[0],xfp) == 0) - return 0; - buf2[0] = buf2[1] = buf2[2] = 0; - - lfp = ptr; - inv_precision = 1.0 / * precision; - run = 0; - i = 0; - lip = buf1; - while ( i < lsize ) - { - thiscoord = (int *)(lip) + i * 3; - - if (bitsize == 0) - { - thiscoord[0] = decodebits(buf2, bitsizeint[0]); - thiscoord[1] = decodebits(buf2, bitsizeint[1]); - thiscoord[2] = decodebits(buf2, bitsizeint[2]); - } - else - { - decodeints(buf2, 3, bitsize, sizeint, thiscoord); - } - - i++; - thiscoord[0] += minint[0]; - thiscoord[1] += minint[1]; - thiscoord[2] += minint[2]; - - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - - flag = decodebits(buf2, 1); - is_smaller = 0; - if (flag == 1) - { - run = decodebits(buf2, 5); - is_smaller = run % 3; - run -= is_smaller; - is_smaller--; - } - if (run > 0) - { - thiscoord += 3; - for (k = 0; k < run; k+=3) - { - decodeints(buf2, 3, smallidx, sizesmall, thiscoord); - i++; - thiscoord[0] += prevcoord[0] - smallnum; - thiscoord[1] += prevcoord[1] - smallnum; - thiscoord[2] += prevcoord[2] - smallnum; - if (k == 0) { - /* interchange first with second atom for better - * compression of water molecules - */ - tmp = thiscoord[0]; thiscoord[0] = prevcoord[0]; - prevcoord[0] = tmp; - tmp = thiscoord[1]; thiscoord[1] = prevcoord[1]; - prevcoord[1] = tmp; - tmp = thiscoord[2]; thiscoord[2] = prevcoord[2]; - prevcoord[2] = tmp; - *lfp++ = prevcoord[0] * inv_precision; - *lfp++ = prevcoord[1] * inv_precision; - *lfp++ = prevcoord[2] * inv_precision; - } else { - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - } - *lfp++ = thiscoord[0] * inv_precision; - *lfp++ = thiscoord[1] * inv_precision; - *lfp++ = thiscoord[2] * inv_precision; - } - } - else - { - *lfp++ = thiscoord[0] * inv_precision; - *lfp++ = thiscoord[1] * inv_precision; - *lfp++ = thiscoord[2] * inv_precision; - } - smallidx += is_smaller; - if (is_smaller < 0) - { - smallnum = smaller; - - if (smallidx > FIRSTIDX) - { - smaller = magicints[smallidx - 1] /2; - } - else - { - smaller = 0; - } - } - else if (is_smaller > 0) - { - smaller = smallnum; - smallnum = magicints[smallidx] / 2; - } - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx] ; - } - return *size; -} - -int -xdrfile_compress_coord_float(float *ptr, - int size, - float precision, - XDRFILE* xfp) -{ - int minint[3], maxint[3], mindiff, *lip, diff; - int lint1, lint2, lint3, oldlint1, oldlint2, oldlint3, smallidx; - int minidx, maxidx; - unsigned sizeint[3], sizesmall[3], bitsizeint[3], size3, *luip; - int k, *buf1, *buf2; - int smallnum, smaller, larger, i, j, is_small, is_smaller, run, prevrun; - float *lfp, lf; - int tmp, tmpsum, *thiscoord, prevcoord[3]; - unsigned int tmpcoord[30]; - int errval=1; - unsigned int bitsize; - - if(xfp==NULL) - return -1; - size3=3*size; - - bitsizeint[0] = 0; - bitsizeint[1] = 0; - bitsizeint[2] = 0; - - if(size3>xfp->buf1size) - { - if((xfp->buf1=(int *)malloc(sizeof(int)*size3))==NULL) - { - fprintf(stderr,"Cannot allocate memory for compressing coordinates.\n"); - return -1; - } - xfp->buf1size=size3; - xfp->buf2size=size3*1.2; - if((xfp->buf2=(int *)malloc(sizeof(int)*xfp->buf2size))==NULL) - { - fprintf(stderr,"Cannot allocate memory for compressing coordinates.\n"); - return -1; - } - } - if(xdrfile_write_int(&size,1,xfp)==0) - return -1; /* return if we could not write size */ - /* Dont bother with compression for three atoms or less */ - if(size<=9) - { - return xdrfile_write_float(ptr,size3,xfp)/3; - /* return number of coords, not floats */ - } - /* Compression-time if we got here. Write precision first */ - if (precision <= 0) - precision = 1000; - xdrfile_write_float(&precision,1,xfp); - /* avoid repeated pointer dereferencing. */ - buf1=xfp->buf1; - buf2=xfp->buf2; - /* buf2[0-2] are special and do not contain actual data */ - buf2[0] = buf2[1] = buf2[2] = 0; - minint[0] = minint[1] = minint[2] = INT_MAX; - maxint[0] = maxint[1] = maxint[2] = INT_MIN; - prevrun = -1; - lfp = ptr; - lip = buf1; - mindiff = INT_MAX; - oldlint1 = oldlint2 = oldlint3 = 0; - while(lfp < ptr + size3 ) - { - /* find nearest integer */ - if (*lfp >= 0.0) - lf = *lfp * precision + 0.5; - else - lf = *lfp * precision - 0.5; - if (fabs(lf) > INT_MAX-2) - { - /* scaling would cause overflow */ - fprintf(stderr,"Internal overflow compressing coordinates.\n"); - errval=0; - } - lint1 = lf; - if (lint1 < minint[0]) minint[0] = lint1; - if (lint1 > maxint[0]) maxint[0] = lint1; - *lip++ = lint1; - lfp++; - if (*lfp >= 0.0) - lf = *lfp * precision + 0.5; - else - lf = *lfp * precision - 0.5; - if (fabs(lf) > INT_MAX-2) - { - /* scaling would cause overflow */ - fprintf(stderr,"Internal overflow compressing coordinates.\n"); - errval=0; - } - lint2 = lf; - if (lint2 < minint[1]) minint[1] = lint2; - if (lint2 > maxint[1]) maxint[1] = lint2; - *lip++ = lint2; - lfp++; - if (*lfp >= 0.0) - lf = *lfp * precision + 0.5; - else - lf = *lfp * precision - 0.5; - if (fabs(lf) > INT_MAX-2) - { - errval=0; - } - lint3 = lf; - if (lint3 < minint[2]) minint[2] = lint3; - if (lint3 > maxint[2]) maxint[2] = lint3; - *lip++ = lint3; - lfp++; - diff = abs(oldlint1-lint1)+abs(oldlint2-lint2)+abs(oldlint3-lint3); - if (diff < mindiff && lfp > ptr + 3) - mindiff = diff; - oldlint1 = lint1; - oldlint2 = lint2; - oldlint3 = lint3; - } - xdrfile_write_int(minint,3,xfp); - xdrfile_write_int(maxint,3,xfp); - - if ((float)maxint[0] - (float)minint[0] >= INT_MAX-2 || - (float)maxint[1] - (float)minint[1] >= INT_MAX-2 || - (float)maxint[2] - (float)minint[2] >= INT_MAX-2) { - /* turning value in unsigned by subtracting minint - * would cause overflow - */ - fprintf(stderr,"Internal overflow compressing coordinates.\n"); - errval=0; - } - sizeint[0] = maxint[0] - minint[0]+1; - sizeint[1] = maxint[1] - minint[1]+1; - sizeint[2] = maxint[2] - minint[2]+1; - - /* check if one of the sizes is to big to be multiplied */ - if ((sizeint[0] | sizeint[1] | sizeint[2] ) > 0xffffff) - { - bitsizeint[0] = sizeofint(sizeint[0]); - bitsizeint[1] = sizeofint(sizeint[1]); - bitsizeint[2] = sizeofint(sizeint[2]); - bitsize = 0; /* flag the use of large sizes */ - } - else - { - bitsize = sizeofints(3, sizeint); - } - lip = buf1; - luip = (unsigned int *) buf1; - smallidx = FIRSTIDX; - while (smallidx < LASTIDX && magicints[smallidx] < mindiff) - { - smallidx++; - } - xdrfile_write_int(&smallidx,1,xfp); - tmp=smallidx+8; - maxidx = (LASTIDX<tmp) ? LASTIDX : tmp; - minidx = maxidx - 8; /* often this equal smallidx */ - tmp=smallidx-1; - tmp= (FIRSTIDX>tmp) ? FIRSTIDX : tmp; - smaller = magicints[tmp] / 2; - smallnum = magicints[smallidx] / 2; - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx]; - larger = magicints[maxidx] / 2; - i = 0; - while (i < size) - { - is_small = 0; - thiscoord = (int *)(luip) + i * 3; - if (smallidx < maxidx && i >= 1 && - abs(thiscoord[0] - prevcoord[0]) < larger && - abs(thiscoord[1] - prevcoord[1]) < larger && - abs(thiscoord[2] - prevcoord[2]) < larger) { - is_smaller = 1; - } - else if (smallidx > minidx) - { - is_smaller = -1; - } - else - { - is_smaller = 0; - } - if (i + 1 < size) - { - if (abs(thiscoord[0] - thiscoord[3]) < smallnum && - abs(thiscoord[1] - thiscoord[4]) < smallnum && - abs(thiscoord[2] - thiscoord[5]) < smallnum) - { - /* interchange first with second atom for better - * compression of water molecules - */ - tmp = thiscoord[0]; thiscoord[0] = thiscoord[3]; - thiscoord[3] = tmp; - tmp = thiscoord[1]; thiscoord[1] = thiscoord[4]; - thiscoord[4] = tmp; - tmp = thiscoord[2]; thiscoord[2] = thiscoord[5]; - thiscoord[5] = tmp; - is_small = 1; - } - } - tmpcoord[0] = thiscoord[0] - minint[0]; - tmpcoord[1] = thiscoord[1] - minint[1]; - tmpcoord[2] = thiscoord[2] - minint[2]; - if (bitsize == 0) - { - encodebits(buf2, bitsizeint[0], tmpcoord[0]); - encodebits(buf2, bitsizeint[1], tmpcoord[1]); - encodebits(buf2, bitsizeint[2], tmpcoord[2]); - } - else - { - encodeints(buf2, 3, bitsize, sizeint, tmpcoord); - } - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - thiscoord = thiscoord + 3; - i++; - - run = 0; - if (is_small == 0 && is_smaller == -1) - is_smaller = 0; - while (is_small && run < 8*3) - { - tmpsum=0; - for(j=0;j<3;j++) - { - tmp=thiscoord[j] - prevcoord[j]; - tmpsum+=tmp*tmp; - } - if (is_smaller == -1 && tmpsum >= smaller * smaller) - { - is_smaller = 0; - } - - tmpcoord[run++] = thiscoord[0] - prevcoord[0] + smallnum; - tmpcoord[run++] = thiscoord[1] - prevcoord[1] + smallnum; - tmpcoord[run++] = thiscoord[2] - prevcoord[2] + smallnum; - - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - - i++; - thiscoord = thiscoord + 3; - is_small = 0; - if (i < size && - abs(thiscoord[0] - prevcoord[0]) < smallnum && - abs(thiscoord[1] - prevcoord[1]) < smallnum && - abs(thiscoord[2] - prevcoord[2]) < smallnum) - { - is_small = 1; - } - } - if (run != prevrun || is_smaller != 0) - { - prevrun = run; - encodebits(buf2, 1, 1); /* flag the change in run-length */ - encodebits(buf2, 5, run+is_smaller+1); - } - else - { - encodebits(buf2, 1, 0); /* flag the fact that runlength did not change */ - } - for (k=0; k < run; k+=3) - { - encodeints(buf2, 3, smallidx, sizesmall, &tmpcoord[k]); - } - if (is_smaller != 0) - { - smallidx += is_smaller; - if (is_smaller < 0) - { - smallnum = smaller; - smaller = magicints[smallidx-1] / 2; - } - else - { - smaller = smallnum; - smallnum = magicints[smallidx] / 2; - } - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx]; - } - } - if (buf2[1] != 0) buf2[0]++; - xdrfile_write_int(buf2,1,xfp); /* buf2[0] holds the length in bytes */ - tmp=xdrfile_write_opaque((char *)&(buf2[3]),(unsigned int)buf2[0],xfp); - if(tmp==(unsigned int)buf2[0]) - return size; - else - return -1; -} - - -int -xdrfile_decompress_coord_double(double *ptr, - int *size, - double *precision, - XDRFILE* xfp) -{ - int minint[3], maxint[3], *lip; - int smallidx, minidx, maxidx; - unsigned sizeint[3], sizesmall[3], bitsizeint[3], size3; - int k, *buf1, *buf2, lsize, flag; - int smallnum, smaller, larger, i, is_smaller, run; - double *lfp, inv_precision; - float float_prec, tmpdata[30]; - int tmp, *thiscoord, prevcoord[3]; - unsigned int bitsize; - - bitsizeint[0] = 0; - bitsizeint[1] = 0; - bitsizeint[2] = 0; - - if(xfp==NULL || ptr==NULL) - return -1; - tmp=xdrfile_read_int(&lsize,1,xfp); - if(tmp==0) - return -1; /* return if we could not read size */ - if (*size < lsize) - { - fprintf(stderr, "Requested to decompress %d coords, file contains %d\n", - *size, lsize); - return -1; - } - *size = lsize; - size3 = *size * 3; - if(size3>xfp->buf1size) - { - if((xfp->buf1=(int *)malloc(sizeof(int)*size3))==NULL) - { - fprintf(stderr,"Cannot allocate memory for decompression coordinates.\n"); - return -1; - } - xfp->buf1size=size3; - xfp->buf2size=size3*1.2; - if((xfp->buf2=(int *)malloc(sizeof(int)*xfp->buf2size))==NULL) - { - fprintf(stderr,"Cannot allocate memory for decompressing coordinates.\n"); - return -1; - } - } - /* Dont bother with compression for three atoms or less */ - if(*size<=9) - { - tmp=xdrfile_read_float(tmpdata,size3,xfp); - for(i=0;i<9*3;i++) - ptr[i]=tmpdata[i]; - return tmp/3; - /* return number of coords, not floats */ - } - /* Compression-time if we got here. Read precision first */ - xdrfile_read_float(&float_prec,1,xfp); - *precision=float_prec; - /* avoid repeated pointer dereferencing. */ - buf1=xfp->buf1; - buf2=xfp->buf2; - /* buf2[0-2] are special and do not contain actual data */ - buf2[0] = buf2[1] = buf2[2] = 0; - xdrfile_read_int(minint,3,xfp); - xdrfile_read_int(maxint,3,xfp); - - sizeint[0] = maxint[0] - minint[0]+1; - sizeint[1] = maxint[1] - minint[1]+1; - sizeint[2] = maxint[2] - minint[2]+1; - - /* check if one of the sizes is to big to be multiplied */ - if ((sizeint[0] | sizeint[1] | sizeint[2] ) > 0xffffff) - { - bitsizeint[0] = sizeofint(sizeint[0]); - bitsizeint[1] = sizeofint(sizeint[1]); - bitsizeint[2] = sizeofint(sizeint[2]); - bitsize = 0; /* flag the use of large sizes */ - } - else - { - bitsize = sizeofints(3, sizeint); - } - - if (xdrfile_read_int(&smallidx,1,xfp) == 0) - return 0; - tmp=smallidx+8; - maxidx = (LASTIDX<tmp) ? LASTIDX : tmp; - minidx = maxidx - 8; /* often this equal smallidx */ - tmp = smallidx-1; - tmp = (FIRSTIDX>tmp) ? FIRSTIDX : tmp; - smaller = magicints[tmp] / 2; - smallnum = magicints[smallidx] / 2; - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx] ; - larger = magicints[maxidx]; - - /* buf2[0] holds the length in bytes */ - - if (xdrfile_read_int(buf2,1,xfp) == 0) - return 0; - if (xdrfile_read_opaque((char *)&(buf2[3]),(unsigned int)buf2[0],xfp) == 0) - return 0; - buf2[0] = buf2[1] = buf2[2] = 0; - - lfp = ptr; - inv_precision = 1.0 / * precision; - run = 0; - i = 0; - lip = buf1; - while ( i < lsize ) - { - thiscoord = (int *)(lip) + i * 3; - - if (bitsize == 0) - { - thiscoord[0] = decodebits(buf2, bitsizeint[0]); - thiscoord[1] = decodebits(buf2, bitsizeint[1]); - thiscoord[2] = decodebits(buf2, bitsizeint[2]); - } else { - decodeints(buf2, 3, bitsize, sizeint, thiscoord); - } - - i++; - thiscoord[0] += minint[0]; - thiscoord[1] += minint[1]; - thiscoord[2] += minint[2]; - - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - - flag = decodebits(buf2, 1); - is_smaller = 0; - if (flag == 1) - { - run = decodebits(buf2, 5); - is_smaller = run % 3; - run -= is_smaller; - is_smaller--; - } - if (run > 0) - { - thiscoord += 3; - for (k = 0; k < run; k+=3) - { - decodeints(buf2, 3, smallidx, sizesmall, thiscoord); - i++; - thiscoord[0] += prevcoord[0] - smallnum; - thiscoord[1] += prevcoord[1] - smallnum; - thiscoord[2] += prevcoord[2] - smallnum; - if (k == 0) - { - /* interchange first with second atom for better - * compression of water molecules - */ - tmp = thiscoord[0]; thiscoord[0] = prevcoord[0]; - prevcoord[0] = tmp; - tmp = thiscoord[1]; thiscoord[1] = prevcoord[1]; - prevcoord[1] = tmp; - tmp = thiscoord[2]; thiscoord[2] = prevcoord[2]; - prevcoord[2] = tmp; - *lfp++ = prevcoord[0] * inv_precision; - *lfp++ = prevcoord[1] * inv_precision; - *lfp++ = prevcoord[2] * inv_precision; - } - else - { - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - } - *lfp++ = thiscoord[0] * inv_precision; - *lfp++ = thiscoord[1] * inv_precision; - *lfp++ = thiscoord[2] * inv_precision; - } - } else { - *lfp++ = thiscoord[0] * inv_precision; - *lfp++ = thiscoord[1] * inv_precision; - *lfp++ = thiscoord[2] * inv_precision; - } - smallidx += is_smaller; - if (is_smaller < 0) { - smallnum = smaller; - if (smallidx > FIRSTIDX) { - smaller = magicints[smallidx - 1] /2; - } else { - smaller = 0; - } - } else if (is_smaller > 0) { - smaller = smallnum; - smallnum = magicints[smallidx] / 2; - } - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx] ; - } - return *size; -} - -int -xdrfile_compress_coord_double(double *ptr, - int size, - double precision, - XDRFILE* xfp) -{ - int minint[3], maxint[3], mindiff, *lip, diff; - int lint1, lint2, lint3, oldlint1, oldlint2, oldlint3, smallidx; - int minidx, maxidx; - unsigned sizeint[3], sizesmall[3], bitsizeint[3], size3, *luip; - int k, *buf1, *buf2; - int smallnum, smaller, larger, i, j, is_small, is_smaller, run, prevrun; - double *lfp; - float float_prec, lf,tmpdata[30]; - int tmp, tmpsum, *thiscoord, prevcoord[3]; - unsigned int tmpcoord[30]; - int errval=1; - unsigned int bitsize; - - bitsizeint[0] = 0; - bitsizeint[1] = 0; - bitsizeint[2] = 0; - - if(xfp==NULL) - return -1; - size3=3*size; - if(size3>xfp->buf1size) { - if((xfp->buf1=(int *)malloc(sizeof(int)*size3))==NULL) { - fprintf(stderr,"Cannot allocate memory for compressing coordinates.\n"); - return -1; - } - xfp->buf1size=size3; - xfp->buf2size=size3*1.2; - if((xfp->buf2=(int *)malloc(sizeof(int)*xfp->buf2size))==NULL) { - fprintf(stderr,"Cannot allocate memory for compressing coordinates.\n"); - return -1; - } - } - if(xdrfile_write_int(&size,1,xfp)==0) - return -1; /* return if we could not write size */ - /* Dont bother with compression for three atoms or less */ - if(size<=9) { - for(i=0;i<9*3;i++) - tmpdata[i]=ptr[i]; - return xdrfile_write_float(tmpdata,size3,xfp)/3; - /* return number of coords, not floats */ - } - /* Compression-time if we got here. Write precision first */ - if (precision <= 0) - precision = 1000; - float_prec=precision; - xdrfile_write_float(&float_prec,1,xfp); - /* avoid repeated pointer dereferencing. */ - buf1=xfp->buf1; - buf2=xfp->buf2; - /* buf2[0-2] are special and do not contain actual data */ - buf2[0] = buf2[1] = buf2[2] = 0; - minint[0] = minint[1] = minint[2] = INT_MAX; - maxint[0] = maxint[1] = maxint[2] = INT_MIN; - prevrun = -1; - lfp = ptr; - lip = buf1; - mindiff = INT_MAX; - oldlint1 = oldlint2 = oldlint3 = 0; - while(lfp < ptr + size3 ) { - /* find nearest integer */ - if (*lfp >= 0.0) - lf = (float)*lfp * float_prec + 0.5; - else - lf = (float)*lfp * float_prec - 0.5; - if (fabs(lf) > INT_MAX-2) { - /* scaling would cause overflow */ - fprintf(stderr,"Internal overflow compressing coordinates.\n"); - errval=0; - } - lint1 = lf; - if (lint1 < minint[0]) minint[0] = lint1; - if (lint1 > maxint[0]) maxint[0] = lint1; - *lip++ = lint1; - lfp++; - if (*lfp >= 0.0) - lf = (float)*lfp * float_prec + 0.5; - else - lf = (float)*lfp * float_prec - 0.5; - if (fabs(lf) > INT_MAX-2) { - /* scaling would cause overflow */ - fprintf(stderr,"Internal overflow compressing coordinates.\n"); - errval=0; - } - lint2 = lf; - if (lint2 < minint[1]) minint[1] = lint2; - if (lint2 > maxint[1]) maxint[1] = lint2; - *lip++ = lint2; - lfp++; - if (*lfp >= 0.0) - lf = (float)*lfp * float_prec + 0.5; - else - lf = (float)*lfp * float_prec - 0.5; - if (fabs(lf) > INT_MAX-2) { - errval=0; - } - lint3 = lf; - if (lint3 < minint[2]) minint[2] = lint3; - if (lint3 > maxint[2]) maxint[2] = lint3; - *lip++ = lint3; - lfp++; - diff = abs(oldlint1-lint1)+abs(oldlint2-lint2)+abs(oldlint3-lint3); - if (diff < mindiff && lfp > ptr + 3) - mindiff = diff; - oldlint1 = lint1; - oldlint2 = lint2; - oldlint3 = lint3; - } - xdrfile_write_int(minint,3,xfp); - xdrfile_write_int(maxint,3,xfp); - - if ((float)maxint[0] - (float)minint[0] >= INT_MAX-2 || - (float)maxint[1] - (float)minint[1] >= INT_MAX-2 || - (float)maxint[2] - (float)minint[2] >= INT_MAX-2) { - /* turning value in unsigned by subtracting minint - * would cause overflow - */ - fprintf(stderr,"Internal overflow compressing coordinates.\n"); - errval=0; - } - sizeint[0] = maxint[0] - minint[0]+1; - sizeint[1] = maxint[1] - minint[1]+1; - sizeint[2] = maxint[2] - minint[2]+1; - - /* check if one of the sizes is to big to be multiplied */ - if ((sizeint[0] | sizeint[1] | sizeint[2] ) > 0xffffff) { - bitsizeint[0] = sizeofint(sizeint[0]); - bitsizeint[1] = sizeofint(sizeint[1]); - bitsizeint[2] = sizeofint(sizeint[2]); - bitsize = 0; /* flag the use of large sizes */ - } else { - bitsize = sizeofints(3, sizeint); - } - lip = buf1; - luip = (unsigned int *) buf1; - smallidx = FIRSTIDX; - while (smallidx < LASTIDX && magicints[smallidx] < mindiff) { - smallidx++; - } - xdrfile_write_int(&smallidx,1,xfp); - tmp=smallidx+8; - maxidx = (LASTIDX<tmp) ? LASTIDX : tmp; - minidx = maxidx - 8; /* often this equal smallidx */ - tmp=smallidx-1; - tmp= (FIRSTIDX>tmp) ? FIRSTIDX : tmp; - smaller = magicints[tmp] / 2; - smallnum = magicints[smallidx] / 2; - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx]; - larger = magicints[maxidx] / 2; - i = 0; - while (i < size) { - is_small = 0; - thiscoord = (int *)(luip) + i * 3; - if (smallidx < maxidx && i >= 1 && - abs(thiscoord[0] - prevcoord[0]) < larger && - abs(thiscoord[1] - prevcoord[1]) < larger && - abs(thiscoord[2] - prevcoord[2]) < larger) { - is_smaller = 1; - } else if (smallidx > minidx) { - is_smaller = -1; - } else { - is_smaller = 0; - } - if (i + 1 < size) { - if (abs(thiscoord[0] - thiscoord[3]) < smallnum && - abs(thiscoord[1] - thiscoord[4]) < smallnum && - abs(thiscoord[2] - thiscoord[5]) < smallnum) { - /* interchange first with second atom for better - * compression of water molecules - */ - tmp = thiscoord[0]; thiscoord[0] = thiscoord[3]; - thiscoord[3] = tmp; - tmp = thiscoord[1]; thiscoord[1] = thiscoord[4]; - thiscoord[4] = tmp; - tmp = thiscoord[2]; thiscoord[2] = thiscoord[5]; - thiscoord[5] = tmp; - is_small = 1; - } - } - tmpcoord[0] = thiscoord[0] - minint[0]; - tmpcoord[1] = thiscoord[1] - minint[1]; - tmpcoord[2] = thiscoord[2] - minint[2]; - if (bitsize == 0) { - encodebits(buf2, bitsizeint[0], tmpcoord[0]); - encodebits(buf2, bitsizeint[1], tmpcoord[1]); - encodebits(buf2, bitsizeint[2], tmpcoord[2]); - } else { - encodeints(buf2, 3, bitsize, sizeint, tmpcoord); - } - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - thiscoord = thiscoord + 3; - i++; - - run = 0; - if (is_small == 0 && is_smaller == -1) - is_smaller = 0; - while (is_small && run < 8*3) { - tmpsum=0; - for(j=0;j<3;j++) { - tmp=thiscoord[j] - prevcoord[j]; - tmpsum+=tmp*tmp; - } - if (is_smaller == -1 && tmpsum >= smaller * smaller) { - is_smaller = 0; - } - - tmpcoord[run++] = thiscoord[0] - prevcoord[0] + smallnum; - tmpcoord[run++] = thiscoord[1] - prevcoord[1] + smallnum; - tmpcoord[run++] = thiscoord[2] - prevcoord[2] + smallnum; - - prevcoord[0] = thiscoord[0]; - prevcoord[1] = thiscoord[1]; - prevcoord[2] = thiscoord[2]; - - i++; - thiscoord = thiscoord + 3; - is_small = 0; - if (i < size && - abs(thiscoord[0] - prevcoord[0]) < smallnum && - abs(thiscoord[1] - prevcoord[1]) < smallnum && - abs(thiscoord[2] - prevcoord[2]) < smallnum) { - is_small = 1; - } - } - if (run != prevrun || is_smaller != 0) { - prevrun = run; - encodebits(buf2, 1, 1); /* flag the change in run-length */ - encodebits(buf2, 5, run+is_smaller+1); - } else { - encodebits(buf2, 1, 0); /* flag the fact that runlength did not change */ - } - for (k=0; k < run; k+=3) { - encodeints(buf2, 3, smallidx, sizesmall, &tmpcoord[k]); - } - if (is_smaller != 0) { - smallidx += is_smaller; - if (is_smaller < 0) { - smallnum = smaller; - smaller = magicints[smallidx-1] / 2; - } else { - smaller = smallnum; - smallnum = magicints[smallidx] / 2; - } - sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx]; - } - } - if (buf2[1] != 0) buf2[0]++; - xdrfile_write_int(buf2,1,xfp); /* buf2[0] holds the length in bytes */ - tmp=xdrfile_write_opaque((char *)&(buf2[3]),(unsigned int)buf2[0],xfp); - if(tmp==(unsigned int)buf2[0]) - return size; - else - return -1; -} - - -/* Dont try do document Fortran interface, since - * Doxygen barfs at the F77_FUNC macro - */ -#ifndef DOXYGEN - -/************************************************************* - * Fortran77 interface for reading/writing portable data * - * The routine are not threadsafe when called from Fortran * - * (as they are when called from C) unless you compile with * - * this file with posix thread support. * - * Note that these are not multithread-safe. * - *************************************************************/ -#define MAX_FORTRAN_XDR 1024 -static XDRFILE *f77xdr[MAX_FORTRAN_XDR]; /* array of file handles */ -static int f77init = 1; /* zero array first time */ - -/* internal to this file: C<-->Fortran string conversion */ -static int ftocstr(char *dest, int dest_len, char *src, int src_len); -static int ctofstr(char *dest, int dest_len, char *src); - - -void -F77_FUNC(xdropen,XDROPEN)(int *fid, char *filename, char *mode, - int fn_len, int mode_len) -{ - char cfilename[512]; - char cmode[5]; - int i; - - /* zero array at first invocation */ - if(f77init) { - for(i=0;i<MAX_FORTRAN_XDR;i++) - f77xdr[i]=NULL; - f77init=0; - } - i=0; - - /* nf77xdr is always smaller or equal to MAX_FORTRAN_XDR */ - while(i<MAX_FORTRAN_XDR && f77xdr[i]!=NULL) - i++; - if(i==MAX_FORTRAN_XDR) { - *fid = -1; - } else if (ftocstr(cfilename, sizeof(cfilename), filename, fn_len)) { - *fid = -1; - } else if (ftocstr(cmode, sizeof(cmode), mode,mode_len)) { - *fid = -1; - } else { - f77xdr[i]=xdrfile_open(cfilename,cmode); - /* return the index in the array as a fortran file handle */ - *fid=i; - } -} - -void -F77_FUNC(xdrclose,XDRCLOSE)(int *fid) -{ - /* first close it */ - xdrfile_close(f77xdr[*fid]); - /* the remove it from file handle list */ - f77xdr[*fid]=NULL; -} - - -void -F77_FUNC(xdrrint,XDRRINT)(int *fid, int *data, int *ndata, int *ret) -{ - *ret = xdrfile_read_int(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwint,XDRWINT)(int *fid, int *data, int *ndata, int *ret) -{ - *ret = xdrfile_write_int(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrruint,XDRRUINT)(int *fid, unsigned int *data, int *ndata, int *ret) -{ - *ret = xdrfile_read_uint(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwuint,XDRWUINT)(int *fid, unsigned int *data, int *ndata, int *ret) -{ - *ret = xdrfile_write_uint(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrrchar,XDRRCHAR)(int *fid, char *ip, int *ndata, int *ret) -{ - *ret = xdrfile_read_char(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwchar,XDRWCHAR)(int *fid, char *ip, int *ndata, int *ret) -{ - *ret = xdrfile_write_char(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrruchar,XDRRUCHAR)(int *fid, unsigned char *ip, int *ndata, int *ret) -{ - *ret = xdrfile_read_uchar(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwuchar,XDRWUCHAR)(int *fid, unsigned char *ip, int *ndata, int *ret) -{ - *ret = xdrfile_write_uchar(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrrshort,XDRRSHORT)(int *fid, short *ip, int *ndata, int *ret) -{ - *ret = xdrfile_read_short(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwshort,XDRWSHORT)(int *fid, short *ip, int *ndata, int *ret) -{ - *ret = xdrfile_write_short(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrrushort,XDRRUSHORT)(int *fid, unsigned short *ip, int *ndata, int *ret) -{ - *ret = xdrfile_read_ushort(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwushort,XDRWUSHORT)(int *fid, unsigned short *ip, int *ndata, int *ret) -{ - *ret = xdrfile_write_ushort(ip,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrrsingle,XDRRSINGLE)(int *fid, float *data, int *ndata, int *ret) -{ - *ret = xdrfile_read_float(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwsingle,XDRWSINGLE)(int *fid, float *data, int *ndata, int *ret) -{ - *ret = xdrfile_write_float(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrrdouble,XDRRDOUBLE)(int *fid, double *data, int *ndata, int *ret) -{ - *ret = xdrfile_read_double(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwdouble,XDRWDOUBLE)(int *fid, double *data, int *ndata, int *ret) -{ - *ret = xdrfile_write_double(data,*ndata,f77xdr[*fid]); -} - -static int ftocstr(char *dest, int destlen, char *src, int srclen) -{ - char *p; - - p = src + srclen; - while ( --p >= src && *p == ' ' ); - srclen = p - src + 1; - destlen--; - dest[0] = 0; - if (srclen > destlen) - return 1; - while (srclen--) - (*dest++ = *src++); - *dest = '\0'; - return 0; -} - - -static int ctofstr(char *dest, int destlen, char *src) -{ - while (destlen && *src) { - *dest++ = *src++; - destlen--; - } - while (destlen--) - *dest++ = ' '; - return 0; -} - - -void -F77_FUNC(xdrrstring,XDRRSTRING)(int *fid, char *str, int *ret, int len) -{ - char *cstr; - - if((cstr=(char*)malloc((len+1)*sizeof(char)))==NULL) { - *ret = 0; - return; - } - if (ftocstr(cstr, len+1, str, len)) { - *ret = 0; - free(cstr); - return; - } - - *ret = xdrfile_read_string(cstr, len+1,f77xdr[*fid]); - ctofstr( str, len , cstr); - free(cstr); -} - -void -F77_FUNC(xdrwstring,XDRWSTRING)(int *fid, char *str, int *ret, int len) -{ - char *cstr; - - if((cstr=(char*)malloc((len+1)*sizeof(char)))==NULL) { - *ret = 0; - return; - } - if (ftocstr(cstr, len+1, str, len)) { - *ret = 0; - free(cstr); - return; - } - - *ret = xdrfile_write_string(cstr, f77xdr[*fid]); - ctofstr( str, len , cstr); - free(cstr); -} - -void -F77_FUNC(xdrropaque,XDRROPAQUE)(int *fid, char *data, int *ndata, int *ret) -{ - *ret = xdrfile_read_opaque(data,*ndata,f77xdr[*fid]); -} - -void -F77_FUNC(xdrwopaque,XDRWOPAQUE)(int *fid, char *data, int *ndata, int *ret) -{ - *ret = xdrfile_write_opaque(data,*ndata,f77xdr[*fid]); -} - - -/* Write single-precision compressed 3d coordinates */ -void -F77_FUNC(xdrccs,XDRCCS)(int *fid, float *data, int *ncoord, - float *precision, int *ret) -{ - *ret = xdrfile_compress_coord_float(data,*ncoord,*precision,f77xdr[*fid]); -} - - -/* Read single-precision compressed 3d coordinates */ -void -F77_FUNC(xdrdcs,XDRDCS)(int *fid, float *data, int *ncoord, - float *precision, int *ret) -{ - *ret = xdrfile_decompress_coord_float(data,ncoord,precision,f77xdr[*fid]); -} - - -/* Write compressed 3d coordinates from double precision data */ -void -F77_FUNC(xdrccd,XDRCCD)(int *fid, double *data, int *ncoord, - double *precision, int *ret) -{ - *ret = xdrfile_compress_coord_double(data,*ncoord,*precision,f77xdr[*fid]); -} - -/* Read compressed 3d coordinates into double precision data */ -void -F77_FUNC(xddcd,XDRDCD)(int *fid, double *data, int *ncoord, - double *precision, int *ret) -{ - *ret = xdrfile_decompress_coord_double(data,ncoord,precision,f77xdr[*fid]); -} - - - - - - - -#endif /* DOXYGEN */ - -/************************************************************* - * End of higher-level routines - dont change things below! * - *************************************************************/ - - - - - - - - - - - - - - - - - - - - -/************************************************************* - * The rest of this file contains our own implementation * - * of the XDR calls in case you are compiling without them. * - * You do NOT want to change things here since it would make * - * things incompatible with the standard RPC/XDR routines. * - *************************************************************/ -#ifndef HAVE_RPC_XDR_H - -/* - * What follows is a modified version of the Sun XDR code. For reference - * we include their copyright and license: - * - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* INT_MAX is defined in limits.h according to ANSI C */ -#if (INT_MAX > 2147483647) -# error Error: Cannot use builtin XDR support when size of int -# error is larger than 4 bytes. Use your system XDR libraries -# error instead, or modify the source code in xdrfile.c -#endif /* Check for 4 byte int type */ - - - - - -typedef int (*xdrproc_t) (XDR *, void *,...); - -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define BYTES_PER_XDR_UNIT 4 -static char xdr_zero[BYTES_PER_XDR_UNIT] = {0, 0, 0, 0}; - -static int32_t -xdr_swapbytes(int32_t x) -{ - int32_t y,i; - char *px=(char *)&x; - char *py=(char *)&y; - - for(i=0;i<4;i++) - py[i]=px[3-i]; - - return y; -} - -static int32_t -xdr_htonl(int32_t x) -{ - int s=0x1234; - if( *((char *)&s)==(char)0x34) { - /* smallendian,swap bytes */ - return xdr_swapbytes(x); - } else { - /* bigendian, do nothing */ - return x; - } -} - -static int32_t -xdr_ntohl(int x) -{ - int s=0x1234; - if( *((char *)&s)==(char)0x34) { - /* smallendian, swap bytes */ - return xdr_swapbytes(x); - } else { - /* bigendian, do nothing */ - return x; - } -} - -static int -xdr_int (XDR *xdrs, int *ip) -{ - int32_t i32; - - switch (xdrs->x_op) - { - case XDR_ENCODE: - i32 = (int32_t) *ip; - return xdr_putlong (xdrs, &i32); - - case XDR_DECODE: - if (!xdr_getlong (xdrs, &i32)) - { - return 0; - } - *ip = (int) i32; - case XDR_FREE: - return 1; - } - return 0; -} - -static int -xdr_u_int (XDR *xdrs, unsigned int *up) -{ - uint32_t ui32; - - switch (xdrs->x_op) - { - case XDR_ENCODE: - ui32 = (uint32_t) * up; - return xdr_putlong (xdrs, (int32_t *)&ui32); - - case XDR_DECODE: - if (!xdr_getlong (xdrs, (int32_t *)&ui32)) - { - return 0; - } - *up = (uint32_t) ui32; - case XDR_FREE: - return 1; - } - return 0; -} - -static int -xdr_short (XDR *xdrs, short *sp) -{ - int32_t i32; - - switch (xdrs->x_op) - { - case XDR_ENCODE: - i32 = (int32_t) *sp; - return xdr_putlong (xdrs, &i32); - - case XDR_DECODE: - if (!xdr_getlong (xdrs, &i32)) - { - return 0; - } - *sp = (short) i32; - return 1; - - case XDR_FREE: - return 1; - } - return 0; -} - -static int -xdr_u_short (XDR *xdrs, unsigned short *sp) -{ - uint32_t ui32; - - switch (xdrs->x_op) - { - case XDR_ENCODE: - ui32 = (uint32_t) *sp; - return xdr_putlong (xdrs, (int32_t *)&ui32); - - case XDR_DECODE: - if (!xdr_getlong (xdrs, (int32_t *)&ui32)) - { - return 0; - } - *sp = (unsigned short) ui32; - return 1; - - case XDR_FREE: - return 1; - } - return 0; -} - -static int -xdr_char (XDR *xdrs, char *cp) -{ - int i; - - i = (*cp); - if (!xdr_int (xdrs, &i)) - { - return 0; - } - *cp = i; - return 1; -} - -static int -xdr_u_char (XDR *xdrs, unsigned char *cp) -{ - unsigned int u; - - u = (*cp); - if (!xdr_u_int (xdrs, &u)) - { - return 0; - } - *cp = u; - return 1; -} - -/* - * XDR opaque data - * Allows the specification of a fixed size sequence of opaque bytes. - * cp points to the opaque object and cnt gives the byte length. - */ -static int -xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt) -{ - unsigned int rndup; - static char crud[BYTES_PER_XDR_UNIT]; - - /* - * if no data we are done - */ - if (cnt == 0) - return 1; - - /* - * round byte count to full xdr units - */ - rndup = cnt % BYTES_PER_XDR_UNIT; - if (rndup > 0) - rndup = BYTES_PER_XDR_UNIT - rndup; - - switch (xdrs->x_op) - { - case XDR_DECODE: - if (!xdr_getbytes (xdrs, cp, cnt)) - { - return 0; - } - if (rndup == 0) - return 1; - return xdr_getbytes (xdrs, (char *)crud, rndup); - - case XDR_ENCODE: - if (!xdr_putbytes (xdrs, cp, cnt)) - { - return 0; - } - if (rndup == 0) - return 1; - return xdr_putbytes (xdrs, xdr_zero, rndup); - - case XDR_FREE: - return 1; - } -#undef BYTES_PER_XDR_UNIT - return 0; -} - - -/* - * XDR null terminated ASCII strings - */ -static int -xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) -{ - char *sp = *cpp; /* sp is the actual string pointer */ - unsigned int size; - unsigned int nodesize; - - /* - * first deal with the length since xdr strings are counted-strings - */ - switch (xdrs->x_op) - { - case XDR_FREE: - if (sp == NULL) - { - return 1; /* already free */ - } - /* fall through... */ - case XDR_ENCODE: - if (sp == NULL) - return 0; - size = strlen (sp); - break; - case XDR_DECODE: - break; - } - if (!xdr_u_int (xdrs, &size)) - { - return 0; - } - if (size > maxsize) - { - return 0; - } - nodesize = size + 1; - - /* - * now deal with the actual bytes - */ - switch (xdrs->x_op) - { - case XDR_DECODE: - if (nodesize == 0) - { - return 1; - } - if (sp == NULL) - *cpp = sp = (char *) malloc (nodesize); - if (sp == NULL) - { - (void) fputs ("xdr_string: out of memory\n", stderr); - return 0; - } - sp[size] = 0; - /* fall into ... */ - - case XDR_ENCODE: - return xdr_opaque (xdrs, sp, size); - - case XDR_FREE: - free (sp); - *cpp = NULL; - return 1; - } - return 0; -} - - - -/* Floating-point stuff */ - -static int -xdr_float(XDR *xdrs, float *fp) -{ - switch (xdrs->x_op) { - - case XDR_ENCODE: - if (sizeof(float) == sizeof(int32_t)) - return (xdr_putlong(xdrs, (int32_t *)fp)); - else if (sizeof(float) == sizeof(int)) { - int32_t tmp = *(int *)fp; - return (xdr_putlong(xdrs, &tmp)); - } - break; - - case XDR_DECODE: - if (sizeof(float) == sizeof(int32_t)) - return (xdr_getlong(xdrs, (int32_t *)fp)); - else if (sizeof(float) == sizeof(int)) { - int32_t tmp; - if (xdr_getlong(xdrs, &tmp)) { - *(int *)fp = tmp; - return (1); - } - } - break; - - case XDR_FREE: - return (1); - } - return (0); -} - - -static int -xdr_double(XDR *xdrs, double *dp) -{ - /* Gromacs detects floating-point stuff at compile time, which is faster */ -#ifdef GROMACS -# ifndef FLOAT_FORMAT_IEEE754 -# error non-IEEE floating point system, or you defined GROMACS yourself... -# endif - int LSW; -# ifdef IEEE754_BIG_ENDIAN_WORD_ORDER - int LSW=1; -# else - int LSW=0; -# endif /* Big endian word order */ -#else - /* Outside Gromacs we rely on dynamic detection of FP order. */ - int LSW; /* Least significant fp word */ - - double x=0.987654321; /* Just a number */ - unsigned char ix = *((char *)&x); - - /* Possible representations in IEEE double precision: - * (S=small endian, B=big endian) - * - * Byte order, Word order, Hex - * S S b8 56 0e 3c dd 9a ef 3f - * B S 3c 0e 56 b8 3f ef 9a dd - * S B dd 9a ef 3f b8 56 0e 3c - * B B 3f ef 9a dd 3c 0e 56 b8 - */ - if(ix==0xdd || ix==0x3f) - LSW=1; /* Big endian word order */ - else if(ix==0xb8 || ix==0x3c) - LSW=0; /* Small endian word order */ - else { /* Catch strange errors */ - fprintf(stderr,"Cannot detect floating-point word order.\n" - "Do you have a non-IEEE system?\n" - "Use system XDR libraries or fix xdr_double().\n"); - abort(); - } -#endif /* end of dynamic detection of fp word order */ - - switch (xdrs->x_op) { - - case XDR_ENCODE: - if (2*sizeof(int32_t) == sizeof(double)) { - int32_t *lp = (int32_t *)dp; - return (xdr_putlong(xdrs, lp+!LSW) && - xdr_putlong(xdrs, lp+LSW)); - } else if (2*sizeof(int) == sizeof(double)) { - int *ip = (int *)dp; - int32_t tmp[2]; - tmp[0] = ip[!LSW]; - tmp[1] = ip[LSW]; - return (xdr_putlong(xdrs, tmp) && - xdr_putlong(xdrs, tmp+1)); - } - break; - - case XDR_DECODE: - if (2*sizeof(int32_t) == sizeof(double)) { - int32_t *lp = (int32_t *)dp; - return (xdr_getlong(xdrs, lp+!LSW) && - xdr_getlong(xdrs, lp+LSW)); - } else if (2*sizeof(int) == sizeof(double)) { - int *ip = (int *)dp; - int32_t tmp[2]; - if (xdr_getlong(xdrs, tmp+!LSW) && - xdr_getlong(xdrs, tmp+LSW)) { - ip[0] = tmp[0]; - ip[1] = tmp[1]; - return (1); - } - } - break; - - case XDR_FREE: - return (1); - } - return (0); -} - - -static int xdrstdio_getlong (XDR *, int32_t *); -static int xdrstdio_putlong (XDR *, int32_t *); -static int xdrstdio_getbytes (XDR *, char *, unsigned int); -static int xdrstdio_putbytes (XDR *, char *, unsigned int); -static off_t xdrstdio_getpos (XDR *); -static int xdrstdio_setpos (XDR *, off_t, int); -static void xdrstdio_destroy (XDR *); - -/* - * Ops vector for stdio type XDR - */ -static const struct xdr_ops xdrstdio_ops = - { - xdrstdio_getlong, /* deserialize a long int */ - xdrstdio_putlong, /* serialize a long int */ - xdrstdio_getbytes, /* deserialize counted bytes */ - xdrstdio_putbytes, /* serialize counted bytes */ - xdrstdio_getpos, /* get offset in the stream */ - xdrstdio_setpos, /* set offset in the stream */ - xdrstdio_destroy, /* destroy stream */ - }; - -/* - * Initialize a stdio xdr stream. - * Sets the xdr stream handle xdrs for use on the stream file. - * Operation flag is set to op. - */ -static void -xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op) -{ - xdrs->x_op = op; - - xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops; - xdrs->x_private = (char *) file; -} - -/* - * Destroy a stdio xdr stream. - * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create. - */ -static void -xdrstdio_destroy (XDR *xdrs) -{ - (void) fflush ((FILE *) xdrs->x_private); - /* xx should we close the file ?? */ -} - -static int -xdrstdio_getlong (XDR *xdrs, int32_t *lp) -{ - int32_t mycopy; - - if (fread ((char *) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) - return 0; - *lp = (int32_t) xdr_ntohl (mycopy); - return 1; -} - -static int -xdrstdio_putlong (XDR *xdrs, int32_t *lp) -{ - int32_t mycopy = xdr_htonl (*lp); - lp = &mycopy; - if (fwrite ((char *) lp, 4, 1, (FILE *) xdrs->x_private) != 1) - return 0; - return 1; -} - -static int -xdrstdio_getbytes (XDR *xdrs, char *addr, unsigned int len) -{ - if ((len != 0) && (fread (addr, (int) len, 1, - (FILE *) xdrs->x_private) != 1)) - return 0; - return 1; -} - -static int -xdrstdio_putbytes (XDR *xdrs, char *addr, unsigned int len) -{ - if ((len != 0) && (fwrite (addr, (int) len, 1, - (FILE *) xdrs->x_private) != 1)) - return 0; - return 1; -} - - -static off_t -xdrstdio_getpos (XDR *xdrs) -{ - return ftello((FILE *) xdrs->x_private); -} - -static int -xdrstdio_setpos (XDR *xdrs, off_t pos, int whence) -{ - return fseeko((FILE *) xdrs->x_private, pos, whence) < 0 ? exdrNR : exdrOK; -} - - -int64_t xdr_tell(XDRFILE *xd) -/* Reads position in file */ -{ - return (int64_t)xdrstdio_getpos(xd->xdr); -} - -int xdr_seek(XDRFILE *xd, int64_t pos, int whence) -/* Seeks to position in file */ -{ - int result; - if ((result = xdrstdio_setpos(xd->xdr, (off_t) pos, whence)) != exdrOK) - return result; - - return exdrOK; -} - - -#endif /* HAVE_RPC_XDR_H not defined */ diff --git a/pymolfile/libpymolfile-old/xdrfile.h b/pymolfile/libpymolfile-old/xdrfile.h deleted file mode 100644 index 1d1d6c5d90e0b7cd11726e2f2721011c6e4180c1..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/xdrfile.h +++ /dev/null @@ -1,631 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- - * - * $Id$ - * - * Copyright (c) Erik Lindahl, David van der Spoel 2003,2004. - * Copyright (c) Manuel Melo <manuel.nuno.melo@gmail.com> 2013,2014. - * Coordinate compression (c) by Frans van Hoesel. - * XTC/TRR seeking and indexing (c) Manuel Melo. - * - * This file is part of libxdrfile2. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -/*! \file xdrfile.h - * \brief Interface to read/write portabile binary files using XDR. - * - * This file provides an interface to read & write portably binary files, - * using XDR - the external data representation standard defined in RFC 1014. - * - * There are several advantages to the XDR approach: - * - * -# It is portable. And not just portable between big/small integer endian, - * but truly portable if you have system XDR routines. For example: - * - It doesn't matter if the character representation is ASCII or EBCDIC. - * - Some systems are small endian but use big endian order of the two - * dword in a double precision floating-point variable. The system XDR - * libraries will read/write this correctly. - * - Some systems (VAX...) don't use IEEE floating point. Their system - * XDR libraries will convert to/from this automatically. - * -# XDR libraries are required for NFS and lots of other network functions. - * This means there isn't a single Unix-like system that doesn't have them. - * -# There is NO extra metadata whatsoever, and we write plain XDR files. - * If you write a float, it will take exactly 4 bytes in the file. - * (All basic datatypes are 4 bytes, double fp 8 bytes). - * -# You can read/write the files by calling the system XDR routines directly - * too - you don't have to use the routines defined in this file. - * -# It is no problem if your system doesn't have XDR libraries (MS Windows). - * We have written our own versions of the necessary routines that work if - * your system uses ASCII for strings and IEEE floating-point. All types - * of byte and dword endian for integer and floating-point are supported. - * -# You can use these routines for any type of data, but since we designed - * them for Gromacs we also provide a special routine to write coordinates - * with (adjustable) lossy compression. The default precision will give you - * three decimals guaranteed accuracy, and reduces the filesize to 1/10th - * of normal binary data. - * - * We do not support getting or setting positions in XDR files, since it can - * break in horrible ways for large (64-bit) files, resulting in silent data - * corruption. Note that it works great to open/read/write 64-bit files if - * your system supports it; it is just the random access we cannot trust! - * - * We also provide wrapper routines so this module can be used from FORTRAN - - * see the file xdrfile_fortran.txt in the Gromacs distribution for - * documentation on the FORTRAN interface! - */ - - -#ifndef _XDRFILE_H_ -#define _XDRFILE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - - /*! \brief Abstract datatype for an portable binary file handle - * - * This datatype essentially works just like the standard FILE type in C. - * The actual contents is hidden in the implementation, so you can only - * define pointers to it, for use with the xdrfile routines. - * - * If you \a really need to see the definition it is in xdrfile.c, but you - * cannot access elements of the structure outside that file. - * - * \warning The implementation is completely different from the C standard - * library FILE, so don't even think about using an XDRFILE pointer as an - * argument to a routine that needs a standard FILE pointer. - */ - typedef struct XDRFILE XDRFILE; - - enum { exdrOK, exdrHEADER, exdrSTRING, exdrDOUBLE, - exdrINT, exdrFLOAT, exdrUINT, exdr3DX, exdrCLOSE, exdrMAGIC, - exdrNOMEM, exdrENDOFFILE, exdrFILENOTFOUND, exdrNR }; - - extern char *exdr_message[exdrNR]; - -#define DIM 3 - typedef float matrix[DIM][DIM]; - typedef float rvec[DIM]; - typedef int mybool; - - - /*! \brief Open a portable binary file, just like fopen() - * - * Use this routine much like calls to the standard library function - * fopen(). The only difference is that the returned pointer should only - * be used with routines defined in this header. - * - * \param path Full or relative path (including name) of the file - * \param mode "r" for reading, "w" for writing, "a" for append. - * - * \return Pointer to abstract xdr file datatype, or NULL if an error occurs. - * - */ - XDRFILE * - xdrfile_open (const char * path, - const char * mode); - - - /*! \brief Close a previously opened portable binary file, just like fclose() - * - * Use this routine much like calls to the standard library function - * fopen(). The only difference is that it is used for an XDRFILE handle - * instead of a FILE handle. - * - * \param xfp Pointer to an abstract XDRFILE datatype - * - * \return 0 on success, non-zero on error. - */ - int - xdrfile_close (XDRFILE * xfp); - - - - - /*! \brief Read one or more \a char type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of characters to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of characters read - */ - int - xdrfile_read_char(char * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a characters type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of characters to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of characters written - */ - int - xdrfile_write_char(char * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Read one or more \a unsigned \a char type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of unsigned characters to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of unsigned characters read - */ - int - xdrfile_read_uchar(unsigned char * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a unsigned \a characters type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of unsigned characters to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of unsigned characters written - */ - int - xdrfile_write_uchar(unsigned char * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Read one or more \a short type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of shorts to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of shorts read - */ - int - xdrfile_read_short(short * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a short type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of shorts to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of shorts written - */ - int - xdrfile_write_short(short * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Read one or more \a unsigned \a short type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of unsigned shorts to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of unsigned shorts read - */ - int - xdrfile_read_ushort(unsigned short * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a unsigned \a short type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of unsigned shorts to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of unsigned shorts written - */ - int - xdrfile_write_ushort(unsigned short * ptr, - int ndata, - XDRFILE * xfp); - - - /*! \brief Read one or more \a integer type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of integers to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of integers read - * - * The integer data type is assumed to be less than or equal to 32 bits. - * - * We do not provide any routines for reading/writing 64-bit integers, since - * - Not all XDR implementations support it - * - Not all machines have 64-bit integers - * - * Split your 64-bit data into two 32-bit integers for portability! - */ - int - xdrfile_read_int(int * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a integer type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of integers to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of integers written - * - * The integer data type is assumed to be less than or equal to 32 bits. - * - * We do not provide any routines for reading/writing 64-bit integers, since - * - Not all XDR implementations support it - * - Not all machines have 64-bit integers - * - * Split your 64-bit data into two 32-bit integers for portability! - */ - int - xdrfile_write_int(int * ptr, - int ndata, - XDRFILE * xfp); - - /*! \brief Read one or more \a unsigned \a integers type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of unsigned integers to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of unsigned integers read - * - * The integer data type is assumed to be less than or equal to 32 bits. - * - * We do not provide any routines for reading/writing 64-bit integers, since - * - Not all XDR implementations support it - * - Not all machines have 64-bit integers - * - * Split your 64-bit data into two 32-bit integers for portability! - */ - int - xdrfile_read_uint(unsigned int * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a unsigned \a integer type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of unsigned integers to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of unsigned integers written - * - * The integer data type is assumed to be less than or equal to 32 bits. - * - * We do not provide any routines for reading/writing 64-bit integers, since - * - Not all XDR implementations support it - * - Not all machines have 64-bit integers - * - * Split your 64-bit data into two 32-bit integers for portability! - */ - int - xdrfile_write_uint(unsigned int * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Read one or more \a float type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of floats to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of floats read - */ - int - xdrfile_read_float(float * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a float type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of floats to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of floats written - */ - int - xdrfile_write_float(float * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Read one or more \a double type variable(s) - * - * \param ptr Pointer to memory where data should be written - * \param ndata Number of doubles to read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of doubles read - */ - int - xdrfile_read_double(double * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Write one or more \a double type variable(s) - * - * \param ptr Pointer to memory where data should be read - * \param ndata Number of double to write. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of doubles written - */ - int - xdrfile_write_double(double * ptr, - int ndata, - XDRFILE * xfp); - - - - /*! \brief Read a string (array of characters) - * - * \param ptr Pointer to memory where data should be written - * \param maxlen Maximum length of string. If no end-of-string is encountered, - * one byte less than this is read and end-of-string appended. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of characters read, including end-of-string - */ - int - xdrfile_read_string(char * ptr, - int maxlen, - XDRFILE * xfp); - - - - /*! \brief Write a string (array of characters) - * - * \param ptr Pointer to memory where data should be read - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of characters written, including end-of-string - */ - int - xdrfile_write_string(char * ptr, - XDRFILE * xfp); - - - - /*! \brief Read raw bytes from file (unknown datatype) - * - * \param ptr Pointer to memory where data should be written - * \param nbytes Number of bytes to read. No conversion whatsoever is done. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of bytes read from file - */ - int - xdrfile_read_opaque(char * ptr, - int nbytes, - XDRFILE * xfp); - - - - - /*! \brief Write raw bytes to file (unknown datatype) - * - * \param ptr Pointer to memory where data should be read - * \param nbytes Number of bytes to write. No conversion whatsoever is done. - * \param xfp Handle to portable binary file, created with xdrfile_open() - * - * \return Number of bytes written to file - */ - int - xdrfile_write_opaque(char * ptr, - int nbytes, - XDRFILE * xfp); - - - - - - - /*! \brief Compress coordiates in a float array to XDR file - * - * This routine will perform \a lossy compression on the three-dimensional - * coordinate data data specified and store it in the XDR file. - * - * The lossy part of the compression consists of multiplying each - * coordinate with the precision argument and then rounding to integers. - * We suggest a default value of 1000.0, which means you are guaranteed - * three decimals of accuracy. The only limitation is that scaled coordinates - * must still fit in an integer variable, so if the precision is 1000.0 the - * coordinate magnitudes must be less than +-2e6. - * - * \param ptr Pointer to coordinates to compress (length 3*ncoord) - * \param ncoord Number of coordinate triplets in data - * \param precision Scaling factor for lossy compression. If it is <=0, - * the default value of 1000.0 is used. - * \param xfp Handle to portably binary file - * - * \return Number of coordinate triplets written. - * IMPORTANT: Check that this is equal to ncoord - if it is - * negative, an error occured. This should not happen with - * normal data, but if your coordinates are NaN or very - * large (>1e6) it is not possible to use the compression. - * - * \warning The compression algorithm is not part of the XDR standard, - * and very complicated, so you will need this xdrfile module - * to read it later. - */ - int - xdrfile_compress_coord_float(float * ptr, - int ncoord, - float precision, - XDRFILE * xfp); - - - - - /*! \brief Decompress coordiates from XDR file to array of floats - * - * This routine will decompress three-dimensional coordinate data previously - * stored in an XDR file and store it in the specified array of floats. - * - * The precision used during the earlier compression is read from the file - * and returned - you cannot adjust the accuracy at this stage. - * - * \param ptr Pointer to coordinates to compress (length>= 3*ncoord) - * \param ncoord Max number of coordinate triplets to read on input, actual - * number of coordinate triplets read on return. If this - * is smaller than the number of coordinates in the frame an - * error will occur. - * \param precision The precision used in the previous compression will be - * written to this variable on return. - * \param xfp Handle to portably binary file - * - * \return Number of coordinate triplets read. If this is negative, - * an error occured. - * - * \warning Since we cannot count on being able to set/get the - * position of large files (>2Gb), it is not possible to - * recover from errors by re-reading the frame if the - * storage area you provided was too small. To avoid this - * from happening, we recommend that you store the number of - * coordinates triplet as an integer either in a header or - * just before the compressed coordinate data, so you can - * read it first and allocated enough memory. - */ - int - xdrfile_decompress_coord_float(float * ptr, - int * ncoord, - float * precision, - XDRFILE * xfp); - - - - - /*! \brief Compress coordiates in a double array to XDR file - * - * This routine will perform \a lossy compression on the three-dimensional - * coordinate data data specified and store it in the XDR file. Double will - * NOT give you any extra precision since the coordinates are compressed. This - * routine just avoids allocating a temporary array of floats. - * - * The lossy part of the compression consists of multiplying each - * coordinate with the precision argument and then rounding to integers. - * We suggest a default value of 1000.0, which means you are guaranteed - * three decimals of accuracy. The only limitation is that scaled coordinates - * must still fit in an integer variable, so if the precision is 1000.0 the - * coordinate magnitudes must be less than +-2e6. - * - * \param ptr Pointer to coordinates to compress (length 3*ncoord) - * \param ncoord Number of coordinate triplets in data - * \param precision Scaling factor for lossy compression. If it is <=0, the - * default value of 1000.0 is used. - * \param xfp Handle to portably binary file - * - * \return Number of coordinate triplets written. - * IMPORTANT: Check that this is equal to ncoord - if it is - * negative, an error occured. This should not happen with - * normal data, but if your coordinates are NaN or very - * large (>1e6) it is not possible to use the compression. - * - * \warning The compression algorithm is not part of the XDR standard, - * and very complicated, so you will need this xdrfile module - * to read it later. - */ - int - xdrfile_compress_coord_double(double * ptr, - int ncoord, - double precision, - XDRFILE * xfp); - - - - - /*! \brief Decompress coordiates from XDR file to array of doubles - * - * This routine will decompress three-dimensional coordinate data previously - * stored in an XDR file and store it in the specified array of doubles. - * Double will NOT give you any extra precision since the coordinates are - * compressed. This routine just avoids allocating a temporary array of floats. - * - * The precision used during the earlier compression is read from the file - * and returned - you cannot adjust the accuracy at this stage. - * - * \param ptr Pointer to coordinates to compress (length>= 3*ncoord) - * \param ncoord Max number of coordinate triplets to read on input, actual - * number of coordinate triplets read on return. If this - * is smaller than the number of coordinates in the frame an - * error will occur. - * \param precision The precision used in the previous compression will be - * written to this variable on return. - * \param xfp Handle to portably binary file - * - * \return Number of coordinate triplets read. If this is negative, - * an error occured. - * - * \warning Since we cannot count on being able to set/get the - * position of large files (>2Gb), it is not possible to - * recover from errors by re-reading the frame if the - * storage area you provided was too small. To avoid this - * from happening, we recommend that you store the number of - * coordinates triplet as an integer either in a header or - * just before the compressed coordinate data, so you can - * read it first and allocated enough memory. - */ - int - xdrfile_decompress_coord_double(double * ptr, - int * ncoord, - double * precision, - XDRFILE * xfp); - - int64_t xdr_tell(XDRFILE *xd); - int xdr_seek(XDRFILE *xd, int64_t pos, int whence); - -#ifdef __cplusplus -} -#endif - -#endif /* _XDRFILE_H_ */ - diff --git a/pymolfile/libpymolfile-old/xdrfile_trr.c b/pymolfile/libpymolfile-old/xdrfile_trr.c deleted file mode 100644 index 17597699486d69c31969f46f5d8b69ac0cc4fde3..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/xdrfile_trr.c +++ /dev/null @@ -1,577 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- - * - * $Id$ - * - * Copyright (c) Erik Lindahl, David van der Spoel 2003,2004. - * Copyright (c) Manuel Melo <manuel.nuno.melo@gmail.com> 2013,2014. - * Coordinate compression (c) by Frans van Hoesel. - * XTC/TRR seeking and indexing (c) Manuel Melo. - * - * This file is part of libxdrfile2. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xdrfile.h" -#include "xdrfile_trr.h" - -#define BUFSIZE 128 -#define GROMACS_MAGIC 1993 - -typedef struct /* This struct describes the order and the */ -/* sizes of the structs in a trjfile, sizes are given in bytes. */ -{ - mybool bDouble; /* Double precision? */ - int ir_size; /* Backward compatibility */ - int e_size; /* Backward compatibility */ - int box_size; /* Non zero if a box is present */ - int vir_size; /* Backward compatibility */ - int pres_size; /* Backward compatibility */ - int top_size; /* Backward compatibility */ - int sym_size; /* Backward compatibility */ - int x_size; /* Non zero if coordinates are present */ - int v_size; /* Non zero if velocities are present */ - int f_size; /* Non zero if forces are present */ - - int natoms; /* The total number of atoms */ - int step; /* Current step number */ - int nre; /* Backward compatibility */ - float tf; /* Current time */ - float lambdaf; /* Current value of lambda */ - double td; /* Current time */ - double lambdad; /* Current value of lambda */ -} t_trnheader; - -static int nFloatSize(t_trnheader *sh,int *nflsz) -{ - int nflsize=0; - - if (sh->box_size) - nflsize = sh->box_size/(DIM*DIM); - else if (sh->x_size) - nflsize = sh->x_size/(sh->natoms*DIM); - else if (sh->v_size) - nflsize = sh->v_size/(sh->natoms*DIM); - else if (sh->f_size) - nflsize = sh->f_size/(sh->natoms*DIM); - else - return exdrHEADER; - - if (((nflsize != sizeof(float)) && (nflsize != sizeof(double)))) - return exdrHEADER; - - *nflsz = nflsize; - - return exdrOK; -} - -static int do_trnheader(XDRFILE *xd,mybool bRead,t_trnheader *sh) -{ - int magic=GROMACS_MAGIC; - int nflsz,slen,result; - char *version = "GMX_trn_file"; - char buf[BUFSIZE]; - - if (xdrfile_read_int(&magic,1,xd) != 1) - return exdrINT; - - if (bRead) - { - if (xdrfile_read_int(&slen,1,xd) != 1) - return exdrINT; - if (slen != strlen(version)+1) - return exdrSTRING; - if (xdrfile_read_string(buf,BUFSIZE,xd) <= 0) - return exdrSTRING; - } - else - { - slen = strlen(version)+1; - if (xdrfile_read_int(&slen,1,xd) != 1) - return exdrINT; - if (xdrfile_write_string(version,xd) != (strlen(version)+1) ) - return exdrSTRING; - } - if (xdrfile_read_int(&sh->ir_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->e_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->box_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->vir_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->pres_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->top_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->sym_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->x_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->v_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->f_size,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->natoms,1,xd) != 1) - return exdrINT; - - if ((result = nFloatSize(sh,&nflsz)) != exdrOK) - return result; - sh->bDouble = (nflsz == sizeof(double)); - - if (xdrfile_read_int(&sh->step,1,xd) != 1) - return exdrINT; - if (xdrfile_read_int(&sh->nre,1,xd) != 1) - return exdrINT; - if (sh->bDouble) - { - if (xdrfile_read_double(&sh->td,1,xd) != 1) - return exdrDOUBLE; - sh->tf = sh->td; - if (xdrfile_read_double(&sh->lambdad,1,xd) != 1) - return exdrDOUBLE; - sh->lambdaf = sh->lambdad; - } - else - { - if (xdrfile_read_float(&sh->tf,1,xd) != 1) - return exdrFLOAT; - sh->td = sh->tf; - if (xdrfile_read_float(&sh->lambdaf,1,xd) != 1) - return exdrFLOAT; - sh->lambdad = sh->lambdaf; - } - - return exdrOK; -} - -static int do_htrn(XDRFILE *xd,mybool bRead,t_trnheader *sh, - matrix box,rvec *x,rvec *v,rvec *f) -{ - double pvd[DIM*DIM]; - double *dx=NULL; - float pvf[DIM*DIM]; - float *fx=NULL; - int i,j; - - if (sh->bDouble) - { - if (sh->box_size != 0) - { - if (!bRead) - { - for(i=0; (i<DIM); i++) - for(j=0; (j<DIM); j++) - if (NULL != box) - { - pvd[i*DIM+j] = box[i][j]; - } - } - if (xdrfile_read_double(pvd,DIM*DIM,xd) == DIM*DIM) - { - for(i=0; (i<DIM); i++) - for(j=0; (j<DIM); j++) - if (NULL != box) - { - box[i][j] = pvd[i*DIM+j]; - } - } - else - return exdrDOUBLE; - } - - if (sh->vir_size != 0) - { - if (xdrfile_read_double(pvd,DIM*DIM,xd) != DIM*DIM) - return exdrDOUBLE; - } - - if (sh->pres_size!= 0) - { - if (xdrfile_read_double(pvd,DIM*DIM,xd) != DIM*DIM) - return exdrDOUBLE; - } - - if ((sh->x_size != 0) || (sh->v_size != 0) || (sh->f_size != 0)) { - dx = (double *)calloc(sh->natoms*DIM,sizeof(dx[0])); - if (NULL == dx) - return exdrNOMEM; - } - if (sh->x_size != 0) - { - if (!bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - dx[i*DIM+j] = x[i][j]; - } - } - if (xdrfile_read_double(dx,sh->natoms*DIM,xd) == sh->natoms*DIM) - { - if (bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - x[i][j] = dx[i*DIM+j]; - } - } - } - else - return exdrDOUBLE; - } - if (sh->v_size != 0) - { - if (!bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - dx[i*DIM+j] = v[i][j]; - } - } - if (xdrfile_read_double(dx,sh->natoms*DIM,xd) == sh->natoms*DIM) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != v) - { - v[i][j] = dx[i*DIM+j]; - } - } - else - return exdrDOUBLE; - } - if (sh->f_size != 0) - { - if (!bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - dx[i*DIM+j] = f[i][j]; - } - } - if (xdrfile_read_double(dx,sh->natoms*DIM,xd) == sh->natoms*DIM) - { - for(i=0; (i<sh->natoms); i++) - { - for(j=0; (j<DIM); j++) - { - if (NULL != f) - { - f[i][j] = dx[i*DIM+j]; - } - } - } - } - else - return exdrDOUBLE; - } - if ((sh->x_size != 0) || (sh->v_size != 0) || (sh->f_size != 0)) { - free(dx); - } - } - else - /* Float */ - { - if (sh->box_size != 0) - { - if (!bRead) - { - for(i=0; (i<DIM); i++) - for(j=0; (j<DIM); j++) - if (NULL != box) - { - pvf[i*DIM+j] = box[i][j]; - } - } - if (xdrfile_read_float(pvf,DIM*DIM,xd) == DIM*DIM) - { - for(i=0; (i<DIM); i++) - { - for(j=0; (j<DIM); j++) - { - if (NULL != box) - { - box[i][j] = pvf[i*DIM+j]; - } - } - } - } - else - return exdrFLOAT; - } - - if (sh->vir_size != 0) - { - if (xdrfile_read_float(pvf,DIM*DIM,xd) != DIM*DIM) - return exdrFLOAT; - } - - if (sh->pres_size!= 0) - { - if (xdrfile_read_float(pvf,DIM*DIM,xd) != DIM*DIM) - return exdrFLOAT; - } - - if ((sh->x_size != 0) || (sh->v_size != 0) || (sh->f_size != 0)) { - fx = (float *)calloc(sh->natoms*DIM,sizeof(fx[0])); - if (NULL == fx) - return exdrNOMEM; - } - if (sh->x_size != 0) - { - if (!bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - fx[i*DIM+j] = x[i][j]; - } - } - if (xdrfile_read_float(fx,sh->natoms*DIM,xd) == sh->natoms*DIM) - { - if (bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - x[i][j] = fx[i*DIM+j]; - } - } - else - return exdrFLOAT; - } - if (sh->v_size != 0) - { - if (!bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - fx[i*DIM+j] = v[i][j]; - } - } - if (xdrfile_read_float(fx,sh->natoms*DIM,xd) == sh->natoms*DIM) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != v) - v[i][j] = fx[i*DIM+j]; - } - else - return exdrFLOAT; - } - if (sh->f_size != 0) - { - if (!bRead) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != x) - { - fx[i*DIM+j] = f[i][j]; - } - } - if (xdrfile_read_float(fx,sh->natoms*DIM,xd) == sh->natoms*DIM) - { - for(i=0; (i<sh->natoms); i++) - for(j=0; (j<DIM); j++) - if (NULL != f) - f[i][j] = fx[i*DIM+j]; - } - else - return exdrFLOAT; - } - if ((sh->x_size != 0) || (sh->v_size != 0) || (sh->f_size != 0)) { - free(fx); - } - } - return exdrOK; -} - -static int do_trn(XDRFILE *xd,mybool bRead,int *step,float *t,float *lambda, - matrix box,int *natoms,rvec *x,rvec *v,rvec *f, int *has_prop) -{ - t_trnheader *sh; - int result; - - sh = (t_trnheader *)calloc(1,sizeof(*sh)); - - if (!bRead) { - sh->box_size = (NULL != box) ? sizeof(matrix):0; - sh->x_size = ((NULL != x) ? (*natoms*sizeof(x[0])):0); - sh->v_size = ((NULL != v) ? (*natoms*sizeof(v[0])):0); - sh->f_size = ((NULL != f) ? (*natoms*sizeof(f[0])):0); - sh->natoms = *natoms; - sh->step = *step; - sh->nre = 0; - sh->td = *t; - sh->lambdad = *lambda; - sh->tf = *t; - sh->lambdaf = *lambda; - } - if ((result = do_trnheader(xd,bRead,sh)) != exdrOK) - return result; - if (bRead) { - *natoms = sh->natoms; - *step = sh->step; - *t = sh->td; - *lambda = sh->lambdad; - /* Flag what we read */ - if (sh->x_size) - *has_prop |= HASX; - if (sh->v_size) - *has_prop |= HASV; - if (sh->f_size) - *has_prop |= HASF; - } - if ((result = do_htrn(xd,bRead,sh,box,x,v,f)) != exdrOK) - return result; - - free(sh); - - return exdrOK; -} - -/************************************************************ - * - * The following routines are the exported ones - * - ************************************************************/ - -int read_trr_natoms(char *fn,int *natoms) -{ - XDRFILE *xd; - t_trnheader sh; - int result; - - xd = xdrfile_open(fn,"r"); - if (NULL == xd) - return exdrFILENOTFOUND; - if ((result = do_trnheader(xd,1,&sh)) != exdrOK) - return result; - xdrfile_close(xd); - *natoms = sh.natoms; - - return exdrOK; -} - -int read_trr_numframes(char *fn, int *numframes, int64_t **offsets) -{ - XDRFILE *xd; - t_trnheader sh; - float time, lambda; - int result, framebytes, est_nframes, totalframebytes; - int64_t filesize, frame_offset; - - if ((xd = xdrfile_open(fn,"r"))==NULL) - return exdrFILENOTFOUND; - if (xdr_seek(xd, 0L, SEEK_END) != exdrOK) - { - xdrfile_close(xd); - return exdrNR; - } - filesize = xdr_tell(xd); - if (xdr_seek(xd, 0L, SEEK_SET) != exdrOK) - { - xdrfile_close(xd); - return exdrNR; - } - - if ((result = do_trnheader(xd,1,&sh)) != exdrOK) - { - xdrfile_close(xd); - return result; - } - - framebytes = sh.ir_size + sh.e_size + sh.box_size + - sh.vir_size + sh.pres_size + sh.top_size + - sh.sym_size + sh.x_size + sh.v_size + sh.f_size; - - est_nframes = (int) (filesize/((int64_t) (framebytes + TRR_MIN_HEADER_SIZE)) + 1); // add one because it'd be easy to underestimate low frame numbers. - est_nframes += est_nframes/5; - - /* Allocate memory for the frame index array */ - if ((*offsets=(int64_t *)malloc(sizeof(int64_t)*est_nframes))==NULL) - { - xdrfile_close(xd); - return exdrNOMEM; - } - - (*offsets)[0] = 0L; - *numframes = 1; - while (1) - { - if (xdr_seek(xd, (int64_t) (framebytes), SEEK_CUR) != exdrOK) { - free(*offsets); - xdrfile_close(xd); - return exdrNR; - } - frame_offset = xdr_tell(xd); /* Store it now, before we read the header */ - if ((result = do_trnheader(xd,1,&sh)) != exdrOK) /* Interpreting as EOF */ - break; - /* Read was successful; this is another frame */ - /* Check if we need to enlarge array */ - if (*numframes == est_nframes){ - est_nframes += est_nframes/5 + 1; // Increase in 20% stretches - if ((*offsets = realloc(*offsets, sizeof(int64_t)*est_nframes))==NULL) - { - xdrfile_close(xd); - return exdrNOMEM; - } - } - (*offsets)[*numframes] = frame_offset; - (*numframes)++; - /* Calculate how much to skip this time */ - framebytes = sh.ir_size + sh.e_size + sh.box_size + - sh.vir_size + sh.pres_size + sh.top_size + - sh.sym_size + sh.x_size + sh.v_size + sh.f_size; - } - xdrfile_close(xd); - return exdrOK; -} - - -int write_trr(XDRFILE *xd,int natoms,int step,float t,float lambda, - matrix box,rvec *x,rvec *v,rvec *f) -{ - int *plcholder; - return do_trn(xd,0,&step,&t,&lambda,box,&natoms,x,v,f, plcholder); -} - -int read_trr(XDRFILE *xd,int natoms,int *step,float *t,float *lambda, - matrix box,rvec *x,rvec *v,rvec *f, int *has_prop) -{ - return do_trn(xd,1,step,t,lambda,box,&natoms,x,v,f,has_prop); -} - diff --git a/pymolfile/libpymolfile-old/xdrfile_trr.h b/pymolfile/libpymolfile-old/xdrfile_trr.h deleted file mode 100644 index f3dc01c8a0c4f765408bd0f42f11f406a1ec40e7..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/xdrfile_trr.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- - * - * $Id$ - * - * Copyright (c) Erik Lindahl, David van der Spoel 2003,2004. - * Copyright (c) Manuel Melo <manuel.nuno.melo@gmail.com> 2013,2014. - * Coordinate compression (c) by Frans van Hoesel. - * XTC/TRR seeking and indexing (c) Manuel Melo. - * - * This file is part of libxdrfile2. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -#ifndef _xdrfile_trr_h -#define _xdrfile_trr_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include "xdrfile.h" - - /* All functions return exdrOK if succesfull. - * (error codes defined in xdrfile.h). - */ - - /* This function returns the number of atoms in the xtc file in *natoms */ - extern int read_trr_natoms(char *fn,int *natoms); - - /* Skip through trajectory, reading headers, obtain the total number of frames in the trr */ - extern int read_trr_numframes(char *fn, int *numframes, int64_t **offsets); - - /* Read one frame of an open trr file. If either of x,v,f,box are - NULL the arrays will be read from the file but not used. */ - extern int read_trr(XDRFILE *xd,int natoms,int *step,float *t,float *lambda, - matrix box,rvec *x,rvec *v,rvec *f, int *has_prop); - - /* Write a frame to trr file */ - extern int write_trr(XDRFILE *xd,int natoms,int step,float t,float lambda, - matrix box,rvec *x,rvec *v,rvec *f); - -/* Minimum TRR header size. It can have 8 bytes more if we have double time and lambda. */ -#define TRR_MIN_HEADER_SIZE 54 -#define TRR_DOUBLE_XTRA_HEADER 8 - -/* Flags to signal the update of pos/vel/forces */ -#define HASX 1 -#define HASV 2 -#define HASF 4 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/pymolfile/libpymolfile-old/xdrfile_xtc.c b/pymolfile/libpymolfile-old/xdrfile_xtc.c deleted file mode 100644 index 58a65eb6d3c009afb1cc2538aa1a5dbab7072aea..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/xdrfile_xtc.c +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- - * - * $Id$ - * - * Copyright (c) Erik Lindahl, David van der Spoel 2003,2004. - * Copyright (c) Manuel Melo <manuel.nuno.melo@gmail.com> 2013,2014. - * Coordinate compression (c) by Frans van Hoesel. - * XTC/TRR seeking and indexing (c) Manuel Melo. - * - * This file is part of libxdrfile2. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include "xdrfile.h" -#include "xdrfile_xtc.h" - -#define MAGIC 1995 - -enum { FALSE, TRUE }; - -static int xtc_header(XDRFILE *xd,int *natoms,int *step,float *time,mybool bRead) -{ - int result,magic,n=1; - - /* Note: read is same as write. He he he */ - magic = MAGIC; - if ((result = xdrfile_write_int(&magic,n,xd)) != n) - { - if (bRead) - return exdrENDOFFILE; - else - return exdrINT; - } - if (magic != MAGIC) - return exdrMAGIC; - if ((result = xdrfile_write_int(natoms,n,xd)) != n) - return exdrINT; - if ((result = xdrfile_write_int(step,n,xd)) != n) - return exdrINT; - if ((result = xdrfile_write_float(time,n,xd)) != n) - return exdrFLOAT; - - return exdrOK; -} - -static int xtc_coord(XDRFILE *xd,int *natoms,matrix box,rvec *x,float *prec, - mybool bRead) -{ - int result; - - /* box */ - result = xdrfile_read_float(box[0],DIM*DIM,xd); - if (DIM*DIM != result) - return exdrFLOAT; - else - { - if (bRead) - { - result = xdrfile_decompress_coord_float(x[0],natoms,prec,xd); - if (result != *natoms) - return exdr3DX; - } - else - { - result = xdrfile_compress_coord_float(x[0],*natoms,*prec,xd); - if (result != *natoms) - return exdr3DX; - } - } - return exdrOK; -} - -int read_xtc_natoms(char *fn,int *natoms) -{ - XDRFILE *xd; - int step,result; - float time; - - xd = xdrfile_open(fn,"r"); - if (NULL == xd) - return exdrFILENOTFOUND; - result = xtc_header(xd,natoms,&step,&time,TRUE); - xdrfile_close(xd); - - return result; -} - -int read_xtc(XDRFILE *xd, - int natoms,int *step,float *time, - matrix box,rvec *x,float *prec) -/* Read subsequent frames */ -{ - int result; - - if ((result = xtc_header(xd,&natoms,step,time,TRUE)) != exdrOK) - return result; - - if ((result = xtc_coord(xd,&natoms,box,x,prec,1)) != exdrOK) - return result; - - return exdrOK; -} - -int read_xtc_numframes(char *fn, int *numframes, int64_t **offsets) -{ - XDRFILE *xd; - int framebytes, natoms, step; - float time; - int64_t filesize; - - if ((xd = xdrfile_open(fn,"r"))==NULL) - return exdrFILENOTFOUND; - - if (xtc_header(xd,&natoms,&step,&time,TRUE) != exdrOK) - { - xdrfile_close(xd); - return exdrHEADER; - } - - if (xdr_seek(xd, 0L, SEEK_END) != exdrOK) - { - xdrfile_close(xd); - return exdrNR; - } - filesize = xdr_tell(xd); - - /* Case of fewer than 10 atoms. Framesize known. */ - if (natoms < 10) - { - int i; - xdrfile_close(xd); - framebytes = XTC_SHORTHEADER_SIZE + XTC_SHORT_BYTESPERATOM*natoms; - *numframes = filesize/framebytes; /* Should we complain if framesize doesn't divide filesize? */ - /* Allocate memory for the frame index array */ - if ((*offsets=(int64_t *)malloc(sizeof(int64_t)*(*numframes)))==NULL) - return exdrNOMEM; - for (i=0; i<*numframes; i++) - { - (*offsets)[i] = i*framebytes; - } - return exdrOK; - } - else /* No easy way out. We must iterate. */ - { - int est_nframes; - /* Estimation of number of frames, with 20% allowance for error. */ - if (xdr_seek(xd, (int64_t) XTC_HEADER_SIZE, SEEK_SET) != exdrOK) - { - xdrfile_close(xd); - return exdrNR; - } - if (xdrfile_read_int(&framebytes,1,xd) == 0) - { - xdrfile_close(xd); - return exdrENDOFFILE; - } - framebytes = (framebytes + 3) & ~0x03; //Rounding to the next 32-bit boundary - est_nframes = (int) (filesize/((int64_t) (framebytes+XTC_HEADER_SIZE)) + 1); // add one because it'd be easy to underestimate low frame numbers. - est_nframes += est_nframes/5; - - /* Allocate memory for the frame index array */ - if ((*offsets=(int64_t *)malloc(sizeof(int64_t)*est_nframes))==NULL) - { - xdrfile_close(xd); - return exdrNOMEM; - } - (*offsets)[0] = 0L; - *numframes = 1; - while (1) - { - if (xdr_seek(xd, (int64_t) (framebytes+XTC_HEADER_SIZE), SEEK_CUR) != exdrOK) { - free(*offsets); - xdrfile_close(xd); - return exdrNR; - } - if (xdrfile_read_int(&framebytes,1,xd) == 0) - break; - /* Read was successful; this is another frame */ - /* Check if we need to enlarge array */ - if (*numframes == est_nframes){ - est_nframes += est_nframes/5 + 1; // Increase in 20% stretches - if ((*offsets = realloc(*offsets, sizeof(int64_t)*est_nframes))==NULL) - { - free(*offsets); - xdrfile_close(xd); - return exdrNOMEM; - } - } - (*offsets)[*numframes] = xdr_tell(xd) - 4L - (int64_t) (XTC_HEADER_SIZE); //Account for the header and the nbytes bytes we read. - (*numframes)++; - framebytes = (framebytes + 3) & ~0x03; //Rounding to the next 32-bit boundary - } - xdrfile_close(xd); - return exdrOK; - } -} - - -int write_xtc(XDRFILE *xd, - int natoms,int step,float time, - matrix box,rvec *x,float prec) -/* Write a frame to xtc file */ -{ - int result; - - if ((result = xtc_header(xd,&natoms,&step,&time,FALSE)) != exdrOK) - return result; - - if ((result = xtc_coord(xd,&natoms,box,x,&prec,0)) != exdrOK) - return result; - - return exdrOK; -} - diff --git a/pymolfile/libpymolfile-old/xdrfile_xtc.h b/pymolfile/libpymolfile-old/xdrfile_xtc.h deleted file mode 100644 index a99135c5baebeef36c8638bbb41b1832c80ae32d..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile-old/xdrfile_xtc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- - * - * $Id$ - * - * Copyright (c) Erik Lindahl, David van der Spoel 2003,2004. - * Copyright (c) Manuel Melo <manuel.nuno.melo@gmail.com> 2013,2014. - * Coordinate compression (c) by Frans van Hoesel. - * XTC/TRR seeking and indexing (c) Manuel Melo. - * - * This file is part of libxdrfile2. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -#ifndef _xdrfile_xtc_h -#define _xdrfile_xtc_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include "xdrfile.h" - - /* All functions return exdrOK if succesfull. - * (error codes defined in xdrfile.h). - */ - - /* This function returns the number of atoms in the xtc file in *natoms */ - extern int read_xtc_natoms(char *fn,int *natoms); - - /* Seek through trajectory counting and indexing frames */ - extern int read_xtc_numframes(char *fn, int *numframes, int64_t **offsets); - - /* Read one frame of an open xtc file */ - extern int read_xtc(XDRFILE *xd,int natoms,int *step,float *time, - matrix box,rvec *x,float *prec); - - /* Write a frame to xtc file */ - extern int write_xtc(XDRFILE *xd, - int natoms,int step,float time, - matrix box,rvec *x,float prec); - -/* XTC header fields until coord floats: *** only for trajectories of less than 10 atoms! *** */ -/* magic natoms step time DIM*DIM_box_vecs natoms */ -#define XTC_SHORTHEADER_SIZE (20 + DIM*DIM*4) -/* Short XTCs store each coordinate as a 32-bit float. */ -#define XTC_SHORT_BYTESPERATOM 12 -/* XTC header fields until frame bytes: *** only for trajectories of more than 9 atoms! *** */ -/* magic natoms step time DIM*DIM_box_vecs natoms prec DIM_min_xyz DIM_max_xyz smallidx */ -#define XTC_HEADER_SIZE (DIM*DIM*4 + DIM*2 + 46) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/pymolfile/libpymolfile/f77_molfile.c b/pymolfile/libpymolfile/f77_molfile.c deleted file mode 100644 index 1bb6aee33f8e61628d32f88fa160be5f8813234f..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile/f77_molfile.c +++ /dev/null @@ -1,363 +0,0 @@ - -/* - * molfile fortran interface - * $Id: f77_molfile.c,v 1.1 2006/03/10 22:48:49 johns Exp $ - * (c) 2006 Axel Kohlmeyer <akohlmey@cmm.chem.upenn.edu> - */ - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -#include "molfile_plugin.h" -#include "libmolfile_plugin.h" -#include "vmdplugin.h" - -#define F77TESTME 1 - -/* fortran name mangling */ -#if defined(_F77_NO_UNDERSCORE) -#define FNAME(n) n -#elif defined(_F77_F2C_UNDERSCORE) -#define FNAME(n) n ## __ -#else -#define FNAME(n) n ## _ -#endif - -/* interface typedef magic */ -typedef int int4; - -struct molfile_f77_handle -{ - void *handle; - const char *fname; - const char *ftype; - molfile_plugin_t *plugin; -}; -typedef struct molfile_f77_handle f77_fd; - -/* plugin list */ -#ifndef MAXPLUGINS -#define MAXPLUGINS 200 -#endif -static int numplugins=0; -static molfile_plugin_t *plugin_list[MAXPLUGINS]; - -/* we maintain a static list of assigned handles */ -#ifndef MAXHADNLES -#define MAXHANDLES 200 -#endif -static int4 numhandles=0; -static f77_fd handle_list[MAXHANDLES]; - -/* helper functions */ -/* helper function to copy fortran style (a la sun fortran) strings into - * valid c style strings. just using the string pointers will not work, - * since the strings are NOT zero terminated. - * - * WARNING: do not forget to free(2) them later, - * or you'll have a memory leak! - */ -static char *f77strdup(const char *s,const int sz) -{ - char *r; - - r = (char *)malloc(sz + 1); - r = (char *)memcpy(r, s, sz); - r[sz] = '\0'; - return r; -} - -/* trim off whitespace at the end of a string */ -static void f77trim(char *s,const int sz) -{ - int i; - - i=1; - while( (i++ < sz) && isspace(s[sz-i]) ) { - s[sz-i] ='\0'; - } -} - -/* get the filename extension */ -static const char *f77getfnext(const char *s) -{ - int i,len; - - len = strlen(s); - for (i=len; i>=0; --i) { - if(s[i] == '.') { - return &s[i+1]; - } - } - return NULL; -} - -/* check validity of plugins and register them. */ -static int f77register(void *ptr, vmdplugin_t *plugin) { - - if (!plugin->type || !plugin->name || !plugin->author) { - fprintf(stderr," skipping plugin with incomplete header\n"); - return -1; - } - -#if F77TESTME - fprintf(stderr, " trying to register plugin #%d: %s, type: %s/%d\n" - " written by: %s\n\n", numplugins+1, plugin->name, - plugin->type, plugin->abiversion, plugin->author); -#endif - - if (plugin->abiversion != vmdplugin_ABIVERSION) { - fprintf(stderr, " skipping plugin with incompatible ABI:%d/%d\n", - plugin->abiversion, vmdplugin_ABIVERSION); - return -2; - } - - if (0 != strncmp(plugin->type, "mol file", 8)) { - fprintf(stderr, " skipping plugin of incompatible type:%s\n", - plugin->type); - return -3; - } - - if (numplugins < MAXPLUGINS) { - plugin_list[numplugins] = (molfile_plugin_t *) plugin; - ++numplugins; - return 0; - } - - fprintf(stderr, " too many plugins: %d. increase MAXPLUGINS, " - "recompile, and try again.\n", numplugins); - - return -4; -} - - -/* the official fortran API */ - -/* register all available plugins and clear handles. */ -void FNAME(f77_molfile_init)(void) -{ - int i; - - MOLFILE_INIT_ALL; - - for (i=0; i<MAXHANDLES; ++i) { - handle_list[i].handle = NULL; - } - - MOLFILE_REGISTER_ALL(NULL,f77register); - - /* - * FIXME: check all plugins and make - * sure the babel plugin(s) are last. - */ -} - -/* unregister all available plugins */ -void FNAME(f77_molfile_finish)(void) -{ -#if 0 - int i; - - /* FIXME: add code to close and nullify all open handles */ - for (i=0; i<MAXHANDLES; ++i) { - handle_list[i] = NULL; - } -#endif - - MOLFILE_FINI_ALL; -} - - -/* open a file and provide file descriptor */ -void FNAME(f77_molfile_open_read)(int4 *handle, int4 *natoms, - const char *infile, const char *intype, - const int len_if, const int len_it) -{ - char *fname, *ftype; - molfile_plugin_t *plugin; - int i; - - if (numhandles >= MAXHANDLES) { - fprintf(stderr, "too many molfile f77 handles.\n"); - *handle = -666; - return; - } - - fname = f77strdup(infile, len_if); - f77trim(fname,len_if); - - ftype = f77strdup(intype, len_it); - f77trim(ftype,len_it); - - fprintf(stderr, " %s: trying for: %s/%d, %s/%d\n", - __FUNCTION__, fname, len_if, ftype, len_it); - - plugin = NULL; - /* determine plugin type automatically */ - if(0 == strncmp(intype, "auto", 4)) { - const char *fext; - - fext = f77getfnext(fname); - if (fext == NULL) { - fprintf(stderr, " could not determine file name extension " - "for automatic plugin guess\n"); - *handle = -111; - return; - } -#if F77TESTME - fprintf(stderr, " filename extension: %s\n", fext); -#endif - - for (i=0; (i<numplugins) && plugin==NULL; ++i) { -#if F77TESTME - fprintf(stderr, " tying filename extension: %s\n", - plugin_list[i]->filename_extension); -#endif - if (0 == strcmp(plugin_list[i]->filename_extension, fext)) { - fprintf(stderr, " using plugin: %s\n", - plugin_list[i]->prettyname); - - plugin = plugin_list[i]; - } - } - if (plugin == NULL) { - fprintf(stderr, " could not determine matching plugin type" - "from file name extension\n"); - *handle = -222; - return; - } - } else { - - for (i=0; (i<numplugins) && (plugin==NULL); ++i) { -#if F77TESTME - fprintf(stderr, " tying plugin type: %s\n", - plugin_list[i]->name); -#endif - if (0 == strcmp(plugin_list[i]->name, ftype)) { - fprintf(stderr, " using plugin: %s\n", - plugin_list[i]->prettyname); - plugin = plugin_list[i]; - } - } - if (plugin == NULL) { - fprintf(stderr, " could not find plugin for type %s\n",ftype); - *handle = -333; - return; - } - } - - if(plugin == NULL) { /* this should not happen, but... */ - fprintf(stderr, " no plugin found.\n"); - *handle = -444; - return; - } - - /* build handle */ - ++numhandles; - for (i=0; i<numhandles; ++i) { - if(handle_list[i].plugin == NULL) { - *handle = i; - handle_list[i].fname=fname; - handle_list[i].ftype=plugin->name; - handle_list[i].plugin=plugin; - } - } - - /* open file for reading and detect number of atoms */ - *natoms=MOLFILE_NUMATOMS_UNKNOWN; - handle_list[*handle].handle= - plugin->open_file_read(fname,plugin->name,natoms); - if(handle_list[*handle].handle == NULL) { - fprintf(stderr, " open of %s-plugin for file %s failed\n", - plugin->type, fname); - --numhandles; - handle_list[*handle].plugin=NULL; - *handle=-777; - return; - } - - return; -} - -/* read next time step */ -void FNAME(f77_molfile_read_next)(int4 *handle, int4 *natoms, float *xyz, - float *box, int4 *status) -{ - molfile_plugin_t *plugin; - molfile_timestep_t step; - int retval; - - /* do some sanity checks on the handle */ - if((*handle < 0) || (*handle >= MAXHANDLES)) { - fprintf(stderr, " %s: illegal handle: %d\n", - __FUNCTION__, *handle); - *status = 0; - return; - } - - plugin = handle_list[*handle].plugin; - if(plugin==NULL) { - fprintf(stderr, " %s: inactive handle: %d\n", - __FUNCTION__, *handle); - *status = 0; - return; - } - - /* skip or read the timestep as demanded */ - if(status == 0) { - retval = plugin->read_next_timestep(handle_list[*handle].handle, - *natoms, NULL); - } else { - step.coords = xyz; - retval = plugin->read_next_timestep(handle_list[*handle].handle, - *natoms, &step); - } - - /* copy the box parameters */ - if (retval == MOLFILE_SUCCESS) { - *status = 1; - box[0]=step.A; - box[1]=step.B; - box[2]=step.C; - box[3]=step.alpha; - box[4]=step.beta; - box[5]=step.gamma; - } else { - *status = 0; - } -} - -/* close a read file descriptor */ -void FNAME(f77_molfile_close_read)(int4 *handle) -{ - molfile_plugin_t *plugin; - - /* do some sanity checks on the handle */ - if((*handle < 0) || (*handle >= MAXHANDLES)) { - fprintf(stderr, " %s: illegal handle: %d\n", - __FUNCTION__, *handle); - *handle = -111; - return; - } - - plugin = handle_list[*handle].plugin; - if(plugin==NULL) { - fprintf(stderr, " %s: inactive handle: %d\n", - __FUNCTION__, *handle); - *handle = -222; - return; - } - -#if F77TESTME - fprintf(stderr, " %s: trying to close handle %d" - " for file %s\n", __FUNCTION__, *handle, - handle_list[*handle].fname); -#endif - - plugin->close_file_read(handle_list[*handle].handle); - --numhandles; - handle_list[*handle].plugin=NULL; - *handle=-1; -} diff --git a/pymolfile/libpymolfile/libvmdmolfile.i b/pymolfile/libpymolfile/libvmdmolfile.i deleted file mode 100644 index e5314f178c70209e9765dcabcf1f04f68f8a798b..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile/libvmdmolfile.i +++ /dev/null @@ -1,298 +0,0 @@ -/* -*- C -*- (not really, but good for syntax highlighting) */ -/* SWIG interface for libvmdmolfile of VMD molfile_plugins - Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> - Published under BSD LICENSE - - swig -python -outdir . src/xdrfile/libxdrfile2.i -*/ -%define DOCSTRING -" -:Author: Berk Onat <b.onat@warwick.ac.uk> -:Year: 2017 -:Licence: BSD LICENSE - - -" -%enddef - -%module(docstring=DOCSTRING) libvmdmolfile - - -%{ -/* Python SWIG interface to libvmdmolfile - Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> - Published under BSD LICENSE - */ -#define SWIG_FILE_WITH_INIT -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> -#include "molfile_plugin.h" -#include "libmolfile_plugin.h" -#include "vmdplugin.h" -%} - -%include "numpy.i" - -%init %{ -import_array(); -%} - - -/* - Wrapping only high-level plugin functions to register VMD - plugins and to retrive the data through molfile_plugin interface. - - Only modifing call signatures. This will help one to access functions - without dealing with pointers from python. -*/ - - -/* status codes */ -enum { exdrOK, exdrHEADER, exdrSTRING, exdrDOUBLE, - exdrINT, exdrFLOAT, exdrUINT, exdr3DX, exdrCLOSE, exdrMAGIC, - exdrNOMEM, exdrENDOFFILE, exdrFILENOTFOUND, exdrNR }; - -/* These com from stdio.h, for file seeking. Gives all the flexibility to _fseek(). */ -enum { SEEK_SET, SEEK_CUR, SEEK_END }; - -/* open/close xdr files */ -%feature("autodoc", "0") xdrfile_open; -extern XDRFILE* xdrfile_open(const char *path, const char *mode); - -%feature("autodoc", "0") xdrfile_close; -extern int xdrfile_close(XDRFILE *fp); - - -/* from xdrfile_xtc.c */ -/* This function returns the number of atoms in the xtc file in *natoms - extern int read_xtc_natoms(char *fn,int *natoms); - ... but the wrapped function returns natoms as the python return value -*/ -%feature("autodoc", "0") my_read_xtc_natoms; -%rename (read_xtc_natoms) my_read_xtc_natoms; -%exception my_read_xtc_natoms { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ - int my_read_xtc_natoms(char *fn) { - int natoms; - int status; - status = read_xtc_natoms(fn, &natoms); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading natoms from xtc '%s'", status, fn); - return 0; - } - return natoms; - } -%} - -%feature("autodoc", "0") my_read_xtc_numframes; -%rename (read_xtc_numframes) my_read_xtc_numframes; -%exception my_read_xtc_numframes { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ -PyObject * my_read_xtc_numframes(char *fn) { - int numframes, status; - int64_t *offsets[1]; - PyObject *npoffsets = NULL; - status = read_xtc_numframes(fn, &numframes, offsets); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading numframes by seeking through xtc '%s'", status, fn); - return 0; - } - npy_intp nfrms[1] = { numframes }; - npoffsets = PyArray_SimpleNewFromData(1, nfrms, NPY_INT64, *offsets); - if (npoffsets==NULL) - { - free(*offsets); - Py_XDECREF(npoffsets); - PyErr_Format(PyExc_IOError, "Error copying frame index into Python."); - return 0; - } - /* From http://web.archive.org/web/20130304224839/http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ */ - PyArray_BASE(npoffsets) = PyCObject_FromVoidPtr(*offsets, free); - PyObject *tuple = PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)numframes)); - PyTuple_SET_ITEM(tuple, 1, npoffsets); - return tuple; - } -%} - - -/* This function returns the number of atoms in the trr file in *natoms - extern int read_trr_natoms(char *fn,int *natoms); - ... but the wrapped function returns natoms as the python return value -*/ -%feature("autodoc", "0") my_read_trr_natoms; -%rename (read_trr_natoms) my_read_trr_natoms; -%exception my_read_trr_natoms { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ - int my_read_trr_natoms(char *fn) { - int natoms; - int status; - status = read_trr_natoms(fn, &natoms); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading natoms from trr '%s'", status, fn); - return 0; - } - return natoms; - } -%} - - -%feature("autodoc", "0") my_read_trr_numframes; -%rename (read_trr_numframes) my_read_trr_numframes; -%exception my_read_trr_numframes { - $action - if (PyErr_Occurred()) SWIG_fail; -} -%inline %{ -PyObject * my_read_trr_numframes(char *fn) { - int numframes, status; - int64_t *offsets[1]; - PyObject *npoffsets = NULL; - status = read_trr_numframes(fn, &numframes, offsets); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading numframes by seeking through trr '%s'", status, fn); - return 0; - } - npy_intp nfrms[1] = { numframes }; - npoffsets = PyArray_SimpleNewFromData(1, nfrms, NPY_INT64, *offsets); - if (npoffsets==NULL) - { - free(*offsets); - Py_XDECREF(npoffsets); - PyErr_Format(PyExc_IOError, "Error copying frame index into Python."); - return 0; - } - /* From http://web.archive.org/web/20130304224839/http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ */ - PyArray_BASE(npoffsets) = PyCObject_FromVoidPtr(*offsets, free); - PyObject *tuple = PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)numframes)); - PyTuple_SET_ITEM(tuple, 1, npoffsets); - return tuple; - } -%} - - - -#define DIM 3 -typedef float matrix[DIM][DIM]; -typedef float rvec[DIM]; - - -/* Reading from xdr files */ - -%apply (float INPLACE_ARRAY2[ANY][ANY]) {(matrix box)} -%apply (int DIM1, int DIM2, float* INPLACE_ARRAY2) {(int natoms, int _DIM, float *x), - (int vnatoms, int v_DIM, float *v), - (int fnatoms, int f_DIM, float *f)} - -/* Read one frame of an open xtc file */ -/* -extern int read_xtc(XDRFILE *xd,int natoms,int *step,float *time, - matrix box,rvec *x,float *prec); -*/ -%feature("autodoc", "read_xtc(XDRFILE, box, x) -> (status, step, time, precision)") my_read_xtc; -%rename (read_xtc) my_read_xtc; -%inline %{ -PyObject * my_read_xtc(XDRFILE *xd, matrix box, int natoms, int _DIM, float *x) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - int status, step; - float time, prec; - PyObject *tuple = PyTuple_New(4); - status = read_xtc(xd, natoms, &step, &time, box, (rvec *)x, &prec); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)status)); - PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)step)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble((double)time)); - PyTuple_SET_ITEM(tuple, 3, PyFloat_FromDouble((double)prec)); - return tuple; // return (status, step, time, prec) -} -%} - -%feature("autodoc", "read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda)") my_read_trr; -%rename (read_trr) my_read_trr; -%inline %{ -PyObject * my_read_trr(XDRFILE *xd, matrix box, - int natoms, int _DIM, float *x, - int vnatoms, int v_DIM, float *v, - int fnatoms, int f_DIM, float *f) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - int status, step, has_prop=0; - float time, lmbda; - PyObject *tuple = PyTuple_New(7); - status = read_trr(xd, natoms, &step, &time, &lmbda, box, (rvec *)x, (rvec *)v, (rvec *)f, &has_prop); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)status)); - PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)step)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble((double)time)); - PyTuple_SET_ITEM(tuple, 3, PyFloat_FromDouble((double)lmbda)); - PyTuple_SET_ITEM(tuple, 4, PyBool_FromLong((long)(has_prop & HASX))); - PyTuple_SET_ITEM(tuple, 5, PyBool_FromLong((long)(has_prop & HASV))); - PyTuple_SET_ITEM(tuple, 6, PyBool_FromLong((long)(has_prop & HASF))); - return tuple; // return (status, step, time, lmbda, has_x, has_v, has_f) -} -%} - -%clear (matrix box); -%clear (int natoms, int _DIM, float *x); -%clear (int vnatoms, int v_DIM, float *v); -%clear (int fnatoms, int f_DIM, float *f); - - -/* Writing of xdr files */ - -%apply (float IN_ARRAY2[ANY][ANY]) {(matrix box)} -%apply (int DIM1, int DIM2, float* IN_ARRAY2) {(int natoms, int _DIM, float *x), - (int vnatoms, int v_DIM, float *v), - (int fnatoms, int f_DIM, float *f)} - -/* Write a frame to xtc file */ -/* -extern int write_xtc(XDRFILE *xd, int natoms,int step,float time, - matrix box,rvec *x,float prec); -*/ -%feature("autodoc", "write_xtc(XDRFILE, step, time, box, x, prec) -> status") my_write_xtc; -%rename (write_xtc) my_write_xtc; -%inline %{ -int my_write_xtc(XDRFILE *xd, int step, float time, - matrix box, int natoms, int _DIM, float *x, float prec) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - return write_xtc(xd, natoms, step, time, box, (rvec *)x, prec); -} -%} - -%feature("autodoc", "write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status") my_write_trr; -%rename (write_trr) my_write_trr; -%inline %{ -int my_write_trr(XDRFILE *xd, int step, float time, float lmbda, matrix box, - int natoms, int _DIM, float *x, - int vnatoms, int v_DIM, float *v, - int fnatoms, int f_DIM, float *f) { - /* Preparing for the case of empty arrays - NULL pointers tell the library to skip this property. */ - if (_DIM == 0) x = NULL; - if (v_DIM == 0) v = NULL; - if (f_DIM == 0) f = NULL; - return write_trr(xd, natoms, step, time, lmbda, box, (rvec *)x, (rvec *)v, (rvec *)f); -} -%} - -%feature("autodoc", "0") xdr_seek; -extern int xdr_seek(XDRFILE *xd, long long pos, int whence); - -%feature("autodoc", "0") xdr_tell; -extern long long xdr_tell(XDRFILE *xd); - -%clear (matrix box); -%clear (int natoms, int _DIM, float *x); -%clear (int vnatoms, int v_DIM, float *v); -%clear (int fnatoms, int f_DIM, float *f); - - diff --git a/pymolfile/libpymolfile/libvmdmolfile.py b/pymolfile/libpymolfile/libvmdmolfile.py deleted file mode 100644 index 87a2c6692427936a46427739df076f2582fc4fef..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile/libvmdmolfile.py +++ /dev/null @@ -1,487 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 2.0.11 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - - - - -""" - -:Author: Oliver Beckstein <orbeckst@gmail.com> -:Author: Manuel Melo <manuel.nuno.melo@gmail.com> -:Year: 2014 -:Licence: GNU GENERAL PUBLIC LICENSE Version 2 (or higher) - - -The Gromacs XTC/TRR library :mod:`libxdrfile2` -============================================== - -:mod:`libxdrfile2`, a derivative of the Gromacs_ `libxdrfile library`_, provides an -interface to some high-level functions for XTC/TRR trajectory handling. -Only functions required for reading and processing whole trajectories are exposed at -the moment; low-level routines to read individual numbers are not provided. In -addition, :mod:`libxdrfile2` exposes functions to allow fast frame indexing and XDR -file seeking. - -The functions querying the numbers of atoms in a trajectory frame -(:func:`read_xtc_natoms` and :func:`read_trr_natoms`) open a file themselves and -only require the file name. - -All other functions operate on a *XDRFILE* object, which is a special file -handle for xdr files. Any xdr-based trajectory file (XTC or TRR format) always -has to be opened with :func:`xdrfile_open`. When done, close the trajectory -with :func:`xdrfile_close`. - -The functions fill or read existing arrays of coordinates; they never allocate -these arrays themselves. Hence they need to be setup outside libxdrfile2 as -numpy arrays. The exception to these are the indexing ones functions that take -care of array allocation and transference to a garbage-collectable memory object. - - -.. _Gromacs: http://www.gromacs.org -.. _libxdrfile library: http://www.gromacs.org/Developer_Zone/Programming_Guide/XTC_Library - -.. versionchanged:: 0.8.0 - :mod:`libxdrfile2` is now used instead of :mod:`libxdrfile`. :mod:`libxdrfile2` is - based on :mod:`libxdrfile` but has xdr seeking and indexing capabilities. - Unlike :mod:`libxdrfile` before it, :mod:`libxdrfile2` is distributed under the GNU - GENERAL PUBLIC LICENSE, version 2 (or higher). - - -Example: Reading from a XTC ---------------------------- - -In the example we read coordinate frames from an existing XTC trajectory:: - - import numpy as np - from libxdrfile2 import xdrfile_open, xdrfile_close, read_xtc_natoms, read_xtc, DIM, exdrOK - xtc = 'md.xtc' - - # get number of atoms - natoms = read_xtc_natoms(xtc) - - # allocate coordinate array of the right size and type - # (the type float32 is crucial to match the underlying C-code!!) - x = np.zeros((natoms, DIM), dtype=np.float32) - # allocate unit cell box - box = np.zeros((DIM, DIM), dtype=np.float32) - - # open file - XTC = xdrfile_open(xtc, 'r') - - # loop through file until return status signifies end or a problem - # (it should become exdrENDOFFILE on the last iteration) - status = exdrOK - while status == exdrOK: - status,step,time,prec = read_xtc(XTC, box, x) - # do something with x - centre = x.mean(axis=0) - print 'Centre of geometry at %(time)g ps: %(centre)r' % vars() - - # finally close file - xdrfile_close(XTC) - -Note that only the *contents* of the coordinate and unitcell arrays *x* and -*box* change. - - -Functions and constants ------------------------ - -The module defines a number of constants such as :data:`DIM` or the -`Status symbols`_. - -.. data:: DIM - - The number of cartesian dimensions for which the underlying C-code - was compiled; this is most certainly 3. - - -Status symbols -~~~~~~~~~~~~~~ - -A number of symbols are exported; they all start with the letters -``exdr``. Important ones are listed here: - -.. data:: exdrOK - - Success of xdr file read/write operation. - -.. data:: exdrCLOSE - - xdr file is closed - -.. data:: exdrENDOFFILE - - end of file was reached (response of :func:`read_xtc` and - :func:`read_trr` after the last read frame) - -.. data:: exdrFILENOTFOUND - - :func:`xdrfile_open` cannot find the requested file - - -Opening and closing of XDR files -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Two low-level functions are used to obtain a *XDRFILE* object (a file handle) -to access xdr files such as XTC or TRR trajectories. - -.. function:: xdrfile_open(path, mode) -> XDRFILE - - Open *path* and returns a *XDRFILE* handle that is required by other - functions. - - :Arguments: - *path* - file name - *mode* - 'r' for reading and 'w' for writing - :Returns: *XDRFILE* handle - -.. function:: xdrfile_close(XDRFILE) -> status - - Close the xdrfile pointed to by *XDRFILE*. - - .. Warning:: Closing an already closed file will lead to a - crash with a double-free pointer error. - -XTC functions -~~~~~~~~~~~~~ - -The XTC trajectory format is a lossy compression format that only stores -coordinates. Compression level is determined by the *precision* argument to the -:func:`write_xtc` function. Coordinates (Gromacs_ uses nm natively) are -multiplied by *precision* and truncated to the integer part. A typical value is -1000.0, which gives an accuracy of 1/100 of an Angstroem. - -The advantage of XTC over TRR is its significantly reduced size. - - -.. function:: read_xtc_natoms(fn) -> natoms - - Read the number of atoms *natoms* from a xtc file *fn*. - - :Arguments: - *fn* - file name of an xtc file - - :Raises: :exc:`IOError` if the supplied filed is not a XTC - or if it is not readable. - -.. function:: read_xtc_numframes(fn) -> (numframes, offsets) - - Read through the whole trajectory headers to obtain the total number of frames. - The process is speeded up by reading frame headers for the amount of data in the frame, - and then skipping directly to the next header. An array of frame offsets is also - returned, which can later be used to seek direcly to arbitrary frames in the trajectory. - - :Arguments: - *fn* - file name of an xtc file - - :Returns: - a tuple containing: - *numframes* - an int with the total frame count in the trajectory - *offsets* - a numpy array of int64 recording the starting byte offset of each frame - - :Raises: :exc:`IOError` if the supplied filed is not a XTC - or if it is not readable. - -.. function:: read_xtc(XDRFILE, box, x) -> (status, step, time, precision) - - Read the next frame from the opened xtc trajectory into *x*. - - :Arguments: - *XDRFILE* - open *XDRFILE* object - *box* - pre-allocated numpy ``array((DIM,DIM),dtype=numpy.float32)`` which - is filled with the unit cell box vectors - *x* - pre-allocated numpy ``array((natoms, DIM),dtype=numpy.float32)`` - which is updated with the coordinates from the frame - - :Returns: - a tuple containing: - *status* - integer status (0 = exdrOK), see `Status symbols`_ for other - values) - *step* - simulation step - *time* - simulation time in ps - *precision* - precision of the lossy xtc format (typically 1000.0) - -.. function:: write_xtc(XDRFILE, step, time, box, x, prec) -> status - - Write the next frame *x* to the opened xtc trajectory. - - :Arguments: - *XDRFILE* - open *XDRFILE* object (writable) - *step* - simulation step - *time* - time step in ps - *box* - numpy ``array((DIM,DIM),dtype=numpy.float32)`` which contains - the unit cell box vectors - *x* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the coordinates from the frame - *precision* - precision of the lossy xtc format (typically 1000.0) - - :Returns: *status*, integer status (0 = OK), see the ``libxdrfile2.exdr*`` - constants under `Status symbols`_ for other values) - -TRR functions -~~~~~~~~~~~~~ - -TRR is the Gromacs_ native full-feature trajectory storage format. It can contain position -coordinates, velocities and forces, and the lambda value for free energy perturbation -calculations. Velocities and forces are optional in the sense that they can be all zero. - -.. function:: read_trr_natoms(fn) -> natoms - - Read the number of atoms *natoms* from a trr file *fn*. - - :Arguments: - *fn* - file name of a trr file - - :Raises: :exc:`IOError` if the supplied filed is not a TRR - or if it is not readable. - -.. function:: read_trr_numframes(fn) -> (numframes, offsets) - - Read through the whole trajectory headers to obtain the total number of frames. - The process is speeded up by reading frame headers for the amount of data in the frame, - and then skipping directly to the next header. An array of frame offsets is also - returned, which can later be used to seek direcly to arbitrary frames in the trajectory. - - :Arguments: - *fn* - file name of an xtc file - - :Returns: - a tuple containing: - *numframes* - an int with the total frame count in the trajectory - *offsets* - a numpy array of int64 recording the starting byte offset of each frame - - :Raises: :exc:`IOError` if the supplied filed is not a TRR or if it is not readable. - -.. function:: read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda) - - Read the next frame from the opened trr trajectory into *x*, *v*, and *f*. - - :Arguments: - *XDRFILE* - open *XDRFILE* object - *box* - pre-allocated numpy ``array((DIM,DIM),dtype=numpy.float32)`` which - is filled with the unit cell box vectors - *x* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **coordinates** from the frame - *v* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **velocities** from the frame - *f* - pre-allocated numpy ``array((natoms, DIM),dtype=nump.float32)`` - which is updated with the **forces** from the frame - - :Returns: - a tuple containing: - *status* - integer status (0 = exdrOK), see the ``libxdrfile2.exdr*`` constants - under `Status symbols`_ for other values) - *step* - simulation step - *time* - simulation time in ps - *lambda* - current lambda value (only interesting for free energy perturbation) - *has_x* - boolean indicating whether coordinates were read from the TRR - *has_v* - boolean indicating whether velocities were read from the TRR - *has_f* - boolean indicating whether forces were read from the TRR - -.. function:: write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status - - Write the next frame to the opened trr trajectory. - - :Arguments: - *XDRFILE* - open *XDRFILE* object (writable) - *step* - simulation step - *time* - time step in ps - *lambda* - free energy lambda value (typically 0.0) - *box* - numpy ``array((DIM,DIM),dtype=numpy.float32)`` which contains - the unit cell box vectors - *x* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **coordinates** from the frame - *v* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **velocities** from the frame - *f* - numpy ``array((natoms, DIM),dtype=nump.float32)`` - which contains the **forces** from the frame - - .. versionchanged:: 0.8.0 - either one of *x*, *v*, or *f* can now be set as a natom,0-DIM - numpy ``array((natom, 0),dtype=nump.float32)``. This will cause the - corresponding property to be skipped when writing to file. - - :Returns: *status*, integer status (0 = OK), see the ``libxdrfile2.exdr*`` - constants under `Status symbols`_ for other values) - - -""" - - -from sys import version_info -if version_info >= (2,6,0): - def swig_import_helper(): - from os.path import dirname - import imp - fp = None - try: - fp, pathname, description = imp.find_module('_libxdrfile2', [dirname(__file__)]) - except ImportError: - import _libxdrfile2 - return _libxdrfile2 - if fp is not None: - try: - _mod = imp.load_module('_libxdrfile2', fp, pathname, description) - finally: - fp.close() - return _mod - _libxdrfile2 = swig_import_helper() - del swig_import_helper -else: - import _libxdrfile2 -del version_info -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. -def _swig_setattr_nondynamic(self,class_type,name,value,static=1): - if (name == "thisown"): return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name,None) - if method: return method(self,value) - if (not static): - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - -def _swig_setattr(self,class_type,name,value): - return _swig_setattr_nondynamic(self,class_type,name,value,0) - -def _swig_getattr(self,class_type,name): - if (name == "thisown"): return self.this.own() - method = class_type.__swig_getmethods__.get(name,None) - if method: return method(self) - raise AttributeError(name) - -def _swig_repr(self): - try: strthis = "proxy of " + self.this.__repr__() - except: strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -try: - _object = object - _newclass = 1 -except AttributeError: - class _object : pass - _newclass = 0 - - -exdrOK = _libxdrfile2.exdrOK -exdrHEADER = _libxdrfile2.exdrHEADER -exdrSTRING = _libxdrfile2.exdrSTRING -exdrDOUBLE = _libxdrfile2.exdrDOUBLE -exdrINT = _libxdrfile2.exdrINT -exdrFLOAT = _libxdrfile2.exdrFLOAT -exdrUINT = _libxdrfile2.exdrUINT -exdr3DX = _libxdrfile2.exdr3DX -exdrCLOSE = _libxdrfile2.exdrCLOSE -exdrMAGIC = _libxdrfile2.exdrMAGIC -exdrNOMEM = _libxdrfile2.exdrNOMEM -exdrENDOFFILE = _libxdrfile2.exdrENDOFFILE -exdrFILENOTFOUND = _libxdrfile2.exdrFILENOTFOUND -exdrNR = _libxdrfile2.exdrNR -SEEK_SET = _libxdrfile2.SEEK_SET -SEEK_CUR = _libxdrfile2.SEEK_CUR -SEEK_END = _libxdrfile2.SEEK_END - -def xdrfile_open(*args): - """xdrfile_open(path, mode) -> XDRFILE *""" - return _libxdrfile2.xdrfile_open(*args) - -def xdrfile_close(*args): - """xdrfile_close(fp) -> int""" - return _libxdrfile2.xdrfile_close(*args) - -def read_xtc_natoms(*args): - """read_xtc_natoms(fn) -> int""" - return _libxdrfile2.read_xtc_natoms(*args) - -def read_xtc_numframes(*args): - """read_xtc_numframes(fn) -> PyObject *""" - return _libxdrfile2.read_xtc_numframes(*args) - -def read_trr_natoms(*args): - """read_trr_natoms(fn) -> int""" - return _libxdrfile2.read_trr_natoms(*args) - -def read_trr_numframes(*args): - """read_trr_numframes(fn) -> PyObject *""" - return _libxdrfile2.read_trr_numframes(*args) -DIM = _libxdrfile2.DIM - -def read_xtc(*args): - """read_xtc(XDRFILE, box, x) -> (status, step, time, precision)""" - return _libxdrfile2.read_xtc(*args) - -def read_trr(*args): - """read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda)""" - return _libxdrfile2.read_trr(*args) - -def write_xtc(*args): - """write_xtc(XDRFILE, step, time, box, x, prec) -> status""" - return _libxdrfile2.write_xtc(*args) - -def write_trr(*args): - """write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status""" - return _libxdrfile2.write_trr(*args) - -def xdr_seek(*args): - """xdr_seek(xd, pos, whence) -> int""" - return _libxdrfile2.xdr_seek(*args) - -def xdr_tell(*args): - """xdr_tell(xd) -> long long""" - return _libxdrfile2.xdr_tell(*args) -# This file is compatible with both classic and new-style classes. - - diff --git a/pymolfile/libpymolfile/tester.f b/pymolfile/libpymolfile/tester.f deleted file mode 100644 index 40e250bb80cc1ad0d8446dd5d37f2726679b5636..0000000000000000000000000000000000000000 --- a/pymolfile/libpymolfile/tester.f +++ /dev/null @@ -1,110 +0,0 @@ -c testing frontend for the molfile plugin fortran interface -c $Id: tester.f,v 1.1 2006/03/10 22:48:49 johns Exp $ -c (c) 2006 Axel Kohlmeyer <akohlmey@cmm.chem.upenn.edu> - - program molfile - implicit none - - integer*4 natom, maxatom, handle(4), status - parameter (maxatom=3000*3) - real*4 xyz(maxatom), box(6) - - character infile*200, intype*10 - integer i,j - - print*,'molfile fortran tester v0.01' - -C set some default values - infile = 'TRAJEC.dcd' - intype = 'auto' - natom = -1 - handle(1) = -1 - handle(2) = -1 - handle(3) = -1 - handle(4) = -1 - - print*,'filename: ', infile - print*,'type: ', intype - -C set up everything and -C register all static plugins - call f77_molfile_init - - call f77_molfile_open_read(handle(1),natom,infile,intype) - - if (handle(1).lt.0) then - print*,'file type unknown or not registered' - else - print*,'file successfully opened:' - print*,'handle:',handle(1) - print*,'natom: ',natom - end if - - do i=1,2000 - status = 1 ! status=1 on entry means read - call f77_molfile_read_next(handle(1),natom,xyz(1),box,status); - print*,'read ',i,' status:',status - print*,'atom(1)', (xyz(j),j=1,3) - print*,'atom(10)',(xyz(j),j=31,33) - print*,'atom(100)',(xyz(j),j=301,303) - print*,'box',box - if(status.eq.0) go to 666 - status = 0 ! status=0 on entry means skip - call f77_molfile_read_next(handle(1),natom,xyz,box,status); - print*,'read ',i,' status:',status - if(status.eq.0) go to 666 - end do - 666 continue - - infile='li-nh3_4-end.pdb' - intype='pdb' - call f77_molfile_open_read(handle(2),natom,infile,intype) - - if (handle(2).lt.0) then - print*,'file type unknown or not registered' - else - print*,'file successfully opened:' - print*,'handle:',handle(2) - print*,'natom: ',natom - end if - - do i=1,2000 - status = 1 ! status=1 on entry means read - call f77_molfile_read_next(handle(2),natom,xyz(1),box,status); - print*,'read ',i,' status:',status - if(status.eq.0) go to 6666 - print*,'atom(1)', (xyz(j),j=1,3) - print*,'atom(10)', (xyz(j),j=31,33) - print*,'atom(100)',(xyz(j),j=301,303) - print*,'box',box - status = 0 ! status=0 on entry means skip - call f77_molfile_read_next(handle(2),natom,xyz,box,status); - print*,'read ',i,' status:',status - if(status.eq.0) go to 6666 - end do - 6666 continue - call f77_molfile_open_read(handle(3),natom,infile,intype) - print*,'handle:',handle(3) - - call f77_molfile_close_read(handle(1),status) - print*,'handle:',handle(1) - call f77_molfile_open_read(handle(1),natom,infile,intype) - print*,'handle:',handle(1) - call f77_molfile_open_read(handle(4),natom,infile,intype) - print*,'handle:',handle(4) - - - call f77_molfile_close_read(handle(2),status) - print*,'handle:',handle(2) - call f77_molfile_close_read(handle(1),status) - print*,'handle:',handle(1) - call f77_molfile_close_read(handle(3),status) - print*,'handle:',handle(3) - call f77_molfile_close_read(handle(2),status) - print*,'handle:',handle(2) - call f77_molfile_close_read(handle(4),status) - print*,'handle:',handle(4) - - call f77_molfile_finish - - end diff --git a/pymolfile/molfile/.lipo b/pymolfile/molfile/.lipo new file mode 100644 index 0000000000000000000000000000000000000000..6203b131c0616fd693c105831a2b1b23fb8fa669 Binary files /dev/null and b/pymolfile/molfile/.lipo differ diff --git a/pymolfile/libpymolfile/__init__.py b/pymolfile/molfile/__init__.py similarity index 50% rename from pymolfile/libpymolfile/__init__.py rename to pymolfile/molfile/__init__.py index 584c3db77a365e537797219d8d866cef43fdd84e..2fa350890c2794810c7356d8e44d2271788527c6 100644 --- a/pymolfile/libpymolfile/__init__.py +++ b/pymolfile/molfile/__init__.py @@ -1,7 +1,7 @@ # Stand-alone python bindings for libvmdmolfile # Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> -# Published under the GNU GENERAL PUBLIC LICENSE Version 2 (or higher) -"""Stand-alone vmdmolfile library. +# Published under the BSD LICENSE +"""libpymolfile library. """ diff --git a/pymolfile/molfile/__init__.pyc b/pymolfile/molfile/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43a135fa7d8f6c90ddc870cad60f1cee52dd6933 Binary files /dev/null and b/pymolfile/molfile/__init__.pyc differ diff --git a/pymolfile/molfile/__pycache__/__init__.cpython-36.pyc b/pymolfile/molfile/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3aaa7daa4aa032356318545e3c703ed00ac0ac6e Binary files /dev/null and b/pymolfile/molfile/__pycache__/__init__.cpython-36.pyc differ diff --git a/pymolfile/molfile/__pycache__/libpymolfile.cpython-36.pyc b/pymolfile/molfile/__pycache__/libpymolfile.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..270df113f6d58296d31053c92d6273f8773ff8e6 Binary files /dev/null and b/pymolfile/molfile/__pycache__/libpymolfile.cpython-36.pyc differ diff --git a/pymolfile/molfile/_libpymolfile.so b/pymolfile/molfile/_libpymolfile.so new file mode 100755 index 0000000000000000000000000000000000000000..5f16657f992bcb5f73c8572738446d8880bc9afd Binary files /dev/null and b/pymolfile/molfile/_libpymolfile.so differ diff --git a/pymolfile/molfile/_libpymolfile.so.dSYM/Contents/Info.plist b/pymolfile/molfile/_libpymolfile.so.dSYM/Contents/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..a1ee3c17acbea1c02095f00322512685cdd3490d --- /dev/null +++ b/pymolfile/molfile/_libpymolfile.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>com.apple.xcode.dsym._libpymolfile.so</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>dSYM</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + </dict> +</plist> diff --git a/pymolfile/molfile/_libpymolfile.so.dSYM/Contents/Resources/DWARF/_libpymolfile.so b/pymolfile/molfile/_libpymolfile.so.dSYM/Contents/Resources/DWARF/_libpymolfile.so new file mode 100644 index 0000000000000000000000000000000000000000..d66b822ee7cd1186e842d1ef8fbd9025fe68b6cb Binary files /dev/null and b/pymolfile/molfile/_libpymolfile.so.dSYM/Contents/Resources/DWARF/_libpymolfile.so differ diff --git a/pymolfile/molfile/compile.sh b/pymolfile/molfile/compile.sh new file mode 100644 index 0000000000000000000000000000000000000000..0a16c41abea2454bf10bf092248037ae54376688 --- /dev/null +++ b/pymolfile/molfile/compile.sh @@ -0,0 +1,2 @@ +swig -Wall -c++ -python libpymolfile.i +g++ -fPIC -Wall -Wextra -Wunused-function -shared -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 diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.a b/pymolfile/molfile/lib/libmolfile_plugin.a similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.a rename to pymolfile/molfile/lib/libmolfile_plugin.a diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.dylib b/pymolfile/molfile/lib/libmolfile_plugin.dylib similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.dylib rename to pymolfile/molfile/lib/libmolfile_plugin.dylib diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.h b/pymolfile/molfile/lib/libmolfile_plugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.h rename to pymolfile/molfile/lib/libmolfile_plugin.h diff --git a/pymolfile/molfile/libpymolfile.i b/pymolfile/molfile/libpymolfile.i new file mode 100644 index 0000000000000000000000000000000000000000..8ac048ba48bfa814e7b7b18b72dc212011b05ec2 --- /dev/null +++ b/pymolfile/molfile/libpymolfile.i @@ -0,0 +1,239 @@ +/* -*- C -*- (not really, but good for syntax highlighting) */ +/* SWIG interface for libvmdmolfile of VMD molfile_plugins + Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> + Published under BSD LICENSE + + swig -python -outdir pymolfile/lib/ pymolfile/src/libpymolfile.i +*/ +%define DOCSTRING +" +:Author: Berk Onat <b.onat@warwick.ac.uk> +:Year: 2017 +:Licence: BSD LICENSE + + +" +%enddef + +%module(docstring=DOCSTRING) libpymolfile + + +%{ +/* Python SWIG interface to libpymolfile + Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> + Published under BSD LICENSE + */ +#define SWIG_FILE_WITH_INIT +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include "molfile_plugin.h" +#include "libmolfile_plugin.h" +#include "vmdplugin.h" +#include "pymolfile.h" +%} + +%include "numpy.i" + +%init %{ +import_array(); +%} + + +/* + Wrapping only high-level plugin functions to register VMD + plugins and to retrive the data through molfile_plugin interface. + + Only modifing call signatures. This will help one to access functions + without dealing with pointers from python. +*/ + + +/* plugin status codes for error handling */ +enum { pluginOK, pluginNOINIT, pluginCLOSE, pluginNOMEM, + pluginENDOFFILE, pluginFILENOTFOUND, pluginFORMATERROR }; + +/* pymolfile.c + initialize and finalize molfile plugins +*/ +%feature("autodoc", "0") molfile_plugin_list; +extern molfile_plugin_t** molfile_plugin_list(int maxsize); + +%feature("autodoc", "0") molfile_init; +extern int molfile_init(void); + +%feature("autodoc", "0") molfile_finish; +extern int molfile_finish(void); + +%feature("autodoc", "0") get_plugin; +extern molfile_plugin_t* get_plugin(molfile_plugin_t** plugin_list, int plugin_no); + +%feature("autodoc", "0") molfile_plugin_info; +%exception molfile_plugin_info { + $action + if (PyErr_Occurred()) SWIG_fail; +} +%inline %{ +PyObject * molfile_plugin_info(molfile_plugin_t** plugin_list, int plugin_no) { + molfile_plugin_t *plugin; + int *plugno = &plugin_no; + int has_readstructure = 0; + int has_readbonds = 0; + int has_readangles = 0; + int has_writestructure = 0; + int has_writebonds = 0; + int has_writeangles = 0; + int has_readnexttimestep = 0; + int has_writetimestep = 0; + int plugin_list_size = sizeof(plugin_list) / sizeof(molfile_plugin_t**); + if (plugno==NULL || plugin_no<0){ + PyErr_Format(PyExc_IOError, "[%d] Error: molfile plugin handle no should be given, be positive value and should not exceed the list length'%d'. You set '%d'", pluginNOINIT, plugin_list_size, plugin_no); + return 0; + } + plugin = plugin_list[plugin_no]; + if(plugin==NULL || !plugin->open_file_read){ + PyErr_Format(PyExc_IOError, "[%d] Error: molfile plugin '%d' is not initialized.", pluginNOINIT, plugin_no); + return 0; + } + if (plugin->read_structure) has_readstructure = 1; + if (plugin->read_bonds) has_readbonds = 1; + if (plugin->read_angles) has_readangles = 1; + if (plugin->read_next_timestep) has_readnexttimestep = 1; + if (plugin->write_structure) has_writestructure = 1; + if (plugin->write_bonds) has_writebonds = 1; + if (plugin->write_angles) has_writeangles = 1; + if (plugin->write_timestep) has_writetimestep = 1; + PyObject *tuple = PyTuple_New(17); + PyTuple_SET_ITEM(tuple, 0, PyString_FromString(plugin->filename_extension)); + PyTuple_SET_ITEM(tuple, 1, PyString_FromString(plugin->name)); + PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)has_readstructure)); + PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((long)has_readbonds)); + PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((long)has_readangles)); + PyTuple_SET_ITEM(tuple, 5, PyInt_FromLong((long)has_readnexttimestep)); + PyTuple_SET_ITEM(tuple, 6, PyInt_FromLong((long)has_writestructure)); + PyTuple_SET_ITEM(tuple, 7, PyInt_FromLong((long)has_writebonds)); + PyTuple_SET_ITEM(tuple, 8, PyInt_FromLong((long)has_writeangles)); + PyTuple_SET_ITEM(tuple, 9, PyInt_FromLong((long)has_writetimestep)); + PyTuple_SET_ITEM(tuple, 10, PyString_FromString(plugin->prettyname)); + PyTuple_SET_ITEM(tuple, 11, PyString_FromString(plugin->type)); + PyTuple_SET_ITEM(tuple, 12, PyString_FromString(plugin->author)); + PyTuple_SET_ITEM(tuple, 13, PyInt_FromLong((long)plugin->majorv)); + PyTuple_SET_ITEM(tuple, 14, PyInt_FromLong((long)plugin->minorv)); + PyTuple_SET_ITEM(tuple, 15, PyInt_FromLong((long)plugin->abiversion)); + PyTuple_SET_ITEM(tuple, 16, PyInt_FromLong((long)plugin->is_reentrant)); + return tuple; + } +%} + +/* +%feature("autodoc", "0") molfile_open; +%exception molfile_open { + $action + if (PyErr_Occurred()) SWIG_fail; +} +%inline %{ +PyObject * molfile_open(molfile_plugin_t* plugin, ) { + int *plugno = &plugin_no; + return plugin; + } +%} +*/ + +/* + 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 */ + + +/* const char *filename_extension; */ + + +/* + void *(* open_file_read)(const char *filepath, const char *filetype, + int *natoms); + void (* close_file_read)(void *); + int (*read_structure)(void *, int *optflags, molfile_atom_t *atoms); + int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder, + int **bondtype, int *nbondtypes, char ***bondtypename); + int (* read_next_timestep)(void *, int natoms, molfile_timestep_t *); + void *(* open_file_write)(const char *filepath, const char *filetype, + int natoms); + int (* write_structure)(void *, int optflags, const molfile_atom_t *atoms); + int (* write_timestep)(void *, const molfile_timestep_t *); + void (* close_file_write)(void *); + int (* read_molecule_metadata)(void *, molfile_metadata_t **metadata); + int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder, + int *bondtype, int nbondtypes, char **bondtypename); + int (* read_angles)(void *handle, int *numangles, int **angles, int **angletypes, + int *numangletypes, char ***angletypenames, int *numdihedrals, + int **dihedrals, int **dihedraltypes, int *numdihedraltypes, + char ***dihedraltypenames, int *numimpropers, int **impropers, + int **impropertypes, int *numimpropertypes, char ***impropertypenames, + int *numcterms, int **cterms, int *ctermcols, int *ctermrows); + int (* write_angles)(void *handle, int numangles, const int *angles, const int *angletypes, + int numangletypes, const char **angletypenames, int numdihedrals, + const int *dihedrals, const int *dihedraltypes, int numdihedraltypes, + const char **dihedraltypenames, int numimpropers, + const int *impropers, const int *impropertypes, int numimpropertypes, + const char **impropertypenames, int numcterms, const int *cterms, + int ctermcols, int ctermrows); + int (* read_timestep)(void *, int natoms, molfile_timestep_t *, + molfile_qm_metadata_t *, molfile_qm_timestep_t *); + int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *); + int (* read_timestep2)(void *, molfile_ssize_t index, molfile_timestep_t *); + molfile_ssize_t (* read_times)( void *, + molfile_ssize_t start, + molfile_ssize_t count, + double * times ); + int (* cons_fputs)(const int, const char*); +*/ + + +/* molfile_timestep_t + + float *coords; coordinates of all atoms, arranged xyzxyzxyz + float *velocities; space for velocities of all atoms; same layout + float A, B, C, alpha, beta, gamma; + double physical_time; physical time point associated with this frame + + double total_energy; + double potential_energy; + double kinetic_energy; + double extended_energy; + double force_energy; + double total_pressure; +*/ + + +/* molfile_timestep_metadata_t + + unsigned int count; total # timesteps; -1 if unknown + unsigned int avg_bytes_per_timestep; bytes per timestep + int has_velocities; if timesteps have velocities +*/ + + + diff --git a/pymolfile/molfile/libpymolfile.py b/pymolfile/molfile/libpymolfile.py new file mode 100644 index 0000000000000000000000000000000000000000..99826d44affeba9f88384ea9f7c7c7f98d6e0212 --- /dev/null +++ b/pymolfile/molfile/libpymolfile.py @@ -0,0 +1,138 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 3.0.12 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + +""" + +:Author: Berk Onat <b.onat@warwick.ac.uk> +:Year: 2017 +:Licence: BSD LICENSE + + + +""" + + +from sys import version_info as _swig_python_version_info +if _swig_python_version_info >= (2, 7, 0): + def swig_import_helper(): + import importlib + pkg = __name__.rpartition('.')[0] + mname = '.'.join((pkg, '_libpymolfile')).lstrip('.') + try: + return importlib.import_module(mname) + except ImportError: + return importlib.import_module('_libpymolfile') + _libpymolfile = swig_import_helper() + del swig_import_helper +elif _swig_python_version_info >= (2, 6, 0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_libpymolfile', [dirname(__file__)]) + except ImportError: + import _libpymolfile + return _libpymolfile + try: + _mod = imp.load_module('_libpymolfile', fp, pathname, description) + finally: + if fp is not None: + fp.close() + return _mod + _libpymolfile = swig_import_helper() + del swig_import_helper +else: + import _libpymolfile +del _swig_python_version_info + +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. + +try: + import builtins as __builtin__ +except ImportError: + import __builtin__ + +def _swig_setattr_nondynamic(self, class_type, name, value, static=1): + if (name == "thisown"): + return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name, None) + if method: + return method(self, value) + if (not static): + if _newclass: + object.__setattr__(self, name, value) + else: + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + + +def _swig_setattr(self, class_type, name, value): + return _swig_setattr_nondynamic(self, class_type, name, value, 0) + + +def _swig_getattr(self, class_type, name): + if (name == "thisown"): + return self.this.own() + method = class_type.__swig_getmethods__.get(name, None) + if method: + return method(self) + raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) + + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except __builtin__.Exception: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except __builtin__.Exception: + class _object: + pass + _newclass = 0 + +pluginOK = _libpymolfile.pluginOK +pluginNOINIT = _libpymolfile.pluginNOINIT +pluginCLOSE = _libpymolfile.pluginCLOSE +pluginNOMEM = _libpymolfile.pluginNOMEM +pluginENDOFFILE = _libpymolfile.pluginENDOFFILE +pluginFILENOTFOUND = _libpymolfile.pluginFILENOTFOUND +pluginFORMATERROR = _libpymolfile.pluginFORMATERROR + +def molfile_plugin_list(maxsize): + """molfile_plugin_list(maxsize) -> molfile_plugin_t **""" + return _libpymolfile.molfile_plugin_list(maxsize) + +def molfile_init(): + """molfile_init() -> int""" + return _libpymolfile.molfile_init() + +def molfile_finish(): + """molfile_finish() -> int""" + return _libpymolfile.molfile_finish() + +def get_plugin(plugin_list, plugin_no): + """get_plugin(plugin_list, plugin_no) -> molfile_plugin_t *""" + return _libpymolfile.get_plugin(plugin_list, plugin_no) + +def molfile_plugin_info(plugin_list, plugin_no): + """molfile_plugin_info(plugin_list, plugin_no) -> PyObject *""" + return _libpymolfile.molfile_plugin_info(plugin_list, plugin_no) +# This file is compatible with both classic and new-style classes. + + diff --git a/pymolfile/molfile/libpymolfile.pyc b/pymolfile/molfile/libpymolfile.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3736e9eb876d4d874db95272a6802c56f105570 Binary files /dev/null and b/pymolfile/molfile/libpymolfile.pyc differ diff --git a/pymolfile/libpymolfile-old/libvmdmolfile_wrap.c b/pymolfile/molfile/libpymolfile_wrap.c similarity index 67% rename from pymolfile/libpymolfile-old/libvmdmolfile_wrap.c rename to pymolfile/molfile/libpymolfile_wrap.c index 4f6f3b412b63345876766b85352a020353acd7dc..6f1adbdcb0d89209aadcc05ce50230698c431e8d 100644 --- a/pymolfile/libpymolfile-old/libvmdmolfile_wrap.c +++ b/pymolfile/molfile/libpymolfile_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.9 + * Version 3.0.12 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -8,7 +8,11 @@ * interface file instead. * ----------------------------------------------------------------------------- */ + +#ifndef SWIGPYTHON #define SWIGPYTHON +#endif + #define SWIG_PYTHON_DIRECTOR_NO_VTABLE /* ----------------------------------------------------------------------------- @@ -78,9 +82,11 @@ #endif /* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif # endif #endif @@ -119,10 +125,29 @@ # define _SCL_SECURE_NO_DEPRECATE #endif +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif -/* Python.h has to appear first */ -#include <Python.h> +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* Use debug wrappers with the Python release dll */ +# undef _DEBUG +# include <Python.h> +# define _DEBUG +#else +# include <Python.h> +#endif /* ----------------------------------------------------------------------------- * swigrun.swg @@ -294,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ -# define SWIG_AddCast +# define SWIG_AddCast(r) (r) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif @@ -358,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, /* Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if not equal, 1 if equal + Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; const char* te = tb + strlen(tb); const char* ne = nb; - while (!equiv && *ne) { + while (equiv != 0 && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + equiv = SWIG_TypeNameComp(nb, ne, tb, te); if (*ne) ++ne; } return equiv; @@ -377,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { /* Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb + Return 0 if not equal, 1 if equal */ SWIGRUNTIME int -SWIG_TypeCompare(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } - /* Check the typename */ @@ -541,14 +555,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *iter = start; do { if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; + size_t l = 0; + size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; + size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { - register int compare = strcmp(name, iname); + int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { @@ -592,7 +606,7 @@ SWIG_TypeQueryModule(swig_module_info *start, of the str field (the human readable name) */ swig_module_info *iter = start; do { - register size_t i = 0; + size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; @@ -611,10 +625,10 @@ SWIG_TypeQueryModule(swig_module_info *start, SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register unsigned char uu = *u; + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } @@ -626,22 +640,22 @@ SWIG_PackData(char *c, void *ptr, size_t sz) { */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; + char d = *(c++); + unsigned char uu; if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); + uu = (unsigned char)((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); + uu = (unsigned char)((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); + uu |= (unsigned char)(d - '0'); else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); + uu |= (unsigned char)(d - ('a'-10)); else return (char *) 0; *u = uu; @@ -737,7 +751,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define PyString_FromString(x) PyUnicode_FromString(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) +#define PyString_Size(str) PyBytes_Size(str) #define PyString_InternFromString(key) PyUnicode_InternFromString(key) #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) @@ -782,7 +796,7 @@ SWIG_Python_str_AsChar(PyObject *str) #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else -# define SWIG_Python_str_DelForPy3(x) +# define SWIG_Python_str_DelForPy3(x) #endif @@ -790,7 +804,7 @@ SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); + return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif @@ -824,10 +838,6 @@ PyString_FromFormat(const char *fmt, ...) { } #endif -/* Add PyObject_Del for old Pythons */ -#if PY_VERSION_HEX < 0x01060000 -# define PyObject_Del(op) PyMem_DEL((op)) -#endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif @@ -942,6 +952,7 @@ typedef destructor freefunc; #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long #endif /* ----------------------------------------------------------------------------- @@ -1028,7 +1039,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { @@ -1154,7 +1165,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int @@ -1181,26 +1192,26 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ -SWIGINTERN void +SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } -SWIGINTERN void +SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, msg); @@ -1221,7 +1232,7 @@ SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { } SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { #if PY_VERSION_HEX < 0x02030000 PyDict_SetItemString(d, (char *)name, obj); #else @@ -1235,13 +1246,13 @@ SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *nam #else SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #if PY_VERSION_HEX < 0x02030000 PyDict_SetItemString(d, (char *)name, obj); #else PyDict_SetItemString(d, name, obj); #endif - Py_DECREF(obj); + Py_DECREF(obj); } #endif @@ -1293,21 +1304,21 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { /* Unpack the argument tuple */ -SWIGINTERN int +SWIGINTERN Py_ssize_t SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } - } + } if (!PyTuple_Check(args)) { if (min <= 1 && max >= 1) { - register int i; + Py_ssize_t i; objs[0] = args; for (i = 1; i < max; ++i) { objs[i] = 0; @@ -1317,17 +1328,17 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { - register Py_ssize_t l = PyTuple_GET_SIZE(args); + Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { - register int i; + Py_ssize_t i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } @@ -1335,7 +1346,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi objs[l] = 0; } return i + 1; - } + } } } @@ -1387,14 +1398,14 @@ extern "C" { # undef Py_None # define Py_None SWIG_Py_None() # endif -SWIGRUNTIMEINLINE PyObject * +SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } -SWIGRUNTIME PyObject * +SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); @@ -1404,7 +1415,7 @@ SWIG_Py_None(void) /* The python void return value */ -SWIGRUNTIMEINLINE PyObject * +SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; @@ -1424,7 +1435,7 @@ typedef struct { PyTypeObject *pytype; } SwigPyClientData; -SWIGRUNTIMEINLINE int +SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; @@ -1439,7 +1450,7 @@ SWIG_Python_ExceptionType(swig_type_info *desc) { } -SWIGRUNTIME SwigPyClientData * +SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { @@ -1493,7 +1504,7 @@ SwigPyClientData_New(PyObject* obj) } } -SWIGRUNTIME void +SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData *data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); @@ -1513,6 +1524,23 @@ typedef struct { #endif } SwigPyObject; + +#ifdef SWIGPYTHON_BUILTIN + +SWIGRUNTIME PyObject * +SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + + if (!sobj->dict) + sobj->dict = PyDict_New(); + + Py_INCREF(sobj->dict); + return sobj->dict; +} + +#endif + SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { @@ -1577,35 +1605,7 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args) PyString_ConcatAndDel(&repr,nrep); # endif } - return repr; -} - -SWIGRUNTIME int -SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) -{ - char *str; -#ifdef METH_NOARGS - PyObject *repr = SwigPyObject_repr(v); -#else - PyObject *repr = SwigPyObject_repr(v, NULL); -#endif - if (repr) { - str = SWIG_Python_str_AsChar(repr); - fputs(str, fp); - SWIG_Python_str_DelForPy3(str); - Py_DECREF(repr); - return 0; - } else { - return 1; - } -} - -SWIGRUNTIME PyObject * -SwigPyObject_str(SwigPyObject *v) -{ - char result[SWIG_BUFFER_SIZE]; - return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? - SWIG_Python_str_FromChar(result) : 0; + return repr; } SWIGRUNTIME int @@ -1626,7 +1626,7 @@ SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); - return res; + return res; } @@ -1679,30 +1679,46 @@ SwigPyObject_dealloc(PyObject *v) if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; + + /* PyObject_CallFunction() has the potential to silently drop + the active active exception. In cases of unnamed temporary + variable or where we just finished iterating over a generator + StopIteration will be active right now, and this needs to + remain true upon return from SwigPyObject_dealloc. So save + and restore. */ + + PyObject *val = NULL, *type = NULL, *tb = NULL; + PyErr_Fetch(&val, &type, &tb); + if (data->delargs) { - /* we need to create a temporary object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - res = ((*meth)(mself, v)); + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); } + if (!res) + PyErr_WriteUnraisable(destroy); + + PyErr_Restore(val, type, tb); + Py_XDECREF(res); - } + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif - } + } Py_XDECREF(next); PyObject_DEL(v); } -SWIGRUNTIME PyObject* +SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; @@ -1712,6 +1728,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) next = tmp; #endif if (!SwigPyObject_Check(next)) { + PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); return NULL; } sobj->next = next; @@ -1719,7 +1736,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) return SWIG_Py_Void(); } -SWIGRUNTIME PyObject* +SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else @@ -1727,7 +1744,7 @@ SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; - if (sobj->next) { + if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { @@ -1766,13 +1783,13 @@ SwigPyObject_own(PyObject *v, PyObject *args) #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #elif (PY_VERSION_HEX < 0x02050000) - if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #else - if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) + if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) #endif { return NULL; - } + } else { SwigPyObject *sobj = (SwigPyObject *)v; @@ -1791,7 +1808,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) SwigPyObject_disown(v,args); } #endif - } + } return obj; } } @@ -1800,23 +1817,23 @@ SwigPyObject_own(PyObject *v, PyObject *args) static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} + {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} + {0, 0, 0, 0} }; #endif @@ -1867,7 +1884,9 @@ SwigPyObject_TypeOnce(void) { (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif -#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ @@ -1882,7 +1901,6 @@ SwigPyObject_TypeOnce(void) { static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -1893,7 +1911,7 @@ SwigPyObject_TypeOnce(void) { sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - (printfunc)SwigPyObject_print, /* tp_print */ + 0, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else @@ -1901,7 +1919,7 @@ SwigPyObject_TypeOnce(void) { #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif @@ -1911,7 +1929,7 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyObject_str, /* tp_str */ + 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ @@ -1947,10 +1965,19 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; swigpyobject_type = tmp; @@ -1993,16 +2020,16 @@ SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; - fputs("<Swig Packed ", fp); + fputs("<Swig Packed ", fp); if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - fputs("at ", fp); - fputs(result, fp); + fputs("at ", fp); + fputs(result, fp); } - fputs(v->ty->name,fp); + fputs(v->ty->name,fp); fputs(">", fp); - return 0; + return 0; } - + SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { @@ -2011,7 +2038,7 @@ SwigPyPacked_repr(SwigPyPacked *v) return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); - } + } } SWIGRUNTIME PyObject * @@ -2022,7 +2049,7 @@ SwigPyPacked_str(SwigPyPacked *v) return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); - } + } } SWIGRUNTIME int @@ -2044,7 +2071,7 @@ SwigPyPacked_type(void) { SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) + return ((op)->ob_type == SwigPyPacked_TypeOnce()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } @@ -2065,7 +2092,6 @@ SwigPyPacked_TypeOnce(void) { static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -2126,10 +2152,19 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; swigpypacked_type = tmp; @@ -2200,11 +2235,11 @@ SWIG_This(void) /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS +#define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) +SWIG_Python_GetSwigThis(PyObject *pyobj) { PyObject *obj; @@ -2227,7 +2262,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); + obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { @@ -2260,7 +2295,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ + SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; @@ -2288,10 +2323,11 @@ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { int res; SwigPyObject *sobj; + int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; if (!obj) return SWIG_ERROR; - if (obj == Py_None) { + if (obj == Py_None && !implicit_conv) { if (ptr) *ptr = 0; return SWIG_OK; @@ -2340,7 +2376,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } res = SWIG_OK; } else { - if (flags & SWIG_POINTER_IMPLICIT_CONV) { + if (implicit_conv) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; @@ -2366,7 +2402,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { - res = SWIG_AddCast(res); + res = SWIG_AddCast(res); } } } @@ -2375,6 +2411,13 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } } + if (!SWIG_IsOK(res) && obj == Py_None) { + if (ptr) + *ptr = 0; + if (PyErr_Occurred()) + PyErr_Clear(); + res = SWIG_OK; + } } return res; } @@ -2387,13 +2430,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; - + /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; - if (!desc) + if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); @@ -2425,7 +2468,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t } } return SWIG_OK; -} +} /* ----------------------------------------------------------------------------- * Create a new pointer object @@ -2436,7 +2479,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t 'this' attribute. */ -SWIGRUNTIME PyObject* +SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) @@ -2462,7 +2505,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) } } else { #if PY_VERSION_HEX >= 0x03000000 - inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); if (inst) { PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; @@ -2530,7 +2573,7 @@ SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); -} +} SWIGINTERN PyObject * @@ -2572,18 +2615,21 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif } if (newobj) { newobj->ptr = ptr; newobj->ty = type; newobj->own = own; newobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif return (PyObject*) newobj; } return SWIG_Py_Void(); @@ -2608,7 +2654,7 @@ SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { } /* -----------------------------------------------------------------------------* - * Get type list + * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME @@ -2646,16 +2692,14 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } - + dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ @@ -2732,7 +2776,7 @@ SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { @@ -2758,7 +2802,7 @@ SWIG_Python_TypeQuery(const char *type) return descriptor; } -/* +/* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 @@ -2767,7 +2811,7 @@ SWIG_Python_TypeQuery(const char *type) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ +{ if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; @@ -2791,7 +2835,7 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) return 0; } } - + SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { @@ -2825,10 +2869,10 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) type, otype); return; } - } else -#endif + } else +#endif { - const char *otype = (obj ? obj->ob_type->tp_name : 0); + const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; @@ -2843,7 +2887,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) Py_XDECREF(str); return; } - } + } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); @@ -2874,7 +2918,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { PyObject *descr; PyObject *encoded_name; descrsetfunc f; - int res; + int res = -1; # ifdef Py_USING_UNICODE if (PyString_Check(name)) { @@ -2897,7 +2941,6 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { goto done; } - res = -1; descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) @@ -2914,7 +2957,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { } else { res = f(descr, obj, value); } - + done: Py_DECREF(name); return res; @@ -2928,20 +2971,19 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_XDRFILE swig_types[0] -#define SWIGTYPE_p_a_3__a_3__float swig_types[1] -#define SWIGTYPE_p_a_3__float swig_types[2] -#define SWIGTYPE_p_char swig_types[3] -static swig_type_info *swig_types[5]; -static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; +#define SWIGTYPE_p_char swig_types[0] +#define SWIGTYPE_p_int swig_types[1] +#define SWIGTYPE_p_molfile_plugin_t swig_types[2] +static swig_type_info *swig_types[4]; +static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -2954,41 +2996,45 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; #endif /*----------------------------------------------- - @(target):= _libxdrfile2.so + @(target):= _libpymolfile.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__libxdrfile2 +# define SWIG_init PyInit__libpymolfile #else -# define SWIG_init init_libxdrfile2 +# define SWIG_init init_libpymolfile #endif -#define SWIG_name "_libxdrfile2" +#define SWIG_name "_libpymolfile" -#define SWIGVERSION 0x020009 +#define SWIGVERSION 0x030012 #define SWIG_VERSION SWIGVERSION -#define SWIG_as_voidptr(a) (void *)((const void *)(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) +#define SWIG_as_voidptr(a) (void *)((const void *)(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -/* Python SWIG interface to some functions in Gromacs libxdr v 2.0 - Copyright (c) 2010 Oliver Beckstein <orbeckst@gmail.com> - Published under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 (or higher) - See http://mdanalysis.googlecode.com for details. +/* Python SWIG interface to libpymolfile + Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> + Published under BSD LICENSE */ #define SWIG_FILE_WITH_INIT #include <stdio.h> -#include "xdrfile.h" -#include "xdrfile_trr.h" -#include "xdrfile_xtc.h" +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include "molfile_plugin.h" +#include "libmolfile_plugin.h" +#include "vmdplugin.h" +#include "pymolfile.h" #ifndef SWIG_FILE_WITH_INIT -# define NO_IMPORT_ARRAY +#define NO_IMPORT_ARRAY #endif #include "stdio.h" +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include <numpy/arrayobject.h> @@ -2999,1496 +3045,294 @@ SWIGINTERNINLINE PyObject* } -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; +PyObject * molfile_plugin_info(molfile_plugin_t *plugin_list, int plugin_no) { + molfile_plugin_t *plugin; + void *plugin_handle; + int has_readstructure = 0; + int has_readbonds = 0; + int has_readangles = 0; + int has_writestructure = 0; + int has_writebonds = 0; + int has_writeangles = 0; + int has_readnexttimestep = 0; + int has_writetimestep = 0; + int plugin_list_size = sizeof(plugin_list) / sizeof(molfile_plugin_t*); + if (&plugin_no==NULL || plugin_no<0 || plugin_no>plugin_list_size){ + PyErr_Format(PyExc_IOError, "[%d] Error: molfile plugin handle no should be given, be positive value and should not exceed the list length. You set '%d'", pluginNOINIT, plugin_no); + return 0; + } + plugin = plugin_list[plugin_no]; + if(plugin==NULL || !plugin->open_file_read){ + PyErr_Format(PyExc_IOError, "[%d] Error: molfile plugin '%d' is not initialized.", pluginNOINIT, plugin_no); + return 0; + } + if (plugin->read_structure) has_readstructure = 1; + if (plugin->read_bonds) has_readbonds = 1; + if (plugin->read_angles) has_readangles = 1; + if (plugin->read_next_timestep) has_readnexttimestep = 1; + if (plugin->write_structure) has_writestructure = 1; + if (plugin->write_bonds) has_writebonds = 1; + if (plugin->write_angles) has_writeangles = 1; + if (plugin->write_timestep) has_writetimestep = 1; + PyObject *tuple = PyTuple_New(16); + PyTuple_SET_ITEM(tuple, 0, PyString_FromString((const char)plugin->name)); + PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)has_readstructure)); + PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)has_readbonds)); + PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((long)has_readangles)); + PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((long)has_readnexttimestep)); + PyTuple_SET_ITEM(tuple, 5, PyInt_FromLong((long)has_writestructure)); + PyTuple_SET_ITEM(tuple, 6, PyInt_FromLong((long)has_writebonds)); + PyTuple_SET_ITEM(tuple, 7, PyInt_FromLong((long)has_writeangles)); + PyTuple_SET_ITEM(tuple, 8, PyInt_FromLong((long)has_writetimestep)); + PyTuple_SET_ITEM(tuple, 9, PyString_FromString((const char)plugin->prettyname)); + PyTuple_SET_ITEM(tuple, 10, PyString_FromString((const char)plugin->type)); + PyTuple_SET_ITEM(tuple, 11, PyString_FromString((const char)plugin->author)); + PyTuple_SET_ITEM(tuple, 12, PyInt_FromLong((long)plugin->majorv)); + PyTuple_SET_ITEM(tuple, 13, PyInt_FromLong((long)plugin->minorv)); + PyTuple_SET_ITEM(tuple, 14, PyInt_FromLong((long)plugin->abiversion)); + PyTuple_SET_ITEM(tuple, 15, PyInt_FromLong((long)plugin->is_reentrant)); + return tuple; } - return info; -} + + +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +SWIG_AsVal_double (PyObject *obj, double *val) { -#if PY_VERSION_HEX>=0x03000000 - if (PyUnicode_Check(obj)) -#else - if (PyString_Check(obj)) + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; +#if PY_VERSION_HEX < 0x03000000 + } else if (PyInt_Check(obj)) { + if (val) *val = (double) PyInt_AsLong(obj); + return SWIG_OK; #endif + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE { - char *cstr; Py_ssize_t len; -#if PY_VERSION_HEX>=0x03000000 - if (!alloc && cptr) { - /* We can't allow converting without allocation, since the internal - representation of string in Python 3 is UCS-2/UCS-4 but we require - a UTF-8 representation. - TODO(bhy) More detailed explanation */ - return SWIG_RuntimeError; + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); } - obj = PyUnicode_AsUTF8String(obj); - PyBytes_AsStringAndSize(obj, &cstr, &len); - if(alloc) *alloc = SWIG_NEWOBJ; -#else - PyString_AsStringAndSize(obj, &cstr, &len); -#endif - if (cptr) { - if (alloc) { - /* - In python the user should not be able to modify the inner - string representation. To warranty that, if you define - SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string - buffer is always returned. - - The default behavior is just to return the pointer value, - so, be careful. - */ -#if defined(SWIG_PYTHON_SAFE_CSTRINGS) - if (*alloc != SWIG_OLDOBJ) -#else - if (*alloc == SWIG_NEWOBJ) -#endif - { - *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); - *alloc = SWIG_NEWOBJ; - } - else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { - #if PY_VERSION_HEX>=0x03000000 - assert(0); /* Should never reach here in Python 3 */ - #endif - *cptr = SWIG_Python_str_AsChar(obj); - } - } - if (psize) *psize = len + 1; -#if PY_VERSION_HEX>=0x03000000 - Py_XDECREF(obj); -#endif - return SWIG_OK; - } else { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *) vptr; - if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; + PyErr_Clear(); } } } - return SWIG_TypeError; +#endif + return res; } +#include <float.h> - - int my_read_xtc_natoms(char *fn) { - int natoms; - int status; - status = read_xtc_natoms(fn, &natoms); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading natoms from xtc '%s'", status, fn); - return 0; - } - return natoms; - } +#include <math.h> -PyObject * my_read_xtc_numframes(char *fn) { - int numframes, status; - int64_t *offsets[1]; - PyObject *npoffsets = NULL; - status = read_xtc_numframes(fn, &numframes, offsets); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading numframes by seeking through xtc '%s'", status, fn); - return 0; - } - npy_intp nfrms[1] = { numframes }; - npoffsets = PyArray_SimpleNewFromData(1, nfrms, NPY_INT64, *offsets); - if (npoffsets==NULL) - { - free(*offsets); - Py_XDECREF(npoffsets); - PyErr_Format(PyExc_IOError, "Error copying frame index into Python."); - return 0; - } - /* From http://web.archive.org/web/20130304224839/http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ */ - #if PY_MAJOR_VERSION < 3 - PyArray_BASE(npoffsets) = PyCObject_FromVoidPtr(*offsets, free); - #else - PyArray_BASE(npoffsets) = PyCapsule_New(*offsets, NULL, NULL); - #endif - PyObject *tuple = PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)numframes)); - PyTuple_SET_ITEM(tuple, 1, npoffsets); - return tuple; +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } } + return 0; +} - int my_read_trr_natoms(char *fn) { - int natoms; - int status; - status = read_trr_natoms(fn, &natoms); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading natoms from trr '%s'", status, fn); - return 0; +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else +#endif + if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; } - return natoms; } - - -PyObject * my_read_trr_numframes(char *fn) { - int numframes, status; - int64_t *offsets[1]; - PyObject *npoffsets = NULL; - status = read_trr_numframes(fn, &numframes, offsets); - if (status != exdrOK) { - PyErr_Format(PyExc_IOError, "[%d] Error reading numframes by seeking through trr '%s'", status, fn); - return 0; +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); } - npy_intp nfrms[1] = { numframes }; - npoffsets = PyArray_SimpleNewFromData(1, nfrms, NPY_INT64, *offsets); - if (npoffsets==NULL) - { - free(*offsets); - Py_XDECREF(npoffsets); - PyErr_Format(PyExc_IOError, "Error copying frame index into Python."); - return 0; + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } } - /* From http://web.archive.org/web/20130304224839/http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ */ - #if PY_MAJOR_VERSION < 3 - PyArray_BASE(npoffsets) = PyCObject_FromVoidPtr(*offsets, free); - #else - PyArray_BASE(npoffsets) = PyCapsule_New(*offsets, NULL, NULL); - #endif - PyObject *tuple = PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)numframes)); - PyTuple_SET_ITEM(tuple, 1, npoffsets); - return tuple; } - - -PyObject * my_read_xtc(XDRFILE *xd, matrix box, int natoms, int _DIM, float *x) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - int status, step; - float time, prec; - PyObject *tuple = PyTuple_New(4); - status = read_xtc(xd, natoms, &step, &time, box, (rvec *)x, &prec); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)status)); - PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)step)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble((double)time)); - PyTuple_SET_ITEM(tuple, 3, PyFloat_FromDouble((double)prec)); - return tuple; // return (status, step, time, prec) +#endif + return SWIG_TypeError; } -/* Support older NumPy data type names -*/ -#if NDARRAY_VERSION < 0x01000000 -#define NPY_BOOL PyArray_BOOL -#define NPY_BYTE PyArray_BYTE -#define NPY_UBYTE PyArray_UBYTE -#define NPY_SHORT PyArray_SHORT -#define NPY_USHORT PyArray_USHORT -#define NPY_INT PyArray_INT -#define NPY_UINT PyArray_UINT -#define NPY_LONG PyArray_LONG -#define NPY_ULONG PyArray_ULONG -#define NPY_LONGLONG PyArray_LONGLONG -#define NPY_ULONGLONG PyArray_ULONGLONG -#define NPY_FLOAT PyArray_FLOAT -#define NPY_DOUBLE PyArray_DOUBLE -#define NPY_LONGDOUBLE PyArray_LONGDOUBLE -#define NPY_CFLOAT PyArray_CFLOAT -#define NPY_CDOUBLE PyArray_CDOUBLE -#define NPY_CLONGDOUBLE PyArray_CLONGDOUBLE -#define NPY_OBJECT PyArray_OBJECT -#define NPY_STRING PyArray_STRING -#define NPY_UNICODE PyArray_UNICODE -#define NPY_VOID PyArray_VOID -#define NPY_NTYPES PyArray_NTYPES -#define NPY_NOTYPE PyArray_NOTYPE -#define NPY_CHAR PyArray_CHAR -#define NPY_USERDEF PyArray_USERDEF -#define npy_intp intp - -#define NPY_MAX_BYTE MAX_BYTE -#define NPY_MIN_BYTE MIN_BYTE -#define NPY_MAX_UBYTE MAX_UBYTE -#define NPY_MAX_SHORT MAX_SHORT -#define NPY_MIN_SHORT MIN_SHORT -#define NPY_MAX_USHORT MAX_USHORT -#define NPY_MAX_INT MAX_INT -#define NPY_MIN_INT MIN_INT -#define NPY_MAX_UINT MAX_UINT -#define NPY_MAX_LONG MAX_LONG -#define NPY_MIN_LONG MIN_LONG -#define NPY_MAX_ULONG MAX_ULONG -#define NPY_MAX_LONGLONG MAX_LONGLONG -#define NPY_MIN_LONGLONG MIN_LONGLONG -#define NPY_MAX_ULONGLONG MAX_ULONGLONG -#define NPY_MAX_INTP MAX_INTP -#define NPY_MIN_INTP MIN_INTP - -#define NPY_FARRAY FARRAY -#define NPY_F_CONTIGUOUS F_CONTIGUOUS -#endif - - -/* Macros to extract array attributes. - */ -#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) -#define array_type(a) (int)(PyArray_TYPE(a)) -#define array_numdims(a) (((PyArrayObject *)a)->nd) -#define array_dimensions(a) (((PyArrayObject *)a)->dimensions) -#define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) -#define array_data(a) (((PyArrayObject *)a)->data) -#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a)) -#define array_is_native(a) (PyArray_ISNOTSWAPPED(a)) -#define array_is_fortran(a) (PyArray_ISFORTRAN(a)) - - - /* Given a PyObject, return a string describing its type. - */ - const char* pytype_string(PyObject* py_obj) { - if (py_obj == NULL ) return "C NULL value"; - if (py_obj == Py_None ) return "Python None" ; - if (PyCallable_Check(py_obj)) return "callable" ; - if (PyString_Check( py_obj)) return "string" ; - if (PyInt_Check( py_obj)) return "int" ; - if (PyFloat_Check( py_obj)) return "float" ; - if (PyDict_Check( py_obj)) return "dict" ; - if (PyList_Check( py_obj)) return "list" ; - if (PyTuple_Check( py_obj)) return "tuple" ; - #if PY_MAJOR_VERSION < 3 - if (PyFile_Check( py_obj)) return "file" ; - #endif - if (PyModule_Check( py_obj)) return "module" ; - #if PY_MAJOR_VERSION < 3 - if (PyInstance_Check(py_obj)) return "instance" ; - #endif - - return "unkown type"; - } - - /* Given a NumPy typecode, return a string describing the type. - */ - const char* typecode_string(int typecode) { - static const char* type_names[25] = {"bool", "byte", "unsigned byte", - "short", "unsigned short", "int", - "unsigned int", "long", "unsigned long", - "long long", "unsigned long long", - "float", "double", "long double", - "complex float", "complex double", - "complex long double", "object", - "string", "unicode", "void", "ntypes", - "notype", "char", "unknown"}; - return typecode < 24 ? type_names[typecode] : type_names[24]; - } - - /* Make sure input has correct numpy type. Allow character and byte - * to match. Also allow int and long to match. This is deprecated. - * You should use PyArray_EquivTypenums() instead. - */ - int type_match(int actual_type, int desired_type) { - return PyArray_EquivTypenums(actual_type, desired_type); - } - - - /* Given a PyObject pointer, cast it to a PyArrayObject pointer if - * legal. If not, set the python error string appropriately and - * return NULL. - */ - PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) - { - PyArrayObject* ary = NULL; - if (is_array(input) && (typecode == NPY_NOTYPE || - PyArray_EquivTypenums(array_type(input), typecode))) - { - ary = (PyArrayObject*) input; - } - else if is_array(input) - { - const char* desired_type = typecode_string(typecode); - const char* actual_type = typecode_string(array_type(input)); - PyErr_Format(PyExc_TypeError, - "Array of type '%s' required. Array of type '%s' given", - desired_type, actual_type); - ary = NULL; - } - else - { - const char * desired_type = typecode_string(typecode); - const char * actual_type = pytype_string(input); - PyErr_Format(PyExc_TypeError, - "Array of type '%s' required. A '%s' was given", - desired_type, actual_type); - ary = NULL; - } - return ary; - } - - /* Convert the given PyObject to a NumPy array with the given - * typecode. On success, return a valid PyArrayObject* with the - * correct type. On failure, the python error string will be set and - * the routine returns NULL. - */ - PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, - int* is_new_object) - { - PyArrayObject* ary = NULL; - PyObject* py_obj; - if (is_array(input) && (typecode == NPY_NOTYPE || - PyArray_EquivTypenums(array_type(input),typecode))) - { - ary = (PyArrayObject*) input; - *is_new_object = 0; - } - else - { - py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_DEFAULT); - /* If NULL, PyArray_FromObject will have set python error value.*/ - ary = (PyArrayObject*) py_obj; - *is_new_object = 1; - } - return ary; - } - - /* Given a PyArrayObject, check to see if it is contiguous. If so, - * return the input pointer and flag it as not a new object. If it is - * not contiguous, create a new PyArrayObject using the original data, - * flag it as a new object and return the pointer. - */ - PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object, - int min_dims, int max_dims) - { - PyArrayObject* result; - if (array_is_contiguous(ary)) - { - result = ary; - *is_new_object = 0; - } - else - { - result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary, - array_type(ary), - min_dims, - max_dims); - *is_new_object = 1; - } - return result; - } - - /* Given a PyArrayObject, check to see if it is Fortran-contiguous. - * If so, return the input pointer, but do not flag it as not a new - * object. If it is not Fortran-contiguous, create a new - * PyArrayObject using the original data, flag it as a new object - * and return the pointer. - */ - PyArrayObject* make_fortran(PyArrayObject* ary, int* is_new_object, - int min_dims, int max_dims) - { - PyArrayObject* result; - if (array_is_fortran(ary)) - { - result = ary; - *is_new_object = 0; - } - else - { - Py_INCREF(ary->descr); - result = (PyArrayObject*) PyArray_FromArray(ary, ary->descr, NPY_FORTRAN); - *is_new_object = 1; - } - return result; - } - - /* Convert a given PyObject to a contiguous PyArrayObject of the - * specified type. If the input object is not a contiguous - * PyArrayObject, a new one will be created and the new object flag - * will be set. - */ - PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, - int typecode, - int* is_new_object) - { - int is_new1 = 0; - int is_new2 = 0; - PyArrayObject* ary2; - PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, - &is_new1); - if (ary1) - { - ary2 = make_contiguous(ary1, &is_new2, 0, 0); - if ( is_new1 && is_new2) - { - Py_DECREF(ary1); - } - ary1 = ary2; - } - *is_new_object = is_new1 || is_new2; - return ary1; - } - - /* Convert a given PyObject to a Fortran-ordered PyArrayObject of the - * specified type. If the input object is not a Fortran-ordered - * PyArrayObject, a new one will be created and the new object flag - * will be set. - */ - PyArrayObject* obj_to_array_fortran_allow_conversion(PyObject* input, - int typecode, - int* is_new_object) - { - int is_new1 = 0; - int is_new2 = 0; - PyArrayObject* ary2; - PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, - &is_new1); - if (ary1) - { - ary2 = make_fortran(ary1, &is_new2, 0, 0); - if (is_new1 && is_new2) - { - Py_DECREF(ary1); - } - ary1 = ary2; - } - *is_new_object = is_new1 || is_new2; - return ary1; - } - - - - /* Test whether a python object is contiguous. If array is - * contiguous, return 1. Otherwise, set the python error string and - * return 0. - */ - int require_contiguous(PyArrayObject* ary) - { - int contiguous = 1; - if (!array_is_contiguous(ary)) - { - PyErr_SetString(PyExc_TypeError, - "Array must be contiguous. A non-contiguous array was given"); - contiguous = 0; - } - return contiguous; - } - - /* Require that a numpy array is not byte-swapped. If the array is - * not byte-swapped, return 1. Otherwise, set the python error string - * and return 0. - */ - int require_native(PyArrayObject* ary) - { - int native = 1; - if (!array_is_native(ary)) - { - PyErr_SetString(PyExc_TypeError, - "Array must have native byteorder. " - "A byte-swapped array was given"); - native = 0; - } - return native; - } - - /* Require the given PyArrayObject to have a specified number of - * dimensions. If the array has the specified number of dimensions, - * return 1. Otherwise, set the python error string and return 0. - */ - int require_dimensions(PyArrayObject* ary, int exact_dimensions) - { - int success = 1; - if (array_numdims(ary) != exact_dimensions) - { - PyErr_Format(PyExc_TypeError, - "Array must have %d dimensions. Given array has %d dimensions", - exact_dimensions, array_numdims(ary)); - success = 0; - } - return success; - } - - /* Require the given PyArrayObject to have one of a list of specified - * number of dimensions. If the array has one of the specified number - * of dimensions, return 1. Otherwise, set the python error string - * and return 0. - */ - int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) - { - int success = 0; - int i; - char dims_str[255] = ""; - char s[255]; - for (i = 0; i < n && !success; i++) - { - if (array_numdims(ary) == exact_dimensions[i]) - { - success = 1; - } - } - if (!success) - { - for (i = 0; i < n-1; i++) - { - sprintf(s, "%d, ", exact_dimensions[i]); - strcat(dims_str,s); - } - sprintf(s, " or %d", exact_dimensions[n-1]); - strcat(dims_str,s); - PyErr_Format(PyExc_TypeError, - "Array must have %s dimensions. Given array has %d dimensions", - dims_str, array_numdims(ary)); - } - return success; - } - - /* Require the given PyArrayObject to have a specified shape. If the - * array has the specified shape, return 1. Otherwise, set the python - * error string and return 0. - */ - int require_size(PyArrayObject* ary, npy_intp* size, int n) - { - int i; - int success = 1; - int len; - char desired_dims[255] = "["; - char s[255]; - char actual_dims[255] = "["; - for(i=0; i < n;i++) - { - if (size[i] != -1 && size[i] != array_size(ary,i)) - { - success = 0; - } - } - if (!success) - { - for (i = 0; i < n; i++) - { - if (size[i] == -1) - { - sprintf(s, "*,"); - } - else - { - sprintf(s, "%ld,", (long int)size[i]); - } - strcat(desired_dims,s); - } - len = strlen(desired_dims); - desired_dims[len-1] = ']'; - for (i = 0; i < n; i++) - { - sprintf(s, "%ld,", (long int)array_size(ary,i)); - strcat(actual_dims,s); - } - len = strlen(actual_dims); - actual_dims[len-1] = ']'; - PyErr_Format(PyExc_TypeError, - "Array must have shape of %s. Given array has shape of %s", - desired_dims, actual_dims); - } - return success; - } - - /* Require the given PyArrayObject to to be FORTRAN ordered. If the - * the PyArrayObject is already FORTRAN ordered, do nothing. Else, - * set the FORTRAN ordering flag and recompute the strides. - */ - int require_fortran(PyArrayObject* ary) - { - int success = 1; - int nd = array_numdims(ary); - int i; - if (array_is_fortran(ary)) return success; - /* Set the FORTRAN ordered flag */ - ary->flags = NPY_FARRAY; - /* Recompute the strides */ - ary->strides[0] = ary->strides[nd-1]; - for (i=1; i < nd; ++i) - ary->strides[i] = ary->strides[i-1] * array_size(ary,i-1); - return success; - } - - - -PyObject * my_read_trr(XDRFILE *xd, matrix box, - int natoms, int _DIM, float *x, - int vnatoms, int v_DIM, float *v, - int fnatoms, int f_DIM, float *f) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - int status, step, has_prop=0; - float time, lmbda; - PyObject *tuple = PyTuple_New(7); - status = read_trr(xd, natoms, &step, &time, &lmbda, box, (rvec *)x, (rvec *)v, (rvec *)f, &has_prop); - PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)status)); - PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)step)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble((double)time)); - PyTuple_SET_ITEM(tuple, 3, PyFloat_FromDouble((double)lmbda)); - PyTuple_SET_ITEM(tuple, 4, PyBool_FromLong((long)(has_prop & HASX))); - PyTuple_SET_ITEM(tuple, 5, PyBool_FromLong((long)(has_prop & HASV))); - PyTuple_SET_ITEM(tuple, 6, PyBool_FromLong((long)(has_prop & HASF))); - return tuple; // return (status, step, time, lmbda, has_x, has_v, has_f) -} - - -int my_write_xtc(XDRFILE *xd, int step, float time, - matrix box, int natoms, int _DIM, float *x, float prec) { - /* _DIM = 3 always, need to reorder for numpy.i SWIG */ - return write_xtc(xd, natoms, step, time, box, (rvec *)x, prec); -} - - -#include <limits.h> -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; - } else if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include <float.h> - - -#include <math.h> - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (int)(v); - } - } - return res; -} - - -SWIGINTERN int -SWIG_AsVal_float (PyObject * obj, float *val) -{ - double v; - int res = SWIG_AsVal_double (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < -FLT_MAX || v > FLT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (float)(v); - } - } - return res; -} - - -int my_write_trr(XDRFILE *xd, int step, float time, float lmbda, matrix box, - int natoms, int _DIM, float *x, - int vnatoms, int v_DIM, float *v, - int fnatoms, int f_DIM, float *f) { - /* Preparing for the case of empty arrays - NULL pointers tell the library to skip this property. */ - if (_DIM == 0) x = NULL; - if (v_DIM == 0) v = NULL; - if (f_DIM == 0) f = NULL; - return write_trr(xd, natoms, step, time, lmbda, box, (rvec *)x, (rvec *)v, (rvec *)f); -} - - -SWIGINTERN int -SWIG_AsVal_long_SS_long (PyObject *obj, long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - long long v = PyLong_AsLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } else { - long v; - res = SWIG_AsVal_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - const double mant_min = -mant_max; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { - if (val) *val = (long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} - - - #define SWIG_From_long PyLong_FromLong - - -SWIGINTERNINLINE PyObject* -SWIG_From_long_SS_long (long long value) -{ - return ((value < LONG_MIN) || (value > LONG_MAX)) ? - PyLong_FromLongLong(value) : PyLong_FromLong((long)(value)); -} - -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_xdrfile_open(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - char *arg2 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - XDRFILE *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:xdrfile_open",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xdrfile_open" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "xdrfile_open" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - result = (XDRFILE *)xdrfile_open((char const *)arg1,(char const *)arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XDRFILE, 0 | 0 ); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_xdrfile_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:xdrfile_close",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xdrfile_close" "', argument " "1"" of type '" "XDRFILE *""'"); - } - arg1 = (XDRFILE *)(argp1); - result = (int)xdrfile_close(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_read_xtc_natoms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:read_xtc_natoms",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_xtc_natoms" "', argument " "1"" of type '" "char *""'"); - } - arg1 = (char *)(buf1); - { - result = (int)my_read_xtc_natoms(arg1); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_read_xtc_numframes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - PyObject *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:read_xtc_numframes",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_xtc_numframes" "', argument " "1"" of type '" "char *""'"); - } - arg1 = (char *)(buf1); - { - result = (PyObject *)my_read_xtc_numframes(arg1); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = result; - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_read_trr_natoms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:read_trr_natoms",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_trr_natoms" "', argument " "1"" of type '" "char *""'"); - } - arg1 = (char *)(buf1); - { - result = (int)my_read_trr_natoms(arg1); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_read_trr_numframes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - PyObject *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:read_trr_numframes",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_trr_numframes" "', argument " "1"" of type '" "char *""'"); - } - arg1 = (char *)(buf1); - { - result = (PyObject *)my_read_trr_numframes(arg1); - if (PyErr_Occurred()) SWIG_fail; - } - resultobj = result; - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = (int)(v); + } + } + return res; } - -SWIGINTERN PyObject *_wrap_read_xtc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_molfile_plugin_list(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; - float (*arg2)[3] ; - int arg3 ; - int arg4 ; - float *arg5 = (float *) 0 ; + int *arg1 = (int *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyArrayObject *array2 = NULL ; - PyArrayObject *array3 = NULL ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:read_xtc",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); + molfile_plugin_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:molfile_plugin_list",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_xtc" "', argument " "1"" of type '" "XDRFILE *""'"); - } - arg1 = (XDRFILE *)(argp1); - { - npy_intp size[2] = { - 3, 3 - }; - array2 = obj_to_array_no_conversion(obj1, NPY_FLOAT); - if (!array2 || !require_dimensions(array2,2) || !require_size(array2, size, 2) || - !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg2 = (float (*)[3]) array_data(array2); - } - { - array3 = obj_to_array_no_conversion(obj2, NPY_FLOAT); - if (!array3 || !require_dimensions(array3,2) || !require_contiguous(array3) || - !require_native(array3)) SWIG_fail; - arg3 = (int) array_size(array3,0); - arg4 = (int) array_size(array3,1); - arg5 = (float*) array_data(array3); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "molfile_plugin_list" "', argument " "1"" of type '" "int *""'"); } - result = (PyObject *)my_read_xtc(arg1,(float (*)[3])arg2,arg3,arg4,arg5); - resultobj = result; + arg1 = (int *)(argp1); + result = (molfile_plugin_t *)molfile_plugin_list(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_molfile_plugin_t, 0 | 0 ); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_read_trr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_molfile_init(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; - float (*arg2)[3] ; - int arg3 ; - int arg4 ; - float *arg5 = (float *) 0 ; - int arg6 ; - int arg7 ; - float *arg8 = (float *) 0 ; - int arg9 ; - int arg10 ; - float *arg11 = (float *) 0 ; + molfile_plugin_t *arg1 = (molfile_plugin_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyArrayObject *array2 = NULL ; - PyArrayObject *array3 = NULL ; - PyArrayObject *array6 = NULL ; - PyArrayObject *array9 = NULL ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:read_trr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:molfile_init",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_molfile_plugin_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_trr" "', argument " "1"" of type '" "XDRFILE *""'"); - } - arg1 = (XDRFILE *)(argp1); - { - npy_intp size[2] = { - 3, 3 - }; - array2 = obj_to_array_no_conversion(obj1, NPY_FLOAT); - if (!array2 || !require_dimensions(array2,2) || !require_size(array2, size, 2) || - !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg2 = (float (*)[3]) array_data(array2); - } - { - array3 = obj_to_array_no_conversion(obj2, NPY_FLOAT); - if (!array3 || !require_dimensions(array3,2) || !require_contiguous(array3) || - !require_native(array3)) SWIG_fail; - arg3 = (int) array_size(array3,0); - arg4 = (int) array_size(array3,1); - arg5 = (float*) array_data(array3); - } - { - array6 = obj_to_array_no_conversion(obj3, NPY_FLOAT); - if (!array6 || !require_dimensions(array6,2) || !require_contiguous(array6) || - !require_native(array6)) SWIG_fail; - arg6 = (int) array_size(array6,0); - arg7 = (int) array_size(array6,1); - arg8 = (float*) array_data(array6); - } - { - array9 = obj_to_array_no_conversion(obj4, NPY_FLOAT); - if (!array9 || !require_dimensions(array9,2) || !require_contiguous(array9) || - !require_native(array9)) SWIG_fail; - arg9 = (int) array_size(array9,0); - arg10 = (int) array_size(array9,1); - arg11 = (float*) array_data(array9); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "molfile_init" "', argument " "1"" of type '" "molfile_plugin_t *""'"); } - result = (PyObject *)my_read_trr(arg1,(float (*)[3])arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11); - resultobj = result; + arg1 = (molfile_plugin_t *)(argp1); + result = (int)molfile_init(arg1); + resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_write_xtc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_molfile_finish(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; - int arg2 ; - float arg3 ; - float (*arg4)[3] ; - int arg5 ; - int arg6 ; - float *arg7 = (float *) 0 ; - float arg8 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - float val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 = 0 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 = 0 ; - float val8 ; - int ecode8 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; int result; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:write_xtc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "write_xtc" "', argument " "1"" of type '" "XDRFILE *""'"); - } - arg1 = (XDRFILE *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "write_xtc" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_float(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "write_xtc" "', argument " "3"" of type '" "float""'"); - } - arg3 = (float)(val3); - { - npy_intp size[2] = { - 3, 3 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, NPY_FLOAT, - &is_new_object4); - if (!array4 || !require_dimensions(array4, 2) || - !require_size(array4, size, 2)) SWIG_fail; - arg4 = (float (*)[3]) array_data(array4); - } - { - npy_intp size[2] = { - -1, -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, NPY_FLOAT, - &is_new_object5); - if (!array5 || !require_dimensions(array5, 2) || - !require_size(array5, size, 2)) SWIG_fail; - arg5 = (int) array_size(array5,0); - arg6 = (int) array_size(array5,1); - arg7 = (float*) array_data(array5); - } - ecode8 = SWIG_AsVal_float(obj5, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "write_xtc" "', argument " "8"" of type '" "float""'"); - } - arg8 = (float)(val8); - result = (int)my_write_xtc(arg1,arg2,arg3,(float (*)[3])arg4,arg5,arg6,arg7,arg8); + + if (!PyArg_ParseTuple(args,(char *)":molfile_finish")) SWIG_fail; + result = (int)molfile_finish(); resultobj = SWIG_From_int((int)(result)); - { - if (is_new_object4 && array4) - { - Py_DECREF(array4); - } - } - { - if (is_new_object5 && array5) - { - Py_DECREF(array5); - } - } return resultobj; fail: - { - if (is_new_object4 && array4) - { - Py_DECREF(array4); - } - } - { - if (is_new_object5 && array5) - { - Py_DECREF(array5); - } - } return NULL; } -SWIGINTERN PyObject *_wrap_write_trr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_molfile_plugin_info(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; + molfile_plugin_t *arg1 = (molfile_plugin_t *) 0 ; int arg2 ; - float arg3 ; - float arg4 ; - float (*arg5)[3] ; - int arg6 ; - int arg7 ; - float *arg8 = (float *) 0 ; - int arg9 ; - int arg10 ; - float *arg11 = (float *) 0 ; - int arg12 ; - int arg13 ; - float *arg14 = (float *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; - float val3 ; - int ecode3 = 0 ; - float val4 ; - int ecode4 = 0 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 = 0 ; - PyArrayObject *array6 = NULL ; - int is_new_object6 = 0 ; - PyArrayObject *array9 = NULL ; - int is_new_object9 = 0 ; - PyArrayObject *array12 = NULL ; - int is_new_object12 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:write_trr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:molfile_plugin_info",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_molfile_plugin_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "write_trr" "', argument " "1"" of type '" "XDRFILE *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "molfile_plugin_info" "', argument " "1"" of type '" "molfile_plugin_t *""'"); } - arg1 = (XDRFILE *)(argp1); + arg1 = (molfile_plugin_t *)(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "write_trr" "', argument " "2"" of type '" "int""'"); - } + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "molfile_plugin_info" "', argument " "2"" of type '" "int""'"); + } arg2 = (int)(val2); - ecode3 = SWIG_AsVal_float(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "write_trr" "', argument " "3"" of type '" "float""'"); - } - arg3 = (float)(val3); - ecode4 = SWIG_AsVal_float(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "write_trr" "', argument " "4"" of type '" "float""'"); - } - arg4 = (float)(val4); - { - npy_intp size[2] = { - 3, 3 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, NPY_FLOAT, - &is_new_object5); - if (!array5 || !require_dimensions(array5, 2) || - !require_size(array5, size, 2)) SWIG_fail; - arg5 = (float (*)[3]) array_data(array5); - } - { - npy_intp size[2] = { - -1, -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, NPY_FLOAT, - &is_new_object6); - if (!array6 || !require_dimensions(array6, 2) || - !require_size(array6, size, 2)) SWIG_fail; - arg6 = (int) array_size(array6,0); - arg7 = (int) array_size(array6,1); - arg8 = (float*) array_data(array6); - } - { - npy_intp size[2] = { - -1, -1 - }; - array9 = obj_to_array_contiguous_allow_conversion(obj6, NPY_FLOAT, - &is_new_object9); - if (!array9 || !require_dimensions(array9, 2) || - !require_size(array9, size, 2)) SWIG_fail; - arg9 = (int) array_size(array9,0); - arg10 = (int) array_size(array9,1); - arg11 = (float*) array_data(array9); - } - { - npy_intp size[2] = { - -1, -1 - }; - array12 = obj_to_array_contiguous_allow_conversion(obj7, NPY_FLOAT, - &is_new_object12); - if (!array12 || !require_dimensions(array12, 2) || - !require_size(array12, size, 2)) SWIG_fail; - arg12 = (int) array_size(array12,0); - arg13 = (int) array_size(array12,1); - arg14 = (float*) array_data(array12); - } - result = (int)my_write_trr(arg1,arg2,arg3,arg4,(float (*)[3])arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14); - resultobj = SWIG_From_int((int)(result)); - { - if (is_new_object5 && array5) - { - Py_DECREF(array5); - } - } - { - if (is_new_object6 && array6) - { - Py_DECREF(array6); - } - } - { - if (is_new_object9 && array9) - { - Py_DECREF(array9); - } - } - { - if (is_new_object12 && array12) - { - Py_DECREF(array12); - } - } - return resultobj; -fail: - { - if (is_new_object5 && array5) - { - Py_DECREF(array5); - } - } - { - if (is_new_object6 && array6) - { - Py_DECREF(array6); - } - } - { - if (is_new_object9 && array9) - { - Py_DECREF(array9); - } - } { - if (is_new_object12 && array12) - { - Py_DECREF(array12); - } - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_xdr_seek(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; - long long arg2 ; - int arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - long long val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:xdr_seek",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xdr_seek" "', argument " "1"" of type '" "XDRFILE *""'"); - } - arg1 = (XDRFILE *)(argp1); - ecode2 = SWIG_AsVal_long_SS_long(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "xdr_seek" "', argument " "2"" of type '" "long long""'"); - } - arg2 = (long long)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "xdr_seek" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)xdr_seek(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_xdr_tell(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - XDRFILE *arg1 = (XDRFILE *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - long long result; - - if (!PyArg_ParseTuple(args,(char *)"O:xdr_tell",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XDRFILE, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xdr_tell" "', argument " "1"" of type '" "XDRFILE *""'"); + result = (PyObject *)molfile_plugin_info(arg1,arg2); + if (PyErr_Occurred()) SWIG_fail; } - arg1 = (XDRFILE *)(argp1); - result = (long long)xdr_tell(arg1); - resultobj = SWIG_From_long_SS_long((long long)(result)); + resultobj = result; return resultobj; fail: return NULL; @@ -4497,46 +3341,34 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, - { (char *)"xdrfile_open", _wrap_xdrfile_open, METH_VARARGS, (char *)"xdrfile_open(path, mode) -> XDRFILE *"}, - { (char *)"xdrfile_close", _wrap_xdrfile_close, METH_VARARGS, (char *)"xdrfile_close(fp) -> int"}, - { (char *)"read_xtc_natoms", _wrap_read_xtc_natoms, METH_VARARGS, (char *)"read_xtc_natoms(fn) -> int"}, - { (char *)"read_xtc_numframes", _wrap_read_xtc_numframes, METH_VARARGS, (char *)"read_xtc_numframes(fn) -> PyObject *"}, - { (char *)"read_trr_natoms", _wrap_read_trr_natoms, METH_VARARGS, (char *)"read_trr_natoms(fn) -> int"}, - { (char *)"read_trr_numframes", _wrap_read_trr_numframes, METH_VARARGS, (char *)"read_trr_numframes(fn) -> PyObject *"}, - { (char *)"read_xtc", _wrap_read_xtc, METH_VARARGS, (char *)"read_xtc(XDRFILE, box, x) -> (status, step, time, precision)"}, - { (char *)"read_trr", _wrap_read_trr, METH_VARARGS, (char *)"read_trr(XDRFILE, box, x, v, f) -> (status, step, time, lambda)"}, - { (char *)"write_xtc", _wrap_write_xtc, METH_VARARGS, (char *)"write_xtc(XDRFILE, step, time, box, x, prec) -> status"}, - { (char *)"write_trr", _wrap_write_trr, METH_VARARGS, (char *)"write_trr(XDRFILE, step, time, lambda, box, x, v, f) -> status"}, - { (char *)"xdr_seek", _wrap_xdr_seek, METH_VARARGS, (char *)"xdr_seek(xd, pos, whence) -> int"}, - { (char *)"xdr_tell", _wrap_xdr_tell, METH_VARARGS, (char *)"xdr_tell(xd) -> long long"}, + { (char *)"molfile_plugin_list", _wrap_molfile_plugin_list, METH_VARARGS, (char *)"molfile_plugin_list(maxsize) -> molfile_plugin_t *"}, + { (char *)"molfile_init", _wrap_molfile_init, METH_VARARGS, (char *)"molfile_init(plugin_list) -> int"}, + { (char *)"molfile_finish", _wrap_molfile_finish, METH_VARARGS, (char *)"molfile_finish() -> int"}, + { (char *)"molfile_plugin_info", _wrap_molfile_plugin_info, METH_VARARGS, (char *)"molfile_plugin_info(plugin_list, plugin_no) -> PyObject *"}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static swig_type_info _swigt__p_XDRFILE = {"_p_XDRFILE", "XDRFILE *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_a_3__a_3__float = {"_p_a_3__a_3__float", "matrix *|float (*)[3][3]", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_a_3__float = {"_p_a_3__float", "float (*)[3]|rvec *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_molfile_plugin_t = {"_p_molfile_plugin_t", "molfile_plugin_t *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { - &_swigt__p_XDRFILE, - &_swigt__p_a_3__a_3__float, - &_swigt__p_a_3__float, &_swigt__p_char, + &_swigt__p_int, + &_swigt__p_molfile_plugin_t, }; -static swig_cast_info _swigc__p_XDRFILE[] = { {&_swigt__p_XDRFILE, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_a_3__a_3__float[] = { {&_swigt__p_a_3__a_3__float, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_a_3__float[] = { {&_swigt__p_a_3__float, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_molfile_plugin_t[] = { {&_swigt__p_molfile_plugin_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { - _swigc__p_XDRFILE, - _swigc__p_a_3__a_3__float, - _swigc__p_a_3__float, _swigc__p_char, + _swigc__p_int, + _swigc__p_molfile_plugin_t, }; @@ -4561,7 +3393,7 @@ static swig_const_info swig_const_table[] = { * array with the correct data and linking the correct swig_cast_info * structures together. * - * The generated swig_type_info structures are assigned staticly to an initial + * The generated swig_type_info structures are assigned statically to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the @@ -4605,8 +3437,8 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found, init; - + int init; + /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ @@ -4617,39 +3449,35 @@ SWIG_InitializeModule(void *clientdata) { } else { init = 0; } - + /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; iter=module_head; do { if (iter==&swig_module) { - found=1; - break; + /* Our module is already in the list, so there's nothing more to do. */ + return; } iter=iter->next; } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ + + /* otherwise we must add our module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } - - /* When multiple interpeters are used, a module could have already been initialized in + + /* When multiple interpreters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; - + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); @@ -4658,11 +3486,11 @@ SWIG_InitializeModule(void *clientdata) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; - + #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif - + /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); @@ -4681,7 +3509,7 @@ SWIG_InitializeModule(void *clientdata) { } else { type = swig_module.type_initial[i]; } - + /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { @@ -4712,7 +3540,7 @@ SWIG_InitializeModule(void *clientdata) { if (!ocast) ret = 0; } } - + if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); @@ -4729,7 +3557,7 @@ SWIG_InitializeModule(void *clientdata) { swig_module.types[i] = type; } swig_module.types[i] = 0; - + #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { @@ -4757,10 +3585,10 @@ SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; - + if (init_run) return; init_run = 1; - + for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; @@ -4788,28 +3616,28 @@ SWIG_PropagateClientData(void) { #ifdef __cplusplus extern "C" { #endif - + /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - + /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ - + typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; - + typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; - + SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 @@ -4818,7 +3646,7 @@ extern "C" { return PyString_FromString("<Swig global variables>"); #endif } - + SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 @@ -4856,7 +3684,7 @@ extern "C" { #endif return str; } - + SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; @@ -4867,7 +3695,7 @@ extern "C" { Py_DECREF(str); return 0; } - + SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; @@ -4878,7 +3706,7 @@ extern "C" { var = n; } } - + SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; @@ -4891,11 +3719,11 @@ extern "C" { var = var->next; } if (res == NULL && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); } return res; } - + SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; @@ -4908,11 +3736,11 @@ extern "C" { var = var->next; } if (res == 1 && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); } return res; } - + SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; @@ -4920,7 +3748,6 @@ extern "C" { static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -4958,10 +3785,19 @@ extern "C" { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; varlink_type = tmp; @@ -4975,7 +3811,7 @@ extern "C" { } return &varlink_type; } - + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { @@ -4985,8 +3821,8 @@ extern "C" { } return ((PyObject*) result); } - - SWIGINTERN void + + SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); @@ -5002,18 +3838,18 @@ extern "C" { } v->vars = gv; } - + SWIGINTERN PyObject * SWIG_globals(void) { - static PyObject *_SWIG_globals = 0; - if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } - + /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ - + /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { @@ -5037,11 +3873,11 @@ extern "C" { } } } - + /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ - + SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, @@ -5050,12 +3886,14 @@ extern "C" { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; - if (c && (c = strstr(c, "swig_ptr: "))) { + if (!c) continue; + c = strstr(c, "swig_ptr: "); + if (c) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, + if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; @@ -5082,8 +3920,8 @@ extern "C" { } } } - } - + } + #ifdef __cplusplus } #endif @@ -5096,7 +3934,7 @@ extern "C" { extern "C" #endif -SWIGEXPORT +SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else @@ -5126,7 +3964,7 @@ SWIG_init(void) { NULL }; #endif - + #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { 0, 0, 0, 0, 0, 0, 0 @@ -5141,56 +3979,56 @@ SWIG_init(void) { static PyGetSetDef thisown_getset_def = { (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure }; - PyObject *metatype_args; PyTypeObject *builtin_pytype; int builtin_base_count; swig_type_info *builtin_basetype; PyObject *tuple; PyGetSetDescrObject *static_getset; PyTypeObject *metatype; + PyTypeObject *swigpyobject; SwigPyClientData *cd; PyObject *public_interface, *public_symbol; PyObject *this_descr; PyObject *thisown_descr; + PyObject *self = 0; int i; - + (void)builtin_pytype; (void)builtin_base_count; (void)builtin_basetype; (void)tuple; (void)static_getset; - - /* metatype is used to implement static member variables. */ - metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); - assert(metatype_args); - metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); + (void)self; + + /* Metaclass is used to implement static member variables */ + metatype = SwigPyObjectType(); assert(metatype); - Py_DECREF(metatype_args); - metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; - assert(PyType_Ready(metatype) >= 0); #endif - + /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - + #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif + md = d = PyModule_GetDict(m); (void)md; - + SWIG_InitializeModule(0); - + #ifdef SWIGPYTHON_BUILTIN + swigpyobject = SwigPyObject_TypeOnce(); + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; if (!cd) { SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); - } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { + SwigPyObject_clientdata.pytype = swigpyobject; + } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); # if PY_VERSION_HEX >= 0x03000000 return NULL; @@ -5198,19 +4036,19 @@ SWIG_init(void) { return; # endif } - + /* All objects have a 'this' attribute */ this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); (void)this_descr; - + /* All objects have a 'thisown' attribute */ thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); (void)thisown_descr; - + public_interface = PyList_New(0); public_symbol = 0; (void)public_symbol; - + PyDict_SetItemString(md, "__all__", public_interface); Py_DECREF(public_interface); for (i = 0; SwigMethods[i].ml_name != NULL; ++i) @@ -5218,30 +4056,22 @@ SWIG_init(void) { for (i = 0; swig_const_table[i].name != 0; ++i) SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); #endif - + SWIG_InstallConstants(d,swig_const_table); - - + + import_array(); - - SWIG_Python_SetConstant(d, "exdrOK",SWIG_From_int((int)(exdrOK))); - SWIG_Python_SetConstant(d, "exdrHEADER",SWIG_From_int((int)(exdrHEADER))); - SWIG_Python_SetConstant(d, "exdrSTRING",SWIG_From_int((int)(exdrSTRING))); - SWIG_Python_SetConstant(d, "exdrDOUBLE",SWIG_From_int((int)(exdrDOUBLE))); - SWIG_Python_SetConstant(d, "exdrINT",SWIG_From_int((int)(exdrINT))); - SWIG_Python_SetConstant(d, "exdrFLOAT",SWIG_From_int((int)(exdrFLOAT))); - SWIG_Python_SetConstant(d, "exdrUINT",SWIG_From_int((int)(exdrUINT))); - SWIG_Python_SetConstant(d, "exdr3DX",SWIG_From_int((int)(exdr3DX))); - SWIG_Python_SetConstant(d, "exdrCLOSE",SWIG_From_int((int)(exdrCLOSE))); - SWIG_Python_SetConstant(d, "exdrMAGIC",SWIG_From_int((int)(exdrMAGIC))); - SWIG_Python_SetConstant(d, "exdrNOMEM",SWIG_From_int((int)(exdrNOMEM))); - SWIG_Python_SetConstant(d, "exdrENDOFFILE",SWIG_From_int((int)(exdrENDOFFILE))); - SWIG_Python_SetConstant(d, "exdrFILENOTFOUND",SWIG_From_int((int)(exdrFILENOTFOUND))); - SWIG_Python_SetConstant(d, "exdrNR",SWIG_From_int((int)(exdrNR))); + + SWIG_Python_SetConstant(d, "pluginOK",SWIG_From_int((int)(pluginOK))); + SWIG_Python_SetConstant(d, "pluginNOINIT",SWIG_From_int((int)(pluginNOINIT))); + SWIG_Python_SetConstant(d, "pluginCLOSE",SWIG_From_int((int)(pluginCLOSE))); + SWIG_Python_SetConstant(d, "pluginNOMEM",SWIG_From_int((int)(pluginNOMEM))); + SWIG_Python_SetConstant(d, "pluginENDOFFILE",SWIG_From_int((int)(pluginENDOFFILE))); + SWIG_Python_SetConstant(d, "pluginFILENOTFOUND",SWIG_From_int((int)(pluginFILENOTFOUND))); + SWIG_Python_SetConstant(d, "pluginFORMATERROR",SWIG_From_int((int)(pluginFORMATERROR))); SWIG_Python_SetConstant(d, "SEEK_SET",SWIG_From_int((int)(SEEK_SET))); SWIG_Python_SetConstant(d, "SEEK_CUR",SWIG_From_int((int)(SEEK_CUR))); SWIG_Python_SetConstant(d, "SEEK_END",SWIG_From_int((int)(SEEK_END))); - SWIG_Python_SetConstant(d, "DIM",SWIG_From_int((int)(3))); #if PY_VERSION_HEX >= 0x03000000 return m; #else diff --git a/pymolfile/molfile/libpymolfile_wrap.cxx b/pymolfile/molfile/libpymolfile_wrap.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a29b996585521d9172c15dca7a7f2811c71dc908 --- /dev/null +++ b/pymolfile/molfile/libpymolfile_wrap.cxx @@ -0,0 +1,4202 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.12 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifndef SWIGPYTHON +#define SWIGPYTHON +#endif + +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template<typename T> class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template <typename T> T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + + +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* Use debug wrappers with the Python release dll */ +# undef _DEBUG +# include <Python.h> +# define _DEBUG +#else +# include <Python.h> +#endif + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if (<obj is ok>) { + if (<need new object>) { + *ptr = <ptr to new allocated object>; + return SWIG_NEWOBJ; + } else { + *ptr = <ptr to old object>; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class<int>" == "Class<int >", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + size_t l = 0; + size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + char d = *(c++); + unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = (unsigned char)((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = (unsigned char)((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (unsigned char)(d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (unsigned char)(d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#define PyString_Check(name) PyBytes_Check(name) +#define PyString_FromString(x) PyUnicode_FromString(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#define PyString_AsString(str) PyBytes_AsString(str) +#define PyString_Size(str) PyBytes_Size(str) +#define PyString_InternFromString(key) PyUnicode_InternFromString(key) +#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE +#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) +#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) + +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Warning: This function will allocate a new string in Python 3, + * so please call SWIG_Python_str_DelForPy3(x) to free the space. + */ +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03000000 + char *cstr; + char *newstr; + Py_ssize_t len; + str = PyUnicode_AsUTF8String(str); + PyBytes_AsStringAndSize(str, &cstr, &len); + newstr = (char *) malloc(len+1); + memcpy(newstr, cstr, len+1); + Py_XDECREF(str); + return newstr; +#else + return PyString_AsString(str); +#endif +} + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) +#else +# define SWIG_Python_str_DelForPy3(x) +#endif + + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +/* Add PyOS_snprintf for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# define PyOS_snprintf _snprintf +# else +# define PyOS_snprintf snprintf +# endif +#endif + +/* A crude PyString_FromFormat implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 + +#ifndef SWIG_PYBUFFER_SIZE +# define SWIG_PYBUFFER_SIZE 1024 +#endif + +static PyObject * +PyString_FromFormat(const char *fmt, ...) { + va_list ap; + char buf[SWIG_PYBUFFER_SIZE * 2]; + int res; + va_start(ap, fmt); + res = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); +} +#endif + +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +/* A crude PyExc_StopIteration exception for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# ifndef PyExc_StopIteration +# define PyExc_StopIteration PyExc_RuntimeError +# endif +# ifndef PyObject_GenericGetAttr +# define PyObject_GenericGetAttr 0 +# endif +#endif + +/* Py_NotImplemented is defined in 2.1 and up. */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef Py_NotImplemented +# define Py_NotImplemented PyExc_RuntimeError +# endif +#endif + +/* A crude PyString_AsStringAndSize implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef PyString_AsStringAndSize +# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} +# endif +#endif + +/* PySequence_Size for old Pythons */ +#if PY_VERSION_HEX < 0x02000000 +# ifndef PySequence_Size +# define PySequence_Size PySequence_Length +# endif +#endif + +/* PyBool_FromLong for old Pythons */ +#if PY_VERSION_HEX < 0x02030000 +static +PyObject *PyBool_FromLong(long ok) +{ + PyObject *result = ok ? Py_True : Py_False; + Py_INCREF(result); + return result; +} +#endif + +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +typedef intargfunc ssizeargfunc; +typedef intintargfunc ssizessizeargfunc; +typedef intobjargproc ssizeobjargproc; +typedef intintobjargproc ssizessizeobjargproc; +typedef getreadbufferproc readbufferproc; +typedef getwritebufferproc writebufferproc; +typedef getsegcountproc segcountproc; +typedef getcharbufferproc charbufferproc; +static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) +{ + long result = 0; + PyObject *i = PyNumber_Int(x); + if (i) { + result = PyInt_AsLong(i); + Py_DECREF(i); + } + return result; +} +#endif + +#if PY_VERSION_HEX < 0x02050000 +#define PyInt_FromSize_t(x) PyInt_FromLong((long)x) +#endif + +#if PY_VERSION_HEX < 0x02040000 +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef struct { + PyTypeObject type; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; + PyBufferProcs as_buffer; + PyObject *name, *slots; +} PyHeapTypeObject; +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef destructor freefunc; +#endif + +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ + (PY_MAJOR_VERSION > 3)) +# define SWIGPY_USE_CAPSULE +# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif + +#if PY_VERSION_HEX < 0x03020000 +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + PyErr_Clear(); + Py_XINCREF(type); + + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_SetString(PyExc_RuntimeError, mesg); + } +} + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ +# define SWIG_PYTHON_USE_GIL +# endif +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + + +/* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ +#if PY_VERSION_HEX >= 0x03000000 +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) +{ + return PyInstanceMethod_New(func); +} +#else +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) +{ + return NULL; +} +#endif + +#ifdef __cplusplus +} +#endif + + +/* ----------------------------------------------------------------------------- + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) + +#ifdef SWIGPYTHON_BUILTIN +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) +#else +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) +#endif + +#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) + +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +#if defined(SWIGPYTHON_BUILTIN) + +SWIGINTERN void +SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { + PyObject *s = PyString_InternFromString(key); + PyList_Append(seq, s); + Py_DECREF(s); +} + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); + if (public_interface) + SwigPyBuiltin_AddPublicSymbol(public_interface, name); +} + +#else + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); +} + +#endif + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +#else + PyObject* o2; + PyObject* o3; + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyTuple_Check(result)) { + o2 = result; + result = PyTuple_New(1); + PyTuple_SET_ITEM(result, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SET_ITEM(o3, 0, obj); + o2 = result; + result = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return result; +#endif +} + +/* Unpack the argument tuple */ + +SWIGINTERN Py_ssize_t +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + if (min <= 1 && max >= 1) { + Py_ssize_t i; + objs[0] = args; + for (i = 1; i < max; ++i) { + objs[i] = 0; + } + return 2; + } + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); + return 0; + } else { + Py_ssize_t i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; + } + } +} + +/* A functor is a function object with one single object argument */ +#if PY_VERSION_HEX >= 0x02020000 +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); +#else +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); +#endif + +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var +#endif + +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) +#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) + +#ifdef __cplusplus +extern "C" { +#endif + +/* How to access Py_None */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# ifndef SWIG_PYTHON_NO_BUILD_NONE +# ifndef SWIG_PYTHON_BUILD_NONE +# define SWIG_PYTHON_BUILD_NONE +# endif +# endif +#endif + +#ifdef SWIG_PYTHON_BUILD_NONE +# ifdef Py_None +# undef Py_None +# define Py_None SWIG_Py_None() +# endif +SWIGRUNTIMEINLINE PyObject * +_SWIG_Py_None(void) +{ + PyObject *none = Py_BuildValue((char*)""); + Py_DECREF(none); + return none; +} +SWIGRUNTIME PyObject * +SWIG_Py_None(void) +{ + static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); + return none; +} +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* SwigPyClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; + PyTypeObject *pytype; +} SwigPyClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + return data ? data->implicitconv : 0; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME SwigPyClientData * +SwigPyClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { +#if (PY_VERSION_HEX < 0x02020000) + data->newraw = 0; +#else + data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); +#endif + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); +#ifdef METH_O + data->delargs = !(flags & (METH_O)); +#else + data->delargs = 0; +#endif + } else { + data->delargs = 0; + } + data->implicitconv = 0; + data->pytype = 0; + return data; + } +} + +SWIGRUNTIME void +SwigPyClientData_Del(SwigPyClientData *data) { + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== SwigPyObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +#ifdef SWIGPYTHON_BUILTIN + PyObject *dict; +#endif +} SwigPyObject; + + +#ifdef SWIGPYTHON_BUILTIN + +SWIGRUNTIME PyObject * +SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + + if (!sobj->dict) + sobj->dict = PyDict_New(); + + Py_INCREF(sobj->dict); + return sobj->dict; +} + +#endif + +SWIGRUNTIME PyObject * +SwigPyObject_long(SwigPyObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +SwigPyObject_format(const char* fmt, SwigPyObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else + res = PyString_Format(ofmt,args); +#endif + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +SwigPyObject_oct(SwigPyObject *v) +{ + return SwigPyObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_hex(SwigPyObject *v) +{ + return SwigPyObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +#ifdef METH_NOARGS +SwigPyObject_repr(SwigPyObject *v) +#else +SwigPyObject_repr(SwigPyObject *v, PyObject *args) +#endif +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v); + if (v->next) { +# ifdef METH_NOARGS + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); +# else + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); +# endif +# if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +# else + PyString_ConcatAndDel(&repr,nrep); +# endif + } + return repr; +} + +SWIGRUNTIME int +SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +/* Added for Python 3.x, would it also be useful for Python 2.x? */ +SWIGRUNTIME PyObject* +SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); + return res; +} + + +SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); + +#ifdef SWIGPYTHON_BUILTIN +static swig_type_info *SwigPyObject_stype = 0; +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + SwigPyClientData *cd; + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + assert(cd); + assert(cd->pytype); + return cd->pytype; +} +#else +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); + return type; +} +#endif + +SWIGRUNTIMEINLINE int +SwigPyObject_Check(PyObject *op) { +#ifdef SWIGPYTHON_BUILTIN + PyTypeObject *target_tp = SwigPyObject_type(); + if (PyType_IsSubtype(op->ob_type, target_tp)) + return 1; + return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); +#else + return (Py_TYPE(op) == SwigPyObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +#endif +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +SwigPyObject_dealloc(PyObject *v) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + PyObject *next = sobj->next; + if (sobj->own == SWIG_POINTER_OWN) { + swig_type_info *ty = sobj->ty; + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + + /* PyObject_CallFunction() has the potential to silently drop + the active active exception. In cases of unnamed temporary + variable or where we just finished iterating over a generator + StopIteration will be active right now, and this needs to + remain true upon return from SwigPyObject_dealloc. So save + and restore. */ + + PyObject *val = NULL, *type = NULL, *tb = NULL; + PyErr_Fetch(&val, &type, &tb); + + if (data->delargs) { + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + if (!res) + PyErr_WriteUnraisable(destroy); + + PyErr_Restore(val, type, tb); + + Py_XDECREF(res); + } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); + } +#endif + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +SwigPyObject_append(PyObject* v, PyObject* next) +{ + SwigPyObject *sobj = (SwigPyObject *) v; +#ifndef METH_O + PyObject *tmp = 0; + if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; + next = tmp; +#endif + if (!SwigPyObject_Check(next)) { + PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +#ifdef METH_NOARGS +SwigPyObject_next(PyObject* v) +#else +SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_disown(PyObject *v) +#else +SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_acquire(PyObject *v) +#else +SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +SwigPyObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; +#if (PY_VERSION_HEX < 0x02020000) + if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) +#elif (PY_VERSION_HEX < 0x02050000) + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) +#else + if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) +#endif + { + return NULL; + } + else + { + SwigPyObject *sobj = (SwigPyObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { +#ifdef METH_NOARGS + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v); + } else { + SwigPyObject_disown(v); + } +#else + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v,args); + } else { + SwigPyObject_disown(v,args); + } +#endif + } + return obj; + } +} + +#ifdef METH_O +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#else +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#endif + +#if PY_VERSION_HEX < 0x02020000 +SWIGINTERN PyObject * +SwigPyObject_getattr(SwigPyObject *sobj,char *name) +{ + return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); +} +#endif + +SWIGRUNTIME PyTypeObject* +SwigPyObject_TypeOnce(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods SwigPyObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc)0, /*nb_divide*/ +#endif + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif + (unaryfunc)SwigPyObject_long, /*nb_int*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_long, /*nb_long*/ +#else + 0, /*nb_reserved*/ +#endif + (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_oct, /*nb_oct*/ + (unaryfunc)SwigPyObject_hex, /*nb_hex*/ +#endif +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ +#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ + 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ +#endif + }; + + static PyTypeObject swigpyobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyObject", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyObject_dealloc, /* tp_dealloc */ + 0, /* tp_print */ +#if PY_VERSION_HEX < 0x02020000 + (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ +#else + (getattrfunc)0, /* tp_getattr */ +#endif + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ +#else + (cmpfunc)SwigPyObject_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyObject_repr, /* tp_repr */ + &SwigPyObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpyobject_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpyobject_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobject_type) < 0) + return NULL; +#endif + } + return &swigpyobject_type; +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +{ + SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} SwigPyPacked; + +SWIGRUNTIME int +SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char result[SWIG_BUFFER_SIZE]; + fputs("<Swig Packed ", fp); + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + fputs("at ", fp); + fputs(result, fp); + } + fputs(v->ty->name,fp); + fputs(">", fp); + return 0; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_repr(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); + } else { + return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +SwigPyPacked_str(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + } else { + return SWIG_Python_str_FromChar(v->ty->name); + } +} + +SWIGRUNTIME int +SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyPacked_Check(PyObject *op) { + return ((op)->ob_type == SwigPyPacked_TypeOnce()) + || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +} + +SWIGRUNTIME void +SwigPyPacked_dealloc(PyObject *v) +{ + if (SwigPyPacked_Check(v)) { + SwigPyPacked *sobj = (SwigPyPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_TypeOnce(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject swigpypacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyPacked", /* tp_name */ + sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ + (printfunc)SwigPyPacked_print, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX>=0x03000000 + 0, /* tp_reserved in 3.0.1 */ +#else + (cmpfunc)SwigPyPacked_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpypacked_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpypacked_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpypacked_type) < 0) + return NULL; +#endif + } + return &swigpypacked_type; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (SwigPyPacked_Check(obj)) { + SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIMEINLINE PyObject * +_SWIG_This(void) +{ + return SWIG_Python_str_FromChar("this"); +} + +static PyObject *swig_this = NULL; + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + if (swig_this == NULL) + swig_this = _SWIG_This(); + return swig_this; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + +SWIGRUNTIME SwigPyObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + PyObject *obj; + + if (SwigPyObject_Check(pyobj)) + return (SwigPyObject *) pyobj; + +#ifdef SWIGPYTHON_BUILTIN + (void)obj; +# ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + pyobj = PyWeakref_GET_OBJECT(pyobj); + if (pyobj && SwigPyObject_Check(pyobj)) + return (SwigPyObject*) pyobj; + } +# endif + return NULL; +#else + + obj = 0; + +#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !SwigPyObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + SwigPyObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (SwigPyObject *)obj; +#endif +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own == SWIG_POINTER_OWN) { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } + } + return 0; +} + +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + int res; + SwigPyObject *sobj; + int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; + + if (!obj) + return SWIG_ERROR; + if (obj == Py_None && !implicit_conv) { + if (ptr) + *ptr = 0; + return SWIG_OK; + } + + res = SWIG_ERROR; + + sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; + while (sobj) { + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } + } + if (sobj) { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + res = SWIG_OK; + } else { + if (implicit_conv) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } + if (!SWIG_IsOK(res) && obj == Py_None) { + if (ptr) + *ptr = 0; + if (PyErr_Occurred()) + PyErr_Clear(); + res = SWIG_OK; + } + } + return res; +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) + return SWIG_ERROR; + if (ty) { + swig_cast_info *tc = SWIG_TypeCheck(desc,ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } + } else { + *ptr = vptr; + } + return SWIG_OK; + } +} + +/* Convert a packed value value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, without calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +{ +#if (PY_VERSION_HEX >= 0x02020000) + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + PyObject *key = SWIG_This(); + PyObject_SetAttr(inst, key, swig_this); +#endif + } + } else { +#if PY_VERSION_HEX >= 0x03000000 + inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + if (inst) { + PyObject_SetAttr(inst, SWIG_This(), swig_this); + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + } +#else + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } +#endif + } + return inst; +#else +#if (PY_VERSION_HEX >= 0x02010000) + PyObject *inst = 0; + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } + return (PyObject *) inst; +#else + PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); + if (inst == NULL) { + return NULL; + } + inst->in_class = (PyClassObject *)data->newargs; + Py_INCREF(inst->in_class); + inst->in_dict = PyDict_New(); + if (inst->in_dict == NULL) { + Py_DECREF(inst); + return NULL; + } +#ifdef Py_TPFLAGS_HAVE_WEAKREFS + inst->in_weakreflist = NULL; +#endif +#ifdef Py_TPFLAGS_GC + PyObject_GC_Init(inst); +#endif + PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); + return (PyObject *) inst; +#endif +#endif +} + +SWIGRUNTIME void +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ + PyObject *dict; +#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + PyDict_SetItem(dict, SWIG_This(), swig_this); + return; + } +#endif + dict = PyObject_GetAttrString(inst, (char*)"__dict__"); + PyDict_SetItem(dict, SWIG_This(), swig_this); + Py_DECREF(dict); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { + return NULL; + } else { + SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + SwigPyObject_append((PyObject*) sthis, obj[1]); + } else { + SWIG_Python_SetSwigThis(obj[0], obj[1]); + } + return SWIG_Py_Void(); + } +} + +/* Create a new pointer object */ + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { + SwigPyClientData *clientdata; + PyObject * robj; + int own; + + if (!ptr) + return SWIG_Py_Void(); + + clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (clientdata && clientdata->pytype) { + SwigPyObject *newobj; + if (flags & SWIG_BUILTIN_TP_INIT) { + newobj = (SwigPyObject*) self; + if (newobj->ptr) { + PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); + while (newobj->next) + newobj = (SwigPyObject *) newobj->next; + newobj->next = next_self; + newobj = (SwigPyObject *)next_self; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + } + } else { + newobj = PyObject_New(SwigPyObject, clientdata->pytype); +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + } + if (newobj) { + newobj->ptr = ptr; + newobj->ty = type; + newobj->own = own; + newobj->next = 0; + return (PyObject*) newobj; + } + return SWIG_Py_Void(); + } + + assert(!(flags & SWIG_BUILTIN_TP_INIT)); + + robj = SwigPyObject_New(ptr, type, own); + if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + Py_DECREF(robj); + robj = inst; + } + return robj; +} + +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); +} + +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else +# ifdef SWIGPY_USE_CAPSULE + type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); +# else + type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +# endif + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif + } + return (swig_module_info *) type_pointer; +} + +#if PY_MAJOR_VERSION < 2 +/* PyModule_AddObject function was introduced in Python 2.0. The following function + is copied out of Python/modsupport.c in python version 2.3.4 */ +SWIGINTERN int +PyModule_AddObject(PyObject *m, char *name, PyObject *o) +{ + PyObject *dict; + if (!PyModule_Check(m)) { + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); + return SWIG_ERROR; + } + if (!o) { + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); + return SWIG_ERROR; + } + + dict = PyModule_GetDict(m); + if (dict == NULL) { + /* Internal error -- modules must have a dict! */ + PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", + PyModule_GetName(m)); + return SWIG_ERROR; + } + if (PyDict_SetItemString(dict, name, o)) + return SWIG_ERROR; + Py_DECREF(o); + return SWIG_OK; +} +#endif + +SWIGRUNTIME void +#ifdef SWIGPY_USE_CAPSULE +SWIG_Python_DestroyModule(PyObject *obj) +#else +SWIG_Python_DestroyModule(void *vptr) +#endif +{ +#ifdef SWIGPY_USE_CAPSULE + swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); +#else + swig_module_info *swig_module = (swig_module_info *) vptr; +#endif + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + if (data) SwigPyClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); + swig_this = NULL; +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); +#endif +#ifdef SWIGPY_USE_CAPSULE + PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#else + PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#endif +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { +#ifdef SWIGPY_USE_CAPSULE + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); +#else + descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif + } else { + swig_module_info *swig_module = SWIG_GetModule(0); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { +#ifdef SWIGPY_USE_CAPSULE + obj = PyCapsule_New((void*) descriptor, NULL, NULL); +#else + obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif + PyDict_SetItem(cache, key, obj); + Py_DECREF(obj); + } + } + Py_DECREF(key); + return descriptor; +} + +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); + } else { + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + } + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +SwigPyObject_GetDesc(PyObject *self) +{ + SwigPyObject *v = (SwigPyObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : ""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && SwigPyObject_Check(obj)) { + const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + type, otype); + return; + } + } else +#endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + SWIG_Python_str_DelForPy3(cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); +#if SWIG_POINTER_EXCEPTION + if (flags) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } +#endif + } + return result; +} + +#ifdef SWIGPYTHON_BUILTIN +SWIGRUNTIME int +SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + PyObject *encoded_name; + descrsetfunc f; + int res = -1; + +# ifdef Py_USING_UNICODE + if (PyString_Check(name)) { + name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); + if (!name) + return -1; + } else if (!PyUnicode_Check(name)) +# else + if (!PyString_Check(name)) +# endif + { + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; + } else { + Py_INCREF(name); + } + + if (!tp->tp_dict) { + if (PyType_Ready(tp) < 0) + goto done; + } + + descr = _PyType_Lookup(tp, name); + f = NULL; + if (descr != NULL) + f = descr->ob_type->tp_descr_set; + if (!f) { + if (PyString_Check(name)) { + encoded_name = name; + Py_INCREF(name); + } else { + encoded_name = PyUnicode_AsUTF8String(name); + } + PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); + Py_DECREF(encoded_name); + } else { + res = f(descr, obj, value); + } + + done: + Py_DECREF(name); + return res; +} +#endif + + +#ifdef __cplusplus +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_char swig_types[0] +#define SWIGTYPE_p_molfile_plugin_t swig_types[1] +#define SWIGTYPE_p_p_molfile_plugin_t swig_types[2] +static swig_type_info *swig_types[4]; +static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#if (PY_VERSION_HEX <= 0x02000000) +# if !defined(SWIG_PYTHON_CLASSIC) +# error "This python version requires swig to be run with the '-classic' option" +# endif +#endif + +/*----------------------------------------------- + @(target):= _libpymolfile.so + ------------------------------------------------*/ +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_init PyInit__libpymolfile + +#else +# define SWIG_init init_libpymolfile + +#endif +#define SWIG_name "_libpymolfile" + +#define SWIGVERSION 0x030012 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include <stdexcept> + + +namespace swig { + class SwigPtr_PyObject { + protected: + PyObject *_obj; + + public: + SwigPtr_PyObject() :_obj(0) + { + } + + SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + + SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) + { + if (initial_ref) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + } + + SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(item._obj); + Py_XDECREF(_obj); + _obj = item._obj; + SWIG_PYTHON_THREAD_END_BLOCK; + return *this; + } + + ~SwigPtr_PyObject() + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XDECREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + + operator PyObject *() const + { + return _obj; + } + + PyObject *operator->() const + { + return _obj; + } + }; +} + + +namespace swig { + struct SwigVar_PyObject : SwigPtr_PyObject { + SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } + + SwigVar_PyObject & operator = (PyObject* obj) + { + Py_XDECREF(_obj); + _obj = obj; + return *this; + } + }; +} + + +/* Python SWIG interface to libpymolfile + Copyright (c) 2017 Berk Onat <b.onat@warwick.ac.uk> + Published under BSD LICENSE + */ +#define SWIG_FILE_WITH_INIT +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include "molfile_plugin.h" +#include "libmolfile_plugin.h" +#include "vmdplugin.h" +#include "pymolfile.h" + + +#ifndef SWIG_FILE_WITH_INIT +#define NO_IMPORT_ARRAY +#endif +#include "stdio.h" +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <numpy/arrayobject.h> + + +#include <complex> + + +SWIGINTERNINLINE PyObject* + SWIG_From_int (int value) +{ + return PyInt_FromLong((long) value); +} + + +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; +#if PY_VERSION_HEX < 0x03000000 + } else if (PyInt_Check(obj)) { + if (val) *val = (double) PyInt_AsLong(obj); + return SWIG_OK; +#endif + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +#include <float.h> + + +#include <math.h> + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else +#endif + if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +PyObject * molfile_plugin_info(molfile_plugin_t** plugin_list, int plugin_no) { + molfile_plugin_t *plugin; + int *plugno = &plugin_no; + int has_readstructure = 0; + int has_readbonds = 0; + int has_readangles = 0; + int has_writestructure = 0; + int has_writebonds = 0; + int has_writeangles = 0; + int has_readnexttimestep = 0; + int has_writetimestep = 0; + int plugin_list_size = sizeof(plugin_list) / sizeof(molfile_plugin_t**); + if (plugno==NULL || plugin_no<0){ + PyErr_Format(PyExc_IOError, "[%d] Error: molfile plugin handle no should be given, be positive value and should not exceed the list length'%d'. You set '%d'", pluginNOINIT, plugin_list_size, plugin_no); + return 0; + } + plugin = plugin_list[plugin_no]; + if(plugin==NULL || !plugin->open_file_read){ + PyErr_Format(PyExc_IOError, "[%d] Error: molfile plugin '%d' is not initialized.", pluginNOINIT, plugin_no); + return 0; + } + if (plugin->read_structure) has_readstructure = 1; + if (plugin->read_bonds) has_readbonds = 1; + if (plugin->read_angles) has_readangles = 1; + if (plugin->read_next_timestep) has_readnexttimestep = 1; + if (plugin->write_structure) has_writestructure = 1; + if (plugin->write_bonds) has_writebonds = 1; + if (plugin->write_angles) has_writeangles = 1; + if (plugin->write_timestep) has_writetimestep = 1; + PyObject *tuple = PyTuple_New(17); + PyTuple_SET_ITEM(tuple, 0, PyString_FromString(plugin->filename_extension)); + PyTuple_SET_ITEM(tuple, 1, PyString_FromString(plugin->name)); + PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)has_readstructure)); + PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((long)has_readbonds)); + PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((long)has_readangles)); + PyTuple_SET_ITEM(tuple, 5, PyInt_FromLong((long)has_readnexttimestep)); + PyTuple_SET_ITEM(tuple, 6, PyInt_FromLong((long)has_writestructure)); + PyTuple_SET_ITEM(tuple, 7, PyInt_FromLong((long)has_writebonds)); + PyTuple_SET_ITEM(tuple, 8, PyInt_FromLong((long)has_writeangles)); + PyTuple_SET_ITEM(tuple, 9, PyInt_FromLong((long)has_writetimestep)); + PyTuple_SET_ITEM(tuple, 10, PyString_FromString(plugin->prettyname)); + PyTuple_SET_ITEM(tuple, 11, PyString_FromString(plugin->type)); + PyTuple_SET_ITEM(tuple, 12, PyString_FromString(plugin->author)); + PyTuple_SET_ITEM(tuple, 13, PyInt_FromLong((long)plugin->majorv)); + PyTuple_SET_ITEM(tuple, 14, PyInt_FromLong((long)plugin->minorv)); + PyTuple_SET_ITEM(tuple, 15, PyInt_FromLong((long)plugin->abiversion)); + PyTuple_SET_ITEM(tuple, 16, PyInt_FromLong((long)plugin->is_reentrant)); + return tuple; + } + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_molfile_plugin_list(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + molfile_plugin_t **result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:molfile_plugin_list",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "molfile_plugin_list" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (molfile_plugin_t **)molfile_plugin_list(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_molfile_plugin_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_molfile_init(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int result; + + if (!PyArg_ParseTuple(args,(char *)":molfile_init")) SWIG_fail; + result = (int)molfile_init(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_molfile_finish(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int result; + + if (!PyArg_ParseTuple(args,(char *)":molfile_finish")) SWIG_fail; + result = (int)molfile_finish(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_get_plugin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + molfile_plugin_t **arg1 = (molfile_plugin_t **) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + molfile_plugin_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:get_plugin",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_p_molfile_plugin_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "get_plugin" "', argument " "1"" of type '" "molfile_plugin_t **""'"); + } + arg1 = reinterpret_cast< molfile_plugin_t ** >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "get_plugin" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (molfile_plugin_t *)get_plugin(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_molfile_plugin_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_molfile_plugin_info(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + molfile_plugin_t **arg1 = (molfile_plugin_t **) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:molfile_plugin_info",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_p_molfile_plugin_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "molfile_plugin_info" "', argument " "1"" of type '" "molfile_plugin_t **""'"); + } + arg1 = reinterpret_cast< molfile_plugin_t ** >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "molfile_plugin_info" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + { + result = (PyObject *)molfile_plugin_info(arg1,arg2); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +static PyMethodDef SwigMethods[] = { + { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, + { (char *)"molfile_plugin_list", _wrap_molfile_plugin_list, METH_VARARGS, (char *)"molfile_plugin_list(maxsize) -> molfile_plugin_t **"}, + { (char *)"molfile_init", _wrap_molfile_init, METH_VARARGS, (char *)"molfile_init() -> int"}, + { (char *)"molfile_finish", _wrap_molfile_finish, METH_VARARGS, (char *)"molfile_finish() -> int"}, + { (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 *"}, + { NULL, NULL, 0, NULL } +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_molfile_plugin_t = {"_p_molfile_plugin_t", "molfile_plugin_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_molfile_plugin_t = {"_p_p_molfile_plugin_t", "molfile_plugin_t **", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_char, + &_swigt__p_molfile_plugin_t, + &_swigt__p_p_molfile_plugin_t, +}; + +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_molfile_plugin_t[] = { {&_swigt__p_molfile_plugin_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_molfile_plugin_t[] = { {&_swigt__p_p_molfile_plugin_t, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_char, + _swigc__p_molfile_plugin_t, + _swigc__p_p_molfile_plugin_t, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_const_info swig_const_table[] = { +{0, 0, 0, 0.0, 0, 0}}; + +#ifdef __cplusplus +} +#endif +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned statically to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + iter=module_head; + do { + if (iter==&swig_module) { + /* Our module is already in the list, so there's nothing more to do. */ + return; + } + iter=iter->next; + } while (iter!= module_head); + + /* otherwise we must add our module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString("<Swig global variables>"); +#else + return PyString_FromString("<Swig global variables>"); +#endif + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; + } + + SWIGINTERN int + swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { + char *tmp; + PyObject *str = swig_varlink_str(v); + fprintf(fp,"Swig global variables "); + fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(str); + return 0; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"swigvarlink", /* tp_name */ + sizeof(swig_varlinkobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (printfunc) swig_varlink_print, /* tp_print */ + (getattrfunc) swig_varlink_getattr, /* tp_getattr */ + (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + varlink_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + varlink_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&varlink_type) < 0) + return NULL; +#endif + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + strncpy(gv->name,name,size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + return _SWIG_globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (!c) continue; + c = strstr(c, "swig_ptr: "); + if (c) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + strncpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + strncpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif + +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 +PyObject* +#else +void +#endif +SWIG_init(void) { + PyObject *m, *d, *md; +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { +# if PY_VERSION_HEX >= 0x03020000 + PyModuleDef_HEAD_INIT, +# else + { + PyObject_HEAD_INIT(NULL) + NULL, /* m_init */ + 0, /* m_index */ + NULL, /* m_copy */ + }, +# endif + (char *) SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; +#endif + +#if defined(SWIGPYTHON_BUILTIN) + static SwigPyClientData SwigPyObject_clientdata = { + 0, 0, 0, 0, 0, 0, 0 + }; + static PyGetSetDef this_getset_def = { + (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + }; + static SwigPyGetSet thisown_getset_closure = { + (PyCFunction) SwigPyObject_own, + (PyCFunction) SwigPyObject_own + }; + static PyGetSetDef thisown_getset_def = { + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure + }; + PyTypeObject *builtin_pytype; + int builtin_base_count; + swig_type_info *builtin_basetype; + PyObject *tuple; + PyGetSetDescrObject *static_getset; + PyTypeObject *metatype; + PyTypeObject *swigpyobject; + SwigPyClientData *cd; + PyObject *public_interface, *public_symbol; + PyObject *this_descr; + PyObject *thisown_descr; + PyObject *self = 0; + int i; + + (void)builtin_pytype; + (void)builtin_base_count; + (void)builtin_basetype; + (void)tuple; + (void)static_getset; + (void)self; + + /* Metaclass is used to implement static member variables */ + metatype = SwigPyObjectType(); + assert(metatype); +#endif + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + +#if PY_VERSION_HEX >= 0x03000000 + m = PyModule_Create(&SWIG_module); +#else + m = Py_InitModule((char *) SWIG_name, SwigMethods); +#endif + + md = d = PyModule_GetDict(m); + (void)md; + + SWIG_InitializeModule(0); + +#ifdef SWIGPYTHON_BUILTIN + swigpyobject = SwigPyObject_TypeOnce(); + + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + if (!cd) { + SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; + SwigPyObject_clientdata.pytype = swigpyobject; + } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { + PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); +# if PY_VERSION_HEX >= 0x03000000 + return NULL; +# else + return; +# endif + } + + /* All objects have a 'this' attribute */ + this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + (void)this_descr; + + /* All objects have a 'thisown' attribute */ + thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + (void)thisown_descr; + + public_interface = PyList_New(0); + public_symbol = 0; + (void)public_symbol; + + PyDict_SetItemString(md, "__all__", public_interface); + Py_DECREF(public_interface); + for (i = 0; SwigMethods[i].ml_name != NULL; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); + for (i = 0; swig_const_table[i].name != 0; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); +#endif + + SWIG_InstallConstants(d,swig_const_table); + + + import_array(); + + SWIG_Python_SetConstant(d, "pluginOK",SWIG_From_int(static_cast< int >(pluginOK))); + SWIG_Python_SetConstant(d, "pluginNOINIT",SWIG_From_int(static_cast< int >(pluginNOINIT))); + SWIG_Python_SetConstant(d, "pluginCLOSE",SWIG_From_int(static_cast< int >(pluginCLOSE))); + SWIG_Python_SetConstant(d, "pluginNOMEM",SWIG_From_int(static_cast< int >(pluginNOMEM))); + SWIG_Python_SetConstant(d, "pluginENDOFFILE",SWIG_From_int(static_cast< int >(pluginENDOFFILE))); + SWIG_Python_SetConstant(d, "pluginFILENOTFOUND",SWIG_From_int(static_cast< int >(pluginFILENOTFOUND))); + SWIG_Python_SetConstant(d, "pluginFORMATERROR",SWIG_From_int(static_cast< int >(pluginFORMATERROR))); +#if PY_VERSION_HEX >= 0x03000000 + return m; +#else + return; +#endif +} + diff --git a/pymolfile/libpymolfile/numpy.i b/pymolfile/molfile/numpy.i similarity index 100% rename from pymolfile/libpymolfile/numpy.i rename to pymolfile/molfile/numpy.i diff --git a/pymolfile/molfile/pymolfile.c b/pymolfile/molfile/pymolfile.c new file mode 100644 index 0000000000000000000000000000000000000000..5bae356ea6afb0e04d4b0c691d94da62c3ab41c6 --- /dev/null +++ b/pymolfile/molfile/pymolfile.c @@ -0,0 +1,248 @@ +/* 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. + */ + +/* Get HAVE_CONFIG_H */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdbool.h> +#include <ctype.h> + +/* get fixed-width types if we are using ANSI C99 */ +#ifdef HAVE_STDINT_H +# include <stdint.h> +#elif (defined HAVE_INTTYPES_H) +# include <inttypes.h> +#endif + +#include "pymolfile.h" + +int numplugins=0; +molfile_plugin_t** plugin_list; + +/* * * * * * * * * * * * * * * * * * * * * * * + * Helper functions to set and store plugins * + * * * * * * * * * * * * * * * * * * * * * * */ +#if 0 +void init_readwriteaccess(struct DICTHOLDER *dict); + +struct DICTHOLDER * plugin_find(struct DICTHOLDER *dict, const char *pluginname){ + struct DICTHOLDER *dictitem; + dictitem = dict; + // search in dictionary linked list + while(dictitem != NULL){ + if(strcmp(dictitem->key, pluginname) == 0){ + return dictitem; + } + dictitem = dictitem->next; + } + return NULL; +} +#endif + +molfile_plugin_t* get_plugin(molfile_plugin_t** plug_list, int plug_no) +{ + if(plug_no < 0){ + return NULL; + } else { + return plug_list[plug_no]; + } +} + +#if 0 +void init_readwriteaccess(struct DICTHOLDER *dict){ + struct DICTHOLDER *dictitem; + dictitem = dict; + // search in dictionary linked list + while(dictitem != NULL){ + if(!dictitem->id){ + if(plugin_list[dictitem->id]->read_next_timestep){ + dictitem->read = 1; + } + if(plugin_list[dictitem->id]->write_timestep){ + dictitem->write = 1; + } + } + dictitem = dictitem->next; + } +} + +static int has_readsupport(const char *pluginname){ + struct DICTHOLDER *item; + item = plugin_find(&plugindict, pluginname); + if (!item){ + return item->read; + } else { + return 0; + } +} + +static int has_writesupport(const char *pluginname){ + struct DICTHOLDER *item; + item = plugin_find(&plugindict, pluginname); + if (!item){ + return item->write; + } else { + return 0; + } +} + +static int plugin_add(struct DICTHOLDER *dict, const char *key, int id){ + struct DICTHOLDER *dictitem; + // Check list is empty or it already has the key + if (plugin_find(dict, key) == NULL){ + dictitem = dict; + while(1){ + // Find the empty next in the list and add item + if(dictitem == NULL){ + struct DICTHOLDER *item = (struct DICTHOLDER*) malloc(sizeof(struct DICTHOLDER)); + item->key = key; + item->id = id; + item->read = NULL; + item->write = NULL; + dictitem = &item; + return 0; + } else { + dictitem = dictitem->next; + } + } + } else { + return 1; + } +} + +static int plugin_remove(struct DICTHOLDER *dict, const char *key){ + struct DICTHOLDER *dictitem; + // Check list is empty or it already has the key + if (plugin_find(dict, key) == NULL){ + // No key in the list. Nothing to remove. + return 1; + } else { + // Remove key in the list + dictitem = dict; + while(dictitem != NULL){ + if(strcmp(dictitem->next->key, key) == 0){ + struct DICTHOLDER *item = dictitem->next->next; + dictitem->next = item; + return 0; + } + dictitem = dictitem->next; + } + return 1; + } +} +#endif +/* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Interface functions to initialize molfile plugins * + * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* check validity of plugins and register them. */ +static int molfile_register(void*, vmdplugin_t *plugin) { + if (!plugin->type || !plugin->name || !plugin->author) { + // skipping plugin with incomplete header + return VMDPLUGIN_ERROR; + } + else if (plugin->abiversion != vmdplugin_ABIVERSION) { + // skipping plugin with incompatible ABI + return VMDPLUGIN_ERROR; + } + else if (0 != strncmp(plugin->type, "mol file", 8)) { + // skipping plugin of incompatible type + return VMDPLUGIN_ERROR; + } + else if (numplugins >= MAXPLUGINS) { + // too many plugins: increase MAXPLUGINS + return VMDPLUGIN_ERROR; + } + + //if (plugin_find(&plugindict, plugin->name) != NULL) { + // multiple plugins for file type + // return VMDPLUGIN_ERROR; + //} else { + plugin_list[numplugins] = (molfile_plugin_t *) plugin; + //plugin_add(&plugindict, plugin->name, numplugins); + ++numplugins; + return VMDPLUGIN_SUCCESS; + //} +} + +molfile_plugin_t** molfile_plugin_list(int maxsize) +{ + if(maxsize < MAXPLUGINS){ + maxsize = MAXPLUGINS; + } + plugin_list = (molfile_plugin_t**) malloc(sizeof(molfile_plugin_t*)*maxsize); + return plugin_list; +} + +/* register all available plugins and clear handles. */ +int molfile_init(void) +{ +#if 0 + int molfile_internal_register(void *ptr, vmdplugin_t *plugin) + { + if (!plugin->type || !plugin->name || !plugin->author) { + // skipping plugin with incomplete header + return VMDPLUGIN_ERROR; + } + else if (plugin->abiversion != vmdplugin_ABIVERSION) { + // skipping plugin with incompatible ABI + return VMDPLUGIN_ERROR; + } + else if (0 != strncmp(plugin->type, "mol file", 8)) { + // skipping plugin of incompatible type + return VMDPLUGIN_ERROR; + } + else if (num_plugins >= MAX_PLUGINS) { + // too many plugins: increase MAXPLUGINS + return VMDPLUGIN_ERROR; + } + + if (plugin_find(&plugindict, plugin->name) != NULL) { + // multiple plugins for file type + return VMDPLUGIN_ERROR; + } else { + plugin_list[numplugins] = (molfile_plugin_t *) plugin; + ++numplugins; + return VMDPLUGIN_SUCCESS; + } + } +#endif + MOLFILE_INIT_ALL; + MOLFILE_REGISTER_ALL(NULL,molfile_register); + return numplugins; +} + +/* unregister all available plugins */ +int molfile_finish(void) +{ + MOLFILE_FINI_ALL; + return 0; +} + +/* * * * * * * * * * * * * * * * * * * * * * * + * Wrappers to directly access molfile plugin* + * functions and settings * + * * * * * * * * * * * * * * * * * * * * * * */ + +/* molfile_plugin_t access */ + +/* Functions in molfile_plugin_t */ + + diff --git a/pymolfile/molfile/pymolfile.h b/pymolfile/molfile/pymolfile.h new file mode 100644 index 0000000000000000000000000000000000000000..e71a911f5bfbd883fa9506462e9d3214526572c9 --- /dev/null +++ b/pymolfile/molfile/pymolfile.h @@ -0,0 +1,72 @@ +/* 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" +#include "vmdplugin.h" + +enum { pluginOK, pluginNOINIT, pluginCLOSE, pluginNOMEM, + pluginENDOFFILE, pluginFILENOTFOUND, pluginFORMATERROR }; + +#ifndef MAXPLUGINS +#define MAXPLUGINS 200 +#endif + +#if 0 +typedef struct DICTHOLDER { + const char *key; // Dictionary key + int id; // Id of the item + int read; // 1 if molfile plugin read the format + int write; // 1 if molfile plugin write in this format + struct DICTHOLDER *next; // Next item in the dictionary +} DICTHOLDER; + +struct DICTHOLDER * plugin_find(struct DICTHOLDER *dict, const char *pluginname); + +static int plugin_add(struct DICTHOLDER *dict, const char *key, int id); + +static int plugin_remove(struct DICTHOLDER *dict, const char *key); + +static int has_readsupport(const char *pluginname); + +static int has_writesupport(const char *pluginname); + +static molfile_plugin_t *get_plugin(const char *pluginname); + +static int molfile_register(void *ptr, vmdplugin_t *plugin); +#endif +molfile_plugin_t* get_plugin(molfile_plugin_t** plug_list, int plug_no); + +molfile_plugin_t** molfile_plugin_list(int maxsize); + +int molfile_init(void); + +int molfile_finish(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _MOLFILE_H_ */ + diff --git a/pymolfile/molfile/test.py b/pymolfile/molfile/test.py new file mode 100644 index 0000000000000000000000000000000000000000..52af65aa65d193c83db4989ec9c3b312189066f1 --- /dev/null +++ b/pymolfile/molfile/test.py @@ -0,0 +1,12 @@ +import numpy +import _libpymolfile + +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) + + diff --git a/pymolfile/vmd_molfile_plugins/LICENSE b/pymolfile/molfile/vmd_molfile_plugins/LICENSE similarity index 100% rename from pymolfile/vmd_molfile_plugins/LICENSE rename to pymolfile/molfile/vmd_molfile_plugins/LICENSE diff --git a/pymolfile/vmd_molfile_plugins/Make-arch b/pymolfile/molfile/vmd_molfile_plugins/Make-arch similarity index 100% rename from pymolfile/vmd_molfile_plugins/Make-arch rename to pymolfile/molfile/vmd_molfile_plugins/Make-arch diff --git a/pymolfile/vmd_molfile_plugins/Makefile b/pymolfile/molfile/vmd_molfile_plugins/Makefile similarity index 100% rename from pymolfile/vmd_molfile_plugins/Makefile rename to pymolfile/molfile/vmd_molfile_plugins/Makefile diff --git a/pymolfile/vmd_molfile_plugins/README b/pymolfile/molfile/vmd_molfile_plugins/README similarity index 100% rename from pymolfile/vmd_molfile_plugins/README rename to pymolfile/molfile/vmd_molfile_plugins/README diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/abinitplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/avsplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/babelplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/basissetplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/bgfplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/binposplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/biomoccaplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/brixplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/carplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/ccp4plugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/corplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cpmdplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/crdplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/cubeplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dcdplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dlpolyplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dsn6plugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dtrplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/dxplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/edmplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/fs4plugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gamessplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/graspplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/grdplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gridplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/gromacsplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/jsplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/lammpsplugin.so diff --git a/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.a b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.a new file mode 100644 index 0000000000000000000000000000000000000000..83aeb16c114a05532be1581f2c9953bf8d743c68 Binary files /dev/null and b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.a differ diff --git a/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.dylib b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.dylib new file mode 100755 index 0000000000000000000000000000000000000000..552430c781785a97e23bf1681dcb11e4a3e2bcde Binary files /dev/null and b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.dylib differ diff --git a/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.h b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.h new file mode 100644 index 0000000000000000000000000000000000000000..8c2fbe80bd14b3bc77ee489e1ca54a953e5e973d --- /dev/null +++ b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/libmolfile_plugin.h @@ -0,0 +1,409 @@ +#ifndef LIBMOLFILE_PLUGIN_H +#define LIBMOLFILE_PLUGIN_H +#include "vmdplugin.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern int molfile_abinitplugin_init(void); +extern int molfile_abinitplugin_register(void *, vmdplugin_register_cb); +extern int molfile_abinitplugin_fini(void); +extern int molfile_avsplugin_init(void); +extern int molfile_avsplugin_register(void *, vmdplugin_register_cb); +extern int molfile_avsplugin_fini(void); +extern int molfile_babelplugin_init(void); +extern int molfile_babelplugin_register(void *, vmdplugin_register_cb); +extern int molfile_babelplugin_fini(void); +extern int molfile_basissetplugin_init(void); +extern int molfile_basissetplugin_register(void *, vmdplugin_register_cb); +extern int molfile_basissetplugin_fini(void); +extern int molfile_bgfplugin_init(void); +extern int molfile_bgfplugin_register(void *, vmdplugin_register_cb); +extern int molfile_bgfplugin_fini(void); +extern int molfile_binposplugin_init(void); +extern int molfile_binposplugin_register(void *, vmdplugin_register_cb); +extern int molfile_binposplugin_fini(void); +extern int molfile_biomoccaplugin_init(void); +extern int molfile_biomoccaplugin_register(void *, vmdplugin_register_cb); +extern int molfile_biomoccaplugin_fini(void); +extern int molfile_brixplugin_init(void); +extern int molfile_brixplugin_register(void *, vmdplugin_register_cb); +extern int molfile_brixplugin_fini(void); +extern int molfile_carplugin_init(void); +extern int molfile_carplugin_register(void *, vmdplugin_register_cb); +extern int molfile_carplugin_fini(void); +extern int molfile_ccp4plugin_init(void); +extern int molfile_ccp4plugin_register(void *, vmdplugin_register_cb); +extern int molfile_ccp4plugin_fini(void); +extern int molfile_corplugin_init(void); +extern int molfile_corplugin_register(void *, vmdplugin_register_cb); +extern int molfile_corplugin_fini(void); +extern int molfile_cpmdplugin_init(void); +extern int molfile_cpmdplugin_register(void *, vmdplugin_register_cb); +extern int molfile_cpmdplugin_fini(void); +extern int molfile_crdplugin_init(void); +extern int molfile_crdplugin_register(void *, vmdplugin_register_cb); +extern int molfile_crdplugin_fini(void); +extern int molfile_cubeplugin_init(void); +extern int molfile_cubeplugin_register(void *, vmdplugin_register_cb); +extern int molfile_cubeplugin_fini(void); +extern int molfile_dcdplugin_init(void); +extern int molfile_dcdplugin_register(void *, vmdplugin_register_cb); +extern int molfile_dcdplugin_fini(void); +extern int molfile_dlpolyplugin_init(void); +extern int molfile_dlpolyplugin_register(void *, vmdplugin_register_cb); +extern int molfile_dlpolyplugin_fini(void); +extern int molfile_dsn6plugin_init(void); +extern int molfile_dsn6plugin_register(void *, vmdplugin_register_cb); +extern int molfile_dsn6plugin_fini(void); +extern int molfile_dxplugin_init(void); +extern int molfile_dxplugin_register(void *, vmdplugin_register_cb); +extern int molfile_dxplugin_fini(void); +extern int molfile_edmplugin_init(void); +extern int molfile_edmplugin_register(void *, vmdplugin_register_cb); +extern int molfile_edmplugin_fini(void); +extern int molfile_fs4plugin_init(void); +extern int molfile_fs4plugin_register(void *, vmdplugin_register_cb); +extern int molfile_fs4plugin_fini(void); +extern int molfile_gamessplugin_init(void); +extern int molfile_gamessplugin_register(void *, vmdplugin_register_cb); +extern int molfile_gamessplugin_fini(void); +extern int molfile_graspplugin_init(void); +extern int molfile_graspplugin_register(void *, vmdplugin_register_cb); +extern int molfile_graspplugin_fini(void); +extern int molfile_grdplugin_init(void); +extern int molfile_grdplugin_register(void *, vmdplugin_register_cb); +extern int molfile_grdplugin_fini(void); +extern int molfile_gridplugin_init(void); +extern int molfile_gridplugin_register(void *, vmdplugin_register_cb); +extern int molfile_gridplugin_fini(void); +extern int molfile_gromacsplugin_init(void); +extern int molfile_gromacsplugin_register(void *, vmdplugin_register_cb); +extern int molfile_gromacsplugin_fini(void); +extern int molfile_jsplugin_init(void); +extern int molfile_jsplugin_register(void *, vmdplugin_register_cb); +extern int molfile_jsplugin_fini(void); +extern int molfile_lammpsplugin_init(void); +extern int molfile_lammpsplugin_register(void *, vmdplugin_register_cb); +extern int molfile_lammpsplugin_fini(void); +extern int molfile_mapplugin_init(void); +extern int molfile_mapplugin_register(void *, vmdplugin_register_cb); +extern int molfile_mapplugin_fini(void); +extern int molfile_mdfplugin_init(void); +extern int molfile_mdfplugin_register(void *, vmdplugin_register_cb); +extern int molfile_mdfplugin_fini(void); +extern int molfile_mol2plugin_init(void); +extern int molfile_mol2plugin_register(void *, vmdplugin_register_cb); +extern int molfile_mol2plugin_fini(void); +extern int molfile_moldenplugin_init(void); +extern int molfile_moldenplugin_register(void *, vmdplugin_register_cb); +extern int molfile_moldenplugin_fini(void); +extern int molfile_molemeshplugin_init(void); +extern int molfile_molemeshplugin_register(void *, vmdplugin_register_cb); +extern int molfile_molemeshplugin_fini(void); +extern int molfile_msmsplugin_init(void); +extern int molfile_msmsplugin_register(void *, vmdplugin_register_cb); +extern int molfile_msmsplugin_fini(void); +extern int molfile_namdbinplugin_init(void); +extern int molfile_namdbinplugin_register(void *, vmdplugin_register_cb); +extern int molfile_namdbinplugin_fini(void); +extern int molfile_offplugin_init(void); +extern int molfile_offplugin_register(void *, vmdplugin_register_cb); +extern int molfile_offplugin_fini(void); +extern int molfile_parm7plugin_init(void); +extern int molfile_parm7plugin_register(void *, vmdplugin_register_cb); +extern int molfile_parm7plugin_fini(void); +extern int molfile_parmplugin_init(void); +extern int molfile_parmplugin_register(void *, vmdplugin_register_cb); +extern int molfile_parmplugin_fini(void); +extern int molfile_pbeqplugin_init(void); +extern int molfile_pbeqplugin_register(void *, vmdplugin_register_cb); +extern int molfile_pbeqplugin_fini(void); +extern int molfile_pdbplugin_init(void); +extern int molfile_pdbplugin_register(void *, vmdplugin_register_cb); +extern int molfile_pdbplugin_fini(void); +extern int molfile_pdbxplugin_init(void); +extern int molfile_pdbxplugin_register(void *, vmdplugin_register_cb); +extern int molfile_pdbxplugin_fini(void); +extern int molfile_phiplugin_init(void); +extern int molfile_phiplugin_register(void *, vmdplugin_register_cb); +extern int molfile_phiplugin_fini(void); +extern int molfile_pltplugin_init(void); +extern int molfile_pltplugin_register(void *, vmdplugin_register_cb); +extern int molfile_pltplugin_fini(void); +extern int molfile_plyplugin_init(void); +extern int molfile_plyplugin_register(void *, vmdplugin_register_cb); +extern int molfile_plyplugin_fini(void); +extern int molfile_pqrplugin_init(void); +extern int molfile_pqrplugin_register(void *, vmdplugin_register_cb); +extern int molfile_pqrplugin_fini(void); +extern int molfile_psfplugin_init(void); +extern int molfile_psfplugin_register(void *, vmdplugin_register_cb); +extern int molfile_psfplugin_fini(void); +extern int molfile_raster3dplugin_init(void); +extern int molfile_raster3dplugin_register(void *, vmdplugin_register_cb); +extern int molfile_raster3dplugin_fini(void); +extern int molfile_rst7plugin_init(void); +extern int molfile_rst7plugin_register(void *, vmdplugin_register_cb); +extern int molfile_rst7plugin_fini(void); +extern int molfile_situsplugin_init(void); +extern int molfile_situsplugin_register(void *, vmdplugin_register_cb); +extern int molfile_situsplugin_fini(void); +extern int molfile_spiderplugin_init(void); +extern int molfile_spiderplugin_register(void *, vmdplugin_register_cb); +extern int molfile_spiderplugin_fini(void); +extern int molfile_stlplugin_init(void); +extern int molfile_stlplugin_register(void *, vmdplugin_register_cb); +extern int molfile_stlplugin_fini(void); +extern int molfile_tinkerplugin_init(void); +extern int molfile_tinkerplugin_register(void *, vmdplugin_register_cb); +extern int molfile_tinkerplugin_fini(void); +extern int molfile_uhbdplugin_init(void); +extern int molfile_uhbdplugin_register(void *, vmdplugin_register_cb); +extern int molfile_uhbdplugin_fini(void); +extern int molfile_vaspchgcarplugin_init(void); +extern int molfile_vaspchgcarplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vaspchgcarplugin_fini(void); +extern int molfile_vaspoutcarplugin_init(void); +extern int molfile_vaspoutcarplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vaspoutcarplugin_fini(void); +extern int molfile_vaspparchgplugin_init(void); +extern int molfile_vaspparchgplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vaspparchgplugin_fini(void); +extern int molfile_vaspposcarplugin_init(void); +extern int molfile_vaspposcarplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vaspposcarplugin_fini(void); +extern int molfile_vasp5xdatcarplugin_init(void); +extern int molfile_vasp5xdatcarplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vasp5xdatcarplugin_fini(void); +extern int molfile_vaspxdatcarplugin_init(void); +extern int molfile_vaspxdatcarplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vaspxdatcarplugin_fini(void); +extern int molfile_vaspxmlplugin_init(void); +extern int molfile_vaspxmlplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vaspxmlplugin_fini(void); +extern int molfile_vtkplugin_init(void); +extern int molfile_vtkplugin_register(void *, vmdplugin_register_cb); +extern int molfile_vtkplugin_fini(void); +extern int molfile_xbgfplugin_init(void); +extern int molfile_xbgfplugin_register(void *, vmdplugin_register_cb); +extern int molfile_xbgfplugin_fini(void); +extern int molfile_xsfplugin_init(void); +extern int molfile_xsfplugin_register(void *, vmdplugin_register_cb); +extern int molfile_xsfplugin_fini(void); +extern int molfile_xyzplugin_init(void); +extern int molfile_xyzplugin_register(void *, vmdplugin_register_cb); +extern int molfile_xyzplugin_fini(void); +extern int molfile_dtrplugin_init(void); +extern int molfile_dtrplugin_register(void *, vmdplugin_register_cb); +extern int molfile_dtrplugin_fini(void); +extern int molfile_maeffplugin_init(void); +extern int molfile_maeffplugin_register(void *, vmdplugin_register_cb); +extern int molfile_maeffplugin_fini(void); + +#define MOLFILE_INIT_ALL \ + molfile_abinitplugin_init(); \ + molfile_avsplugin_init(); \ + molfile_babelplugin_init(); \ + molfile_basissetplugin_init(); \ + molfile_bgfplugin_init(); \ + molfile_binposplugin_init(); \ + molfile_biomoccaplugin_init(); \ + molfile_brixplugin_init(); \ + molfile_carplugin_init(); \ + molfile_ccp4plugin_init(); \ + molfile_corplugin_init(); \ + molfile_cpmdplugin_init(); \ + molfile_crdplugin_init(); \ + molfile_cubeplugin_init(); \ + molfile_dcdplugin_init(); \ + molfile_dlpolyplugin_init(); \ + molfile_dsn6plugin_init(); \ + molfile_dxplugin_init(); \ + molfile_edmplugin_init(); \ + molfile_fs4plugin_init(); \ + molfile_gamessplugin_init(); \ + molfile_graspplugin_init(); \ + molfile_grdplugin_init(); \ + molfile_gridplugin_init(); \ + molfile_gromacsplugin_init(); \ + molfile_jsplugin_init(); \ + molfile_lammpsplugin_init(); \ + molfile_mapplugin_init(); \ + molfile_mdfplugin_init(); \ + molfile_mol2plugin_init(); \ + molfile_moldenplugin_init(); \ + molfile_molemeshplugin_init(); \ + molfile_msmsplugin_init(); \ + molfile_namdbinplugin_init(); \ + molfile_offplugin_init(); \ + molfile_parm7plugin_init(); \ + molfile_parmplugin_init(); \ + molfile_pbeqplugin_init(); \ + molfile_pdbplugin_init(); \ + molfile_pdbxplugin_init(); \ + molfile_phiplugin_init(); \ + molfile_pltplugin_init(); \ + molfile_plyplugin_init(); \ + molfile_pqrplugin_init(); \ + molfile_psfplugin_init(); \ + molfile_raster3dplugin_init(); \ + molfile_rst7plugin_init(); \ + molfile_situsplugin_init(); \ + molfile_spiderplugin_init(); \ + molfile_stlplugin_init(); \ + molfile_tinkerplugin_init(); \ + molfile_uhbdplugin_init(); \ + molfile_vaspchgcarplugin_init(); \ + molfile_vaspoutcarplugin_init(); \ + molfile_vaspparchgplugin_init(); \ + molfile_vaspposcarplugin_init(); \ + molfile_vasp5xdatcarplugin_init(); \ + molfile_vaspxdatcarplugin_init(); \ + molfile_vaspxmlplugin_init(); \ + molfile_vtkplugin_init(); \ + molfile_xbgfplugin_init(); \ + molfile_xsfplugin_init(); \ + molfile_xyzplugin_init(); \ + molfile_dtrplugin_init(); \ + molfile_maeffplugin_init(); \ + +#define MOLFILE_REGISTER_ALL(v, cb) \ + molfile_abinitplugin_register(v, cb); \ + molfile_avsplugin_register(v, cb); \ + molfile_babelplugin_register(v, cb); \ + molfile_basissetplugin_register(v, cb); \ + molfile_bgfplugin_register(v, cb); \ + molfile_binposplugin_register(v, cb); \ + molfile_biomoccaplugin_register(v, cb); \ + molfile_brixplugin_register(v, cb); \ + molfile_carplugin_register(v, cb); \ + molfile_ccp4plugin_register(v, cb); \ + molfile_corplugin_register(v, cb); \ + molfile_cpmdplugin_register(v, cb); \ + molfile_crdplugin_register(v, cb); \ + molfile_cubeplugin_register(v, cb); \ + molfile_dcdplugin_register(v, cb); \ + molfile_dlpolyplugin_register(v, cb); \ + molfile_dsn6plugin_register(v, cb); \ + molfile_dxplugin_register(v, cb); \ + molfile_edmplugin_register(v, cb); \ + molfile_fs4plugin_register(v, cb); \ + molfile_gamessplugin_register(v, cb); \ + molfile_graspplugin_register(v, cb); \ + molfile_grdplugin_register(v, cb); \ + molfile_gridplugin_register(v, cb); \ + molfile_gromacsplugin_register(v, cb); \ + molfile_jsplugin_register(v, cb); \ + molfile_lammpsplugin_register(v, cb); \ + molfile_mapplugin_register(v, cb); \ + molfile_mdfplugin_register(v, cb); \ + molfile_mol2plugin_register(v, cb); \ + molfile_moldenplugin_register(v, cb); \ + molfile_molemeshplugin_register(v, cb); \ + molfile_msmsplugin_register(v, cb); \ + molfile_namdbinplugin_register(v, cb); \ + molfile_offplugin_register(v, cb); \ + molfile_parm7plugin_register(v, cb); \ + molfile_parmplugin_register(v, cb); \ + molfile_pbeqplugin_register(v, cb); \ + molfile_pdbplugin_register(v, cb); \ + molfile_pdbxplugin_register(v, cb); \ + molfile_phiplugin_register(v, cb); \ + molfile_pltplugin_register(v, cb); \ + molfile_plyplugin_register(v, cb); \ + molfile_pqrplugin_register(v, cb); \ + molfile_psfplugin_register(v, cb); \ + molfile_raster3dplugin_register(v, cb); \ + molfile_rst7plugin_register(v, cb); \ + molfile_situsplugin_register(v, cb); \ + molfile_spiderplugin_register(v, cb); \ + molfile_stlplugin_register(v, cb); \ + molfile_tinkerplugin_register(v, cb); \ + molfile_uhbdplugin_register(v, cb); \ + molfile_vaspchgcarplugin_register(v, cb); \ + molfile_vaspoutcarplugin_register(v, cb); \ + molfile_vaspparchgplugin_register(v, cb); \ + molfile_vaspposcarplugin_register(v, cb); \ + molfile_vasp5xdatcarplugin_register(v, cb); \ + molfile_vaspxdatcarplugin_register(v, cb); \ + molfile_vaspxmlplugin_register(v, cb); \ + molfile_vtkplugin_register(v, cb); \ + molfile_xbgfplugin_register(v, cb); \ + molfile_xsfplugin_register(v, cb); \ + molfile_xyzplugin_register(v, cb); \ + molfile_dtrplugin_register(v, cb); \ + molfile_maeffplugin_register(v, cb); \ + +#define MOLFILE_FINI_ALL \ + molfile_abinitplugin_fini(); \ + molfile_avsplugin_fini(); \ + molfile_babelplugin_fini(); \ + molfile_basissetplugin_fini(); \ + molfile_bgfplugin_fini(); \ + molfile_binposplugin_fini(); \ + molfile_biomoccaplugin_fini(); \ + molfile_brixplugin_fini(); \ + molfile_carplugin_fini(); \ + molfile_ccp4plugin_fini(); \ + molfile_corplugin_fini(); \ + molfile_cpmdplugin_fini(); \ + molfile_crdplugin_fini(); \ + molfile_cubeplugin_fini(); \ + molfile_dcdplugin_fini(); \ + molfile_dlpolyplugin_fini(); \ + molfile_dsn6plugin_fini(); \ + molfile_dxplugin_fini(); \ + molfile_edmplugin_fini(); \ + molfile_fs4plugin_fini(); \ + molfile_gamessplugin_fini(); \ + molfile_graspplugin_fini(); \ + molfile_grdplugin_fini(); \ + molfile_gridplugin_fini(); \ + molfile_gromacsplugin_fini(); \ + molfile_jsplugin_fini(); \ + molfile_lammpsplugin_fini(); \ + molfile_mapplugin_fini(); \ + molfile_mdfplugin_fini(); \ + molfile_mol2plugin_fini(); \ + molfile_moldenplugin_fini(); \ + molfile_molemeshplugin_fini(); \ + molfile_msmsplugin_fini(); \ + molfile_namdbinplugin_fini(); \ + molfile_offplugin_fini(); \ + molfile_parm7plugin_fini(); \ + molfile_parmplugin_fini(); \ + molfile_pbeqplugin_fini(); \ + molfile_pdbplugin_fini(); \ + molfile_pdbxplugin_fini(); \ + molfile_phiplugin_fini(); \ + molfile_pltplugin_fini(); \ + molfile_plyplugin_fini(); \ + molfile_pqrplugin_fini(); \ + molfile_psfplugin_fini(); \ + molfile_raster3dplugin_fini(); \ + molfile_rst7plugin_fini(); \ + molfile_situsplugin_fini(); \ + molfile_spiderplugin_fini(); \ + molfile_stlplugin_fini(); \ + molfile_tinkerplugin_fini(); \ + molfile_uhbdplugin_fini(); \ + molfile_vaspchgcarplugin_fini(); \ + molfile_vaspoutcarplugin_fini(); \ + molfile_vaspparchgplugin_fini(); \ + molfile_vaspposcarplugin_fini(); \ + molfile_vasp5xdatcarplugin_fini(); \ + molfile_vaspxdatcarplugin_fini(); \ + molfile_vaspxmlplugin_fini(); \ + molfile_vtkplugin_fini(); \ + molfile_xbgfplugin_fini(); \ + molfile_xsfplugin_fini(); \ + molfile_xyzplugin_fini(); \ + molfile_dtrplugin_fini(); \ + molfile_maeffplugin_fini(); \ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/maeffplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mapplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mdfplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/mol2plugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/moldenplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/molemeshplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/msmsplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/namdbinplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/offplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parm7plugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/parmplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pbeqplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pdbxplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/phiplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pltplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/plyplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/pqrplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/psfplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/raster3dplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/rst7plugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/situsplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/spiderplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/stlplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/tinkerplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/uhbdplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vasp5xdatcarplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspchgcarplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspoutcarplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspparchgplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspposcarplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxdatcarplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vaspxmlplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/vtkplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xbgfplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xsfplugin.so diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin-s.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin-s.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin-s.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin-s.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.o b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.o similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.o rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.o diff --git a/pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.so b/pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.so similarity index 100% rename from pymolfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.so rename to pymolfile/molfile/vmd_molfile_plugins/compile/lib_MACOSXX86_64/molfile/xyzplugin.so diff --git a/pymolfile/vmd_molfile_plugins/create_static_header.sh b/pymolfile/molfile/vmd_molfile_plugins/create_static_header.sh similarity index 100% rename from pymolfile/vmd_molfile_plugins/create_static_header.sh rename to pymolfile/molfile/vmd_molfile_plugins/create_static_header.sh diff --git a/pymolfile/vmd_molfile_plugins/include/CVS/Entries b/pymolfile/molfile/vmd_molfile_plugins/include/CVS/Entries similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/CVS/Entries rename to pymolfile/molfile/vmd_molfile_plugins/include/CVS/Entries diff --git a/pymolfile/vmd_molfile_plugins/include/CVS/Repository b/pymolfile/molfile/vmd_molfile_plugins/include/CVS/Repository similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/CVS/Repository rename to pymolfile/molfile/vmd_molfile_plugins/include/CVS/Repository diff --git a/pymolfile/vmd_molfile_plugins/include/CVS/Root b/pymolfile/molfile/vmd_molfile_plugins/include/CVS/Root similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/CVS/Root rename to pymolfile/molfile/vmd_molfile_plugins/include/CVS/Root diff --git a/pymolfile/vmd_molfile_plugins/include/import_graphics_plugin.h b/pymolfile/molfile/vmd_molfile_plugins/include/import_graphics_plugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/import_graphics_plugin.h rename to pymolfile/molfile/vmd_molfile_plugins/include/import_graphics_plugin.h diff --git a/pymolfile/vmd_molfile_plugins/include/molfile_plugin.h b/pymolfile/molfile/vmd_molfile_plugins/include/molfile_plugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/molfile_plugin.h rename to pymolfile/molfile/vmd_molfile_plugins/include/molfile_plugin.h diff --git a/pymolfile/vmd_molfile_plugins/include/vmdconio.h b/pymolfile/molfile/vmd_molfile_plugins/include/vmdconio.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/vmdconio.h rename to pymolfile/molfile/vmd_molfile_plugins/include/vmdconio.h diff --git a/pymolfile/vmd_molfile_plugins/include/vmdplugin.h b/pymolfile/molfile/vmd_molfile_plugins/include/vmdplugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/include/vmdplugin.h rename to pymolfile/molfile/vmd_molfile_plugins/include/vmdplugin.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/CVS/Entries b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/CVS/Entries similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/CVS/Entries rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/CVS/Entries diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/CVS/Repository b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/CVS/Repository similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/CVS/Repository rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/CVS/Repository diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/CVS/Root b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/CVS/Root similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/CVS/Root rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/CVS/Root diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/LICENSE b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/LICENSE similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/LICENSE rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/LICENSE diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/Makefile b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/Makefile similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/Makefile rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/Makefile diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/Makefile.orig b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/Makefile.orig similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/Makefile.orig rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/Makefile.orig diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/Makefile.rej b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/Makefile.rej similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/Makefile.rej rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/Makefile.rej diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Entries b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Entries similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Entries rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Entries diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Repository b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Repository similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Repository rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Repository diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Root b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Root similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Root rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/CVS/Root diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/avsplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/avsplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/avsplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/avsplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/babelplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/babelplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/babelplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/babelplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/bgfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/bgfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/bgfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/bgfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/binposplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/binposplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/binposplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/binposplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/biomoccaplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/biomoccaplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/biomoccaplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/biomoccaplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/brixplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/brixplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/brixplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/brixplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/carplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/carplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/carplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/carplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/ccp4plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/ccp4plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/ccp4plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/ccp4plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/corplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/corplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/corplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/corplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/cpmdplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/cpmdplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/cpmdplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/cpmdplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/crdplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/crdplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/crdplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/crdplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/cubeplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/cubeplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/cubeplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/cubeplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dcdplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dcdplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dcdplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dcdplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dlpolyplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dlpolyplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dlpolyplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dlpolyplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dsn6plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dsn6plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dsn6plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dsn6plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dxplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dxplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/dxplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/dxplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/edmplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/edmplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/edmplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/edmplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/fs4plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/fs4plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/fs4plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/fs4plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/g96plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/g96plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/g96plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/g96plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/gamessplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/gamessplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/gamessplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/gamessplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/graspplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/graspplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/graspplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/graspplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/grdplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/grdplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/grdplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/grdplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/gridplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/gridplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/gridplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/gridplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/groplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/groplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/groplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/groplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/index.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/index.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/index.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/index.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/lammpsplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/lammpsplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/lammpsplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/lammpsplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/mapplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/mapplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/mapplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/mapplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/mdfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/mdfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/mdfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/mdfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/mol2plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/mol2plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/mol2plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/mol2plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/moldenplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/moldenplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/moldenplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/moldenplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/msmsplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/msmsplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/msmsplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/msmsplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/namdbinplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/namdbinplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/namdbinplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/namdbinplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/netcdfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/netcdfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/netcdfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/netcdfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/parm7plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/parm7plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/parm7plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/parm7plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/parmplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/parmplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/parmplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/parmplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/pdbplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/pdbplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/pdbplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/pdbplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/phiplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/phiplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/phiplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/phiplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/pltplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/pltplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/pltplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/pltplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/pqrplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/pqrplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/pqrplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/pqrplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/psfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/psfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/psfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/psfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/raster3dplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/raster3dplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/raster3dplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/raster3dplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/rst7plugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/rst7plugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/rst7plugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/rst7plugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/situsplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/situsplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/situsplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/situsplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/spiderplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/spiderplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/spiderplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/spiderplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/stlplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/stlplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/stlplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/stlplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/template.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/template.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/template.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/template.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/tinkerplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/tinkerplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/tinkerplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/tinkerplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/tngplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/tngplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/tngplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/tngplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/trrplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/trrplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/trrplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/trrplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/uhbdplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/uhbdplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/uhbdplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/uhbdplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/vaspplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/vaspplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/vaspplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/vaspplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/vtfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/vtfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/vtfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/vtfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/webpdbplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/webpdbplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/webpdbplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/webpdbplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/xbgfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/xbgfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/xbgfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/xbgfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/xsfplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/xsfplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/xsfplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/xsfplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/doc/xyzplugin.html b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/xyzplugin.html similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/doc/xyzplugin.html rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/doc/xyzplugin.html diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Entries b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Entries similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Entries rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Entries diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Repository b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Repository similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Repository rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Repository diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Root b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Root similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Root rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/CVS/Root diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/Makefile b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/Makefile similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/f77/Makefile rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/Makefile diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/README b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/README similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/f77/README rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/README diff --git a/pymolfile/libpymolfile-old/f77_molfile.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/f77_molfile.c similarity index 100% rename from pymolfile/libpymolfile-old/f77_molfile.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/f77_molfile.c diff --git a/pymolfile/libpymolfile-old/tester.f b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/tester.f similarity index 100% rename from pymolfile/libpymolfile-old/tester.f rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/f77/tester.f diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Entries b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Entries similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Entries rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Entries diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Repository b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Repository similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Repository rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Repository diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Root b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Root similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Root rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/CVS/Root diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/babelplugin.dsp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/babelplugin.dsp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/babelplugin.dsp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/babelplugin.dsp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/dcdplugin.dsp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/dcdplugin.dsp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/dcdplugin.dsp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/dcdplugin.dsp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/gromacsplugin.dsp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/gromacsplugin.dsp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/gromacsplugin.dsp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/gromacsplugin.dsp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/pdbplugin.dsp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/pdbplugin.dsp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/pdbplugin.dsp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/pdbplugin.dsp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/psfplugin.dsp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/psfplugin.dsp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/psfplugin.dsp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/psfplugin.dsp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/template.dsp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/template.dsp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/template.dsp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/template.dsp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.idb b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.idb similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.idb rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.idb diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.pdb b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.pdb similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.pdb rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/msvc/vc60.pdb diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/.#dlpolyplugin.c.1.21 b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/.#dlpolyplugin.c.1.21 similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/.#dlpolyplugin.c.1.21 rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/.#dlpolyplugin.c.1.21 diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/.main.c.swp b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/.main.c.swp similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/.main.c.swp rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/.main.c.swp diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Entries b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Entries similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Entries rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Entries diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Repository b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Repository similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Repository rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Repository diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Root b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Root similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Root rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/Root diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/mmCIF.C,t b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/mmCIF.C,t similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/CVS/mmCIF.C,t rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/CVS/mmCIF.C,t diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/Gromacs.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/Gromacs.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/Gromacs.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/Gromacs.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM7.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM7.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM7.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ReadPARM7.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/abinitplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/abinitplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/abinitplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/abinitplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/avsplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/avsplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/avsplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/avsplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/babelplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/babelplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/babelplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/babelplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/basissetplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/basissetplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/basissetplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/basissetplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/bgfplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/bgfplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/bgfplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/bgfplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/binposplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/binposplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/binposplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/binposplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/biomoccaplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/biomoccaplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/biomoccaplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/biomoccaplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/brixplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/brixplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/brixplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/brixplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/carplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/carplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/carplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/carplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/ccp4plugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ccp4plugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/ccp4plugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ccp4plugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/corplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/corplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/corplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/corplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/cpmdlogplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/cpmdlogplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/cpmdlogplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/cpmdlogplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/cpmdplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/cpmdplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/cpmdplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/cpmdplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/crdplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/crdplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/crdplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/crdplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/cubeplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/cubeplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/cubeplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/cubeplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dcdplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dcdplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dcdplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dcdplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dlpolyplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dlpolyplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dlpolyplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dlpolyplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dmsplugin.cxx b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dmsplugin.cxx similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dmsplugin.cxx rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dmsplugin.cxx diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dsn6plugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dsn6plugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dsn6plugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dsn6plugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.cxx b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.cxx similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.cxx rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.cxx diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.hxx b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.hxx similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.hxx rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dtrplugin.hxx diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/dxplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dxplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/dxplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/dxplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/edmplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/edmplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/edmplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/edmplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/endianswap.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/endianswap.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/endianswap.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/endianswap.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/fastio.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/fastio.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/fastio.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/fastio.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/fortread.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/fortread.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/fortread.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/fortread.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/fs4plugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/fs4plugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/fs4plugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/fs4plugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/gamessplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gamessplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/gamessplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gamessplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gaussianplugin.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/graspplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/graspplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/graspplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/graspplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/grdplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/grdplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/grdplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/grdplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/gridplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gridplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/gridplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gridplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/gromacsplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gromacsplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/gromacsplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/gromacsplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/hash.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/hash.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/hash.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/hash.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/hash.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/hash.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/hash.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/hash.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/hoomdplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/hoomdplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/hoomdplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/hoomdplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/inthash.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/inthash.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/inthash.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/inthash.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/inthash.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/inthash.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/inthash.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/inthash.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/jsplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/jsplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/jsplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/jsplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/lammpsplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/lammpsplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/lammpsplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/lammpsplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/largefiles.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/largefiles.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/largefiles.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/largefiles.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/maeffplugin.cxx b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/maeffplugin.cxx similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/maeffplugin.cxx rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/maeffplugin.cxx diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/main.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/main.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/main.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/main.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/mapplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mapplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/mapplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mapplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/mdfplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mdfplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/mdfplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mdfplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/mmcif.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mmcif.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/mmcif.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mmcif.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/mol2plugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mol2plugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/mol2plugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/mol2plugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/moldenplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/moldenplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/moldenplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/moldenplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/molemeshplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/molemeshplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/molemeshplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/molemeshplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/msmsplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/msmsplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/msmsplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/msmsplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/namdbinplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/namdbinplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/namdbinplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/namdbinplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/netcdfplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/netcdfplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/netcdfplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/netcdfplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/offplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/offplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/offplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/offplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/parm7plugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/parm7plugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/parm7plugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/parm7plugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/parmplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/parmplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/parmplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/parmplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/pbeqplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pbeqplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/pbeqplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pbeqplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/pdbplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pdbplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/pdbplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pdbplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/pdbxplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pdbxplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/pdbxplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pdbxplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/periodic_table.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/periodic_table.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/periodic_table.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/periodic_table.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/phiplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/phiplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/phiplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/phiplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/pltplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pltplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/pltplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pltplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/plugintest.x b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/plugintest.x similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/plugintest.x rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/plugintest.x diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/ply.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ply.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/ply.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ply.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/ply.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ply.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/ply.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/ply.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/plyplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/plyplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/plyplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/plyplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/pqrplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pqrplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/pqrplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/pqrplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/psfplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/psfplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/psfplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/psfplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/qmplugin.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/qmplugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/qmplugin.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/qmplugin.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/raster3dplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/raster3dplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/raster3dplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/raster3dplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/readpdb.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/readpdb.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/readpdb.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/readpdb.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/rst7plugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/rst7plugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/rst7plugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/rst7plugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/situsplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/situsplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/situsplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/situsplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/spiderplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/spiderplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/spiderplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/spiderplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/stlplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/stlplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/stlplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/stlplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/tinkerplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/tinkerplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/tinkerplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/tinkerplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/tngplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/tngplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/tngplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/tngplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/uhbdplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/uhbdplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/uhbdplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/uhbdplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/unit_conversion.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/unit_conversion.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/unit_conversion.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/unit_conversion.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vasp5xdatcarplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vasp5xdatcarplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vasp5xdatcarplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vasp5xdatcarplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspchgcarplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspchgcarplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspchgcarplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspchgcarplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspoutcarplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspoutcarplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspoutcarplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspoutcarplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspparchgplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspparchgplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspparchgplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspparchgplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspplugin.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspplugin.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspplugin.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspplugin.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspposcarplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspposcarplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspposcarplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspposcarplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspxdatcarplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspxdatcarplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspxdatcarplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspxdatcarplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspxmlplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspxmlplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vaspxmlplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vaspxmlplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vmddir.h b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vmddir.h similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vmddir.h rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vmddir.h diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vtfplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vtfplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vtfplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vtfplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/vtkplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vtkplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/vtkplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/vtkplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/webpdbplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/webpdbplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/webpdbplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/webpdbplugin.c diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/xbgfplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/xbgfplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/xbgfplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/xbgfplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/xsfplugin.C b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/xsfplugin.C similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/xsfplugin.C rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/xsfplugin.C diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/src/xyzplugin.c b/pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/xyzplugin.c similarity index 100% rename from pymolfile/vmd_molfile_plugins/molfile_plugin/src/xyzplugin.c rename to pymolfile/molfile/vmd_molfile_plugins/molfile_plugin/src/xyzplugin.c diff --git a/pymolfile/python/Makefile.am b/pymolfile/python/Makefile.am deleted file mode 100644 index e96a0767ea13418531a936613ba50816b0f9f86d..0000000000000000000000000000000000000000 --- a/pymolfile/python/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=*.py \ No newline at end of file diff --git a/pymolfile/python/Makefile.in b/pymolfile/python/Makefile.in deleted file mode 100644 index 1856705397c949ce4289a492ffd2ea45516f16b8..0000000000000000000000000000000000000000 --- a/pymolfile/python/Makefile.in +++ /dev/null @@ -1,335 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/python -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASFLAGS = @ASFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -F77LINK = @F77LINK@ -FFLAGS = @FFLAGS@ -FLIBS = @FLIBS@ -GMXANA_LIBOBJS = @GMXANA_LIBOBJS@ -GMXLIB_LIBOBJS = @GMXLIB_LIBOBJS@ -GMX_FORTRAN_FALSE = @GMX_FORTRAN_FALSE@ -GMX_FORTRAN_TRUE = @GMX_FORTRAN_TRUE@ -GREP = @GREP@ -INCLUDES = @INCLUDES@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSUFFIX = @LIBSUFFIX@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MDLIB_LIBOBJS = @MDLIB_LIBOBJS@ -MPICC = @MPICC@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -RPM = @RPM@ -SET_MAKE = @SET_MAKE@ -SHARED_VERSION_INFO = @SHARED_VERSION_INFO@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -EXTRA_DIST = *.py -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/python/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/python/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/pymolfile/python/sample.py b/pymolfile/python/sample.py deleted file mode 100755 index 56b5d4fbf241d354de3193e9e3f17e824c0e8d5a..0000000000000000000000000000000000000000 --- a/pymolfile/python/sample.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/python -# -*- mode: python; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- -# -# $Id$ -# -# Copyright (c) Erik Lindahl, David van der Spoel 2003-2007. -# Coordinate compression (c) by Frans van Hoesel. -# Python wrapper (c) by Roland Schulz -# -# IN contrast to the rest of Gromacs, XDRFILE is distributed under the -# BSD license, so you can use it any way you wish, including closed source: -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# -from xdrfile import * -import sys - -#you have to compile with --enable-shared -#and have libxdrfile.so in the LD_LIBRARY_PATH - -if len(sys.argv)!=2: - print "Missing file argument\nUsage: sample.py FILE" - sys.exit() - - -x=xdrfile(sys.argv[1]) -for f in x: #iterates frames - print "%8s %8s %8s %8s Step: %8d "%("Atom","X","Y","Z",f.step) #print header - for i,a in enumerate(f.x): #iterate atoms - print "%8d %8.1f %8.1f %8.1f"%(i+1,a[0],a[1],a[2]) #print atom number, x, y, z diff --git a/pymolfile/python/xdrfile.py b/pymolfile/python/xdrfile.py deleted file mode 100644 index ba4d75e1ae3ae527a860635acd06535fe08d54f4..0000000000000000000000000000000000000000 --- a/pymolfile/python/xdrfile.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- mode: python; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- -# -# $Id$ -# -# Copyright (c) Erik Lindahl, David van der Spoel 2003-2007. -# Coordinate compression (c) by Frans van Hoesel. -# Python wrapper (c) by Roland Schulz -# -# IN contrast to the rest of Gromacs, XDRFILE is distributed under the -# BSD license, so you can use it any way you wish, including closed source: -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# - -from ctypes import * -import os.path - -mTrr,mNumPy=1,2 -try: - from numpy import * - from numpy.ctypeslib import ndpointer - auto_mode=mNumPy -except: - auto_mode=0 - - -class frame: - #variables - #x: rvec*natoms / numpy array if installed - #box DIM*DIM - #step - #time - #prec - #lam: lambda - - def __init__(self,n,mode): - #create vector for x - if mode&mNumPy: - self.x=empty((n,3),dtype=float32) - self.box = empty((3,3),float32) - else: - self.x=((c_float*3)*n)() - self.box = (c_float*3*3)() - - -class xdrfile: - exdrOK, exdrHEADER, exdrSTRING, exdrDOUBLE, exdrINT, exdrFLOAT, exdrUINT, exdr3DX, exdrCLOSE, exdrMAGIC, exdrNOMEM, exdrENDOFFILE, exdrNR = range(13) - - # - def __init__(self,fn,mode="Auto",ft="Auto"): - if mode=="NumPy": - self.mode=mNumPy - try: - empty - except NameError: - raise IOError("NumPy selected but not correctly installed") - elif mode=="Std": - self.mode=0 - elif mode=="Auto": - self.mode=auto_mode - else: - raise IOError("unsupported mode") - - if ft=="Auto": - ft = os.path.splitext(fn)[1][1:] - - if ft=="trr": - self.mode|=mTrr - elif ft=="xtc": - pass - else: - raise IOError("Only xtc and trr supported") - - #load libxdrfil - try: - self.xdr=cdll.LoadLibrary("libxdrfile.so") - except: - raise IOError("libxdrfile.so can't be loaded") - - #open file - self.xd = self.xdr.xdrfile_open(fn,"r") - if not self.xd: raise IOError("Cannot open file: '%s'"%fn) - - #read natoms - natoms=c_int() - if self.mode&mTrr: - r=self.xdr.read_trr_natoms(fn,byref(natoms)) - else: - r=self.xdr.read_xtc_natoms(fn,byref(natoms)) - if r!=self.exdrOK: raise IOError("Error reading: '%s'"%fn) - self.natoms=natoms.value - - #for NumPy define argtypes - ndpointer is not automatically converted to POINTER(c_float) - #alternative of ctypes.data_as(POINTER(c_float)) requires two version for numpy and c_float array - if self.mode&mNumPy: - self.xdr.read_xtc.argtypes=[c_int,c_int,POINTER(c_int),POINTER(c_float), - ndpointer(ndim=2,dtype=float32),ndpointer(ndim=2,dtype=float32),POINTER(c_float)] - self.xdr.read_trr.argtypes=[c_int,c_int,POINTER(c_int),POINTER(c_float),POINTER(c_float), - ndpointer(ndim=2,dtype=float32),ndpointer(ndim=2,dtype=float32), - POINTER(c_float),POINTER(c_float)] - - - def __iter__(self): - f = frame(self.natoms,self.mode) - #temporary c_type variables (frame variables are python type) - step = c_int() - time = c_float() - prec = c_float() - lam = c_float() - while 1: - #read next frame - if not self.mode&mTrr: - result = self.xdr.read_xtc(self.xd,self.natoms,byref(step),byref(time),f.box, - f.x,byref(prec)) - f.prec=prec.value - else: - result = self.xdr.read_trr(self.xd,self.natoms,byref(step),byref(time),byref(lam), - f.box,f.x,None,None) #TODO: make v,f possible - f.lam=lam.value - - #check return value - if result==self.exdrENDOFFILE: break - if result==self.exdrINT and self.mode&mTrr: - break #TODO: dirty hack. read_trr return exdrINT not exdrENDOFFILE - if result!=self.exdrOK: raise IOError("Error reading xdr file") - - #convert c_type to python - f.step=step.value - f.time=time.value - yield f - diff --git a/pymolfile/python/xdrfile_test.py b/pymolfile/python/xdrfile_test.py deleted file mode 100755 index d4c6025b23a637d5afa2fa084d40a436bd9692c3..0000000000000000000000000000000000000000 --- a/pymolfile/python/xdrfile_test.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python -# -*- mode: python; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- -# -# $Id$ -# -# Copyright (c) Erik Lindahl, David van der Spoel 2003-2007. -# Coordinate compression (c) by Frans van Hoesel. -# Python wrapper (c) by Roland Schulz -# -# IN contrast to the rest of Gromacs, XDRFILE is distributed under the -# BSD license, so you can use it any way you wish, including closed source: -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# -from xdrfile import * -from math import * - -#you have to compile with --enable-shared -#and have libxdrfile.so in the LD_LIBRARY_PATH -#it expect the test.xtc/test.trr file generated by xdrfile_c_test - -DIM=3 -natoms1 = 173 -step1 = 1993 -prec1 = 1000 -time1 = 1097.23 -lam1 = 0.4 -box1=[[(i+1)*3.7 + (j+1) for j in range(DIM)] for i in range(DIM)] -toler = 1e-3 - -def test(fn): - x=xdrfile(fn) - if x.natoms != natoms1: print "natoms != natoms1",x.natoms,natoms1 - for k,f in enumerate(x): - if f.step != step1+k: print "incorrect step",f.step,step1+k,k - if fabs(f.time-time1-k) > toler: print "incorrect time",f.time,time1+k - if not x.mode&mTrr and fabs(f.prec-prec1) > toler: print "incorrect precision",f.prec,prec1 - if x.mode&mTrr and fabs(f.lam-lam1) > toler: print "incorrect lambda",f.lam,lam1 - for i in range(DIM): - for j in range(DIM): - if fabs(f.box[i][j] - box1[i][j]) > toler: print "box incorrect",f.box[i][j],box1[i][j] - for i in range(x.natoms): - for j in range(DIM): - target = (i+1)*3.7 + (j+1) - if f.x[i][j] - target > toler : print "x incorrect" - print fn,"OK" - -test("../test.trr") -test("../test.xtc") diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/f77_molfile.c b/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/f77_molfile.c deleted file mode 100644 index 1bb6aee33f8e61628d32f88fa160be5f8813234f..0000000000000000000000000000000000000000 --- a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/f77_molfile.c +++ /dev/null @@ -1,363 +0,0 @@ - -/* - * molfile fortran interface - * $Id: f77_molfile.c,v 1.1 2006/03/10 22:48:49 johns Exp $ - * (c) 2006 Axel Kohlmeyer <akohlmey@cmm.chem.upenn.edu> - */ - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -#include "molfile_plugin.h" -#include "libmolfile_plugin.h" -#include "vmdplugin.h" - -#define F77TESTME 1 - -/* fortran name mangling */ -#if defined(_F77_NO_UNDERSCORE) -#define FNAME(n) n -#elif defined(_F77_F2C_UNDERSCORE) -#define FNAME(n) n ## __ -#else -#define FNAME(n) n ## _ -#endif - -/* interface typedef magic */ -typedef int int4; - -struct molfile_f77_handle -{ - void *handle; - const char *fname; - const char *ftype; - molfile_plugin_t *plugin; -}; -typedef struct molfile_f77_handle f77_fd; - -/* plugin list */ -#ifndef MAXPLUGINS -#define MAXPLUGINS 200 -#endif -static int numplugins=0; -static molfile_plugin_t *plugin_list[MAXPLUGINS]; - -/* we maintain a static list of assigned handles */ -#ifndef MAXHADNLES -#define MAXHANDLES 200 -#endif -static int4 numhandles=0; -static f77_fd handle_list[MAXHANDLES]; - -/* helper functions */ -/* helper function to copy fortran style (a la sun fortran) strings into - * valid c style strings. just using the string pointers will not work, - * since the strings are NOT zero terminated. - * - * WARNING: do not forget to free(2) them later, - * or you'll have a memory leak! - */ -static char *f77strdup(const char *s,const int sz) -{ - char *r; - - r = (char *)malloc(sz + 1); - r = (char *)memcpy(r, s, sz); - r[sz] = '\0'; - return r; -} - -/* trim off whitespace at the end of a string */ -static void f77trim(char *s,const int sz) -{ - int i; - - i=1; - while( (i++ < sz) && isspace(s[sz-i]) ) { - s[sz-i] ='\0'; - } -} - -/* get the filename extension */ -static const char *f77getfnext(const char *s) -{ - int i,len; - - len = strlen(s); - for (i=len; i>=0; --i) { - if(s[i] == '.') { - return &s[i+1]; - } - } - return NULL; -} - -/* check validity of plugins and register them. */ -static int f77register(void *ptr, vmdplugin_t *plugin) { - - if (!plugin->type || !plugin->name || !plugin->author) { - fprintf(stderr," skipping plugin with incomplete header\n"); - return -1; - } - -#if F77TESTME - fprintf(stderr, " trying to register plugin #%d: %s, type: %s/%d\n" - " written by: %s\n\n", numplugins+1, plugin->name, - plugin->type, plugin->abiversion, plugin->author); -#endif - - if (plugin->abiversion != vmdplugin_ABIVERSION) { - fprintf(stderr, " skipping plugin with incompatible ABI:%d/%d\n", - plugin->abiversion, vmdplugin_ABIVERSION); - return -2; - } - - if (0 != strncmp(plugin->type, "mol file", 8)) { - fprintf(stderr, " skipping plugin of incompatible type:%s\n", - plugin->type); - return -3; - } - - if (numplugins < MAXPLUGINS) { - plugin_list[numplugins] = (molfile_plugin_t *) plugin; - ++numplugins; - return 0; - } - - fprintf(stderr, " too many plugins: %d. increase MAXPLUGINS, " - "recompile, and try again.\n", numplugins); - - return -4; -} - - -/* the official fortran API */ - -/* register all available plugins and clear handles. */ -void FNAME(f77_molfile_init)(void) -{ - int i; - - MOLFILE_INIT_ALL; - - for (i=0; i<MAXHANDLES; ++i) { - handle_list[i].handle = NULL; - } - - MOLFILE_REGISTER_ALL(NULL,f77register); - - /* - * FIXME: check all plugins and make - * sure the babel plugin(s) are last. - */ -} - -/* unregister all available plugins */ -void FNAME(f77_molfile_finish)(void) -{ -#if 0 - int i; - - /* FIXME: add code to close and nullify all open handles */ - for (i=0; i<MAXHANDLES; ++i) { - handle_list[i] = NULL; - } -#endif - - MOLFILE_FINI_ALL; -} - - -/* open a file and provide file descriptor */ -void FNAME(f77_molfile_open_read)(int4 *handle, int4 *natoms, - const char *infile, const char *intype, - const int len_if, const int len_it) -{ - char *fname, *ftype; - molfile_plugin_t *plugin; - int i; - - if (numhandles >= MAXHANDLES) { - fprintf(stderr, "too many molfile f77 handles.\n"); - *handle = -666; - return; - } - - fname = f77strdup(infile, len_if); - f77trim(fname,len_if); - - ftype = f77strdup(intype, len_it); - f77trim(ftype,len_it); - - fprintf(stderr, " %s: trying for: %s/%d, %s/%d\n", - __FUNCTION__, fname, len_if, ftype, len_it); - - plugin = NULL; - /* determine plugin type automatically */ - if(0 == strncmp(intype, "auto", 4)) { - const char *fext; - - fext = f77getfnext(fname); - if (fext == NULL) { - fprintf(stderr, " could not determine file name extension " - "for automatic plugin guess\n"); - *handle = -111; - return; - } -#if F77TESTME - fprintf(stderr, " filename extension: %s\n", fext); -#endif - - for (i=0; (i<numplugins) && plugin==NULL; ++i) { -#if F77TESTME - fprintf(stderr, " tying filename extension: %s\n", - plugin_list[i]->filename_extension); -#endif - if (0 == strcmp(plugin_list[i]->filename_extension, fext)) { - fprintf(stderr, " using plugin: %s\n", - plugin_list[i]->prettyname); - - plugin = plugin_list[i]; - } - } - if (plugin == NULL) { - fprintf(stderr, " could not determine matching plugin type" - "from file name extension\n"); - *handle = -222; - return; - } - } else { - - for (i=0; (i<numplugins) && (plugin==NULL); ++i) { -#if F77TESTME - fprintf(stderr, " tying plugin type: %s\n", - plugin_list[i]->name); -#endif - if (0 == strcmp(plugin_list[i]->name, ftype)) { - fprintf(stderr, " using plugin: %s\n", - plugin_list[i]->prettyname); - plugin = plugin_list[i]; - } - } - if (plugin == NULL) { - fprintf(stderr, " could not find plugin for type %s\n",ftype); - *handle = -333; - return; - } - } - - if(plugin == NULL) { /* this should not happen, but... */ - fprintf(stderr, " no plugin found.\n"); - *handle = -444; - return; - } - - /* build handle */ - ++numhandles; - for (i=0; i<numhandles; ++i) { - if(handle_list[i].plugin == NULL) { - *handle = i; - handle_list[i].fname=fname; - handle_list[i].ftype=plugin->name; - handle_list[i].plugin=plugin; - } - } - - /* open file for reading and detect number of atoms */ - *natoms=MOLFILE_NUMATOMS_UNKNOWN; - handle_list[*handle].handle= - plugin->open_file_read(fname,plugin->name,natoms); - if(handle_list[*handle].handle == NULL) { - fprintf(stderr, " open of %s-plugin for file %s failed\n", - plugin->type, fname); - --numhandles; - handle_list[*handle].plugin=NULL; - *handle=-777; - return; - } - - return; -} - -/* read next time step */ -void FNAME(f77_molfile_read_next)(int4 *handle, int4 *natoms, float *xyz, - float *box, int4 *status) -{ - molfile_plugin_t *plugin; - molfile_timestep_t step; - int retval; - - /* do some sanity checks on the handle */ - if((*handle < 0) || (*handle >= MAXHANDLES)) { - fprintf(stderr, " %s: illegal handle: %d\n", - __FUNCTION__, *handle); - *status = 0; - return; - } - - plugin = handle_list[*handle].plugin; - if(plugin==NULL) { - fprintf(stderr, " %s: inactive handle: %d\n", - __FUNCTION__, *handle); - *status = 0; - return; - } - - /* skip or read the timestep as demanded */ - if(status == 0) { - retval = plugin->read_next_timestep(handle_list[*handle].handle, - *natoms, NULL); - } else { - step.coords = xyz; - retval = plugin->read_next_timestep(handle_list[*handle].handle, - *natoms, &step); - } - - /* copy the box parameters */ - if (retval == MOLFILE_SUCCESS) { - *status = 1; - box[0]=step.A; - box[1]=step.B; - box[2]=step.C; - box[3]=step.alpha; - box[4]=step.beta; - box[5]=step.gamma; - } else { - *status = 0; - } -} - -/* close a read file descriptor */ -void FNAME(f77_molfile_close_read)(int4 *handle) -{ - molfile_plugin_t *plugin; - - /* do some sanity checks on the handle */ - if((*handle < 0) || (*handle >= MAXHANDLES)) { - fprintf(stderr, " %s: illegal handle: %d\n", - __FUNCTION__, *handle); - *handle = -111; - return; - } - - plugin = handle_list[*handle].plugin; - if(plugin==NULL) { - fprintf(stderr, " %s: inactive handle: %d\n", - __FUNCTION__, *handle); - *handle = -222; - return; - } - -#if F77TESTME - fprintf(stderr, " %s: trying to close handle %d" - " for file %s\n", __FUNCTION__, *handle, - handle_list[*handle].fname); -#endif - - plugin->close_file_read(handle_list[*handle].handle); - --numhandles; - handle_list[*handle].plugin=NULL; - *handle=-1; -} diff --git a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/tester.f b/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/tester.f deleted file mode 100644 index 40e250bb80cc1ad0d8446dd5d37f2726679b5636..0000000000000000000000000000000000000000 --- a/pymolfile/vmd_molfile_plugins/molfile_plugin/f77/tester.f +++ /dev/null @@ -1,110 +0,0 @@ -c testing frontend for the molfile plugin fortran interface -c $Id: tester.f,v 1.1 2006/03/10 22:48:49 johns Exp $ -c (c) 2006 Axel Kohlmeyer <akohlmey@cmm.chem.upenn.edu> - - program molfile - implicit none - - integer*4 natom, maxatom, handle(4), status - parameter (maxatom=3000*3) - real*4 xyz(maxatom), box(6) - - character infile*200, intype*10 - integer i,j - - print*,'molfile fortran tester v0.01' - -C set some default values - infile = 'TRAJEC.dcd' - intype = 'auto' - natom = -1 - handle(1) = -1 - handle(2) = -1 - handle(3) = -1 - handle(4) = -1 - - print*,'filename: ', infile - print*,'type: ', intype - -C set up everything and -C register all static plugins - call f77_molfile_init - - call f77_molfile_open_read(handle(1),natom,infile,intype) - - if (handle(1).lt.0) then - print*,'file type unknown or not registered' - else - print*,'file successfully opened:' - print*,'handle:',handle(1) - print*,'natom: ',natom - end if - - do i=1,2000 - status = 1 ! status=1 on entry means read - call f77_molfile_read_next(handle(1),natom,xyz(1),box,status); - print*,'read ',i,' status:',status - print*,'atom(1)', (xyz(j),j=1,3) - print*,'atom(10)',(xyz(j),j=31,33) - print*,'atom(100)',(xyz(j),j=301,303) - print*,'box',box - if(status.eq.0) go to 666 - status = 0 ! status=0 on entry means skip - call f77_molfile_read_next(handle(1),natom,xyz,box,status); - print*,'read ',i,' status:',status - if(status.eq.0) go to 666 - end do - 666 continue - - infile='li-nh3_4-end.pdb' - intype='pdb' - call f77_molfile_open_read(handle(2),natom,infile,intype) - - if (handle(2).lt.0) then - print*,'file type unknown or not registered' - else - print*,'file successfully opened:' - print*,'handle:',handle(2) - print*,'natom: ',natom - end if - - do i=1,2000 - status = 1 ! status=1 on entry means read - call f77_molfile_read_next(handle(2),natom,xyz(1),box,status); - print*,'read ',i,' status:',status - if(status.eq.0) go to 6666 - print*,'atom(1)', (xyz(j),j=1,3) - print*,'atom(10)', (xyz(j),j=31,33) - print*,'atom(100)',(xyz(j),j=301,303) - print*,'box',box - status = 0 ! status=0 on entry means skip - call f77_molfile_read_next(handle(2),natom,xyz,box,status); - print*,'read ',i,' status:',status - if(status.eq.0) go to 6666 - end do - 6666 continue - call f77_molfile_open_read(handle(3),natom,infile,intype) - print*,'handle:',handle(3) - - call f77_molfile_close_read(handle(1),status) - print*,'handle:',handle(1) - call f77_molfile_open_read(handle(1),natom,infile,intype) - print*,'handle:',handle(1) - call f77_molfile_open_read(handle(4),natom,infile,intype) - print*,'handle:',handle(4) - - - call f77_molfile_close_read(handle(2),status) - print*,'handle:',handle(2) - call f77_molfile_close_read(handle(1),status) - print*,'handle:',handle(1) - call f77_molfile_close_read(handle(3),status) - print*,'handle:',handle(3) - call f77_molfile_close_read(handle(2),status) - print*,'handle:',handle(2) - call f77_molfile_close_read(handle(4),status) - print*,'handle:',handle(4) - - call f77_molfile_finish - - end diff --git a/setup.py b/setup.py index 23214208729f17afc63b0fda0746ac1cfdd9e157..0647300cfde420b34e43d9d28dee29deb582f71a 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ CLASSIFIERS = [ "Development Status :: 1 - Alpha", "Intended Audience :: Science/Research", "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "License :: OSI Approved :: University of Illinois Open Source License (UIUC)", "Programming Language :: C", "Programming Language :: Python", "Programming Language :: Python :: 2", @@ -82,8 +82,8 @@ def get_numpy_include(): numpy_include = np.get_numpy_include() return numpy_include - -# Needed for large-file seeking under 32bit systems (for xtc/trr indexing and access). +# from SimpleTraj setup.py (https://github.com/arose/simpletraj) +# Needed for large-file seeking under 32bit systems (migth need for indexing and access). largefile_macros = [ ( "_LARGEFILE_SOURCE", None ), ( "_LARGEFILE64_SOURCE", None ), @@ -98,18 +98,25 @@ if __name__ == '__main__': description = "Python interface for VMD molfile plugins.", version = VERSION, classifiers = CLASSIFIERS, - license = "GPL2", - url = "https://github.com/berkonat/pymolfile", + license = "UIUC", + url = "https://gitlab.mpcdf.mpg.de/berko/pymolfile", zip_safe = False, packages = find_packages(), ext_modules = [ NumpyExtension( - "pymolfile/molfile._libmolfile", + "pymolfile/molfile._libpymolfile", sources = [ - "pymolfile/molfile/libmolfile_wrap.c", - "pymolfile/molfile/molfile.c", + "pymolfile/molfile/libpymolfile_wrap.c", + "pymolfile/molfile/pymolfile.c", + "pymolfile/molfile/lib/libmolfile_plugin.a", ], - include_dirs = [ get_numpy_include ], + include_dirs = [ + get_numpy_include, + "pymolfile/molfile/", + "pymolfile/molfile/vmd_molfile_plugins/include", + "pymolfile/molfile/vmd_molfile_plugins/molfile_plugins/src", + "pymolfile/molfile/lib", + ], define_macros = largefile_macros ), ],