[AMBER] MCPB.py Error at Step 2: TypeError with numpy.complex128 in angle parameter generation

From: maciej.spiegel via AMBER <amber.ambermd.org>
Date: Fri, 01 Aug 2025 17:23:49 +0200

Hello Everyone,

I am following the MCPB.py tutorial and encountered an error at the
step:
"MCPB.py -i MCPB.in -s 2"

The program starts as expected and parses the input successfully, but
then fails during the angle parameter generation using the Seminario
method, with the following error:

"""
******************************************************************
* Welcome to use the MCPB.py program *
* Version 2024 *
* Author: Pengfei Li *
* Merz Research Group *
* Michigan State University *
* AND *
* Hammes-Schiffer Research Group *
* Yale University *
* AND *
* Li Research Group *
* Loyola University Chicago *
******************************************************************
The input file you are using is : MCPB.in
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The following is the input variable you have:
The variable ion_ids is : [1]
The variable ion_info is : []
The variable ion_mol2files is : ['PT.mol2']
The variable original_pdb is : CIX.pdb
The variable add_bonded_pairs is : []
The variable add_redcrd is : 0
The variable additional_resids is : []
The variable anglefc_avg is : 0
The variable bondfc_avg is : 0
The variable chgfix_resids is : []
The variable cut_off is : 2.8
The variable force_field is : ff19SB
The variable frcmod_files is : ['ISX.frcmod']
The variable gaff is : 1
The variable group_name is : CIX
The variable ion_paraset is : 12_6 (Only for the ions using the
nonbonded model).
The variable large_opt is : 1
The variable lgmodel_chg is : -99
The variable lgmodel_spin is : -99
              -99 means program will assign a charge automatically.
The variable naa_mol2files is : ['ISX.mol2', 'WAT.mol2', 'CL.mol2']
The variable scale_factor is : 1.0
              ATTENTION: This is the scale factor of frequency. The
              force constants will be scaled by multiplying the square
              of scale_factor.
The variable smmodel_chg is : -99
The variable smmodel_spin is : -99
              -99 means program will assign a charge automatically.
The variable software_version is : gau
The variable sqm_opt is : 0
The variable water_model is : OPC
The variable xstru is : 0
******************************************************************
* *
*===================Generate the Initial frcmod file=============*
* *
******************************************************************
Atoms which has changed the atom types: [1, 2, 18, 34, 36]
1-PT.1-PT : PT --> M1
2-ISX.2-N1 : n2 --> Y1
3-ISX.18-N1 : n2 --> Y2
4-CL.34-CL : Cl --> Y3
5-WAT.36-O : OW --> Y4
******************************************************************
* *
*=========Using the Seminario method to solve the problem========*
* *
******************************************************************
=======================Generate the bond parameters===============
For bondtype: M1-Y1. There are 1 bond(s) in this type:
   The bond length(s) is(are): [2.0637]
   The average bond length is: 2.0637 Angstrom.
   The force constant(s) is(are): [np.float64(103.8)]
   The average force constant is: 103.8 Kcal*mol^-1*A^-2.
For bondtype: M1-Y2. There are 1 bond(s) in this type:
   The bond length(s) is(are): [1.9964]
   The average bond length is: 1.9964 Angstrom.
   The force constant(s) is(are): [np.float64(144.8)]
   The average force constant is: 144.8 Kcal*mol^-1*A^-2.
For bondtype: M1-Y3. There are 1 bond(s) in this type:
   The bond length(s) is(are): [2.311]
   The average bond length is: 2.311 Angstrom.
   The force constant(s) is(are): [np.float64(140.6)]
   The average force constant is: 140.6 Kcal*mol^-1*A^-2.
For bondtype: M1-Y4. There are 1 bond(s) in this type:
   The bond length(s) is(are): [2.1182]
   The average bond length is: 2.1182 Angstrom.
   The force constant(s) is(are): [np.float64(87.7)]
   The average force constant is: 87.7 Kcal*mol^-1*A^-2.
=======================Generate the angle parameters==============
For angletype: M1-Y1-c1. There are 1 angle(s) in this type:
   The angle value(s) is(are): [134.7]
   The average angle value is: 134.7 Degree.
   The force constant(s) is(are): [np.float64(143.92)]
   The average force constant is: 143.92 Kcal*mol^-1*Rad^-2.
Traceback (most recent call last):
   File
"/mnt/storage_2/project_data/pl0251-02/bin/miniconda3/envs/AmberTools24/bin/MCPB.py",
line 682, in <module>
     gene_by_QM_fitting_sem(smpdbf, ionids, xstru, stfpf, prefcdf,
finfcdf,
     
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fcfchkf, fclogf, g0x, scalef, bondfc_avg, anglefc_avg)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File
"/mnt/storage_2/project_data/pl0251-02/bin/miniconda3/envs/AmberTools24/lib/python3.13/site-packages/pymsmt/mcpb/gene_final_frcmod_file.py",
line 835, in gene_by_QM_fitting_sem
     ang_para = avg_angle_para(misangat123, angvals, afconst)
   File
"/mnt/storage_2/project_data/pl0251-02/bin/miniconda3/envs/AmberTools24/lib/python3.13/site-packages/pymsmt/mcpb/gene_final_frcmod_file.py",
line 131, in avg_angle_para
     afconst = [round(i, 2) for i in afconst]
                ~~~~~^^^^^^
TypeError: type numpy.complex128 doesn't define __round__ method
"""

It seems that the program is attempting to round a value of type
numpy.complex128, which leads to a TypeError since complex numbers
cannot be directly rounded.


For convenience, I’ve made all the relevant input files available in
this GitHub repository:
https://github.com/farmaceut/ERROR_MCPB.py.git

Has anyone encountered a similar issue? Any suggestions or insights on
how to resolve this would be greatly appreciated.
Thank you in advance !
-
Maciej Spiegel, MPharm PhD
assistant professor

Department of Organic Chemistry and Pharmaceutical Technology,
Faculty of Pharmacy, Wroclaw Medical University
Borowska 211A, 50-556 Wroclaw, Poland

_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Fri Aug 01 2025 - 08:30:02 PDT
Custom Search