Commit 829a6109 by tzh

init

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

*.pkl binary
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install system dependencies
run: >
sudo apt-get update;
sudo apt-get --no-install-recommends install
catch2
libfreetype6-dev
libglew-dev
libglm-dev
libmsgpack-dev
libnetcdf-dev
libpng-dev
libxml2-dev
python-is-python3
python3-biopython
python3-dev
python3-distutils
python3-numpy
python3-pil
python3-pytest
- name: Install collada2gltf
run: |
wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2
sudo tar xf collada2gltf-*.tar.bz2 -C / bin/collada2gltf
- name: Get additional sources
run: |
git clone --depth 1 https://github.com/schrodinger/pymol-testing.git
git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* include/
- name: Build
run: |
python setup.py --testing install --prefix=install-prefix
env:
DEBUG: 1
- name: Test
run: |
./install-prefix/bin/pymol -ckqy pymol-testing/testing.py --run all
*.pyc
*.d
generated
build
Warren L. DeLano, Ph.D. [1]
Jason Vertrees, Ph.D. [1,2]
Blaine Bell, Ph.D. [2]
Thomas Holder [2,3]
Piotr Rotkiewicz, Ph.D. [2]
Tor Colvin [2]
Gabriel Marques [2]
Jared Sampson [3] (COLLADA export)
Michael G. Lerner, Ph.D. [3] (APBS Tools plugin)
Jarrett Johnson, Ph.D. [2]
AFFILIATIONS
[1] DeLano Scientific LLC.
[2] Schrodinger, LLC.
[3] PyMOL Open-Source Fellow
See the README file for a historical list of contributors.
This source diff could not be displayed because it is too large. You can view the blob instead.
PyMOL Developer Notice
======================
Updated January 28th, 2006
There are three ways in which software developers can contribute to
the PyMOL Molecular Graphics Project.
(1) Work on the main source tree. As a practical matter, you must
transfer copyright of such improvements to Schrodinger, LLC and
attach no conditions to your work beyond those specified in the PyMOL
LICENSE file. Essentially you are giving everyone the right to use
your code for all purposes without restriction. To explicitly
transfer ownership to us or to place it in the public domain, include
the appropriate headers below at the top of each source code file.
/* On January 28th, 2006, I, John Doe, hereby transfer copyright and
* assign all rights, title, and interest in the following source code to
* Schrodinger, LLC. */
/* On January 28th, 2006, I, John Doe, hereby place the following
* source code into the public domain. */
(2) Develop self-contained functionality that can be integrated into
PyMOL as part of the "contrib" directory. With this approach, you
retain copyright to your code, but you must still place your source
under the "Python" license or an equivalent. Again, you are giving
everyone the right to use your code for all purposes without
restriction, no exceptions. Source code header:
/*
____module name_____ Copyright Notice
=====================================
The ____module name____ source code is copyrighted, but you can freely
use and copy it as long as you don't change or remove any of the
Copyright notices. ____module name____ is made available under the
following open-source license terms:
----------------------------------------------------------------------
______module name_____ is Copyright (C) 2006 ____your name____
All Rights Reserved
Permission to use, copy, modify, distribute, and distribute modified
versions of this software and its built-in documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appears in all copies and that both the copyright
notice and this permission notice appear in supporting documentation,
and that the names of ____your name and company (if any)____ not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
____your name and company (if any)____ DISCLAIM ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ____your name and
company (if any)____ BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
----------------------------------------------------------------------
*/
(3) Develop independent functionality which makes use of the PyMOL
Python API. With this approach, your project need not become part of
the PyMOL distribution, and you can attach whatever restrictions you
would like to usage and distribution of your code. However, if you
attach restrictions, then you must also assume responsibility for
distributing the software. If you want your code to become part of
the official PyMOL package, then you will need to release it under the
"PyMOL" license or an equivalent non-restrictive open source license
(not GPL).
Thanks for your participation in the PyMOL Open-Source Project!
----------------------------------------------------------------------
INSTALLATION VIA COMPILATION
----------------------------------------------------------------------
See also: http://pymolwiki.org/index.php/Linux_Install
REQUIREMENTS
- C++11 compiler (e.g. gcc 4.7+)
- Python 3.6+
- Pmw (Python Megawidgets) (optional, for legacy GUI/plugins)
https://github.com/schrodinger/pmw-patched
- OpenGL
- GLEW
- GLUT (freeglut) (optional, enable with --glut)
- libpng
- freetype
- libxml2 (optional, for COLLADA export, disable with --no-libxml)
- msgpack-c 2.1.5+ (optional, for fast MMTF loading and export,
disable with --use-msgpackc=no)
- mmtf-cpp (for fast MMTF export, disable with --use-msgpackc=no)
- PyQt5, PyQt4, PySide2 or PySide (optional, will fall back to Tk
interface if compiled with --glut)
- glm
- catch2 (optional, enable with --testing)
- openvr 1.0.x (optional, enable with --openvr)
- libnetcdf (optional, disable with --no-vmd-plugins)
SETUP OPTIONS
python setup.py --help
python setup.py --help-distutils
python setup.py --help-distutils install
Special install options:
--pymol-path= installation directory for PyMOL data ($PYMOL_PATH)
--no-launcher skip installation of the pymol launcher
Environment variables:
PREFIX_PATH Colon-delimited list of paths to search for headers and
libraries, e.g. $HOME/mmtf-cpp:$HOME/msgpack-c:/opt/local
CXX C++ compiler command
CC C compiler command
CXXFLAGS C++ compiler flags
CFLAGS C compiler and linker flags
CPPFLAGS C/C++ preprocessor flags, e.g. -I/tmp/msgpack-c/include
LDFLAGS linker flags
INSTALLATION
python setup.py install --prefix=~/someplace
RUNNING PyMOL
~/someplace/bin/pymol
Good luck!
Open-Source PyMOL Copyright Notice
==================================
The Open-Source PyMOL source code is copyrighted, but you can freely
use and copy it as long as you don't change or remove any of the
Copyright notices. The Open-Source PyMOL product is made available
under the following open-source license terms:
----------------------------------------------------------------------
Open-Source PyMOL is Copyright (C) Schrodinger, LLC.
All Rights Reserved
Permission to use, copy, modify, distribute, and distribute modified
versions of this software and its built-in documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appears in all copies and that both the copyright
notice and this permission notice appear in supporting documentation,
and that the name of Schrodinger, LLC not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission.
SCHRODINGER, LLC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL SCHRODINGER, LLC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
USE OR PERFORMANCE OF THIS SOFTWARE.
----------------------------------------------------------------------
PyMOL Trademark Notice
======================
PyMOL(TM) is a trademark of Schrodinger, LLC. Derivative
software which contains PyMOL source code must be plainly
distinguished from any and all PyMOL products distributed by Schrodinger,
LLC in all publicity, advertising, and documentation.
The slogans, "Includes PyMOL(TM).", "Based on PyMOL(TM) technology.",
"Contains PyMOL(TM) source code.", and "Built using PyMOL(TM).", may
be used in advertising, publicity, and documentation of derivative
software provided that the notice, "PyMOL is a trademark of Schrodinger,
LLC.", is included in a footnote or at the end of the
document.
All other endorsements employing the PyMOL trademark require specific,
written prior permission.
*********************
PyMOL Packaging Guide
*********************
===========================
PyMOL environment variables
===========================
Typical installations don't require any environment variables to run
PyMOL. PyMOL will automatically assign the following variables if they
are unset:
PYMOL_PATH = First of:
- <pymol python module> + "/pymol_path"
- parent of the "modules" directory if launch script matches
"modules/pymol/__init__.py"
- sys.prefix + "/share/pymol"
PYMOL_DATA = $PYMOL_PATH/data
PYMOL_SCRIPTS = $PYMOL_PATH/scripts
=======================================================
Suggested File Locations (for package managed installs)
=======================================================
== pymol package ==
modules/pymol -> /usr/lib/pythonX.X/site-packages/pymol
modules/chempy -> /usr/lib/pythonX.X/site-packages/chempy
modules/pmg_tk -> /usr/lib/pythonX.X/site-packages/pmg_tk
== pymol-data package ==
scripts -> /usr/share/pymol/scripts (RUNTIME REQUIREMENT)
data -> /usr/share/pymol/data (RUNTIME REQUIREMENT)
Installable with:
python setup.py install --pymol-path=/usr/share/pymol
----------------------------------------------------------------------
PyMOL is Copyright (c) Schrodinger, LLC
http://www.pymol.org
----------------------------------------------------------------------
PyMOL is an OPEN SOURCE program distributed under the "Python" license.
Please see the LICENSE file for additional information.
----------------------------------------------------------------------
See INSTALL for installation instructions
----------------------------------------------------------------------
The PyMOL Team:
NOTE: this list has not been updated since Fall 2003. Since then, the
PyMOL effort has grown to such an extent that it is no longer
practical to recognize everyone individually. Fortunately, a public
record of participation exists and can be appreciated on the internet,
and especially via the PyMOL mailing list archives. Suffice it to say
that the PyMOL user community now numbers well into the thousands and
includes scientists, students, and educators worldwide, spread
throughout academia and the biotechnology and pharmaceutical
industries. Though Schrodinger, LLC specifically supports and
maintains the PyMOL code base, the project can only continue to
succeed through the sponsorship and participation of the broader
community.
See the AUTHORS file for additional authors.
Founder and Principal Author:
Warren L. DeLano
Major Authors (5000+ lines of code):
Ralf W. Grosse-Kunstleve (SGLite Module -- inactivated as of 2008)
Minor Authors (500+ lines of code):
Scott Dixon (Metaphorics CEX support)
Filipe Maia (Slice Objects)
Other Contributors: These are the people who have gone out of
their way to help the project with their ideas, actions,
advice, hardware donations, testing, information, sponsorship,
peer support, or code snippets.
Daan van Aalten
Paul Adams
Stephen Adler
Jun Aishima
Dennis Allison
Ricardo Aparicio
Daniel Appelman
Diosdado "Rey" Banatao
Michael Banck
Ulrich Baumann
Joseph Becker
Balaji Bhyravbhatla
Jeff Bizzaro
Jeff Blaney
Juergen Bosch
Michael Bower
Sarina Bromberg
Axel Brunger
Robert Campbell
Bronwyn Carlisle
Duilio Cascio
Julien Chiron
Shawn Christensen
Scott Classen
David Cooper
Larry Coopet
Jacob Corn
Ben Cornett
Andrew Dalke
Koen van der Drift
Harry Dailey
Byron DeLaBarre
Bill DeGrado
Thomas Earnest
Nathaniel Echols
John Eksterowicz
Erik Evensen
David Fahrney
Tim Fenn
Thierry Fischmann
Michael Ford
Esben Peter Friis
Kevin Gardner
R. Michael Garavito
John Gerig
Jonathan Greene
Michael Goodman
Joel Harp
Reece Hart
Richard Hart
Peter Haebel
Matt Henderson
Douglas Henry
Possu Huang
Uwe Hoffmann
Jenny Hinshaw
Carly Huitema
Bjorn Kauppi
Greg Landrum
Robert Lawrence Kehrer
Tom Lee
Eugen Leitl
Ken Lind
Jules Jacobsen
Luca Jovine
Andrey Khavryuchenko
David Konerding
Greg Landrum
Michael Love
Tadashi Matsushita
Genevieve Matthews
Gerry McDermott
Robert McDowell
Gustavo Mercier
Naveen Michaud-Agrawal
Aaron Miller
Holly Miller
Tim Moore
Kelley Moremen
Hideaki Moriyama
Nigel Moriarty
Geoffrey Mueller
Cameron Mura
Florian Nachon
Hanspeter Niederstrasser
Michael Nilges
Hoa Nguyen
Shoichiro Ono
Chris Oubridge
Andre Padilla
Jay Pandit
Ezequiel "Zac" Panepucci
Robert Phillips
Hans Purkey
Rama Ranganathan
Michael Randal
Daniel Ricklin
Ian Robinson
Eric Ross
Kristian Rother
Marc Saric
Bill Scott
Keana Scott
Denis Shcherbakov
Goede Schueler
Paul Sherwood
Ward Smith
John Somoza
David van der Spoel
Paul Sprengeler
Matt Stephenson
Peter Stogios
John Stone
Charlie Strauss
Michael Summers
Brian Sutton
Hanna and Abraham Szoke
Rod Tweten
Andras Varadi
Scott Walsh
Pat Walters
Mark White
Michael Wilson
Dave Weininger
Chris Wiesmann
Charles Wolfus
Richard Xie
Miscellaneous Code Snippets Lifted From:
Thomas Malik (fast matrix-multiply code)
John E. Grayson (Author of "Python and Tkinter")
Doug Hellmann (Wrote code that JEG later modified.)
Open-Source "Enablers" (essential, but not directly involved):
Brian Paul (Mesa)
Mark Kilgard (GLUT)
Guido van Rossum (Python)
Linus Torvalds (Linux Kernel)
Precision Insight (DRI)
The XFree86 Project (Free Windowing System)
VA Linux (CVS Hosting)
Richard Stallman/Free Software Foundation (GNU Suite)
The unknown authors of EISPACK (Linear Algebra)
Graphics Technology "Enablers" (essential!)
3dfx (RIP)
nVidia
ATI
----------------------------------------------------------------------
Specific Acknowledgments (last updated around 2005):
* Thanks to Joni W. Lam for making the business work.
* Thanks to John Stone and John Furr for being such excellent
colleagues.
* Thanks to Ragu Bharadwaj and Marcin Joachimiak for Java expertise
and encouragement.
* Thanks to Apple Computer for continued encouragement, assistance,
and HLAs in support of Mac development. Thanks especially to
Robert Kehrer for creating so many fun opportunities over the years.
* Thanks to Aaron Miller (GlaxoSmithKline) for a continuous stream of
thoughtful opinions and suggestions.
* Thanks to Dave Weininger for suggesting the "roving" feature and for
being such an inspirational friend and mentor.
* Thanks to Matt Hahn and Dave Rogers for proving that it can also be
done, again.
* Thanks to Mick Savage for providing experienced practical advice on
the marketing of scientific software.
* Thanks to Ian Matthew for 3D experience and perspective.
* Thanks for Jeff Blaney for numerous insightful discussions.
* Thanks to Elizabeth Pehrson for making this a team effort.
* Thanks to Erin Bradley for schooling in focus and vision.
* Thanks to Vera Povolona for catalytic clarity and introspection.
* Thanks to Anthony Nichols for proving that it can be done, yet again.
* Thanks to Thompson Doman for timely Open-Source validation.
* Thanks to Manfred Sippl for making it all seem so simple.
* Thanks to Kristian Rother for all his excellent work building on the
PyMOL foundation, and in helping others learn to use the software.
* Thanks to Dave Weininger, Scott Dixon, Roger Sayle, Andrew Dalke,
Anthony Nichols, Dick Cramer, and David Miller, as well as rest of
the Daylight and OpenEye teams for thoughtful discussions on PyMOL
and open-source software during my 2002 pilgrimage to Sante Fe, NM.
* Thanks to Ralf Grosse-Kunstleve for his contribution of the "sglite"
space group and symmetry handling module.
* Thanks to the scientists and management of Sunesis Pharmaceuticals
for supporting PyMOL development since program inception.
* Thanks to the Computational Crystallography Initiative (LBNL)
developers for their encouragement, ideas, and support.
* Thanks to Scott Walsh for being the first individual to provide
financial support for PyMOL.
* Thanks to the hundreds of individuals, companies, and institutions
that have provided financial support for the project.
* Thanks to Brian Paul and the Precision Insight team for development
of Mesa/DRI which greatly assisted in the early development of PyMOL.
* Thanks to Michael Love for the first major outside port of PyMOL
(to GNU-Darwin/OSX) and for believing in the cause.
* Thanks for Paul Sherwood for making a concerted effort to develop
using PyMOL long before the software and vision had matured.
* Thanks to Jay Ponder for thoughtful email discussions on Tinker and
the role of open-source scientific software.
* Thanks to hundreds of PyMOL users for the many forms of feedback,
bug sightings, and encouragement they've provided.
[![CI](https://github.com/schrodinger/pymol-open-source/workflows/CI/badge.svg)](https://github.com/schrodinger/pymol-open-source/actions)
<img src="./data/pymol/icons/icon2.svg" height="100" align="right" />
# Open-Source PyMOL
[Open-source foundation](https://pymol.org/#opensource) of the user-sponsored PyMOL molecular visualization system.
The commercial PyMOL product ("Incentive PyMOL") with maintenance and support is available from https://pymol.org
## Installation
See [INSTALL](INSTALL).
## Contributing
See [DEVELOPERS](DEVELOPERS).
## License
Copyright (c) [Schrodinger, LLC](https://www.schrodinger.com/)
Published under a BSD-like license, see [LICENSE](LICENSE).
Contrib Directory Disclaimer Notice
===================================
All software in the PyMOL "contrib" directory is either under a
PyMOL-compatible BSD-like unrestricted open-source license or has been
released under terms which specifically permit inclusion with PyMOL.
Schrodinger, LLC believes that you have permission to use the
code contained herein with PyMOL without incurring any additional
costs or obligations, but we do not warrant or guarantee this
assertion.
----------------------------------------------------------------------
USE OF PYMOL CONTRIB SOFTWARE IS ENTIRELY AT YOUR OWN RISK.
SCHRODINGER, LLC DISCLAIM ALL WARRANTIES
WITH REGARD TO PYMOL CONTRIB SOFTWARE, INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS, OWNERSHIP, AND NONINFRINGEMENT
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
SCHRODINGER, LLC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF PYMOL CONTRIB SOFTWARE.
Individual contrib packages are protected under the copyrights of
their respective authors. Please see the source code and any LICENSE
or COPYING files for specific information regarding each contrib
package.
----------------------------------------------------------------------
Open-Source PyMOL Copyright Notice
==================================
The Open-Source PyMOL source code is copyrighted, but you can freely
use and copy it as long as you don't change or remove any of the
Copyright notices. The Open-Source PyMOL product is made available
under the following open-source license terms:
----------------------------------------------------------------------
Open-Source PyMOL is Copyright (C) Schrodinger, LLC.
All Rights Reserved
Permission to use, copy, modify, distribute, and distribute modified
versions of this software and its built-in documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appears in all copies and that both the copyright
notice and this permission notice appear in supporting documentation,
and that the name of Schrodinger, LLC not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission.
SCHRODINGER, LLC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL SCHRODINGER, LLC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
USE OR PERFORMANCE OF THIS SOFTWARE.
----------------------------------------------------------------------
PyMOL Trademark Notice
======================
PyMOL(TM) is a trademark of Schrodinger, LLC. Derivative
software which contains PyMOL source code must be plainly
distinguished from any and all PyMOL products distributed by Schrodinger,
LLC in all publicity, advertising, and documentation.
The slogans, "Includes PyMOL(TM).", "Based on PyMOL(TM) technology.",
"Contains PyMOL(TM) source code.", and "Built using PyMOL(TM).", may
be used in advertising, publicity, and documentation of derivative
software provided that the notice, "PyMOL is a trademark of Schrodinger,
LLC.", is included in a footnote or at the end of the
document.
All other endorsements employing the PyMOL trademark require specific,
written prior permission.
CHAMP: CHemical Atom Manipulation with Patterns
Copyright (C) 2002 Warren L. DeLano
This module is part of the PyMOL molecular graphics system, but the
code is built separately to enable usage of this module outside of the
PyMOL interpreter.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_Champ
#define _H_Champ
#include"list.h"
#include"os_python.h"
/* max bonds an atom can have */
#define MAX_BOND 12
#define MAX_RING 50
/* CUTOFF = 2*N/2*N+1 for the largest ring we spend time to detecting:
8 = 16-17 atom cycles
*/
#define RING_SEARCH_CUTOFF 8
/* atoms */
#define cH_Any 0xFFFFFFFF
#define cH_H 0x00000001
#define cH_C 0x00000002
#define cH_N 0x00000004
#define cH_O 0x00000008
#define cH_Sym 0x00000010
#define cH_S 0x00000020
#define cH_P 0x00000040
#define cH_F 0x00000080
#define cH_Cl 0x00000100
#define cH_Br 0x00000200
#define cH_I 0x00000400
#define cH_Na 0x00000800
#define cH_K 0x00001000
#define cH_Ca 0x00002000
#define cH_Mg 0x00004000
#define cH_Zn 0x00008000
#define cH_Fe 0x00010000
#define cH_Cu 0x00020000
#define cH_Se 0x00040000
#define cH_B 0x00080000
#define cH_A 0x00100000
#define cH_E 0x00200000
#define cH_G 0x00400000
#define cH_J 0x00800000
#define cH_L 0x01000000
#define cH_M 0x02000000
#define cH_Q 0x04000000
#define cH_R 0x08000000
#define cH_T 0x10000000
#define cH_X 0x20000000
#define cH_Z 0x40000000
#define cH_NotH 0xFFFFFFFE
/* charge */
#define cH_Neutral 0x00000001
#define cH_Cation 0x00000002
#define cH_Dication 0x00000004
#define cH_Anion 0x00000008
#define cH_Dianion 0x00000010
#define cH_Trication 0x00000020
#define cH_Trianion 0x00000040
#define cH_Tetcation 0x00000080
#define cH_Tetanion 0x00000100
#define cH_Pentcation 0x00000200
#define cH_Pentanion 0x00000400
/* cycles */
#define cH_Acyclic 0x00000001
#define cH_Ring3 0x00000002
#define cH_Ring4 0x00000004
#define cH_Ring5 0x00000008
#define cH_Ring6 0x00000010
#define cH_Ring7 0x00000020
#define cH_Ring8 0x00000040
#define cH_RingN 0x80000000 /* not yet implemented */
#define cH_Cyclic 0xFFFFFFFE
/* class */
#define cH_Aliphatic 0x00000001
#define cH_Aromatic 0x00000002
#define cH_Pi 0x00000004 /* non-exclusive with above */
#define cH_AnyClass 0x00000003
/* degree */
#define cH_0Bond 0x00000001
#define cH_1Bond 0x00000002
#define cH_2Bond 0x00000004
#define cH_3Bond 0x00000008
#define cH_4Bond 0x00000010
#define cH_5Bond 0x00000020
#define cH_6Bond 0x00000040
#define cH_7Bond 0x00000080
#define cH_8Bond 0x00000100
/* valence */
#define cH_0Valence 0x00000001
#define cH_1Valence 0x00000002
#define cH_2Valence 0x00000004
#define cH_3Valence 0x00000008
#define cH_4Valence 0x00000010
#define cH_5Valence 0x00000020
#define cH_6Valence 0x00000040
#define cH_7Valence 0x00000080
#define cH_8Valence 0x00000100
typedef char AtomBuffer[255]; /* maximum length for a single atom */
#define NAM_SIZE 5
#define RES_SIZE 5
#define SYM_SIZE 3
#define dTag_disable 0
#define cTag_merge 1
#define cTag_copy 2
typedef struct {
int link; /* memory management */
int index;
int bond[MAX_BOND+1];
int pos_flag;
unsigned int atom; // bitmask
int charge;
int cycle;
int class;
int degree;
int valence;
int imp_hydro;
int tot_hydro;
int hydro_flag; /* are we trying to match hydrogen counts? */
char symbol[SYM_SIZE];
char name[NAM_SIZE];
char residue[RES_SIZE];
float coord[3];
int neg_flag;
unsigned int not_atom; // bitmask
int not_charge;
int not_cycle;
int not_class;
int not_degree;
int not_valence;
int comp_imp_hydro_flag; /* do we need to compute implicit hydrogens? */
int stereo; /* based on lexical ordering: 0 = unspecified, 1 = anti-clockwise, -1 = clockwise */
int stereo_internal; /* based on internal atom IDs */
int mark_tmpl,mark_targ,mark_read; /* traversal */
int first_tmpl,first_targ; /* first template stack entry */
int first_base;
int ext_index; /* for maintaining atom references with PyMOL */
unsigned int tag,not_tag;
PyObject *chempy_atom;
} ListAtom;
/* order */
#define cH_Single 0x00000001
#define cH_Double 0x00000002
#define cH_Triple 0x00000004
#define cH_AnyOrder 0x00000007
#define cH_NoOrder 0x00000000
/* double-bond stereochem */
#define cH_Up 1
#define cH_Down -1
/* tetrahedral stereochem */
#define cH_Anticlock 1
#define cH_Clockwise -1
typedef struct {
int link; /* memory management */
int index;
int atom[2]; /* connected atoms -- directionality must reflect tree */
int pri[2]; /* forward and backward lexical priorities */
int order;
int class;
int cycle;
int not_order;
int not_class;
int not_cycle;
int direction; /* 0 = specified, 1 = up, -1 = down */
int mark_tmpl,mark_targ,mark_read; /* traversal */
unsigned int tag,not_tag;
int ext_index;
PyObject *chempy_bond;
} ListBond;
typedef struct {
int link;
int atom;
int bond; /* bond index index in atom */
int base_bond; /* absolute bond index */
int base_atom; /* absolute atom index */
int paren_flag;
} ListScope;
typedef struct {
int link;
int atom; /* root of atom list (Pat) */
int bond; /* root of bond list (Bond) */
PyObject *chempy_molecule;
int unique_atom; /* list of unique atoms (Int) */
int target_prep; /* has pattern been prepared as a target? */
} ListPat;
typedef struct {
int link;
int atom;
int bond;
} ListMatch;
typedef struct {
int link;
int atom; /* root of atom list (Pat) */
int bond; /* root of bond list (Bond) */
int parent;
int match;
int targ_start;
int bond_pri;
} ListTmpl;
typedef struct {
int link;
int atom; /* root of atom list (Pat) */
int bond; /* root of bond list (Bond) */
int bond_pri;
} ListTarg;
typedef struct {
ListAtom *Atom; /* lists */
ListBond *Bond;
ListInt *Int;
ListInt2 *Int2;
ListInt3 *Int3;
ListTmpl *Tmpl;
ListTarg *Targ;
ListPat *Pat;
ListScope *Scope;
ListMatch *Match;
char *Str;
int ActivePatList;
} CChamp; /* champ class */
/* prototypes */
CChamp *ChampNew(void);
void ChampFree(CChamp *I);
void ChampAtomFree(CChamp *I,int atom);
void ChampAtomFreeChain(CChamp *I,int atom);
void ChampBondFree(CChamp *I,int bond);
void ChampBondFreeChain(CChamp *I,int bond);
void ChampPatFree(CChamp *I,int index);
int ChampPatIdentical(ListAtom *p,ListAtom *a);
int ChampAtomMatch(ListAtom *p,ListAtom *a);
int ChampBondMatch(ListBond *p,ListBond *a);
int ChampSmiToPat(CChamp *I, const char *c);
void ChampMemoryDump(CChamp *I);
int ChampMemoryUsage(CChamp *I);
int ChampMatch_1V1_B(CChamp *I,int pattern,int target);
int ChampMatch_1V1_Map(CChamp *I,int pattern,int target,int limit,int tag_flag);
int ChampMatch_1VN_N(CChamp *I,int pattern,int list);
int ChampMatch_1V1_N(CChamp *I,int pattern,int target,int limit,int tag_flag);
int ChampMatch_NV1_N(CChamp *I,int list,int target,int limit,int tag_flag);
int ChampExact_1VN_N(CChamp *I,int pattern,int list);
int ChampModelToPat(CChamp *I,PyObject *model);
char *ChampPatToSmiVLA(CChamp *I,int index,char *vla,int mode);
int ChampAtomToString(CChamp *I,int index,char *buf);
int ChampBondToString(CChamp *I,int index,char *buf);
void ChampPatReindex(CChamp *I,int index);
void ChampPatDump(CChamp *I,int index);
void ChampOrientBonds(CChamp *I,int index);
void ChampGeneralize(CChamp *I,int index);
void ChampDetectChirality(CChamp *I,int index);
#endif
#include"os_std.h"
#include"sort.h"
#include"chiral.h"
static int chirality_lookup[256];
#define chi(a,b,c,d) (0xFF&(a<<6|b<<4|c<<2|d))
void ChiralInit(void)
{
int a;
for(a=0;a<256;a++) {
chirality_lookup[a]=0;
}
/* these orderings have input chirality
(equivalent to 0,1,2,3) */
chirality_lookup[chi(0,1,2,3)]=1;
chirality_lookup[chi(0,2,3,1)]=1;
chirality_lookup[chi(0,3,1,2)]=1;
chirality_lookup[chi(1,0,3,2)]=1;
chirality_lookup[chi(1,3,2,0)]=1;
chirality_lookup[chi(1,2,0,3)]=1;
chirality_lookup[chi(2,0,1,3)]=1;
chirality_lookup[chi(2,1,3,0)]=1;
chirality_lookup[chi(2,3,0,1)]=1;
chirality_lookup[chi(3,2,1,0)]=1;
chirality_lookup[chi(3,1,0,2)]=1;
chirality_lookup[chi(3,0,2,1)]=1;
/* these orderings have reverse chirality
(opposite to 0,1,3,2) */
chirality_lookup[chi(0,1,3,2)]=-1;
chirality_lookup[chi(0,2,1,3)]=-1;
chirality_lookup[chi(0,3,2,1)]=-1;
chirality_lookup[chi(1,0,2,3)]=-1;
chirality_lookup[chi(1,3,0,2)]=-1;
chirality_lookup[chi(1,2,3,0)]=-1;
chirality_lookup[chi(2,0,3,1)]=-1;
chirality_lookup[chi(2,1,0,3)]=-1;
chirality_lookup[chi(2,3,1,0)]=-1;
chirality_lookup[chi(3,2,0,1)]=-1;
chirality_lookup[chi(3,1,2,0)]=-1;
chirality_lookup[chi(3,0,1,2)]=-1;
}
int ChiralHandedness(int *a)
{
int idx[4],ord[4];
int result;
SortIntIndex(4,a,idx);
ord[idx[0]]=0;
ord[idx[1]]=1;
ord[idx[2]]=2;
ord[idx[3]]=3;
result = chirality_lookup[chi(ord[0],ord[1],ord[2],ord[3])];
/* printf("%d %d %d %d => %d\n",ord[0],ord[1],ord[2],ord[3],result);*/
return(result);
}
#if 0
main()
{
int a;
int val[][4] = {
{1,10,50,60},
{2,9,6,12},
{12,1,2,7},
{2,10,6,9},
{1,12,6,3},
};
ChiralInit();
for(a=0;a<5;a++) {
printf("%d %d %d %d => %d\n\n",
val[a][0],val[a][1],val[a][2],val[a][3],
ChiralHandedness(val[a]));
}
}
#endif
#ifndef _H_chiral
#define _H_chiral
void ChiralInit(void);
int ChiralHandedness(int *a);
#endif
#ifndef _H_const
#define _H_const
/* numeric tools */
#define c_small4 (1e-4)
#define c_small8 (1e-8)
#define c_small12 (1e-12)
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#include"os_std.h"
#include"err2.h"
void err_fatal(const char *where,const char *what)
{
fprintf(stderr,"%s-ERR: %s\n",where,what);
fflush(stderr);
exit(1);
}
int err_message(const char *where,const char *what)
{
printf("%s-ERR: %s\n",where,what);
fflush(stderr);
return(0);
}
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_err
#define _H_err
void err_fatal(const char *where,const char *what);
int err_message(const char *where,const char *what);
#endif
#include"os_std.h"
#include"const.h"
#include"vla.h"
#include"feedback2.h"
typedef struct {
char *Stack;
int Depth;
} Cfeedback_;
char *feedback_Mask;
Cfeedback_ Feedbk;
static int feedback_init = true;
void feedback_Init(void)
{
int a;
Cfeedback_ *I=&Feedbk;
if(feedback_init) {
feedback_init=false;
vla_malloc(I->Stack,char,FB_total);
I->Depth=0;
feedback_Mask = I->Stack;
for(a=0;a<FB_total;a++) {
feedback_Mask[a] = FB_results | FB_errors | FB_warnings | FB_actions | FB_details;
/* | FB_everything;*/
}
}
}
void feedback_Free(void)
{
Cfeedback_ *I=&Feedbk;
vla_free(I->Stack);
}
/* below we'll presume that any standard feedback on the feedback
module itself will be effected at the Python level, since feedback
levels will be changed as a matter of course inside of PyMOL in order
to quietly perform complex actions. */
void feedback_Push(void)
{
Cfeedback_ *I=&Feedbk;
int a;
I->Depth++;
vla_check(I->Stack,char,(I->Depth+1)*FB_total);
feedback_Mask=I->Stack+(I->Depth*FB_total);
for(a=0;a<FB_total;a++) {
feedback_Mask[a] = feedback_Mask[a-FB_total];
}
PRINTFD(FB_feedback_) " feedback: push\n" ENDFD;
}
void feedback_Pop(void)
{
Cfeedback_ *I=&Feedbk;
if(I->Depth) {
I->Depth--;
feedback_Mask=I->Stack+(I->Depth*FB_total);
}
PRINTFD(FB_feedback_) " feedback: pop\n" ENDFD;
}
void feedback_SetMask(unsigned int sysmod,unsigned char mask)
{
int a;
if((sysmod>0)&&(sysmod<FB_total)) {
feedback_Mask[sysmod] = mask;
} else if(!sysmod) {
for(a=0;a<FB_total;a++) {
feedback_Mask[a] = mask;
}
}
PRINTFD(FB_feedback_)
" feedbackSetMask: sysmod %d, mask 0x%02X\n",sysmod,mask
ENDFD;
}
void feedback_Disable(unsigned int sysmod,unsigned char mask)
{
int a;
if((sysmod>0)&&(sysmod<FB_total)) {
feedback_Mask[sysmod] = feedback_Mask[sysmod] & (0xFF-mask);
} else if(!sysmod) {
for(a=0;a<FB_total;a++) {
feedback_Mask[a] = feedback_Mask[a] & (0xFF-mask);
}
}
PRINTFD(FB_feedback_)
" feedbackDisable: sysmod %d, mask 0x%02X\n",sysmod,mask
ENDFD;
}
void feedback_Enable(unsigned int sysmod,unsigned char mask)
{
int a;
if((sysmod>0)&&(sysmod<FB_total)) {
feedback_Mask[sysmod] = feedback_Mask[sysmod] | mask;
} else if(!sysmod) {
for(a=0;a<FB_total;a++) {
feedback_Mask[a] = feedback_Mask[a] | mask;
}
}
PRINTFD(FB_feedback_)
" feedbackEnable: sysmod %d, mask 0x%02X\n",sysmod,mask
ENDFD;
}
#ifndef _H_Feedback
#define _H_Feedback
/*
IMPORTANT DEVELOPER NOTICE:
All non-debugging output should pass through the PRINTF and ENDF
macros currently defined below, or through the FeedbackAdd or
FeedbackAutoAdd routines.
Feedback bits are:
results -- DEFAULT: ON
output from a definite action which gives a result, such as an RMS
fit, a measured surface area, etc.
errors -- DEFAULT: ON
complaints which will cause failure at some level.
actions -- DEFAULT: ON
Output regarding actions in progress or completed, but which
don't return a particular result. Example: loading an object or
creating a selection.
warnings -- DEFAULT: ON
Questionable situations which will not necessarily result in task
failure.
details -- DEFAULT: ON
Verbose output reflecting details about what is going on.
blather -- DEFAULT: OFF
Output which doesn't fit into the above catogories, and is not likely
to be required except in extreme cases, but doesn't fall into the
category of debugging.
debugging -- DEFAULT: OFF
Text output while would only be of interest to a developer.
NOTE: Debugging output is the only kind of output which should be sent
directly to standard output (actually, standard error).
NOTE: Debugging output should always be preceeded by the enclosing
function name.
*/
/* WARNING: The following constants are replicated in Python for the purpose
* of minimize program startup time */
/* Discrete Systems and/or Code Modules */
#define FB_all 0 /* only used for setting */
#define FB_feedback_ 1
#define FB_smiles_parsing 2
#define FB_smiles_creation 3
#define FB_total 20 /* highest index + 1 */
/* Feedback level bit masks */
#define FB_none 0x00
#define FB_results 0x01
#define FB_errors 0x02
#define FB_actions 0x04
#define FB_warnings 0x08
#define FB_details 0x10
#define FB_blather 0x20
#define FB_debugging 0x80
#define FB_everything 0xFF
extern char *feedback_Mask;
void feedback_Init(void);
void feedback_Free(void);
void feedback_Push(void);
void feedback_Pop(void);
void feedback_SetMask(unsigned int sysmod,unsigned char mask);
void feedback_Disable(unsigned int sysmod,unsigned char mask);
void feedback_Enable(unsigned int sysmod,unsigned char mask);
/* Mechanism: a high-speed bit test, with no range checking
* in order to avoid penalizing performance-senstive code
* modules which may contain live debugging code.
*/
#define feedback_(sysmod,mask) (feedback_Mask[sysmod]&mask)
#define FEEDBACK_MAX_OUTPUT 1024
typedef char feedback_LineType[FEEDBACK_MAX_OUTPUT];
/* Print feedback_ Macros -- this the most flexible and cross-OS
* portable solution I've come up with for sending output with
* variable arguments.
*/
#define PRINTFB(sysmod,mask) { if(feedback_(sysmod,mask)) { printf(
#define ENDFB );}}
#define PRINTF { printf(
#define ENDF );}
/* debugging: goes to stderr */
#define PRINTFD(sysmod) {if(feedback_(sysmod,FB_debugging)) fprintf(stderr,
#define ENDFD );}
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#include"os_std.h"
#include"os_memory.h"
#include"mac.h"
#include"vla.h"
#include"list.h"
/* TEST */
#ifdef _LIST_UT
int main(int argc, char *argv[])
{
ListInt *int_list,*l;
List *hl;
int a,b,c,pass,n_cycles;
int list[256];
int_list = (ListInt*)ListNew(10,sizeof(ListInt));
hl = (List*)int_list;
c = hl->next_avail;
l = int_list + c;
while(l->link) {
printf(" record %p %d link %d\n",int_list,c,l->link);
c = l->link;
l = int_list + c;
}
printf(" record %p %d link %d\n",int_list,c,l->link);
for(a=0;a<100;a++) {
c = ListElemNew(&int_list);
printf(" ListElemNew %p %d\n",int_list,c);
fflush(stdout);
}
for(a=0;a<256;a++)
list[a]=0;
for(pass=0;pass<20;pass++) {
printf("pass %d\n",pass);
n_cycles = 10000*pass*pass;
for(a=0;a<n_cycles;a++) {
b = rand()&0xFF;
if(rand()&0x1) {
c = ListElemNew(&int_list);
int_list[c].link = list[b];
list[b] = c;
} else {
c = list[b];
if(c) {
list[b]=int_list[c].link;
ListElemFree(int_list,c);
}
}
}
printf(" cleaning up\n");
hl = (List*)int_list;
c = ListLen(int_list,hl->next_avail);
printf(" available %d\n",c);
for(a=0;a<256;a++) {
b = ListLen(int_list,list[a]);
c+=b;
ListElemFreeChain(int_list,list[a]);
list[a]=0;
printf(" list %d len %d exp %d actual %d \n",
a,b,c,ListLen(int_list,hl->next_avail));
}
}
return 0;
}
#endif
/* end unit test */
int ListLen(void *list,int start)
{
List *I;
ListElem *hle = NULL;
register int rec_size,len;
if(start) {
len = 1;
I=(List*)list;
rec_size = I->rec_size;
hle = (ListElem*)(((char*)I)+rec_size*start);
while(hle->link) {
hle = (ListElem*)(((char*)I)+rec_size*hle->link);
len++;
}
} else
len = 0;
return len;
}
void ListPrime(void *list,int start,int stop);
int ListGetNAlloc(void *list)
{
List *I;
I = ((List*)list);
return(vla_get_size(I));
}
int ListElemPush(void *list_ptr_ptr,int elem)
{
List *I;
ListElem *hle;
int start,stop;
int next;
I=*((List**)list_ptr_ptr);
if(!I->next_avail) {
start = vla_get_size(I);
vla_check(I,List,start+1);
(*((List**)list_ptr_ptr))=I;
stop = vla_get_size(I);
ListPrime(I,start,stop);
}
next = I->next_avail;
hle = (ListElem*)(((char*)I)+I->rec_size*next);
I->next_avail = hle->link;
hle->link = elem;
return next;
}
int ListElemPushInt(ListInt **list,int elem,int value)
{
elem = ListElemPush(list,elem);
(*list)[elem].value=value;
return(elem);
}
int ListElemPopInt(ListInt *list,int elem,int *value)
{
*value = list[elem].value;
elem = ListElemPop(list,elem);
return(elem);
}
int ListElemGetInt(ListInt *list,int elem,int *value)
{
*value = list[elem].value;
elem = list[elem].link;
return(elem);
}
int ListElemPurgeInt(ListInt *list,int start,int value)
{
int last = 0;
int result = start;
while(start) {
if(list[start].value==value) {
if(!last) {
result = list[start].link;
} else {
list[last].link = list[start].link;
}
ListElemFree(list,start);
break;
}
start = list[start].link;
}
return(result);
}
int ListElemNew(void *list_ptr_ptr)
{
return(ListElemPush(list_ptr_ptr,0));
}
int ListElemNewZero(void *list_ptr)
{
List *I;
ListElem *hle;
int start,stop;
int next;
I=*((List**)list_ptr);
if(!I->next_avail) {
start = vla_get_size(I);
vla_check(I,List,start+1);
(*((List**)list_ptr))=I;
stop = vla_get_size(I);
ListPrime(I,start,stop);
}
next = I->next_avail;
hle = (ListElem*)(((char*)I)+I->rec_size*next);
I->next_avail = hle->link;
os_zero((char*)hle,((char*)hle)+I->rec_size);
return next;
}
void *ListNew(int init_size,int rec_size)
{
List *I;
I = (List*)VLAMalloc(init_size+1,rec_size,5,0);
I->rec_size = rec_size;
I->next_avail = 0;
ListPrime(I,1,init_size+1);
return I;
}
void ListPrime(void *list,int start,int stop)
{ /* sets up next free entry */
List *I;
ListElem *hle;
int a,next,rec_size;
I = ((List*)list);
rec_size = I->rec_size;
next = I->next_avail;
hle = (ListElem*)(((char*)I)+I->rec_size*(stop-1));
for(a=stop-1;a>=start;a--) {
hle->link = next;
next = a;
hle = (ListElem*)(((char*)hle)-rec_size);
}
I->next_avail = next;
}
int ListElemPop(void *list,int elem)
{
List *I;
ListElem *hle;
int result;
if(elem) {
I=(List*)list;
hle = (ListElem*)(((char*)I)+I->rec_size*elem);
result = hle->link;
hle->link = I->next_avail;
I->next_avail = elem;
} else
result=0;
return(result);
}
void ListElemFree(void *list,int elem)
{
List *I;
ListElem *hle;
if(elem) {
I=(List*)list;
hle = (ListElem*)(((char*)I)+I->rec_size*elem);
hle->link = I->next_avail;
I->next_avail = elem;
}
}
void ListElemFreeChain(void *list,int start)
{
List *I;
ListElem *hle = NULL;
register int rec_size;
if(start) {
I=(List*)list;
rec_size = I->rec_size;
hle = (ListElem*)(((char*)I)+rec_size*start);
while(hle->link) {
hle = (ListElem*)(((char*)I)+rec_size*hle->link);
}
hle->link = I->next_avail;
I->next_avail = start;
}
}
void ListFree(void *list)
{
VLAFree(list);
}
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_List
#define _H_List
/* All data structures which use List must have this header */
typedef struct {
int link;
} ListElem;
typedef struct {
/* NOTE: happy lists must have record sizes equal or larger
than the length of this struct */
int rec_size;
int next_avail;
} List;
typedef struct {
int link;
int value;
} ListInt;
typedef struct {
int link;
int value[2];
} ListInt2;
typedef struct {
int link;
int value[3];
} ListInt3;
typedef struct {
int link;
int value[4];
} ListInt4;
typedef struct {
int link;
int value[5];
} ListInt5;
void *ListNew(int init_size,int rec_size);
int ListElemNewZero(void *list_ptr);
int ListElemNew(void *list_ptr_ptr);
void ListFree(void *list);
void ListElemFree(void *list,int elem);
void ListElemFreeChain(void *list,int start);
int ListLen(void *list,int start);
int ListGetNAlloc(void *list);
/* shortcut routines for managing tops of lists */
int ListElemPop(void *list,int elem);
int ListElemPush(void *list_ptr_ptr,int elem);
int ListElemPushInt(ListInt **list,int elem,int value);
int ListElemPopInt(ListInt *list,int elem,int *value);
int ListElemGetInt(ListInt *list,int elem,int *value);
int ListElemPurgeInt(ListInt *list,int start, int value); /* slow! */
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_mac
#define _H_mac
#include "os_memory.h"
#ifndef NULL
#define NULL ((void*)0)
#endif
#define mac_calloc(type) ((type*)os_calloc(1,sizeof(type)))
/* allocate a new, blank object of given type */
#define mac_calloc_array(type,cnt) ((type*)os_calloc(cnt,sizeof(type)))
/* allocate a new, blank array of given type */
#define mac_malloc(type) ((type*)os_malloc(sizeof(type)))
/* allocate a block of given type (not blanked) */
#define mac_malloc_array(type,cnt) ((type*)os_malloc(sizeof(type)*(cnt)))
/* allocate an array of blocks of given type (not blanked) */
#define mac_free(ptr) {if(ptr) {os_free(ptr);(ptr)=NULL;}}
/* free a pointer if it is non-null, then nullify */
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#include"os_memory.h"
#ifdef _os_memory_debug_on
#include<stdio.h>
#include<string.h>
#define GDB_ENTRY
typedef struct DebugRec {
struct DebugRec *next;
char file[64], note[64];
int line;
unsigned int size;
int type;
} DebugRec;
#define HASH(x) ((x>>11)&0x3FF)
static DebugRec *HashTable[1024];
static int InitFlag=true;
static int Count;
static int MaxCount;
DebugRec *OSMemoryRemove(void *ptr);
void OSMemoryInit(void);
#endif
void OSMemoryZero(char *p,char *q)
{
register unsigned long count;
register long *a;
int mask;
count = q-p;
mask=sizeof(long)-1;
/* get us word aligned */
while(count&&(((int)p)&mask)) {
count--;
*p++=0;
}
a=(long*)p;
/* now blank efficiently */
while(count>(sizeof(long)*16))
{
count-=(sizeof(long)*16);
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
*a++=0;
}
p=(char*)a;
while(count>0)
{
*p++=0;
count--;
}
}
#ifdef _os_memory_debug_on
void OSMemoryInit(void)
{
int a;
for(a=0;a<1024;a++)
HashTable[a]=NULL;
InitFlag=false;
Count=0;
MaxCount=0;
}
void OSMemoryDump(void)
{
int a;
int cnt=0;
unsigned int tot = 0;
DebugRec *rec;
if(InitFlag) OSMemoryInit();
for(a=0;a<1024;a++)
{
rec=HashTable[a];
while(rec)
{
tot+=rec->size;
printf(" OSMemory: @%10p:%7x:%i %s:%i \n",
(char*)rec+1,rec->size,rec->type,rec->file,rec->line);
rec=rec->next;
cnt++;
}
}
printf(" Memory: %d blocks expected, %d found, %d maximum allocated.\n",
Count,cnt,MaxCount);
printf(" Memory: current memory allocated %x bytes (%0.1f MB).\n",tot,tot/(1024.0*1024));
}
void OSMemoryHashAdd(DebugRec *rec);
DebugRec *OSMemoryHashRemove(void *ptr);
void OSMemoryHashAdd(DebugRec *rec)
{
int hash;
hash=(int)rec;
hash=HASH(hash);
rec->next=HashTable[hash];
HashTable[hash]=rec;
}
DebugRec *OSMemoryHashRemove(void *ptr)
{
DebugRec *rec,*cur,*last;
int hash;
rec=(DebugRec*)ptr;
rec--;
hash=(int)rec;
hash=HASH(hash);
last=NULL;
cur=HashTable[hash];
while(cur)
{
if(cur==rec)
{
if(last)
last->next=cur->next;
else
HashTable[hash]=cur->next;
break;
}
last=cur;
cur=cur->next;
}
return(cur);
}
void *OSMemoryMalloc(unsigned int size,const char *file,int line,int type)
{
DebugRec *rec;
if(InitFlag) OSMemoryInit();
rec=(DebugRec*)malloc(sizeof(DebugRec)+size);
if(!rec)
return(NULL);
strcpy(rec->file,file);
rec->line=line;
rec->size=size;
rec->type=type;
OSMemoryHashAdd(rec);
rec++;
Count++;
if(MaxCount<Count) MaxCount=Count;
return((void *) rec);
}
void *OSMemoryCalloc(unsigned int count,unsigned int size,const char *file,int line,int type)
{
DebugRec *rec;
if(InitFlag) OSMemoryInit();
size = size*count;
rec=(DebugRec*)calloc(1,sizeof(DebugRec)+size);
if(!rec)
return(NULL);
strcpy(rec->file,file);
rec->line=line;
rec->size=size;
rec->type=type;
OSMemoryHashAdd(rec);
rec++;
Count++;
if(MaxCount<Count) MaxCount=Count;
return((void *) rec);
}
void *OSMemoryRealloc(void *ptr,unsigned int size,const char *file,
int line,int type)
{
DebugRec *rec;
if(InitFlag) OSMemoryInit();
if((!ptr)&&(!size))
{
printf(
"OSMemory-ERR: realloc given (NULL,zero) (%s:%i)\n",
file,line);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
if(!ptr)
return(OSMemoryMalloc(size,file,line,type));
else if(!size)
{
OSMemoryFree(ptr,file,line,type);
return(NULL);
}
else
{
rec=OSMemoryHashRemove(ptr);
if(!rec)
{
printf(
"OSMemory-ERR: realloc() corrupted tree or bad ptr! (%s:%i @%p)\n",
file,line,ptr);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
else
{
if(rec->type!=type)
{
printf("OSMemory-ERR: ptr is of wrong type: %i!=%i (%s:%i)\n",
rec->type,type,file,line);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
rec=(DebugRec*)realloc(rec,size+sizeof(DebugRec));
if(!rec)
{
printf("OSMemory-ERR: realloc() failed reallocation! (%s:%i)\n",
file,line);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
else
{
OSMemoryHashAdd(rec);
rec->size=size;
rec++;
return((void*)rec);
}
}
}
return(ptr);
}
void OSMemoryFree(void *ptr,const char*file,int line,int type)
{
DebugRec *rec;
if(InitFlag) OSMemoryInit();
if(!ptr)
{
printf("OSMemory-ERR: free() called with NULL pointer (%s:%i)\n",
file,line);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
rec=OSMemoryHashRemove(ptr);
if(rec)
{
if(rec->type!=type)
{
printf("OSMemory-ERR: ptr is of wrong type: %i!=%i (%s:%i)\n",
rec->type,type,file,line);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
free(rec);
}
else
{
printf(
"OSMemory-ERR: free(): corrupted tree or bad ptr! (%s:%i @%p)\n",
file,line,ptr);
#ifdef GDB_ENTRY
OSMemoryDump();
printf("hit ctrl/c to enter debugger\n");
while(true){};
#else
exit(EXIT_FAILURE);
#endif
}
Count--;
}
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_os_memory
#define _H_os_memory
/* This file can be included by C programs for debugging of malloc, realloc, free in C
In order to use the debugging system, you must do the following...
*use os_malloc for malloc
*use os_realloc for realloc
*use os_calloc for calloc
*use os_free for free
*/
#include<stdlib.h>
#include<stdbool.h>
/* ==================== Master Switch =============================
* Define _os_memory_debug_on to enable the debugging system...
* Note: the debugging system is not thread-safe, so turn this
* flag off when you are using threads
*/
#define _os_memory_debug_on
/* ================================================================
* Don't touch below unless you know what you are doing */
#ifndef _os_memory_debug_on
#define os_malloc malloc
#define os_realloc realloc
#define os_calloc calloc
#define os_free free
#define os_memory_dump()
#else
#define _OSMemoryPointer 1
#define _OSMemoryVLA 2
void *OSMemoryMalloc(unsigned int size,const char *file,int line,int type);
void *OSMemoryCalloc(unsigned int count,unsigned int size,const char *file,int line,int type);
void *OSMemoryRealloc(void *ptr,unsigned int size,const char *file,int line,int type);
void OSMemoryFree(void *ptr,const char *file,int line,int type);
void OSMemoryDump(void);
#define os_malloc(x) OSMemoryMalloc(x,__FILE__,__LINE__,_OSMemoryPointer)
#define os_calloc(n,x) OSMemoryCalloc(n,x,__FILE__,__LINE__,_OSMemoryPointer)
#define os_realloc(x,y) OSMemoryRealloc(x,y,__FILE__,__LINE__,_OSMemoryPointer)
#define os_free(x) OSMemoryFree(x,__FILE__,__LINE__,_OSMemoryPointer)
#define os_memory_dump() OSMemoryDump()
#endif
void OSMemoryZero(char *p,char *q);
#define os_zero(p,q) OSMemoryZero(p,q)
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_os_python
#define _H_os_python
#include"Python.h"
# define PyInt_Check PyLong_Check
# define PyInt_FromLong PyLong_FromLong
# define PyInt_AsLong PyLong_AsLong
# define PyInt_AS_LONG PyLong_AS_LONG
# define PyNumber_Int PyNumber_Long
# define PyString_Check PyUnicode_Check
# define PyString_Size PyUnicode_GetLength
# define PyString_FromString PyUnicode_FromString
# define PyString_FromStringAndSize PyUnicode_FromStringAndSize
# define PyString_InternFromString PyUnicode_InternFromString
# define PyString_AsString PyUnicode_AsUTF8
# define PyString_AS_STRING PyUnicode_AsUTF8
# define PyCObject_AsVoidPtr(capsule) PyCapsule_GetPointer(capsule, NULL)
# define PyCObject_FromVoidPtr(p, d) Error_Function_not_available_PyCapsule_New_destructor_differs()
# define PyCObject_Check PyCapsule_CheckExact
# define PyEval_EvalCode(o, ...) PyEval_EvalCode((PyObject*)o, __VA_ARGS__)
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_os_mech
#define _H_os_mech
#ifdef _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<limits.h>
#include<float.h>
#endif
#include"sort.h"
void SortIntIndex(int n,int *v,int *i)
{
int l,a,r,t,d;
if(n<1) return;
else if(n==1) { i[0]=0; return; }
for(a=0;a<n;a++) i[a]=a;
l=(n>>1);
r=n-1;
while(1) {
if(l>0)
t = i[--l];
else {
t = i[r];
i[r] = i[0];
if( --r == 0) {
i[0] = t;
break;
}
}
d=l;
a= ((l+1) << 1)-1;
while (a <= r) {
if ((a < r) && (v[i[a+1]]>v[i[a]])) a++;
if (v[i[a]]>v[t]) {
i[d] = i[a];
a += (d=a)+1;
} else
a = r + 1;
}
i[d] = t;
}
}
#if 0
/* vidation code */
main()
{
int a,b,c,d;
int v[1000];
int i[1000];
for(a=0;a<1000;a++) { /* list length */
for(b=0;b<(100-(a/100));b++) { /* number of trials */
for(c=0;c<a;c++) { /* prime list */
v[c] = (int)(random()&0xFFF);
/* printf("%d ",v[c]);*/
}
/* printf("\n");*/
SortIntIndex(a,v,i);
for(c=0;c<a;c++) { /* prime list */
/* printf("%d ",v[i[c]]);*/
}
for(c=0;c<a-1;c++) { /* vidate */
for(d=c+1;d<a;d++) {
if(v[i[c]]>v[i[d]])
printf("broken!\n");
}
}
}
printf("list len %d\n",a);
}
}
#endif
#ifndef _H_sort
#define _H_sort
void SortIntIndex(int n,int *v,int *i);
#endif
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#include"os_std.h"
#include"os_memory.h"
#include"mac.h"
#include"vla.h"
#include"strblock.h"
/* TEST */
#ifdef _STRLIST_UT
int main(int argc, char *argv[])
{
char *sb;
char buffer[256];
int a,b,c;
int index;
buffer[0]=0;
sb = StrBlockNew(10);
b = rand()&0xFF;
for(a=0;a<100000;a++) {
index = StrBlockNewStr(&sb,NULL,b);
for(c=0;c<b;c++) {
sb[c+index]='a';
}
}
return 0;
}
#endif
/* end unit test */
/* right now just a braindead, memory-leaky system */
int StrBlockNewStr(char **list_ptr,const char *st,int len)
{
StrBlock *I;
register int a;
register char *q;
const char *p;
char *str;
int result, new_extent;
I=*((StrBlock**)list_ptr);
new_extent = len + 1 + I->next_unused;
vla_check(I,StrBlock,new_extent);
(*((StrBlock**)list_ptr))=I;
result = I->next_unused;
str = (char*)(((char*)I)+I->next_unused);
if(st) {
p = st;
q = str;
for(a=0;a<len;a++)
*(q++)=*(p++);
} else
str[0]=0;
str[len]=0;
I->next_unused = new_extent;
return result;
}
char *StrBlockNew(int init_size)
{
StrBlock *I;
I = (StrBlock*)VLAMalloc(init_size+sizeof(StrBlock),sizeof(char),5,0);
I->next_unused = sizeof(StrBlock);
return (char*)I;
}
void StrBlockFreeStr(char *list,int index)
{
/* just leak within the array */
}
void StrBlockFree(char *list)
{
VLAFree(list);
}
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_StrBlock
#define _H_StrBlock
/* All data structures which use StrBlock must have this header */
typedef struct {
int next_unused;
} StrBlock;
char *StrBlockNew(int init_size);
int StrBlockNewStr(char **block,const char *st,int len);
void StrBlockFree(char *block);
void StrBlockFreeStr(char *block,int elem);
#endif
from chempy.champ import Champ
ch = Champ()
p1 = ch.insert_pattern_string("C(N)(F)O")
ch.pattern_dump(p1)
ch = Champ()
p1 = ch.insert_pattern_string("C1(N)(F).O1")
ch.pattern_dump(p1)
from chempy.champ import Champ
ch = Champ()
# basic validation of stereochemistry handling on the simplest system
IS = [ # implicit patterns (S)
"[C@H](C)(N)O",
"[C@H](N)(O)C",
"[C@H](O)(C)N",
"C[C@H](N)O",
"N[C@H](O)C",
"O[C@H](C)N",
"[C@@H](C)(O)N",
"[C@@H](N)(C)O",
"[C@@H](O)(N)C",
"C[C@@H](O)N",
"N[C@@H](C)O",
"O[C@@H](N)C",
]
IR = [ # implicit patterns (R)
"[C@@H](C)(N)O",
"[C@@H](N)(O)C",
"[C@@H](O)(C)N",
"C[C@@H](N)O",
"N[C@@H](O)C",
"O[C@@H](C)N",
"[C@H](C)(O)N",
"[C@H](N)(C)O",
"[C@H](O)(N)C",
"C[C@H](O)N",
"N[C@H](C)O",
"O[C@H](N)C",
]
XS = [ # explicit patterns (S)
"H[C@](C)(N)O",
"H[C@](N)(O)C",
"H[C@](O)(C)N",
"C[C@](H)(O)N",
"N[C@](H)(C)O",
"O[C@](H)(N)C",
"O[C@](N)(C)H",
"C[C@](O)(N)H",
"N[C@](C)(O)H",
"N[C@](O)(H)C",
"O[C@](C)(H)N",
"C[C@](N)(H)O",
"H[C@@](C)(O)N",
"H[C@@](N)(C)O",
"H[C@@](O)(N)C",
"C[C@@](H)(N)O",
"N[C@@](H)(O)C",
"O[C@@](H)(C)N",
"O[C@@](N)(H)C",
"C[C@@](O)(H)N",
"N[C@@](C)(H)O",
"N[C@@](O)(C)H",
"O[C@@](C)(N)H",
"C[C@@](N)(O)H",
]
XR = [ # explicit patterns (R)
"H[C@@](C)(N)O",
"H[C@@](N)(O)C",
"H[C@@](O)(C)N",
"C[C@@](H)(O)N",
"N[C@@](H)(C)O",
"O[C@@](H)(N)C",
"O[C@@](N)(C)H",
"C[C@@](O)(N)H",
"N[C@@](C)(O)H",
"N[C@@](O)(H)C",
"O[C@@](C)(H)N",
"C[C@@](N)(H)O",
"H[C@](C)(O)N",
"H[C@](N)(C)O",
"H[C@](O)(N)C",
"C[C@](H)(N)O",
"N[C@](H)(O)C",
"O[C@](H)(C)N",
"O[C@](N)(H)C",
"C[C@](O)(H)N",
"N[C@](C)(H)O",
"N[C@](O)(C)H",
"O[C@](C)(N)H",
"C[C@](N)(O)H",
]
I = [ # implicit patterns (achiral)
"[CH](C)(N)O",
"[CH](N)(O)C",
"[CH](O)(C)N",
"C[CH](N)O",
"N[CH](O)C",
"O[CH](C)N",
]
X = [ # explicit patterns (achiral)
"HC(C)(N)O",
"HC(N)(O)C",
"HC(O)(C)N",
"CC(H)(O)N",
"NC(H)(C)O",
"OC(H)(N)C",
"OC(N)(C)H",
"CC(O)(N)H",
"NC(C)(O)H",
"NC(O)(H)C",
"OC(C)(H)N",
"CC(N)(H)O",
]
# print
PIS = map(lambda x:ch.insert_pattern_string(x),IS)
PXS = map(lambda x:ch.insert_pattern_string(x),XS)
for a in range(0,len(PIS)):
print IS[a],ch.pattern_get_string(PIS[a])
for a in range(0,len(PXS)):
print XS[a],ch.pattern_get_string(PXS[a])
PIR = map(lambda x:ch.insert_pattern_string(x),IR)
PXR = map(lambda x:ch.insert_pattern_string(x),XR)
for a in range(0,len(PIR)):
print IR[a],ch.pattern_get_string(PIR[a])
for a in range(0,len(PXR)):
print XR[a],ch.pattern_get_string(PXR[a])
PI = map(lambda x:ch.insert_pattern_string(x),I)
PX = map(lambda x:ch.insert_pattern_string(x),X)
for a in range(0,len(PI)):
print I[a],ch.pattern_get_string(PI[a])
for a in range(0,len(PX)):
print X[a],ch.pattern_get_string(PX[a])
# PyMOL
from pymol import cmd
from chempy.champ import Champ
import string
print '''# NOTE: This file was autogenerated
aa_dict = {'
'''
for res in ( 'ala','arg','asp','asn','cys','gln','glu','gly','his','ile','leu','lys','met','phe','pro','ser','thr','trp','tyr','val' ):
print "'"+string.upper(res)+"': ["
ch = Champ()
cmd.fragment(res,"tmp")
model = cmd.get_model("tmp")
cmd.delete("tmp")
m1 = ch.insert_model(model)
ch.pattern_detect_chirality(m1)
ch.pattern_orient_bonds(m1)
pat1 = ch.pattern_get_string_with_names(m1)
ch.pattern_detect_chirality(m1)
pat2 = ch.pattern_get_string_with_names(m1)
# confirm that CHAMP handles this pattern well...
if pat1!=pat2:
print " Chirality Assignment Error!"
print pat1
print pat2
break
else:
pat = pat1
# print pat1
clean_pat = re.sub("<[^>]*>","",pat)
source = ch.insert_pattern_string(clean_pat)
# print ch.pattern_get_string(source)
# print ch.pattern_get_string(m1)
if ch.match_1v1_b(source,m1)==0:
print " Error: Pattern doesn't match with self!"
pat_isomer = string.replace(pat,"@@","X")
pat_isomer = string.replace(pat_isomer,"@","@@")
pat_isomer = string.replace(pat_isomer,"X","@")
isomer = ch.insert_pattern_string(pat_isomer)
if ch.match_1v1_b(isomer,m1)==1:
if(res!='gly'):
print " Error: Pattern matches the enatiomer"
pat_racemic = string.replace(pat,"@","")
racemic = ch.insert_pattern_string(pat_racemic)
# print ch.pattern_get_string(source)
# print ch.pattern_get_string(isomer)
# print ch.pattern_get_string(racemic)
if ch.match_1v1_b(racemic,source)!=1:
print " Error: Racemic doesn't match source isomer"
if ch.match_1v1_b(racemic,isomer)!=1:
print " Error: Racemic doesn't match enantiomer"
if ch.match_1v1_b(source,racemic)!=0:
print " Error: Source matches racemic"
if ch.match_1v1_b(isomer,racemic)!=0:
print " Error: Isomer matches racemic"
lst = []
for a in string.split(pat,'<'):
for b in string.split(a,'>'):
lst.append(b)
tag_count = 0
pat_list = []
tag_list = []
flag = 0
while 1:
if lst==[]:
break
pat_list.append(lst.pop(0))
if lst==[]:
break;
tag_list.append((tag_count,lst.pop(0)))
pat_list.append("<%d>"%tag_count)
tag_count = tag_count+1
new_pat = string.join(pat_list,'')
print " '"+new_pat+"',"
print " ["
for a in tag_list:
print " (%2d, '%s'),"%a
print " ]"
print "],"
print "}"
# PyMOL
from pymol import cmd,stored
from chempy.champ import Champ
import re
import string
print '''# NOTE: This file was autogenerated
formal_charge_dict = {
'''
for res in ( 'ala','arg','asp','asn','cys','gln','glu','gly','his',
'hip','hie','hid','ile','leu','lys','met','phe','pro',
'ser','thr','trp','tyr','val' ):
stored.fc_dict = {}
print "'"+string.upper(res)+"': ["
print " ("
ch = Champ()
cmd.fragment(res,"tmp")
cmd.iterate("tmp","stored.fc_dict[name]=formal_charge",quiet=1)
cmd.alter("all","formal_charge=0",quiet=1)
cmd.remove("hydro",quiet=1)
model = cmd.get_model("tmp")
cmd.delete("tmp")
m1 = ch.insert_model(model)
ch.pattern_detect_chirality(m1)
ch.pattern_orient_bonds(m1)
pat1 = ch.pattern_get_string_with_names(m1)
ch.pattern_detect_chirality(m1)
pat2 = ch.pattern_get_string_with_names(m1)
# confirm that CHAMP handles this pattern well...
if pat1!=pat2:
print " Chirality Assignment Error!"
print pat1
print pat2
break
else:
pat = pat1
# print pat1
clean_pat = re.sub("<[^>]*>","",pat)
source = ch.insert_pattern_string(clean_pat)
# print ch.pattern_get_string(source)
# print ch.pattern_get_string(m1)
if ch.match_1v1_b(source,m1)==0:
print " Error: Pattern doesn't match with self!"
pat_isomer = string.replace(pat,"@@","X")
pat_isomer = string.replace(pat_isomer,"@","@@")
pat_isomer = string.replace(pat_isomer,"X","@")
isomer = ch.insert_pattern_string(pat_isomer)
# if ch.match_1v1_b(isomer,m1)==1:
# if(res!='gly'):
# print " Error: Pattern matches the enatiomer"
pat_racemic = string.replace(pat,"@","")
racemic = ch.insert_pattern_string(pat_racemic)
# print ch.pattern_get_string(source)
# print ch.pattern_get_string(isomer)
# print ch.pattern_get_string(racemic)
if ch.match_1v1_b(racemic,source)!=1:
print " Error: Racemic doesn't match source isomer"
if ch.match_1v1_b(racemic,isomer)!=1:
print " Error: Racemic doesn't match enantiomer"
lst = []
for a in string.split(pat,'<'):
for b in string.split(a,'>'):
lst.append(b)
tag_count = 0
pat_list = []
tag_list = []
flag = 0
while 1:
if lst==[]:
break
pat_list.append(lst.pop(0))
if lst==[]:
break;
tag_list.append((tag_count,stored.fc_dict[lst.pop(0)]))
pat_list.append("<%d>"%tag_count)
tag_count = tag_count+1
new_pat = string.join(pat_list,'')
print " '"+new_pat+"',"
# np = ch.insert_pattern_string(new_pat)
# print ch.pattern_get_tags(np)
# ch.pattern_clear_tags(m1)
# print ch.match_1v1_map(np,m1,1,1)
# print ch.pattern_get_ext_indices_with_tags(m1)
print " {"
for a in tag_list:
print " %2d: %d,"%a
print " },"
print " ),"
print "],"
print "}"
from chempy.champ import Champ
# see if we can read-in and read-out all of the NCI
# database SMILES strings without a hitch
import re
num_re = re.compile("[0-9]")
pnum_re = re.compile(r"\%[0-9][0-9]")
ch = Champ()
f = open("nci.smi")
c = 1
lst = []
while 1:
l = f.readline()
if not l: break
l = string.strip(l)
if len(l):
if 1000*(c/1000)==c:
print c
c = c + 1
# print l
idx = ch.insert_pattern_string(l)
# ch.pattern_dump(idx)
o = ch.get_pattern_string(idx)
if len(o) != len(l): # same length?
print "orig: ",l
print "champ: ",o
ch.pattern_dump(idx)
break
else:
# now, anonymize cycle identifiers and then compare...
o = pnum_re.sub("|",o)
o = num_re.sub("|",o)
l = pnum_re.sub("|",l)
l = num_re.sub("|",l)
fail = 0
if o!=l:
if o!="S=1(=NC(=O)C(=C(S[C])N=1)C#N)([C])[C]":
print "orig: ",l
print "champ: ",o
ch.pattern_dump(idx)
fail = 1
break
if fail:
break
ch.pattern_free(idx)
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
/* This file can be compiled under C as a .c file, or under C++ as a .cc file*/
#include<stdio.h>
#include"vla.h"
#ifndef _os_memory_debug_on
void *VLAExpand(void *ptr,unsigned int rec)
#else
void *_champVLAExpand(const char *file,int line,
void *ptr,unsigned int rec)
#endif
{
VLARec *vla;
char *start,*stop;
unsigned int soffset=0;
vla = &(((VLARec*)ptr)[-1]);
if(rec>=vla->nAlloc)
{
if(vla->autoZero)
soffset = sizeof(VLARec)+(vla->recSize*vla->nAlloc);
vla->nAlloc = (rec*(vla->growFactor+10)/10)+1;
#ifndef _os_memory_debug_on
vla=(void*)os_realloc(vla,(vla->recSize*vla->nAlloc)+sizeof(VLARec));
#else
vla=(void*)OSMemoryRealloc(vla,(vla->recSize*vla->nAlloc)+sizeof(VLARec),file,line,_OSMemoryVLA);
#endif
if(!vla)
{
printf("VLAExpand-ERR: realloc failed\n");
exit(EXIT_FAILURE);
}
if(vla->autoZero)
{
start = ((char*)vla) + soffset;
stop = ((char*)vla)+sizeof(VLARec)+(vla->recSize*vla->nAlloc);
os_zero(start,stop);
}
}
return((void*)&(vla[1]));
}
#ifndef _os_memory_debug_on
void *VLAMalloc(unsigned int initSize,unsigned int recSize,unsigned int growFactor,int autoZero)
#else
void *_champVLAMalloc(const char *file,int line,unsigned int initSize,unsigned int recSize,unsigned int growFactor,int autoZero)
#endif
{
VLARec *vla;
#ifndef _os_memory_debug_on
if(autoZero)
vla=(void*)os_calloc(1,(initSize*recSize)+sizeof(VLARec));
else
vla=(void*)os_malloc((initSize*recSize)+sizeof(VLARec));
#else
if(autoZero)
vla=OSMemoryCalloc(1,(initSize*recSize)+sizeof(VLARec),file,line,_OSMemoryVLA);
else
vla=OSMemoryMalloc((initSize*recSize)+sizeof(VLARec),file,line,_OSMemoryVLA);
#endif
if(!vla)
{
printf("VLAMalloc-ERR: realloc failed\n");
exit(EXIT_FAILURE);
}
vla->nAlloc=initSize;
vla->recSize=recSize;
vla->growFactor=growFactor;
vla->autoZero=autoZero;
return((void*)&(vla[1]));
}
#ifndef _os_memory_debug_on
void VLAFree(void *ptr)
#else
void _champVLAFree(const char *file,int line,void *ptr)
#endif
{
VLARec *vla;
vla = &(((VLARec*)ptr)[-1]);
#ifndef _os_memory_debug_on
os_free(vla);
#else
OSMemoryFree(vla,file,line,_OSMemoryVLA);
#endif
}
unsigned int VLAGetSize2(void *ptr)
{
VLARec *vla;
vla = &((VLARec*)ptr)[-1];
return(vla->nAlloc);
}
#ifndef _os_memory_debug_on
void *VLASetSize(void *ptr,unsigned int newSize)
#else
void *_champVLASetSize(const char *file,int line,void *ptr,unsigned int newSize)
#endif
{
VLARec *vla;
unsigned int orig_size = 0;
char *start;
char *stop;
vla = &((VLARec*)ptr)[-1];
if(vla->autoZero)
orig_size = sizeof(VLARec)+(vla->recSize*vla->nAlloc);
vla->nAlloc = newSize;
#ifndef _os_memory_debug_on
vla=(void*)os_realloc(vla,(vla->recSize*vla->nAlloc)+sizeof(VLARec));
#else
vla=OSMemoryRealloc(vla,(vla->recSize*vla->nAlloc)+sizeof(VLARec),file,line,_OSMemoryVLA);
#endif
if(!vla)
{
printf("VLASetSize-ERR: realloc failed\n");
exit(EXIT_FAILURE);
}
if(vla->autoZero)
{
start = ((char*)vla)+orig_size;
stop = ((char*)vla)+sizeof(VLARec)+(vla->recSize*vla->nAlloc);
if(start<stop)
os_zero(start,stop);
}
return((void*)&(vla[1]));
}
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_vla
#define _H_vla
#include "os_memory.h"
/* WARNING, almost all vla macros have the side effect of changing the pointer...
so be careful not to ever use temporary copies of vla pointers with these operations */
typedef struct VLARec {
unsigned int nAlloc;
unsigned int recSize;
unsigned int growFactor;
int autoZero;
} VLARec;
/* NOTE: in vla_check, rec is a zero based array index, not a record count */
#define vla_check(ptr,type,rec) (ptr=(type*)(((((unsigned int)(rec))>=((VLARec*)(ptr))[-1].nAlloc) ? VLAExpand(ptr,(rec)) : (ptr))))
#define vla_malloc(ptr,type,initSize) (ptr=(type*)VLAMalloc(initSize,sizeof(type),5,0))
#define vla_calloc(ptr,type,initSize) (ptr=(type*)VLAMalloc(initSize,sizeof(type),5,1))
#define vla_free(ptr) {if(ptr) {VLAFree(ptr);ptr=NULL;}}
#define vla_set_size(ptr,type,size) {ptr=(type*)VLASetSize(ptr,size);}
#define vla_get_size(ptr) VLAGetSize2(ptr)
unsigned int VLAGetSize2(void *ptr);
#ifndef _os_memory_debug_on
void *VLAExpand(void *ptr,unsigned int rec);
void *VLAMalloc(unsigned int initSize,unsigned int recSize,unsigned int growFactor,int autoZero); /*growfactor 1-10*/
void VLAFree(void *ptr);
void *VLASetSize(void *ptr,unsigned int newSize);
#else
#define VLAMalloc(a,b,c,d) _champVLAMalloc(__FILE__,__LINE__,a,b,c,d)
#define VLAExpand(a,b) _champVLAExpand(__FILE__,__LINE__,a,b)
#define VLAFree(a) _champVLAFree(__FILE__,__LINE__,a)
#define VLASetSize(a,b) _champVLASetSize(__FILE__,__LINE__,a,b)
void *_champVLAExpand(const char *file,int line,
void *ptr,unsigned int rec);
void _champVLAFree(const char *file,int line,
void *ptr);
void *_champVLASetSize(const char *file,int line,
void *ptr,unsigned int newSize);
void *_champVLAMalloc(const char *file,int line,
unsigned int initSize,unsigned int recSize,
unsigned int growFactor,int autoZero);
#endif
#endif
// *************************************************************************
// Copyright [2016] [RCSB]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// This file is the header file for the MMTF parser for the C language.
//
// The authors of this code are: Julien Ferte (http://www.julienferte.com/),
// Anthony Bradley, Thomas Holder.
//
//
// Other contributors: Yana Valasatava, Gazal Kalyan, Alexander Rose.
//
// *************************************************************************
#ifndef MMTF_PARSER_H
#define MMTF_PARSER_H
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief MMTF spec version which this library implements
*/
#define MMTF_SPEC_VERSION_MAJOR 1
#define MMTF_SPEC_VERSION_MINOR 0
#define WITHCOUNT(name) \
name; \
size_t name##Count
/**
* @brief Group (residue) level data store
*
* https://github.com/rcsb/mmtf/blob/HEAD/spec.md#group-data
*/
typedef struct {
int32_t* formalChargeList;
char** WITHCOUNT(atomNameList);
char** WITHCOUNT(elementList);
int32_t* WITHCOUNT(bondAtomList);
int8_t* WITHCOUNT(bondOrderList);
char* groupName;
char singleLetterCode;
char* chemCompType;
} MMTF_GroupType;
/**
* @brief Entity type.
*
* https://github.com/rcsb/mmtf/blob/HEAD/spec.md#entitylist
*/
typedef struct {
int32_t* WITHCOUNT(chainIndexList);
char* description;
char* type;
char* sequence;
} MMTF_Entity;
/**
* @brief Transformation definition for a set of chains.
*
* https://github.com/rcsb/mmtf/blob/HEAD/spec.md#bioassemblylist
*/
typedef struct {
int32_t* WITHCOUNT(chainIndexList);
float matrix[16];
} MMTF_Transform;
/**
* @brief Data store for the biological assembly annotation.
*
* https://github.com/rcsb/mmtf/blob/HEAD/spec.md#bioassemblylist
*/
typedef struct {
MMTF_Transform* WITHCOUNT(transformList);
char* name;
} MMTF_BioAssembly;
/**
* @brief Top level MMTF data container.
*
* https://github.com/rcsb/mmtf/blob/HEAD/spec.md#fields
*/
typedef struct {
char* mmtfVersion;
char* mmtfProducer;
float unitCell[6];
char* spaceGroup;
char* structureId;
char* title;
char* depositionDate;
char* releaseDate;
MMTF_BioAssembly* WITHCOUNT(bioAssemblyList);
MMTF_Entity* WITHCOUNT(entityList);
char** WITHCOUNT(experimentalMethods);
float resolution;
float rFree;
float rWork;
int32_t numBonds;
int32_t numAtoms;
int32_t numGroups;
int32_t numChains;
int32_t numModels;
MMTF_GroupType* WITHCOUNT(groupList);
int32_t* WITHCOUNT(bondAtomList);
int8_t* WITHCOUNT(bondOrderList);
float* xCoordList;
float* yCoordList;
float* zCoordList;
float* bFactorList;
int32_t* atomIdList;
char* altLocList;
float* occupancyList;
int32_t* groupIdList;
int32_t* groupTypeList;
int8_t* secStructList;
char* insCodeList;
int32_t* sequenceIndexList;
char** WITHCOUNT(chainIdList);
char** WITHCOUNT(chainNameList);
int32_t* groupsPerChain;
int32_t* chainsPerModel;
// PyMOL
int32_t* pymolRepsList;
int32_t* pymolColorList;
} MMTF_container;
/*
* Macros for declaration generic initialization and destroying functions
*/
#define CODEGEN_MMTF_parser_TYPE(type) \
type* type##_new(void); \
void type##_init(type*); \
void type##_destroy(type*); \
void type##_clear(type*); \
void type##_free(type*);
/**
* @fn MMTF_container * MMTF_container_new()
* @brief Allocate and initialize a new empty MMTF container
* @return pointer which needs to be freed with ::MMTF_container_free
*
* @fn void MMTF_container_free(MMTF_container* container)
* @brief Destroy the instance and free the memory
* @param container A MMTF container which has been allocated with ::MMTF_container_new
*
* @fn void MMTF_container_init(MMTF_container * container)
* @brief Initialize an empty MMTF container
* @param container Uninitialized memory, needs to be destroyed with ::MMTF_container_destroy
*
* @fn void MMTF_container_destroy(MMTF_container* container)
* @brief Destroy the instance and leave the memory uninitialized
* @param container A MMTF container which has been initialized with ::MMTF_container_init
*/
// clang-format off
CODEGEN_MMTF_parser_TYPE(MMTF_container)
CODEGEN_MMTF_parser_TYPE(MMTF_BioAssembly)
CODEGEN_MMTF_parser_TYPE(MMTF_Transform)
CODEGEN_MMTF_parser_TYPE(MMTF_Entity)
CODEGEN_MMTF_parser_TYPE(MMTF_GroupType)
#undef CODEGEN_MMTF_parser_TYPE
/**
* @brief Decode a MMTF_container from a string
* @param[in] buffer file contents
* @param[in] size file size
* @param[out] container initialized but empty MMTF container to populate with data
* @return true on success, false if an error occured
*/
bool MMTF_unpack_from_string(const char* buffer, size_t size, MMTF_container* container);
// clang-format on
/**
* @brief Decode a MMTF_container from a file
* @param[in] filename file path of an uncompressed .mmtf file
* @param[out] container initialized but empty MMTF container to populate with data
* @return true on success, false if an error occured
*/
bool MMTF_unpack_from_file(const char* filename, MMTF_container* container);
#undef WITHCOUNT
#ifdef __cplusplus
}
#endif
#endif
// vi:sw=4:expandtab
To whom it may concern:
Please note that this directory contains source code from the VMD
plugin tree used under and in compliance with the UIUC Open Source
license terms. Please consult the LICENSE files under this directory
tree for more information.
Note that this special instance of the VMD plugin tree source code has
been automatically modified to work and compile within the PyMOL
environment. Therefore, for all uses of this code other than
compilation of PyMOL, we urge you to refer back to the Theoretical and
Computational Biophysics Group at the University of Illinois at
Urbana-Champaign (http://www.ks.uiuc.edu/) for pristine copies of the
unmodified VMD plugin tree. Please do not rely upon our modified copy
outside of the PyMOL context, since it may change unexpectedly.
Thank you for your cooperation, and let us all give thanks especially
to the VMD developers for their decision to release VMD plugins under
an unrestricted open-source license!
DeLano Scientific LLC
With the exception of specifically marked plugins or source files
which have different license terms due to inclusion of source code
or data under different restrictions, the software contained
within the VMD plugin tree is subject to the UIUC Open Source license
which is included below the explicitly listed exceptions below:
Specically listed exceptions:
psfgen -- NAMD License
vmdtkcon -- See TkCon license
intersurf -- See Intersurf license text
Prof. A. MacKerell's CHARMM force field --
(excerpts in 'solvate', 'autoionize')
http://www.pharmacy.umaryland.edu/faculty/amackere/force_fields.htm
------------------------------------------------------------------------------
University of Illinois Open Source License
Copyright 2006 Theoretical and Computational Biophysics Group,
All rights reserved.
Developed by: Theoretical and Computational Biophysics Group
University of Illinois at Urbana-Champaign
http://www.ks.uiuc.edu/
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the Software), to deal with
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:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the documentation
and/or other materials provided with the distribution.
Neither the names of Theoretical and Computational Biophysics Group,
University of Illinois at Urbana-Champaign, nor the names of its contributors
may be used to endorse or promote products derived from this Software without
specific prior written permission.
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 CONTRIBUTORS 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 WITH THE SOFTWARE.
/***************************************************************************
*cr
*cr (C) Copyright 1995-2006 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************************/
/***************************************************************************
* RCS INFORMATION:
*
* $RCSfile: import_graphics_plugin.h,v $
* $Author: johns $ $Locker: $ $State: Exp $
* $Revision: 1.5 $ $Date: 2006/04/25 21:32:05 $
*
***************************************************************************/
#ifndef IMPORT_GRAPHICS_PLUGIN_H
#define IMPORT_GRAPHICS_PLUGIN_H
/*
* API for C extensions to define a way to import low-level graphics primitives
*/
#include "vmdplugin.h"
/*
* Define a common plugin type to be used when registering the plugin.
*/
#define IMPORT_GRAPHICS_PLUGIN_TYPE "import graphics"
typedef enum {
IMPORT_GRAPHICS_LINE_SOLID, IMPORT_GRAPHICS_LINE_DASHED
} import_graphics_linestyle_t;
/*
* Application-provided callbacks for specifying graphics primitives.
* Items must be maintained in order by the application for the purpose of
* coloring; see below.
*/
typedef struct {
/*
* Draw a point at the specified location in 3-D space.
*/
int (* add_point)(void *, const float *x);
int (* add_triangle)(void *, const float *x1, const float *x2, const float *x3);
int (* add_trinorm)(void *, const float *x1, const float *x2, const float *x3,
const float *n1, const float *n2, const float *n3);
int (* add_line)(void *, const float *x, const float *y, int line_style,
int width);
int (* add_cylinder)(void *, const float *x, const float *y, float radius,
int resolution, int filled);
int (* add_sphere)(void *, const float *x, float rad, int resolution);
int (* add_text)(void *, const float *x, const char *text, float size);
/*
* Color to use for subsequent primitives. If primitives are added before
* any call to use_color, the application is free to do whatever it likes.
*/
int (* use_color)(void *, float r, float g, float b);
/*
* Indicate whether the set of primitives is to be lit or not. Either all
* or none of the primitives will be lit.
*/
int (* use_materials)(void *, int yes_no);
} import_graphics_cb_t;
/*
* Main file reader API begins here. Any function in this struct may be NULL
* if not implemented by the plugin; the application checks this to determine
* what functionality is present in the plugin.
*/
typedef struct {
/*
* Required header
*/
vmdplugin_HEAD
/*
* Filename extension for this file type. May be NULL if no filename
* extension exists and/or is known.
*/
const char *filename_extension;
/*
* Try to open the file for reading. Return an opaque handle, or NULL on
* failure. filetype should be the name under which this plugin was
* registered; this is provided so that plugins can provide the same
* function pointer * to handle multiple file types.
*/
void *(* open_file_read)(const char *filepath, const char *filetype);
/*
* Read data and return it to the application in the supplied
* callbacks. The first void * is an opaque application handle which
* should be passed to all the callbacks in import_cb_t. The second
* void * is the plugin handle returned by open_file_read.
*/
int (* read_data)(void *, void *mydata, import_graphics_cb_t *);
/*
* Close the file and release all data. The handle cannot be reused.
*/
void (* close_file_read)(void *);
} import_graphics_plugin_t;
#endif
/***************************************************************************
*cr
*cr (C) Copyright 2009 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************************/
/***************************************************************************
* RCS INFORMATION:
*
* $RCSfile: vmdconio.h,v $
* $Author: johns $ $Locker: $ $State: Exp $
* $Revision: 1.4 $ $Date: 2015/10/11 22:36:27 $
*
***************************************************************************/
/** @file
* APIs for console output management. The calling application may
* optionally provide callback routines for console output that direct
* output to GUI consoles and other places besides stdout.
*/
#ifndef VMDCON_PLUGIN_H
#define VMDCON_PLUGIN_H
/* this has to correspond to vmdconsole.h */
#define VMDCON_ALL 0 /**< "print all messages" log level */
#define VMDCON_INFO 1 /**< informational messages log level */
#define VMDCON_WARN 2 /**< warning messages" log level */
#define VMDCON_ERROR 3 /**< error messages log level */
#define VMDCON_ALWAYS 4 /**< print always log level */
#define VMDCON_LOG 5 /**< store only in syslog log level */
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* set default */
#if !defined(THISPLUGIN)
#define THISPLUGIN plugin
#endif
/* forward declaration */
static molfile_plugin_t THISPLUGIN;
/*
* Emulate printf. unfortunately, we cannot rely on
* snprintf being available, so we have to write to
* a very large buffer and then free it. :-(
*/
static int vmdcon_printf(int lvl, const char *fmt, ...) {
va_list ap;
char *buf;
int len;
/* expand formatted output into a single string */
buf = (char *)malloc(MOLFILE_BIGBUFSIZ);
va_start(ap, fmt);
len = vsprintf(buf, fmt, ap);
/*
* Check result. we may get a segfault, but if not
* let the user know that he/she is in trouble.
*/
if (len >= MOLFILE_BIGBUFSIZ) {
fprintf(stderr,"WARNING! buffer overflow in vmdcon_printf. %d vs %d.\n",
len, MOLFILE_BIGBUFSIZ);
free(buf);
#if 0
errno=ERANGE; /* this is inherently thread-unsafe */
#endif
return -1;
}
/*
* write to registered console output function.
* fall back to stdout, if vmdcon not available.
*/
if (THISPLUGIN.cons_fputs) {
(*THISPLUGIN.cons_fputs)(lvl, buf);
} else {
fputs(buf, stdout);
}
free(buf);
return 0;
}
#ifdef __cplusplus
}
#endif
#endif /* VMDCON_PLUGIN_H */
/***************************************************************************
*cr
*cr (C) Copyright 1995-2006 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************************/
/***************************************************************************
* RCS INFORMATION:
*
* $RCSfile: vmdplugin.h,v $
* $Author: johns $ $Locker: $ $State: Exp $
* $Revision: 1.33 $ $Date: 2015/10/29 05:10:54 $
*
***************************************************************************/
/** @file
* This header must be included by every VMD plugin library. It defines the
* API for every plugin so that VMD can organize the plugins it finds.
*/
#ifndef VMD_PLUGIN_H
#define VMD_PLUGIN_H
/*
* Preprocessor tricks to make it easier for us to redefine the names of
* functions when building static plugins.
*/
#if !defined(VMDPLUGIN)
/**
* macro defining VMDPLUGIN if it hasn't already been set to the name of
* a static plugin that is being compiled. This is the catch-all case.
*/
#define VMDPLUGIN vmdplugin
#endif
/** concatenation macro, joins args x and y together as a single string */
#define xcat(x, y) cat(x, y)
/** concatenation macro, joins args x and y together as a single string */
#define cat(x, y) x ## y
/*
* macros to correctly define plugin function names depending on whether
* the plugin is being compiled for static linkage or dynamic loading.
* When compiled for static linkage, each plugin needs to have unique
* function names for all of its entry points. When compiled for dynamic
* loading, the plugins must name their entry points consistently so that
* the plugin loading mechanism can find the register, register_tcl, init,
* and fini routines via dlopen() or similar operating system interfaces.
*/
/*@{*/
/** Macro names entry points correctly for static linkage or dynamic loading */
#define VMDPLUGIN_register xcat(VMDPLUGIN, _register)
#define VMDPLUGIN_register_tcl xcat(VMDPLUGIN, _register_tcl)
#define VMDPLUGIN_init xcat(VMDPLUGIN, _init)
#define VMDPLUGIN_fini xcat(VMDPLUGIN, _fini)
/*@}*/
/** "WIN32" is defined on both WIN32 and WIN64 platforms... */
#if (defined(WIN32))
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#if !defined(STATIC_PLUGIN)
#if defined(VMDPLUGIN_EXPORTS)
/**
* Only define DllMain for plugins, not in VMD or in statically linked plugins
* VMDPLUGIN_EXPORTS is only defined when compiling dynamically loaded plugins
*/
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#define VMDPLUGIN_API __declspec(dllexport)
#else
#define VMDPLUGIN_API __declspec(dllimport)
#endif /* VMDPLUGIN_EXPORTS */
#else /* ! STATIC_PLUGIN */
#define VMDPLUGIN_API
#endif /* ! STATIC_PLUGIN */
#else
/** If we're not compiling on Windows, then this macro is defined empty */
#define VMDPLUGIN_API
#endif
/** define plugin linkage correctly for both C and C++ based plugins */
#ifdef __cplusplus
#define VMDPLUGIN_EXTERN extern "C" VMDPLUGIN_API
#else
#define VMDPLUGIN_EXTERN extern VMDPLUGIN_API
#endif /* __cplusplus */
/*
* Plugin API functions start here
*/
/**
* Init routine: called the first time the library is loaded by the
* application and before any other API functions are referenced.
* Return 0 on success.
*/
VMDPLUGIN_EXTERN int VMDPLUGIN_init(void);
/**
* Macro for creating a struct header used in all plugin structures.
*
* This header should be placed at the top of every plugin API definition
* so that it can be treated as a subtype of the base plugin type.
*
* abiversion: Defines the ABI for the base plugin type (not for other plugins)
* type: A string descriptor of the plugin type.
* name: A name for the plugin.
* author: A string identifier, possibly including newlines.
* Major and minor version.
* is_reentrant: Whether this library can be run concurrently with itself.
*/
#define vmdplugin_HEAD \
int abiversion; \
const char *type; \
const char *name; \
const char *prettyname; \
const char *author; \
int majorv; \
int minorv; \
int is_reentrant;
/**
* Typedef for generic plugin header, individual plugins can
* make their own structures as long as the header info remains
* the same as the generic plugin header, most easily done by
* using the vmdplugin_HEAD macro.
*/
typedef struct {
vmdplugin_HEAD
} vmdplugin_t;
/**
* Use this macro to initialize the abiversion member of each plugin
*/
#define vmdplugin_ABIVERSION 17
/*@{*/
/** Use this macro to indicate a plugin's thread-safety at registration time */
#define VMDPLUGIN_THREADUNSAFE 0
#define VMDPLUGIN_THREADSAFE 1
/*@}*/
/*@{*/
/** Error return code for use in the plugin registration and init functions */
#define VMDPLUGIN_SUCCESS 0
#define VMDPLUGIN_ERROR -1
/*@}*/
/**
* Function pointer typedef for register callback functions
*/
typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *);
/**
* Allow the library to register plugins with the application.
* The callback should be called using the passed-in void pointer, which
* should not be interpreted in any way by the library. Each vmdplugin_t
* pointer passed to the application should point to statically-allocated
* or heap-allocated memory and should never be later modified by the plugin.
* Applications must be permitted to retain only a copy of the the plugin
* pointer, without making any deep copy of the items in the struct.
*/
VMDPLUGIN_EXTERN int VMDPLUGIN_register(void *, vmdplugin_register_cb);
/**
* Allow the library to register Tcl extensions.
* This API is optional; if found by dlopen, it will be called after first
* calling init and register.
*/
VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp,
vmdplugin_register_cb);
/**
* The Fini method is called when the application will no longer use
* any plugins in the library.
*/
VMDPLUGIN_EXTERN int VMDPLUGIN_fini(void);
#endif /* VMD_PLUGIN_H */
University of Illinois Open Source License
Copyright 2003 Theoretical and Computational Biophysics Group,
All rights reserved.
Developed by: Theoretical and Computational Biophysics Group
University of Illinois at Urbana-Champaign
http://www.ks.uiuc.edu/
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the Software), to deal with
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:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the documentation
and/or other materials provided with the distribution.
Neither the names of Theoretical and Computational Biophysics Group,
University of Illinois at Urbana-Champaign, nor the names of its contributors
may be used to endorse or promote products derived from this Software without
specific prior written permission.
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 CONTRIBUTORS 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 WITH THE SOFTWARE.
/* MACHINE GENERATED FILE, DO NOT EDIT! */
#define VMDPLUGIN molfile_binposplugin
#define STATIC_PLUGIN 1
/***************************************************************************
*cr
*cr (C) Copyright 1995-2016 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************************/
/***************************************************************************
* RCS INFORMATION:
*
* $RCSfile: binposplugin.c,v $
* $Author: johns $ $Locker: $ $State: Exp $
* $Revision: 1.12 $ $Date: 2016/11/28 05:01:53 $
*
***************************************************************************/
#include "largefiles.h" /* platform dependent 64-bit file I/O defines */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "molfile_plugin.h"
#if INT_MAX == 2147483647
typedef int binpos_int32;
#elif SHRT_MAX == 2147483647
typedef short binpos_int32;
#elif LONG_MAX == 2147483647
typedef long binpos_int32;
#endif
typedef struct {
FILE *fd;
int numatoms;
int wrongendian;
float *xyz;
} binposhandle;
static void *open_binpos_read(const char *path, const char *filetype,
int *natoms) {
binposhandle *binpos;
FILE *fd;
int er=0,point,igarb;
char lenbuf[4];
char tmpc;
char magicchar[5];
fd = fopen(path, "rb");
if (!fd)
{
fprintf(stderr, "Could not open file '%s' for reading.\n", path);
return NULL;
}
binpos = (binposhandle *)malloc(sizeof(binposhandle));
memset(binpos, 0, sizeof(binposhandle));
fread(magicchar,sizeof(char),4,fd);
magicchar[4]= '\0' ;
if(strcmp(magicchar,"fxyz")!=0)
{
fprintf(stderr,"not a binpos amber coordinate file\n");
return NULL;
}
fprintf(stderr,"Proceeding to open amber7 binpos coordinate file\n");
fread(&igarb,sizeof(int),1,fd);
point=ftell(fd);
/* Check for endianism here*/
if(igarb>1000000000)
{
fprintf(stderr, "File '%s' appears to be other-endian.\n", path);
binpos->wrongendian = 1;
memcpy(lenbuf, (const char *)&igarb, 4);
tmpc = lenbuf[0]; lenbuf[0] = lenbuf[3]; lenbuf[3] = tmpc;
tmpc = lenbuf[1]; lenbuf[1] = lenbuf[2]; lenbuf[2] = tmpc;
memcpy((char *)&igarb, lenbuf, 4);
if((fseek(fd, point, SEEK_SET))!=0)
{
fprintf(stderr,"Endian correction failed. er=%d\n",er);
return NULL;
}
fseek(fd, point, SEEK_SET);
}
binpos->fd = fd;
binpos->numatoms = igarb;
binpos->xyz = (float *)malloc(3 * binpos->numatoms * sizeof(float));
if (!binpos->xyz) {
fprintf(stderr, "Unable to allocate space for %d atoms.\n", binpos->numatoms);
fclose(fd);
free(binpos);
return NULL;
}
*natoms = binpos->numatoms;
return binpos;
}
static int read_next_timestep(void *v, int natoms, molfile_timestep_t *ts)
{
binposhandle *binpos;
int i, numatoms,igarb;
char *cdata;
char tmpc;
binpos = (binposhandle *)v;
if (!binpos->fd)
return MOLFILE_ERROR; /* Done reading frames */
numatoms = binpos->numatoms;
if (fread(binpos->xyz, sizeof(float), 3 * numatoms, binpos->fd)
!= (size_t)(3 * numatoms)) {
fprintf(stderr, "Failure reading data from amber7 binary file.\n");
return MOLFILE_ERROR;
}
if (binpos->wrongendian) {
/*For float or single precision endian conversion*/
/*amber7 binpos files are always float not doubles*/
cdata = (char *) binpos->xyz;
for ( i=0; i<3*numatoms; ++i, cdata+=4 ) {
tmpc = cdata[0]; cdata[0] = cdata[3]; cdata[3] = tmpc;
tmpc = cdata[1]; cdata[1] = cdata[2]; cdata[2] = tmpc;
}
}
if (ts) {
for ( i=0; i<numatoms; ++i) {
ts->coords[3*i] = binpos->xyz[3*i];
ts->coords[3*i+1] = binpos->xyz[3*i+1];
ts->coords[3*i+2] = binpos->xyz[3*i+2];
}
}
/*
* Close the file handle and set to NULL so we know we're done reading
*
*/
if((fread(&igarb,sizeof(int),1,binpos->fd))!=1)
{
fclose(binpos->fd);
binpos->fd = NULL;
}
return MOLFILE_SUCCESS;
}
static void close_file_read(void *v) {
binposhandle *binpos = (binposhandle *)v;
if (binpos->fd)
fclose(binpos->fd);
free(binpos->xyz);
free(binpos);
}
static void *open_binpos_write(const char *path, const char *filetype,
int natoms) {
binposhandle *binpos;
FILE *fd;
fd = fopen(path, "wb");
if (!fd) {
fprintf(stderr, "Could not open file %s for writing\n", path);
return NULL;
}
fprintf(stderr,"Writing file in current machine endian-ism\n");
binpos = (binposhandle *)malloc(sizeof(binposhandle));
binpos->fd = fd;
binpos->numatoms = natoms;
fwrite( "fxyz", 4, 1, binpos->fd);
return binpos;
}
static int write_timestep(void *v, const molfile_timestep_t *ts) {
int i,numatoms;
binposhandle *binpos = (binposhandle *)v;
if (!binpos->fd)
return MOLFILE_ERROR;
/*add the number of atoms in between frames*/
/*myint = (binpos_int32)binpos->numatoms;*/
numatoms = binpos->numatoms;
fwrite(&numatoms, 4, 1, binpos->fd);
for (i=0; i<3*numatoms; i++)
{
float tmp = ts->coords[i];
if (fwrite(&tmp, sizeof(float), 1, binpos->fd) != 1) {
fprintf(stderr, "Error writing amber7 binary file\n");
return MOLFILE_ERROR;
}
}
/*
* Close and NULLify the file handle so we don't write any more frames.
*/
/* fclose(binpos->fd);
binpos->fd = NULL;*/
return MOLFILE_SUCCESS;
}
static void close_file_write(void *v) {
binposhandle *binpos = (binposhandle *)v;
if (binpos->fd)
fclose(binpos->fd);
free(binpos);
}
/*
* Initialization stuff here
*/
static molfile_plugin_t plugin;
VMDPLUGIN_API int VMDPLUGIN_init() {
memset(&plugin, 0, sizeof(molfile_plugin_t));
plugin.abiversion = vmdplugin_ABIVERSION;
plugin.type = MOLFILE_PLUGIN_TYPE;
plugin.name = "binpos";
plugin.prettyname = "Scripps Binpos";
plugin.author = "Brian Bennion";
plugin.majorv = 0;
plugin.minorv = 4;
plugin.is_reentrant = VMDPLUGIN_THREADSAFE;
plugin.filename_extension = "binpos";
plugin.open_file_read = open_binpos_read;
plugin.read_next_timestep = read_next_timestep;
plugin.close_file_read = close_file_read;
plugin.open_file_write = open_binpos_write;
plugin.write_timestep = write_timestep;
plugin.close_file_write = close_file_write;
return VMDPLUGIN_SUCCESS;
}
VMDPLUGIN_API int VMDPLUGIN_register(void *v, vmdplugin_register_cb cb) {
(*cb)(v, (vmdplugin_t *)&plugin);
return VMDPLUGIN_SUCCESS;
}
VMDPLUGIN_API int VMDPLUGIN_fini() {
return VMDPLUGIN_SUCCESS;
}
/* MACHINE GENERATED FILE, DO NOT EDIT! */
#define VMDPLUGIN molfile_biomoccaplugin
#define STATIC_PLUGIN 1
/***************************************************************************
*cr
*cr (C) Copyright 1995-2016 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************************/
/***************************************************************************
* RCS INFORMATION:
*
* $RCSfile: biomoccaplugin.C,v $
* $Author: johns $ $Locker: $ $State: Exp $
* $Revision: 1.6 $ $Date: 2016/11/28 05:01:53 $
*
***************************************************************************/
/*
* Biomocca volumetric map file reader
* Biomocca is written by the CEG at UIUC:
* http://www.ceg.uiuc.edu/
*
* File format (simple ASCII text):
* Xcenter Ycenter Zcenter (in Angstroms)
* Nx(number of cells on the x axis) Ny Nz
* d (cell spacing, in Angstroms)
* Voxel values (-1, 0, 1, ...) stored in Z/Y/X fortran style order
*
* Meaning of voxel values:
* -1 for lipid
* 0 for channel or solvent baths
* 1 stands for the protein
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#if defined(_AIX)
#include <strings.h>
#endif
#include "molfile_plugin.h"
typedef struct {
FILE *fd;
int nsets;
molfile_volumetric_t *vol;
} biomocca_t;
static void *open_biomocca_read(const char *filepath, const char *filetype,
int *natoms) {
FILE *fd;
biomocca_t *biomocca;
float scale;
int xsize, ysize, zsize;
float orig[3];
fd = fopen(filepath, "r");
if (!fd) {
printf("biomoccaplugin) Error opening file.\n");
return NULL;
}
if (fscanf(fd, "%f %f %f", orig, orig+1, orig+2) != 3) {
printf("biomoccaplugin) Error reading grid origin.\n");
return NULL;
}
/* get the number of grid points */
if (fscanf(fd, "%d %d %d", &xsize, &ysize, &zsize) != 3) {
printf("biomoccaplugin) Error reading grid dimensions.\n");
return NULL;
}
/* get the voxel scale */
if (fscanf(fd, "%f", &scale) != 1) {;
printf("biomoccaplugin) Error reading voxel scale.\n");
return NULL;
}
/* allocate and initialize the biomocca structure */
biomocca = new biomocca_t;
biomocca->fd = fd;
biomocca->vol = NULL;
*natoms = MOLFILE_NUMATOMS_NONE;
biomocca->nsets = 1; /* this file contains only one data set */
biomocca->vol = new molfile_volumetric_t[1];
strcpy(biomocca->vol[0].dataname, "BioMocca map");
/* Set the unit cell origin and basis vectors */
for (int i=0; i<3; i++) {
biomocca->vol[0].origin[i] = orig[i];
biomocca->vol[0].xaxis[i] = 0.0;
biomocca->vol[0].yaxis[i] = 0.0;
biomocca->vol[0].zaxis[i] = 0.0;
}
biomocca->vol[0].xaxis[0] = scale * (xsize-1);
biomocca->vol[0].yaxis[1] = scale * (ysize-1);
biomocca->vol[0].zaxis[2] = scale * (zsize-1);
biomocca->vol[0].origin[0] -= 0.5 * biomocca->vol[0].xaxis[0];
biomocca->vol[0].origin[1] -= 0.5 * biomocca->vol[0].yaxis[1];
biomocca->vol[0].origin[2] -= 0.5 * biomocca->vol[0].zaxis[2];
biomocca->vol[0].xsize = xsize;
biomocca->vol[0].ysize = ysize;
biomocca->vol[0].zsize = zsize;
biomocca->vol[0].has_color = 0; /* BioMocca maps contain no color info */
return biomocca;
}
static int read_biomocca_metadata(void *v, int *nsets,
molfile_volumetric_t **metadata) {
biomocca_t *biomocca = (biomocca_t *)v;
*nsets = biomocca->nsets;
*metadata = biomocca->vol;
return MOLFILE_SUCCESS;
}
static int read_biomocca_data(void *v, int set, float *datablock,
float *colorblock) {
biomocca_t *biomocca = (biomocca_t *)v;
FILE *fd = biomocca->fd;
int x, y, z, xsize, ysize, zsize, xysize;
xsize = biomocca->vol[0].xsize;
ysize = biomocca->vol[0].ysize;
zsize = biomocca->vol[0].zsize;
xysize = xsize * ysize;
for (x=0; x<xsize; x++) {
for (y=0; y<ysize; y++) {
for (z=0; z<zsize; z++) {
if (fscanf(fd, "%f", datablock + z*xysize + y*xsize + x) != 1) {
printf("biomoccaplugin) Failed reading biomocca map data\n");
return MOLFILE_ERROR;
}
}
}
}
return MOLFILE_SUCCESS;
}
static void close_biomocca_read(void *v) {
biomocca_t *biomocca = (biomocca_t *)v;
fclose(biomocca->fd);
if (biomocca->vol != NULL)
delete [] biomocca->vol;
delete biomocca;
}
/*
* Initialization stuff here
*/
static molfile_plugin_t plugin;
VMDPLUGIN_API int VMDPLUGIN_init(void) {
memset(&plugin, 0, sizeof(molfile_plugin_t));
plugin.abiversion = vmdplugin_ABIVERSION;
plugin.type = MOLFILE_PLUGIN_TYPE;
plugin.name = "biomocca";
plugin.prettyname = "Biomocca Volumetric Map";
plugin.author = "John Stone";
plugin.majorv = 0;
plugin.minorv = 2;
plugin.is_reentrant = VMDPLUGIN_THREADSAFE;
plugin.filename_extension = "bmcg";
plugin.open_file_read = open_biomocca_read;
plugin.read_volumetric_metadata = read_biomocca_metadata;
plugin.read_volumetric_data = read_biomocca_data;
plugin.close_file_read = close_biomocca_read;
return VMDPLUGIN_SUCCESS;
}
VMDPLUGIN_API int VMDPLUGIN_fini(void) { return VMDPLUGIN_SUCCESS; }
VMDPLUGIN_API int VMDPLUGIN_register(void *v, vmdplugin_register_cb cb) {
(*cb)(v, (vmdplugin_t *)&plugin);
return VMDPLUGIN_SUCCESS;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment