JMorado / ParaMol

A Package for Parametrization of Molecular Mechanics Force Fields
https://paramol.readthedocs.io
MIT License
27 stars 3 forks source link

Errors in the examples #52

Closed mmagithub closed 3 years ago

mmagithub commented 3 years ago

Hi, I am trying to make use of this wonderful tool, but I keep getting errors for the provided examples, mostly because of the dependence of ParaMol on many external helper codes, like ASE, DFTB+, etc. I wonder if you have recently tested the examples and if you can list the exact versions of the auxiliary codes you have used and if you can provide some interactive Jupiter notebooks with these examples,

Thanks, Marawan

JMorado commented 3 years ago

Hi,

Can you please specify what are the errors you are getting?

All examples are updated and have been recently tested. The DFTB+ version is 19.1, though more recent ones should still work if ASE has been updated accordingly. The ASE version is the most recent one, 3.21.1 .

Best regards, João

mmagithub commented 3 years ago

Hi Joao,

For example, 1- The OpenMMEngine argument does not accept "crd_format" keyword.

TypeError: init() got an unexpected keyword argument 'crd_format'

This is in all examples

2- from ParaMol.Utils.Symmetrizers.amber_symmetrizer import does not call and has to change to "from ParaMol.Utils.amber_symmetrizer import " 3-The psi/orca ase calculators. 4-Example 5 gives this error:

Traceback (most recent call last): File "example_5.py", line 22, in norfloxacin.force_field.create_force_field(ff_file="norfloxacin_symm.ff") File "~/anaconda3/envs/paramol/lib/python3.7/site-packages/ParaMol/Force_field/force_field.py", line 95, in create_force_field assert os.path.exists(ff_file), "\t ERROR: .param file provided - {} - does not exist." AssertionError: ERROR: .param file provided - {} - does not exist.

This is in all examples with the symmetrization consideration.

5-There is no Example 6 (not sure if this is intentional).

It would be great if you can provide even a single conventional working example for norfloxacin/aspirin etc (the drug-like molecule space everyone is working with), without any advanced functionalities, such as symmetry consideration or something, particularly for the torsional and bonded parameters. Just a vanilla-like example. I tried to use the CO example to generalize to for example Norfloxacin, but it did not work.

Your help is much appreciated and your tool is truly remarkable, cannot wait to use it,

Thanks, Marawan

JMorado commented 3 years ago

Hi,

1,2 - All examples are working just fine, what is happening is that you have to update your ParaMol version. Just download this github repo and point to it by using the following code snippet at the top of your scripts:

import os
import sys
# Path to ParaMol
sys.path.insert(0, os.path.abspath(path_to_paramol))

3 - Can't give you more information as I do not know what is the error, but I use psi4 ASE calculator regularly without any problem.

4 - It gives you that error because you have not created the .ff file. My advice is that you read the full documentation at https://paramol.readthedocs.io/en/latest/Examples/Example_5/Example_5.html .

5 - Example 6 exists and you can find it on the webpage. https://paramol.readthedocs.io/en/latest/Examples/Example_6/Example_6.html

I will also update the conda package so that it contains the last master branch version (it had version 1.0.2 and not 1.1.0). In any case, the best way to have the last working version of ParaMol is to point to this repo.

mmagithub commented 3 years ago

Hi Joao, Adding the os.path.abspath did not help.

Now the DFTB+ and the PSI4 calculators in the adaptive parametrization example gives this error:

Traceback (most recent call last): File "example_3.py", line 58, in adaptive_parametrization.run_task(paramol_settings, [caffeine], rmsd_tol=0.0001, max_iter=100, structures_per_iter=100, ) File "~/anaconda3/envs/paramol/lib/python3.7/site-packages/ParaMol/Tasks/adaptive_parametrization.py", line 96, in run_task system.create_qm_engines(settings.qm_engine["qm_engine"], settings.qm_engine[settings.qm_engine["qm_engine"].lower()]) AttributeError: 'Psi4' object has no attribute 'lower'

or(AttributeError: 'Dftb' object has no attribute 'lower')

I will read the documentation again and see if the issues persist. I am sure there is an incompatibility issue somewhere between ASE/DFTB+/PSI4 and ParaMol. Perhaps the more the users start using the tool, the issue will be more clear.

Thanks

JMorado commented 3 years ago

Hi,

There's no incompatibility. I have just tried with both DFTB+ and Psi4 calculators without any issue.

The way you set, e.g., the DFTB+ ASE calculator is by using the following code:

# Create the ASE calculator
from ase.calculators.dftb import *

calc = Dftb(Hamiltonian_='DFTB',
            Hamiltonian_MaxAngularMomentum_='',
            Hamiltonian_MaxAngularMomentum_O='p',
            Hamiltonian_MaxAngularMomentum_C='p',
            Hamiltonian_SCC='Yes',
            Hamiltonian_SCCTolerance=1e-8,
            Hamiltonian_MaxSCCIterations=10000)

# Set the calculator in the settings; alternatively the QM engine could be created manually
paramol_settings.qm_engine["qm_engine"] = "ase"
paramol_settings.qm_engine["ase"]["calculator"] = calc

I have no access to your script, but it seems to me that you are setting paramol_settings.qm_engine["qm_engine"] equal to the ASE calculator instance, whilst you should be setting paramol_settings.qm_engine["qm_engine"]="ase" and paramol_settings.qm_engine["ase"]["calculator"] = calc, where calc is the ASE calculator instance.

Hope this helps.

mmagithub commented 3 years ago

Mostly, it was a DFTB+ issue. Mine was 20.2 and the script seems to be compatible with 19.1.

JMorado commented 3 years ago

Summary: examples have no errors; no incompatibility between DFTB+ (at least version 19 1)/psi4/ParaMol; the errors were related either to using a not updated version of the code or not using ParaMol as recommended.

Issue is closed as these are non-ParaMol-related issues. I encourage you to report those in the ASE repository.

Best regards, João