jszopi / repESP

Reproducing molecular ESP from partial charges and more
GNU General Public License v3.0
6 stars 7 forks source link

problem with ch3oh and esp_fit_and_flex.py #14

Closed ph265 closed 6 years ago

ph265 commented 8 years ago

Hi Jan, For my methanol molecule I can run the script fine for the C atom (no. 1) but not for the O atom (no. 5) all I do is swap the 5 and 1 labels in the script: (the following is to try for the flexibility of the O atom, I increased the xlim1 because the charge on the O atom is over -0.5)

esp_charge_type = 'mk' alt_esp_charge_type = 'chelpg' vary_label1 = 5 charge_dict_1D = lambda a1: {5: a1} vary_label2 = 1 charge_dict_2D = lambda a1, a2: {1: a2, 5: a1} labels_to_monitor = [1, 2, 6] xlim1 = (-1, 1) xlim2 = (-1, 0)

the output looks like this: python3.5 esp_fit_and_flex.py esp_fit.py script

Molecule: ch3oh Charge type: MK Non-ESP charge type: NBO Alt. ESP charge type: CHELPG

Running unrestrained RESP to fit ESP with equivalence:

Please check if the following RESP input is what you want:

Atom 1: C Atom 2: H Atom 3: H , equivalenced to atom 2 Atom 4: H , equivalenced to atom 2 Atom 5: O Atom 6: H

The molecule with MK charges: RMS: 0.00208 RRMS: 0.13574 RMSV: 0.01534 Atom 1: C , charge: 0.1747 Atom 2: H , charge: 0.0566 Atom 3: H , charge: -0.0084 Atom 4: H , charge: -0.0084 Atom 5: O , charge: -0.6056 Atom 6: H , charge: 0.3912

The molecule with equivalenced MK charges (unrestrained RESP): RMS: 0.00283 RRMS: 0.18461 RMSV: 0.01534 Atom 1: C , charge: 0.1237 Atom 2: H , charge: 0.0241 Atom 3: H , charge: 0.0241 Atom 4: H , charge: 0.0241 Atom 5: O , charge: -0.5448 Atom 6: H , charge: 0.3489

Checking differences between raw and equivalenced charges ... Atom 1: C differs by 0.051 Atom 5: O differs by -0.061

The molecule with equivalenced CHELPG charges (unrestrained RESP) evaluated on the MK grid: RMS: 0.00284 RRMS: 0.18542 RMSV: 0.01534 Percentage increase over equivalenced MK charges: 0.44 % Atom 1: C , charge: 0.1855 Atom 2: H , charge: 0.0076 Atom 3: H , charge: 0.0076 Atom 4: H , charge: 0.0076 Atom 5: O , charge: -0.5552 Atom 6: H , charge: 0.3470

One-dimensional scan:

Charges on these atoms will be varied:

See below for equivalence information of other atoms.

Please check if the following RESP input is what you want:

Atom 1: C Atom 2: H Atom 3: H , equivalenced to atom 2 Atom 4: H , equivalenced to atom 2 Atom 5: O , frozen Atom 6: H

Sampling progress: 100.00 %

Flexibility limits on Atom 5: O Traceback (most recent call last): File "esp_fit_and_flex.py", line 256, in (1+level/100)*resp_rrms, charge_vals, result, resp_args) File "/Users/tricia/bin/repESP/repESP/resp.py", line 603, in find_flex xtol=1e-5) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/scipy/optimize/zeros.py", line 442, in brentq r = _zeros._brentq(f,a,b,xtol,rtol,maxiter,args,full_output,disp) ValueError: f(a) and f(b) must have different signs

jszopi commented 8 years ago

This is due to there being no fit minimum on the specified charge range for O. It's good that you've changed the limits, but the minimum is perhaps even more negative. Does it work if you change xlim1 = (-2,0) ?

Reading into the error message you can see thar the program fails because in the minimum finding optimization the target function doesn't change sign.

jszopi commented 6 years ago

Closing old issues.