mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-07 22:44:25 +08:00
* hello world works * more * more minimallib needs to be tested * parse substructure parameters from JSON * add substruct search and parameters * add descriptors * register more descriptors * fingerprints, first pass * stop outputting tiny coord vals * support generating 2d coords * coordgen testing * return nulls * initial 3d support; add/removeHs; cleanup * Embedding parameters from JSON * update * pattern fp, fps as bytes * use json to configure MFP * use json to configure rdkit and pattern fps * aligned 2d coords * parsing options * options for writers * rename remove_hs * get this working on windows (kind of) * silence some msvc warnings * cmake updates * update python tests * add the CFFI code to CI builds * cleanup line ending mess? * a couple small fixes * make this work with URF * support coordMap in the 3D coordinate generation * updates in response to review
14 lines
454 B
Python
14 lines
454 B
Python
import ctypes
|
|
rdk = ctypes.cdll.LoadLibrary('./lib/librdkitcffi.so')
|
|
rdk.get_smiles.argtypes = [ctypes.c_void_p, ctypes.c_size_t, ctypes.c_char_p]
|
|
rdk.get_smiles.restype = ctypes.c_char_p
|
|
rdk.get_mol.restype = ctypes.c_void_p
|
|
rdk.free_ptr.argtypes = [ctypes.c_void_p]
|
|
|
|
sz = ctypes.c_size_t()
|
|
mol = rdk.get_mol(b'CCC(O)C(C(=O)O)C', ctypes.byref(sz), b'')
|
|
smi = rdk.get_smiles(mol, sz, b'')
|
|
assert (smi == b'CCC(O)C(C)C(=O)O')
|
|
print(smi)
|
|
rdk.free_ptr(mol)
|