kylelutz / chemkit Goto Github PK
View Code? Open in Web Editor NEWA C++ library for molecular modelling, cheminformatics and molecular visualization.
Home Page: http://www.chemkit.org
License: BSD 3-Clause "New" or "Revised" License
A C++ library for molecular modelling, cheminformatics and molecular visualization.
Home Page: http://www.chemkit.org
License: BSD 3-Clause "New" or "Revised" License
Currently the PdbFileFormat class in the pdb plugin only supports reading. Support for writing pdb files also needs to be implemented.
The mdl family of file formats (mdl, mol, sd, sdf) should be rewritten using std::istream
and std::ostream
instead of QIODevice
.
The read()
method in the MdlFileFormat
class in the mdl
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
And the write()
method should be changed from:
bool write(const chemkit::MoleculeFile *file, QIODevice *iodev)
to:
bool write(const chemkit::MoleculeFile *file, std::ostream &output)
The mopin file format should be rewritten using std::istream
instead of QIODevice
.
The read()
method in the MopinFileFormat
class in the mopac
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
The fhz file format should be rewritten using std::istream
instead of QIODevice
.
The read()
method in the FhzFileFormat
class in the fhz
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
There is an error in the function CartesianCoordinates::weightedCenter().
After summing the coordinates with their respective weights, the results gets divided by
the total mass times the number of particles. This is not correct. It should only be divided by
the total mass.
Hi.
I'm trying to debianize this package, and have encountered a segmentatoin fault.
When I build and test on an amd64 system, everything goes well.
However, when it comes on an i386 system (both on debian jessie and sid),
MolecularSurfaceTest::buckminsterfullerene()
receives a segmentation fault.
I've managed to figure out that this segmentation fault is caused by -2
in the Tetrahedron::neighbors
,
which seems to mean that DelaunayTriangulation::insertPoint
cannot find a neighboring tetrahedron for a new tetrahedron.
Strangely enough, it does not receive a segfalt when it run under valgrind, yet valgrind reports no errors.
I'm not sure why and under what condition it happens, but I'm afraid that chemkit::geometry::planeOrientation
goes unstable when it handles near-coplanar points in some environment.
What do you think?
The cube file format should be rewritten using std::istream
instead of QIODevice
.
The read()
method in the CubeFileFormat
class in the cube
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
Currently the inchi plugin in chemkit uses version 1.02 of the IUPAC InChI library. The latest stable version is 1.04 and is available at http://www.iupac.org/inchi/download/.
The plugins directory should be set by hand after make install.
export CHEMKIT_PLUGIN_PATH=path_for_plugins_directory.
The mopcrt file format should be rewritten using std::istream
instead of QIODevice
.
The read()
method in the MopcrtFileFormat
class in the mopac
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
Add support for reading mdcrd trajectory files. The mdcrd format is fairly common and is used by AMBER.
The Moiety::molecule() method will crash with a segmentation fault when called on an empty Moiety object.
Somewhat recent commit 0afc788 has replaced Qt4 with Qt5. If possible, please maintain the former for the sake of better compatibility (not all systems have Qt5).
The txyz file format should be rewritten using std::istream
instead of QIODevice
.
The read()
method in the TxyzFileFormat
class in the txyz
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
And the write()
method should be changed from:
bool write(const chemkit::MoleculeFile *file, QIODevice *iodev)
to:
bool write(const chemkit::MoleculeFile *file, std::ostream &output)
I had a linker error with nmake and it took hours to figure out how to fix this.
It tried to build dynamic libraries by linking against static boost libs.
Please have a look at these two files:
chemkit/CMakelists.txt (line 13):
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
endif()
chemkit/src/CMakelists.txt (line 8):
add_library(${library_name} DYNAMIC ${ARGN})
When i switch this from SHARED to STATIC, building with static boost libs works
properly for the core library, but not for the plugins.
The only way to compile the library is to manualy change the boost librarys per file
by removing the "lib" from "libboost..." filenames in the cmake-gui, but than the projects
depends on the boost-dll's.
Add support for reading dcd trajectory files. The dcd format is fairly common and is used by CHARMM.
Remove libchemkit's dependence on the Qt library. This will increase portability and improve performance for the core chemkit library. Qt's containers and algorithms should be replaced with their equivalents from STL and Boost.
Problem: Valgrind reports an "Invalid read of size 4" in the SSSR implementation in the libchemkit library.
How to reproduce: Run valgrind on the benzimidazole method of the ring-perception auto test. The output is as follows:
$ valgrind ./ringperceptiontest benzimidazole ==25592== Memcheck, a memory error detector ==25592== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==25592== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==25592== Command: ./ringperceptiontest benzimidazole ==25592== ********* Start testing of RingPerceptionTest ********* Config: Using QTest library 4.7.0, Qt 4.7.0 PASS : RingPerceptionTest::initTestCase() ==25592== Invalid read of size 4 ==25592== at 0x4E865D2: chemkit::(anonymous namespace)::Sssr::isUnique(std::vector > const&) const (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E883D6: chemkit::MolecularGraph::sssr_rpPath(chemkit::MolecularGraph const*) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E826F6: chemkit::MolecularGraph::sssr(chemkit::Fragment const*) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E827EA: chemkit::MolecularGraph::sssr(chemkit::Molecule const*) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E91894: chemkit::Molecule::rings() const (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E919A8: chemkit::Molecule::ringCount() const (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x40FD06: RingPerceptionTest::benzimidazole() (in /home/kyle/dev/chemkit/build/tests/auto/chemkit/ring-perception/ringperceptiontest) ==25592== by 0x42E987: RingPerceptionTest::qt_metacall(QMetaObject::Call, int, void**) (in /home/kyle/dev/chemkit/build/tests/auto/chemkit/ring-perception/ringperceptiontest) ==25592== by 0x545CBF8: QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (in /usr/lib/libQtCore.so.4.7.0) ==25592== by 0x545E305: QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (in /usr/lib/libQtCore.so.4.7.0) ==25592== by 0x50D1385: ??? (in /usr/lib/libQtTest.so.4.7.0) ==25592== by 0x50D2321: QTest::qExec(QObject*, int, char**) (in /usr/lib/libQtTest.so.4.7.0) ==25592== Address 0x8953ee4 is 0 bytes after a block of size 20 alloc'd ==25592== at 0x4C28973: operator new(unsigned long) (vg_replace_malloc.c:261) ==25592== by 0x4E6F229: std::vector >::vector(std::vector > const&) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E6FA0C: std::vector >, std::allocator > > >::_M_insert_aux(__gnu_cxx::__normal_iterator >*, std::vector >, std::allocator > > > >, std::vector > const&) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E88D1A: chemkit::MolecularGraph::sssr_rpPath(chemkit::MolecularGraph const*) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E826F6: chemkit::MolecularGraph::sssr(chemkit::Fragment const*) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E827EA: chemkit::MolecularGraph::sssr(chemkit::Molecule const*) (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E91894: chemkit::Molecule::rings() const (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x4E919A8: chemkit::Molecule::ringCount() const (in /home/kyle/dev/chemkit/build/src/chemkit/libchemkit.so) ==25592== by 0x40FD06: RingPerceptionTest::benzimidazole() (in /home/kyle/dev/chemkit/build/tests/auto/chemkit/ring-perception/ringperceptiontest) ==25592== by 0x42E987: RingPerceptionTest::qt_metacall(QMetaObject::Call, int, void**) (in /home/kyle/dev/chemkit/build/tests/auto/chemkit/ring-perception/ringperceptiontest) ==25592== by 0x545CBF8: QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (in /usr/lib/libQtCore.so.4.7.0) ==25592== by 0x545E305: QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (in /usr/lib/libQtCore.so.4.7.0) ==25592== PASS : RingPerceptionTest::benzimidazole() PASS : RingPerceptionTest::cleanupTestCase() Totals: 3 passed, 0 failed, 0 skipped ********* Finished testing of RingPerceptionTest ********* ==25592== ==25592== HEAP SUMMARY: ==25592== in use at exit: 760 bytes in 7 blocks ==25592== total heap usage: 1,774 allocs, 1,767 frees, 57,684 bytes allocated ==25592== ==25592== LEAK SUMMARY: ==25592== definitely lost: 0 bytes in 0 blocks ==25592== indirectly lost: 0 bytes in 0 blocks ==25592== possibly lost: 0 bytes in 0 blocks ==25592== still reachable: 760 bytes in 7 blocks ==25592== suppressed: 0 bytes in 0 blocks ==25592== Rerun with --leak-check=full to see details of leaked memory ==25592== ==25592== For counts of detected and suppressed errors, rerun with: -v ==25592== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)
Right now, chemkit.MoleculeFile takes a filename passed as string.
This keeps you from doing useful things like wrapping a string as a file object with io.BytesIO. When you have a database / web query that returns Molfile information as a string, it's a pain to have to write it to a temporary file before parsing it with chemkit.
A possible alternative to overhauling the .read() method might be to add another method to moleculefile.pxi that lets you pass a string and bypass the GenericFile object all together.
Relevant code and file at https://gist.github.com/2926056
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff9270c874 in strcmp ()
import chemkit
st = """ 2 1 0 0 0 0 999 V2000
... -0.4125 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
... 0.4125 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0"""
f = chemkit.MoleculeFile()
f.setFormat("sdf")
True
f.readString(st)
Segmentation fault: 11
For your copying and pasting pleasure, the string above is:
' 2 1 0 0 0 0 999 V2000\n -0.4125 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.4125 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n'
Hello !
I've been trying to compile the protein surface example following your step by step instructions. To get rid of the first compilation errors I had to add some Boost related entries in the CMakeLists :
find_package(Boost COMPONENTS iostreams filesystem system REQUIRED)
target_link_libraries(protein-surface-area ${CHEMKIT_LIBRARIES} ${Boost_LIBRARIES})
Errors are still showing up at linking :
[100%] Building CXX object CMakeFiles/protein-surface-area.dir/protein-surface-area.cpp.o
Linking CXX executable protein-surface-area
CMakeFiles/protein-surface-area.dir/protein-surface-area.cpp.o: In function `main':
protein-surface-area.cpp:(.text+0x4e): undefined reference to `chemkit::PolymerFile::PolymerFile(std::string const&)'
protein-surface-area.cpp:(.text+0xe3): undefined reference to `chemkit::PolymerFile::polymer(unsigned long) const'
protein-surface-area.cpp:(.text+0x25c): undefined reference to `chemkit::PolymerFile::~PolymerFile()'
protein-surface-area.cpp:(.text+0x2cb): undefined reference to `chemkit::PolymerFile::~PolymerFile()'
CMakeFiles/protein-surface-area.dir/protein-surface-area.cpp.o: In function `chemkit::GenericFile::read(std::istream&)':
protein-surface-area.cpp:(.text._ZN7chemkit11GenericFileINS_11PolymerFileENS_17PolymerFileFormatEE4readERSi[_ZN7chemkit11GenericFileINS_11PolymerFileENS_17PolymerFileFormatEE4readERSi]+0x20a): undefined reference to `chemkit::PolymerFileFormat::errorString() const'
collect2: error: ld returned 1 exit status
make[2]: *** [protein-surface-area] Error 1
make[1]: *** [CMakeFiles/protein-surface-area.dir/all] Error 2
make: *** [all] Error 2
I've tried both the stable version and latest git codes but I can't get past this error ...
Any idea ?
Thanks
The mol2 file format should be rewritten using std::istream
instead of QIODevice
.
The read()
method in the Mol2FileFormat
class in the sybyl
plugin should be changed from:
bool read(QIODevice *iodev, chemkit::MoleculeFile *file)
to:
bool read(std::istream &input, chemkit::MoleculeFile *file)
And the write()
method should be changed from:
bool write(const chemkit::MoleculeFile *file, QIODevice *iodev)
to:
bool write(const chemkit::MoleculeFile *file, std::ostream &output)
Hi,
When I want to install chemkit into system, there is a error:
CMake Error at src/io/cmake_install.cmake:54 (FILE):
file INSTALL cannot find
"/home/klniu/abs/chemkit/src/src/io/moledulefileformat.h".
I found in src/io/CMakeLists.txt the moleculefileformat.h file was named as moledulefileformat.h. It's a small issuse.
Thank you for your code. It's very useful and helpful.
Recards
Hugh
Hi,
In file internalcoordinates.cpp, It seems that the 2nd function should be multiplied by DegreesToRadians rather than RadiansToDegress. Also, the bond length r should not be multiplied by RadiansToDegrees, the same is true for ::coordinatesRidians().
// --- Coordinates --------------------------------------------------------- //
/// Sets the distance, angle, and torsion at \p row to \p r,
/// \p theta and \p phi respectively. The angles are in degrees.
void InternalCoordinates::setCoordinates(size_t row, Real r, Real theta, Real phi)
{
assert(row < d->size);
d->coordinates[row * 3 + 0] = r;
d->coordinates[row * 3 + 1] = theta;
d->coordinates[row * 3 + 2] = phi;
}
/// Sets the distance, angle, and torsion at \p row to \p r,
/// \p theta and \p phi respectively. The angles are in radians.
void InternalCoordinates::setCoordinatesRadians(size_t row, Real r, Real theta, Real phi)
{
assert(row < d->size);
d->coordinates[row * 3 + 0] = r * chemkit::constants::RadiansToDegrees;
d->coordinates[row * 3 + 1] = theta * chemkit::constants::RadiansToDegrees;
d->coordinates[row * 3 + 2] = phi * chemkit::constants::RadiansToDegrees;
}
Add a method to convert from cartesian coordinates (the Coordinates class) to internal coordinates (the InternalCoordinates class).
Currently the console applications chemkit-convert and chemkit-grep are not built on Windows due to the lack of the getopt library. Porting these two applications from getopt to boost::program_options would allow them to be more portable.
Found a molfile document from EBI that contains the name of the molecule in quotes. This causes the cjson writer to output a node like:
"name": ""2-thiouridine"",
Needless to say, this breaks everything ever.
Test script, cjson writer output, and traceback are up at https://gist.github.com/2968739.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.