Jump to content
DaveB

Using external chemistry libraries with Delphi

Recommended Posts

Hi everyone,

 

I am pretty much a newbie in Delphi (learnt a bit of Pascal and Delphi 20 years ago, but coming back to it in 2025 and everything feels very new to me). My intention is to start developping an app to handle chemistry operations. There are several nice toolkits around, for instance:
- EPAM's Indigo toolkit https://lifescience.opensource.epam.com/indigo/ (with pre-existing wrappers for C/C++/C#/Java/Python)
- Greg Landrum's
 RDKit https://www.rdkit.org/ (Python and C++ wrappers exist, as well as a MinimalLib CFFI https://greglandrum.github.io/rdkit-blog/posts/2021-05-01-rdkit-cffi-part1.html)
- the Chemistry Development Kit https://cdk.github.io/ (with tutorials to interface it in Java)
and probably others. However, I could not find any Delphi wrapper for any of them, nor any example case where someone would have been interfacing them in a Delphi app.

Could anyone explain me how I could start making my way to using any of them in Delphi, or how to create a dedicated wrapper ?

I did not find any previous topic on any of these toolkits on that forum, but do not hesitate to point me to another discussion topic where creating a wrapper to an external library was discussed (if understandable for a newcomer 🙂 )

Many, many thanks in advance for any help

Dave

Edited by DaveB
changed title

Share this post


Link to post

If there are not any wrapper for Pascal ,you need to arm yourself with a lot of patience and start creating your wrappers from the definitions of the include (i.e. the files with the extension ".h").
It might not be an easy path, quite the opposite.

However, there are some tools that can help you:

 

https://github.com/neslib/Chet

 

this utility allows you to create pascal wrappers from .h files.

Keep in mind that what is done will not be perfect and you will have to get your hands on it. Also keep in mind that you can only use C includes, NOT C++.

And you will also have to convert the code by hand.

Another equally valid alternative is to pass the include file and ask some AI to convert it to Pascal ...

Surely some forum user will be able to give you some further and better advice.

This is an example of conversion of the Indigo APIs performed by the tool I proposed to you, you need to get your hands on it but it is a start.

I wish you good work.

 

 

 

 

Indigo.pas

Indigo.h

  • Like 1

Share this post


Link to post

Python seems most natual to me, since all 3 libraries may support it or have wrapper for that.
Moreover is Python maybe also a natural way to use these kind of libraries ( but I'm not a Chemist ),
so to put a Delphi UI on top would have a lot of benefits IMHO, while still keeping the full force of Python to C++ underneath.
The additional burden to install and requiring Python-Libs for such project seems minor to me.

Esspeciall when you think of combining Chemistry with AI features, I think you are already right in the Python world.


 

Edited by Rollo62

Share this post


Link to post

I used Python in some projects (with P4D).

I found the approach very simple and effective, except for the versioning of the various components. The version of Python, with all the various libraries that it brings with it (and if AI is used it is even worse) is quite critical.
For now I still prefer the old method of "wrapping" the libraries from C in Pascal if available.
However, I understand that using Python as a base can be in some cases (especially for those who do not have much experience) certainly the best choice.

Share this post


Link to post
On 3/5/2025 at 1:18 PM, DaveB said:

Hi everyone,

 

I am pretty much a newbie in Delphi (learnt a bit of Pascal and Delphi 20 years ago, but coming back to it in 2025 and everything feels very new to me). My intention is to start developping an app to handle chemistry operations. There are several nice toolkits around, for instance:
- EPAM's Indigo toolkit https://lifescience.opensource.epam.com/indigo/ (with pre-existing wrappers for C/C++/C#/Java/Python)
- Greg Landrum's
 RDKit https://www.rdkit.org/ (Python and C++ wrappers exist, as well as a MinimalLib CFFI https://greglandrum.github.io/rdkit-blog/posts/2021-05-01-rdkit-cffi-part1.html)
- the Chemistry Development Kit https://cdk.github.io/ (with tutorials to interface it in Java)
and probably others. However, I could not find any Delphi wrapper for any of them, nor any example case where someone would have been interfacing them in a Delphi app.
 

Well, well, has been some years since somebody asked about chemistry here 8-)...

As it happens I am a (retired) organic chemist and have worked for more than 30 years for a german (later french) pharma company in research. I wrote a lot of software working with chemical information, mostly from chemical databases. While the core of my library depended on MDL (later Accelrys) ISIS (long dead) and their Oracle chemistry package I tried during my last year at the company to get rid of the ISIS dependency by creating a Delphi wrapper for the Indigo library. Unfortunately I did not have enough time to complete and test the wrapper, and it is based on the 2017 32-bit Indigo DLLs, but perhaps you can find something of use in the mess. I also included some other units related to chemistry in the attached archive without ISIS dependencies.

 

Have fun ;).

chemistry.zip

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×