charnley / rmsd

Calculate Root-mean-square deviation (RMSD) of two molecules, using rotation, in xyz or pdb format
BSD 2-Clause "Simplified" License
500 stars 115 forks source link

--reorder-method qml --reorder-method none currently not available #87

Closed nbehrnd closed 1 year ago

nbehrnd commented 2 years ago

This issue report evolves from an earlier discussion here.

With the test data provided in the .zip attached below, the RMSD of an alignment works fine e.g.,

$ calculate_rmsd --reorder --reorder-method brute 1.xyz 2.xyz 
0.0012379383034675595

However, this is not the case opting for qml:

$ calculate_rmsd --reorder --reorder-method qml 1.xyz 2.xyz 
Traceback (most recent call last):
  File "/usr/local/bin/calculate_rmsd", line 8, in <module>
    sys.exit(main())
  File "/home/USER/.local/lib/python3.9/site-packages/rmsd/calculate_rmsd.py", line 1965, in main
    q_review = reorder_method(p_atoms, q_atoms, p_coord, q_coord)
  File "/home/USER/.local/lib/python3.9/site-packages/rmsd/calculate_rmsd.py", line 829, in reorder_similarity
    p_vecs = qml.representations.generate_fchl_acsf(
AttributeError: module 'qml.representations' has no attribute 'generate_fchl_acsf'

despite qml is installed with pip for Python 3 (version 0.2.1, Anders S. Christensen (2016)), version information after import qml in Python and a subsequent help(qml)). It's PyPi page states version 0.4.0.27 as the one currently provided, suggesting a discrepancy.

Second, contrasting to the documentation displayed by calculate_rmsd --help, the level none does not work:

calculate_rmsd --reorder --reorder-method none 1.xyz 2.xyz 
Traceback (most recent call last):
  File "/usr/local/bin/calculate_rmsd", line 8, in <module>
    sys.exit(main())
  File "/home/USER/.local/lib/python3.9/site-packages/rmsd/calculate_rmsd.py", line 1965, in main
    q_review = reorder_method(p_atoms, q_atoms, p_coord, q_coord)
UnboundLocalError: local variable 'reorder_method' referenced before assignment

The observations refer to an installation in Linux Debian 12/bookworm (branch testing), Python 3.9.10, and rmsd 1.4 installed via pip for Python 3.

2022-03-04_data.zip

alexispaz commented 1 year ago

I have noted that the generate_fchl_acsf attribute is present on the develop branch of qml. Thus:

pip install git+https://github.com/qmlcode/qml@develop  -U

Solve this issue for me, altought it rise another error:

ValueError: invalid literal for int() with base 10: 'Sn'

I guess a good solution will be to know what specific version or commit hash for the qml develop branch is required, or which one was used during the develop or these reordering methods... I will try to figure out by reading the repo history.

alexispaz commented 1 year ago

Well... qml seems to be added on August 2021 and the commit message confirms that develop branch is required.

$ git log -S qml
commit 824c94530d82a1c365451606bafa5cf237d6a07c
Author: Henrique Musseli Cezar <henrique.musseli@gmail.com>
Date:   Fri Aug 13 17:24:39 2021 -0300

    Added qml reordering as an option (requires qml develop branch).

However, current commit on develop branch of qml is from Jun 2020... so the invalid literalerror is not a version issue... may be a different bug.

charnley commented 1 year ago

@alexispaz, you are correct that only the develop branch of qml is working, but please document how you to reproduce the error in a new issue, otherwise it is hard to maintain issues/bugs.

alexispaz commented 1 year ago

I agree @charnley. I initially thought it was related since it was in the multiprocessing module. However it's not related and even not a bug of rmsd package (I was using clusttraj). So, I guess you can safely mark this as solved.