Shualdon / QupKake

BSD 3-Clause "New" or "Revised" License
12 stars 5 forks source link

error when specifying xtb version vs prepackaged binary #2

Closed ljmartin closed 4 months ago

ljmartin commented 4 months ago

hi all, congrats on the nice publication and code here.

I think using a newer version of xtb is leading to featurization errors. QupKake runs nicely using the prepackaged binary of xtb (version 6.4.1), but not when specifying a, more recent, pre-built binary (v 6.6.1). Potentially there's a difference in the output files, but I can't track it down.

prepackaged binary is version:

./qupkake/xtb-641/bin/xtb --version
>> * xtb version 6.4.1 (unknown) compiled by 'oda6@login1.crc.pitt.edu' on 2021-06-25

newer version:

/home/ubuntu/programs/xtb/xtb-6.6.1/bin/xtb --version
>> * xtb version 6.6.1 (8d0f1dd) compiled by 'stahn@M-Bot' on 2023-08-01

this works fine:

export XTBPATH=''
qupkake smiles "OC1=CN=CC=C1"

but this terminates with error:

export XTBPATH=`which xtb`
qupkake smiles "OC1=CN=CC=C1"

error message:

(qupkake) ubuntu@ip-172-31-8-111:~/QupKake/example$ qupkake smiles "OC1=CN=CC=C1"
Failed to find the pandas get_adjustment() function to patch
Failed to patch pandas - PandasTools will have limited functionality
/home/ubuntu/programs/xtb/xtb-6.6.1/bin/xtb
Failed to patch pandas - unable to change molecule rendering
Processing...
Failed to patch pandas - unable to change molecule rendering
Processing molecule:   0%|                                                                                                                                         | 0/1 [00:00<?, ?it/s]not enough values to unpack (expected 4, got 1)  final structure:

'natom'      #        f(+)     f(-)     f(0)

not enough values to unpack (expected 4, got 1)  final structure:

'natom'      #        f(+)     f(-)     f(0)

not enough values to unpack (expected 4, got 1)  final structure:

'natom'      #        f(+)     f(-)     f(0)

not enough values to unpack (expected 4, got 1)  final structure:

'natom'      #        f(+)     f(-)     f(0)

not enough values to unpack (expected 4, got 1)  final structure:

'natom'      #        f(+)     f(-)     f(0)

Processing molecule: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00,  2.43s/it]
Done!
/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/pytorch_lightning/utilities/data.py:104: Total length of `DataLoader` across ranks is zero. Please make sure this was your intention.
Traceback (most recent call last):
  File "/home/ubuntu/micromamba/envs/qupkake/bin/qupkake", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/qupkake/cli.py", line 399, in main
    parse_arguments(sys.argv[1:])
  File "/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/qupkake/cli.py", line 395, in parse_arguments
    parsed_args.func(parsed_args)
  File "/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/qupkake/cli.py", line 214, in main_smiles
    run_pipeline(args)
  File "/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/qupkake/cli.py", line 295, in run_pipeline
    run_prediction_pipeline(**vars(args))
  File "/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/qupkake/predict.py", line 248, in run_prediction_pipeline
    prot_indices = predict_sites(dataset, prot_model)
  File "/home/ubuntu/micromamba/envs/qupkake/lib/python3.9/site-packages/qupkake/predict.py", line 153, in predict_sites
    sites_indices = [
TypeError: 'NoneType' object is not iterable

just to verify the xtb install is functional:

obabel -O mol.sdf --gen3D -h -:"OC1=CN=CC=C1"
xtb mol.sdf --opt --alpb water lmo -P 16

terminates without error.

thanks again for a great package!

ljmartin commented 4 months ago

as an aside, I figured this docker image could be useful for mac users (encountered some trouble compiling XTB on mac). I'm not a docker native so no idea if this is efficient, but it works:

FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    git \
    && rm -rf /var/lib/apt/lists/*

RUN ln -s /usr/bin/python3 /usr/bin/python

RUN apt-get update && apt-get install -y wget
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh \
    && bash miniconda.sh -b -p /opt/miniconda \
    && rm miniconda.sh
ENV PATH="/opt/miniconda/bin:${PATH}"

RUN git clone https://github.com/Shualdon/QupKake.git && cd QupKake && conda env create -f environment.yaml && conda init

RUN echo "source activate qupkake" >> ~/.bashrc

RUN cd QupKake && pip install .

RUN apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6 #required by PandasTools > rdMolDraw2d
mkdir output
docker run -v $(pwd)/output:/app/output docker_app_name qupkake smiles "CCCO" -r /app/output
Shualdon commented 4 months ago

Hey @ljmartin,

As we talked, you should install the right xTB version (6.4.1) as newer version don't support mol\sdf files created using RDKit for some reason (see https://github.com/ReactionMechanismGenerator/ARC/issues/655). They have detailed installation guides using CMake or meson.

Thanks for the docker image! I will work to add official docker images in the future.