Error in running pdb2gmx for protein with modified residue

GROMACS version: 2021.4-Ubuntu-2021.4-2
GROMACS modification: No
Here post your question
I am trying to run pdb2gmx for a pdb with a modified residue with Amber96 forcefield and TIP3P water. I have modified aminoacids.rtp and aminoacids.hdb files to include the modified residue (chromophore in 1bfp). When I am running, the following error comes:

Fatal error:
Residue 66 named IIC of a molecule in the input file was mapped
to an entry in the topology database, but the atom C used in
that entry is not found in the input file. Perhaps your atom
and/or residue naming needs to be fixed.

But the rtp does not have C, and the entries in the rtp file and the input pdb are matching.
Here is the rtp entry for the modified residue:
[ IIC ]
[ atoms ]
N1 N -0.548582 1
H H 0.400399 2
CA1 CT -0.101469 3
HA1 H1 0.214310 4
CB1 CT -0.068149 5
HB11 H1 0.260349 6
HB12 H1 0.171718 7
OG1 OH -0.642600 8
HG1 H1 0.424967 9
CA3 CT -0.290798 10
HA31 H1 0.208999 11
HA32 H1 0.152438 12
C3 C 0.573572 13
O3 O -0.542998 14
C1 CK 0.598230 15
N2 NB -0.672233 16
CA2 CC 0.220947 17
C2 CC 0.565509 18
O2 O -0.494683 19
N3 N* -0.510388 20
CB2 CM 0.224631 21
HB2 HC 0.183086 22
CG2 CC 0.324378 23
ND1 NB -0.619765 24
CE1 CR 0.223150 25
HE1 H5 0.164588 26
NE2 NA -0.421035 27
HE2 H 0.347920 28
CD2 CW -0.051955 29
HD2 H4 0.154726 30

Here is the residue IIC in the input file:
ATOM 481 C1 IIC A 65 26.589 27.058 37.112 1.00 5.23 C
ATOM 482 N2 IIC A 65 27.875 27.700 37.197 1.00 8.50 N
ATOM 483 CA2 IIC A 65 28.092 28.054 38.561 1.00 9.52 C
ATOM 484 C2 IIC A 65 26.899 27.674 39.362 1.00 1.00 C
ATOM 485 O2 IIC A 65 26.769 27.659 40.557 1.00 22.50 O
ATOM 486 N3 IIC A 65 26.065 27.009 38.390 1.00 16.14 N
ATOM 487 CA1 IIC A 65 25.925 26.647 35.850 1.00 3.62 C
ATOM 488 N1 IIC A 65 24.947 27.619 35.442 1.00 30.34 N
ATOM 489 CB1 IIC A 65 26.790 26.236 34.651 1.00 19.32 C
ATOM 490 OG1 IIC A 65 27.734 25.285 35.063 1.00 18.74 O
ATOM 491 CA3 IIC A 65 24.719 26.554 38.680 1.00 17.05 C
ATOM 492 C3 IIC A 65 24.595 25.182 39.315 1.00 6.60 C
ATOM 493 O3 IIC A 65 23.733 24.940 40.139 1.00 23.88 O
ATOM 494 CB2 IIC A 65 29.212 28.660 39.007 1.00 19.99 C
ATOM 495 CG2 IIC A 65 30.330 29.074 38.098 1.00 9.87 C
ATOM 496 ND1 IIC A 65 30.322 28.828 36.727 1.00 12.20 N
ATOM 497 CE1 IIC A 65 31.407 29.416 36.217 1.00 20.41 C
ATOM 498 NE2 IIC A 65 32.150 29.936 37.202 1.00 13.18 N
ATOM 499 CD2 IIC A 65 31.494 29.748 38.398 1.00 15.02 C

From the terminal:

                                                         gmx pdb2gmx -f 1bfpclean.pdb -o bfppro.gro
         :-) GROMACS - gmx pdb2gmx, 2021.4-Ubuntu-2021.4-2 (-:

                        GROMACS is written by:
 Andrey Alekseenko              Emile Apol              Rossen Apostolov
     Paul Bauer           Herman J.C. Berendsen           Par Bjelkmar
   Christian Blau           Viacheslav Bolnykh             Kevin Boyd
 Aldert van Buuren           Rudi van Drunen             Anton Feenstra
Gilles Gouaillardet             Alan Gray               Gerrit Groenhof
   Anca Hamuraru            Vincent Hindriksen          M. Eric Irrgang
  Aleksei Iupinov           Christoph Junghans             Joe Jordan
Dimitrios Karkoulis            Peter Kasson                Jiri Kraus
  Carsten Kutzner              Per Larsson              Justin A. Lemkul
   Viveca Lindahl            Magnus Lundborg             Erik Marklund
    Pascal Merz             Pieter Meulenhoff            Teemu Murtola
    Szilard Pall               Sander Pronk              Roland Schulz
   Michael Shirts            Alexey Shvetsov             Alfons Sijbers
   Peter Tieleman              Jon Vincent              Teemu Virolainen
 Christian Wennberg            Maarten Wolf              Artem Zhmurov
                       and the project leaders:
    Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

Copyright (c) 1991-2000, University of Groningen, The Netherlands.
Copyright (c) 2001-2019, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out http://www.gromacs.org for more information.

GROMACS is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

GROMACS: gmx pdb2gmx, version 2021.4-Ubuntu-2021.4-2
Executable: /usr/bin/gmx
Data prefix: /usr
Working dir: /mnt/f/BioSim/Project
Command line:
gmx pdb2gmx -f 1bfpclean.pdb -o bfppro.gro

Select the Force Field:

From current directory:

1: AMBER96 protein, nucleic AMBER94 (Kollman et al., Acc. Chem. Res. 29, 461-469, 1996)

From ‘/usr/share/gromacs/top’:

2: AMBER03 protein, nucleic AMBER94 (Duan et al., J. Comp. Chem. 24, 1999-2012, 2003)

3: AMBER94 force field (Cornell et al., JACS 117, 5179-5197, 1995)

4: AMBER96 protein, nucleic AMBER94 (Kollman et al., Acc. Chem. Res. 29, 461-469, 1996)

5: AMBER99 protein, nucleic AMBER94 (Wang et al., J. Comp. Chem. 21, 1049-1074, 2000)

6: AMBER99SB protein, nucleic AMBER94 (Hornak et al., Proteins 65, 712-725, 2006)

7: AMBER99SB-ILDN protein, nucleic AMBER94 (Lindorff-Larsen et al., Proteins 78, 1950-58, 2010)

8: AMBERGS force field (Garcia & Sanbonmatsu, PNAS 99, 2782-2787, 2002)

9: CHARMM27 all-atom force field (CHARM22 plus CMAP for proteins)

10: GROMOS96 43a1 force field

11: GROMOS96 43a2 force field (improved alkane dihedrals)

12: GROMOS96 45a3 force field (Schuler JCC 2001 22 1205)

13: GROMOS96 53a5 force field (JCC 2004 vol 25 pag 1656)

14: GROMOS96 53a6 force field (JCC 2004 vol 25 pag 1656)

15: GROMOS96 53a6carbo force field (JCC 2011 vol 32 pag 998, doi 10.1002/jcc.21675)

16: GROMOS96 54a7 force field (Eur. Biophys. J. (2011), 40, 843-856, DOI: 10.1007/s00249-011-0700-9)

17: OPLS-AA/L all-atom force field (2001 aminoacid dihedrals)
1

Using the Amber96 force field in directory ./amber96.ff
Opening force field file ./amber96.ff/watermodels.dat

Select the Water Model:

1: TIP3P TIP 3-point, recommended

2: TIP4P TIP 4-point

3: TIP4P-Ew TIP 4-point optimized with Ewald

4: TIP5P TIP 5-point

5: SPC simple point charge

6: SPC/E extended simple point charge

7: None
1

going to rename ./amber96.ff/aminoacids.r2b
Opening force field file ./amber96.ff/aminoacids.r2b

going to rename ./amber96.ff/dna.r2b
Opening force field file ./amber96.ff/dna.r2b

going to rename ./amber96.ff/rna.r2b
Opening force field file ./amber96.ff/rna.r2b
Reading 1bfpclean.pdb…
WARNING: all CONECT records are ignored
Read ‘BLUE FLUORESCENT PROTEIN’, 1818 atoms

Analyzing pdb file
Splitting chemical chains based on TER records or chain id changing.

There are 1 chains and 0 blocks of water and 227 residues with 1818 atoms

chain #res #atoms

1 ‘A’ 227 1818

there were 8 atoms with zero occupancy and 0 atoms with occupancy unequal to one (out of 1818 atoms). Check your pdb file.
there were 8 atoms with zero occupancy and 0 atoms with occupancy unequal to one (out of 1818 atoms). Check your pdb file.
Opening force field file ./amber96.ff/atomtypes.atp

Reading residue database… (Amber96)
Opening force field file ./amber96.ff/aminoacids.rtp
Opening force field file ./amber96.ff/dna.rtp
Opening force field file ./amber96.ff/rna.rtp
Opening force field file ./amber96.ff/aminoacids.hdb
Opening force field file ./amber96.ff/dna.hdb
Opening force field file ./amber96.ff/rna.hdb
Opening force field file ./amber96.ff/aminoacids.n.tdb
Opening force field file ./amber96.ff/aminoacids.c.tdb

Processing chain 1 ‘A’ (1818 atoms, 227 residues)
Analysing hydrogen-bonding network for automated assignment of histidine
protonation. 340 donors and 343 acceptors were found.
There are 557 hydrogen bonds
Will use HISE for residue 25
Will use HISE for residue 75
Will use HISE for residue 79
Will use HISE for residue 137
Will use HISD for residue 146
Will use HISE for residue 167
Will use HISE for residue 179
Will use HISH for residue 197
Will use HISD for residue 215

Identified residue MET1 as a starting terminus.

Identified residue ILE227 as a ending terminus.
8 out of 8 lines of specbond.dat converted successfully
Special Atom Distance matrix:
MET1 HIS25 CYS48 CYS68 HIS75 MET76 HIS79
SD7 NE2185 SG356 SG521 NE2586 SD593 NE2624
HIS25 NE2185 5.125
CYS48 SG356 4.404 1.196
CYS68 SG521 1.988 3.235 2.420
HIS75 NE2586 1.633 4.635 4.033 2.011
MET76 SD593 1.629 4.250 3.668 1.672 0.410
HIS79 NE2624 1.270 4.491 3.971 1.829 0.827 0.685
MET86 SD681 1.876 3.426 2.636 0.519 2.286 1.962 1.950
HIS137 NE21099 4.852 0.832 1.050 2.957 4.165 3.809 4.158
HIS146 NE21180 2.986 2.731 2.326 1.630 1.988 1.647 2.069
MET151 SD1222 2.505 3.527 3.356 2.013 1.879 1.550 1.411
HIS167 NE21356 3.786 1.903 1.779 2.162 2.901 2.550 2.905
HIS179 NE21446 3.281 2.129 1.900 1.712 2.557 2.173 2.431
HIS197 NE21585 1.710 3.772 3.258 1.314 1.040 0.642 0.737
HIS215 NE21731 4.296 2.178 1.200 2.413 3.704 3.414 3.885
MET216 SD1738 3.724 1.954 1.181 1.850 3.041 2.712 3.145
MET86 HIS137 HIS146 MET151 HIS167 HIS179 HIS197
SD681 NE21099 NE21180 SD1222 NE21356 NE21446 NE21585
HIS137 NE21099 3.260
HIS146 NE21180 2.075 2.216
MET151 SD1222 2.173 3.304 1.526
HIS167 NE21356 2.545 1.382 0.916 2.041
HIS179 NE21446 2.048 1.780 0.739 1.551 0.605
HIS197 NE21585 1.562 3.422 1.368 1.059 2.187 1.712
HIS215 NE21731 2.779 1.577 2.195 3.574 1.917 2.157 3.200
MET216 SD1738 2.259 1.342 1.340 2.691 1.080 1.262 2.427
HIS215
NE21731
MET216 SD1738 0.902
Opening force field file ./amber96.ff/aminoacids.arn
Opening force field file ./amber96.ff/dna.arn
Opening force field file ./amber96.ff/rna.arn

Checking for duplicate atoms…

Generating any missing hydrogen atoms and/or adding termini.


Program: gmx pdb2gmx, version 2021.4-Ubuntu-2021.4-2
Source file: src/gromacs/gmxpreprocess/pgutil.cpp (line 191)

Fatal error:
Residue 66 named IIC of a molecule in the input file was mapped
to an entry in the topology database, but the atom C used in
that entry is not found in the input file. Perhaps your atom
and/or residue naming needs to be fixed.

How do I resolve this error?

There might be some discrepancy in atom naming of modified residue IIC in the input PDB file vs files in the topology database.

In the aminoacids.rtp file, did you check if the improper dihedrals are also modified?
When I added a modified residue as the C-terminal residue, I had to edit the following files in addition to the ones you mentioned:
atomtypes.atp, ffnonbonded.itp, ffbonded.itp, residuetypes.dat (this file both in forcefield and working directory)