sokrypton / ColabFold

Making Protein folding accessible to all!
MIT License
1.98k stars 495 forks source link

Minimization fails with notebook relax_amber.ipynb #356

Open EliyaGold opened 1 year ago

EliyaGold commented 1 year ago

Hi,

We are trying to use the only AMBER relax notebook and encountered an issue. Do you have any ideas why it could have happened?

Thank you!

Expected Behavior

Uploading a PDB file to relax_amber.ipynb and getting the relaxed structure

Current Behavior

After uploading, the minimization fails, with the error in the ColabFold output part.

Steps to Reproduce (for bugs)

we provided the PDB file that was used, just renamed it to .txt instead of .pdb amber1.txt

ColabFold Output (for bugs)

amber1.pdb(application/x-aportisdoc) - 62226 bytes, last modified: n/a - 100% done

Saving amber1.pdb to amber1.pdb

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

[<ipython-input-3-6b2a34f498ab>](https://localhost:8080/#) in <module>
      6 from google.colab import files
      7 pdb_dict = files.upload()
----> 8 relax_me(pdb_in=list(pdb_dict.keys())[0],
      9          pdb_out="relaxed.pdb")
     10 files.download(f'relaxed.pdb')

3 frames

[/opt/conda/lib/python3.8/site-packages/alphafold/relax/amber_minimize.py](https://localhost:8080/#) in _run_one_iteration(pdb_string, max_iterations, tolerance, stiffness, restraint_set, max_attempts, use_gpu, exclude_residues)
    418       logging.info(e)
    419   if not minimized:
--> 420     raise ValueError(f"Minimization failed after {max_attempts} attempts.")
    421   ret["opt_time"] = time.time() - start
    422   ret["min_attempts"] = attempts

ValueError: Minimization failed after 100 attempts.

Context

We run AF2 locally but could not install AMBER, so we wanted to run relax_amber.ipynb

Your Environment

Colab

jfbazan commented 1 year ago

I think I ran into the same issue with the (very useful!) relax_amber.ipynb colab notebook. Thanks in advance for putting it back in circulation! Here's the error message:

tnd.pdb(n/a) - 106516 bytes, last modified: 1/20/2023 - 100% done Saving tnd.pdb to tnd.pdb

AssertionError Traceback (most recent call last) in 6 from google.colab import files 7 pdb_dict = files.upload() ----> 8 relax_me(pdb_in=list(pdb_dict.keys())[0], 9 pdb_out="relaxed.pdb") 10 files.download(f'relaxed.pdb')

8 frames /usr/local/lib/python3.8/dist-packages/numpy/testing/_private/utils.py in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf) 842 verbose=verbose, header=header, 843 names=('x', 'y'), precision=precision) --> 844 raise AssertionError(msg) 845 except ValueError: 846 import traceback

AssertionError: Arrays are not almost equal to 7 decimals

Mismatched elements: 7 / 2916 (0.24%) Max absolute difference: 1. Max relative difference: 0. x: array([1, 1, 1, ..., 0, 0, 0], dtype=int32) y: array([0., 1., 0., ..., 0., 0., 0.])

sokrypton commented 1 year ago

Thanks for the reports... Still trying to debug why this is happening...

One quick solution is to run with CPU only. For some reason, GPU version is having some issues with recent updates (either from AlphaFold side or Amber side...)

EgonHeuson commented 1 year ago

Hello, I don't know if it can be of any help but I get a similar issue when executing ColabFoldLocal on my M1 Mac:

Command: colabfold_batch --amber --templates --num-recycle 3 --use-gpu-relax /Users/xxxxx/Downloads/A1B2C3/A1B2C3.fasta /Users/xxxxx/Downloads/A1B2C3

File "/Users/xxxxx/opt/ColabFold/colabfold_batch/colabfold-conda/lib/python3.8/site-packages/alphafold/relax/amber_minimize.py", line 419, in _run_one_iteration
    raise ValueError(f"Minimization failed after {max_attempts} attempts.")
ValueError: Minimization failed after 100 attempts

I'll try with CPU only as suggested. Or without amber :-)

EgonHeuson commented 1 year ago

Hmm, running on CPU only didn't seem to solve the issue on my side.

sherryliu987 commented 7 months ago

I also have this issue.

milot-mirdita commented 7 months ago

You can try to set the relax iterations to unlimited (--relax-max-iterations 0). This is the AF2 default behavior, but it was resulting in very long relaxation times.