[AMBER] MCPB.py step 4n1 error

From: Jasmin Güven via AMBER <amber.ambermd.org>
Date: Fri, 5 May 2023 12:13:59 +0000

Hello,

I've been trying to run MCPB.py nonbonded model to parameterise VIM-2 in complex with L8J (PDB ID 6O5T) with two zinc files in its active site.

I've been following this tutorial <http://ambermd.org/tutorials/advanced/tutorial20/mcpbpy.htm> but only running the large model MK charge calculation, as I want to run the nonbonded model with refitting charges.

As per the Amber22 manual, I am following the MCPB.py steps 1m -> 3b -> 4n1.

Running step 3b takes in the old ZN mol2 files and refits the charge from +2 to ~0.79 and ~1.08, according to the DFT output file of the population analysis.

However, when running step 4n1, I get the following error:

 Traceback (most recent call last):
  File "/home/jguven/Software/amber22/bin/MCPB.py", line 712, in <module>
    gene_leaprc(gname, orpdbf, fipdbf, stpdbf, stfpf, ionids, ionmol2fs,
  File "/home/jguven/Software/amber22/lib/python3.10/site-packages/pymsmt/mcpb/amber_modeling.py", line 201, in gene_leaprc
    frcmodf = get_frcmod_fname(element, chg, watermodel, paraset)
  File "/home/jguven/Software/amber22/lib/python3.10/site-packages/pymsmt/mcpb/amber_modeling.py", line 108, in get_frcmod_fname
    return frcmodf
UnboundLocalError: local variable 'frcmodf' referenced before assignment

I looked at the file amber_modeling.py and found this in lines 194-203:

    #----------------------Generate the lib file and get the frcmod file name
    if model == 2:
        for ionmol2f in ionmol2fs:
            ionmol, ionatids, ionresids = get_atominfo(ionmol2f)
            for i in ionatids:
                element = ionmol.atoms[i].element
                chg = int(ionmol.atoms[i].charge)
                frcmodf = get_frcmod_fname(element, chg, watermodel, paraset)
                if frcmodf not in frcmodfs:
                    frcmodfs.append(frcmodf)

Since the ionmol variable is read in from get_atominfo which reads in the .mol2 files of the zinc ions, these are now ~0.79 and ~1.08 for my case. Since the above code block converts the ionmol.atoms[i].charge to an integer, this sets the charge to 0 and 1 respectively.

Thus, in get_frcmod_fname():

   # Choose the correct frcmod file for the ion
    if watermodel in ['tip3p', 'spce', 'tip4pew']:
        #For monovalent ions
        if charge in [-1, 1]:
            frcmodf = 'frcmod.ions1lm_'
            if paraset in ['hfe', 'cm', '12_6']:
                frcmodf = frcmodf + '126_' + watermodel
            elif paraset == 'iod':
                frcmodf = frcmodf + 'iod'
            elif paraset == '12_6_4':
                frcmodf = frcmodf + '1264_' + watermodel
        #For +2, +3, and +4 ions
        elif charge in [2, 3, 4]:
            frcmodf = 'frcmod.ions234lm_'
            if paraset == 'hfe':
                frcmodf = frcmodf + 'hfe_' + watermodel
            elif paraset == 'iod':
                frcmodf = frcmodf + 'iod_' + watermodel
            elif paraset == '12_6_4':
                frcmodf = frcmodf + '1264_' + watermodel
            elif paraset in ['cm', '12_6']:
                frcmodf = frcmodf + '126_' + watermodel
    elif watermodel in ['opc3', 'opc', 'fb3', 'fb4']:
        frcmodf = 'frcmod.ionslm_'
        if paraset == 'hfe':
            frcmodf = frcmodf + 'hfe_' + watermodel
        if paraset in ['cm', '12_6']:
            frcmodf = frcmodf + '126_' + watermodel
        elif paraset == 'iod':
            frcmodf = frcmodf + 'iod_' + watermodel
        elif paraset == '12_6_4':
            frcmodf = frcmodf + '1264_' + watermodel

    return frcmodf

The frcmodf file is not defined for a charge of 0, which causes the error.

Am I doing something wrong in the workflow, or is this a bug in the code? I've uploaded some of my files for convenience.

Many thanks in advance.

Kind regards,

Jasmin Güven

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th' ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber

Received on Fri May 05 2023 - 05:30:02 PDT
Custom Search