Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time


This is the code repository for OctSurf: Efficient Hierarchical Voxel-based Molecular Surface Representation for the Protein-Ligand Affinity Prediction.


Download PDBbind

Download PDBbind general, refined, and core(CASF) from
Also fix some minor problems in data(replace several mol2 files by transforming sdf, and remove the CONECT with index 0 in pdb file).

cd pdbbind
cd ..

Set-up Enviroment

Install packages and compile the required tools, e.g. the java tool for generating surface points, the C++ code for octree, and the operation (convolution etc.) API that work with tensorflow. (cmake/3.10.2, gcc/5.4.0, cuda/10.1)

# compile java
cd pdbbind/java
javac -cp cdk-2.3-SNAPSHOT.jar
cd ../..

# set-up TF enviroment and compile cpp
conda create -n OctSurf_env tensorflow-gpu==1.14.0
conda activate OctSurf_env
conda install -c conda-forge openbabel==3.0.0
conda install -c conda-forge yacs tqdm
pip install sklearn
pip install matplotlib
pip install seaborn
# uncomment if want to visualize in Paraview
# pip install vtk==9.0.3

cd octree/external && git clone --recursive
cd .. && mkdir build && cd build
cmake .. -DUSE_CUDA=ON && cmake --build . --config Release
export PATH=`pwd`:$PATH

cd ../../../tensorflow/libs
cd ../../

Octree Generation Example (Optional)

Provide one example data 1A1E from refined-set.
Following steps can generate the points and build the OctSurf. (Default density for points is 6, and depth for OctSurf is 10. Can be specified in file)
We also provide python tool to parse the generated OctSurf, and generate vtk files that can be visualized in Paraview.

cd pdbbind/data_example/pdbbind
cp ../../bash_scripts/ .
cd 1a1e
bash ../
cd octree_folder
ls -lh
cd ../../../../

# parse by python, and visualization(optional)
cd python
cd ../

CNN Modeling

prepare the data for modeling

First it will generate the points file for each complex in general, refined, core set. (The density of points can be specificed in, low resolution OctSurf can use low density points to accelerate the process, here for depth=6 model, we use density 3.)
Then the points and labels will be transformed into tfrecords file.

cd ..

train model

Specify the config files (the network architecture, the input/log path, iterations etc.)

cd tensorflow/script
python --config configs/train_resnet_depth6.yaml

test performance

Specify the config files (the path for pretrained model/test dataset, network architecture, iterations etc)
Test the pre-trained model on test dataset, and report the performance.

python --config configs/test_resnet_depth6.yaml


Code is inspired by O-CNN.

The code is released under the MIT license.
Please contact us (Qinqing Liu, Minghu Song ) if you have any problems about our implementation.