selimsami / qforce

Apache License 2.0
57 stars 13 forks source link

Charge not used during the dihedral fitting #36

Closed xiki-tempula closed 2 years ago

xiki-tempula commented 2 years ago

In theory, the partial charge used during the dihedral fitting should be the charge derived in the QM calculations. However, in practice, the charge ext_q is used instead.

This creates a large hysteresis. start_qforce/fragments/scan_data_CC_H8C8O2_b5abd75e5cfae9c5961bfe983af88435~2.pdf scan_data_CC_H8C8O2_b5abd75e5cfae9c5961bfe983af88435~2

The fragment which under QM optimisation is image The fragment under MD optimisation is image

Note that the N being this close to the carboxyl group can be quite problematic.

Note that if one look at start_qforce/fragments/CC_H8C8O2_b5abd75e5cfae9c5961bfe983af88435~2/step23/start_qforce.itp

[ atoms ]
;  nr     type resnr resnm   atom cgrp     charge      mass
    1 opls_135     1   MOL     C1    1   -0.41895  12.01070
    2 opls_231     1   MOL     C2    2    0.79408  12.01070
    3 opls_145     1   MOL     C3    3    0.17101  12.01070
    4 opls_140     1   MOL     H1    4    0.13232   1.00794
    5 opls_140     1   MOL     H2    5    0.13232   1.00794
    6 opls_236     1   MOL     O1    6   -0.57655  15.99940
    7 opls_154     1   MOL     O2    7   -0.61085  15.99940
    8 opls_145     1   MOL     C4    8    0.21848  12.01070
    9 opls_145     1   MOL     C5    9   -0.24753  12.01070
   10 opls_155     1   MOL     H3   10    0.42946   1.00794
   11 opls_145     1   MOL     C6   11   -0.25271  12.01070
   12 opls_145     1   MOL     C7   12   -0.14949  12.01070
   13 opls_146     1   MOL     H4   13    0.15559   1.00794
   14 opls_145     1   MOL     C8   14   -0.12478  12.01070
   15 opls_146     1   MOL     H5   15    0.18430   1.00794
   16 opls_146     1   MOL     H6   16    0.15559   1.00794
   17 opls_146     1   MOL     H7   17    0.13631   1.00794
   18 opls_140     1   MOL     N1   18   -0.66695  14.00670

The last atom N1 got a charge of -0.66695, which is from the ext_q instead of the QM charge. Such a large charge will cause some problems to the MM potential landscape.

xiki-tempula commented 2 years ago

Archive.zip

selimsami commented 2 years ago

Yeah this is a problem. But I do not fully agree with your statement: "In theory, the partial charge used during the dihedral fitting should be the charge derived in the QM calculations."

Because the external charges are not necessarily similar to the QM-based charges. So one cannot assume to assign QM-based charges to the fragments and hope that they are similar to final molecule's charges. And if they are not, the dihedral profiles will be off.

I thought about this issue and so far have not found an error-free solution except not allowing external charges.

Perhaps could give the user the option to pick "use external charges for fragments" vs "use QM based charges for fragments".

What do you think?

xiki-tempula commented 2 years ago

Because the external charges are not necessarily similar to the QM-based charges. So one cannot assume to assign QM-based charges to the fragments and hope that they are similar to final molecule's charges. And if they are not, the dihedral profiles will be off.

I guess it is more related to why does one need the external charges. The reason that I use external charges is that I use the ESP/RESP charge, which is conformation-dependent for flexible molecules. So I need to supply the external charge as a way of supplying the charge derived at the same theory level but across many conformations. So for me, this is not an issue. This is also kind of my reason for having the option qm_method_charge for ORCA where the QM charge could be derived at the same level as external charges during the dihedral scan.

But I do agree with the

Perhaps could give the user the option to pick "use external charges for fragments" vs "use QM based charges for fragments".

[scan]
ext_charges = True/False
selimsami commented 2 years ago

Completely agree!

Could have ext_charges = False by default (since it is more stable). But throw a NOTE/WARNING that this might be an issue if ext_charges are very different.

selimsami commented 2 years ago

This should be implemented in the latest push.

Usage:

[ff]

If user chooses ext_charges=True, by default fragments will still use the chosen QM method for

determining fragment charges. This is to avoid spuriously high charges on capping hydrogens.

However, using QM charges for fragments and ext_charges for the molecule can also result in

inaccuracies if these two charges are very different.

use_ext_charges_for_frags = no :: bool

xiki-tempula commented 2 years ago

@selimsami Excellent, thank you.

xiki-tempula commented 2 years ago

@selimsami With regard to this using explict charge during the dihedral scan, I have a question. Given that the explicit charge will be used during the dihedral scan, will the charge recorded in the qforce_fragments be the explicit charge as well? Or the QM charge is recorded? Thanks

selimsami commented 2 years ago

Do you mean external by explicit?

charge in qforce_fragments should be a dictionary of QM methods: charges

xiki-tempula commented 2 years ago

@selimsami

Do you mean external by explicit?

Yes, sorry.

charge in qforce_fragments should be a dictionary of QM methods: charges

Cool.