Problem with pdb2gmx as it says there is no resdiue type XXX

GROMACS version: 2022
GROMACS modification: Yes/No
Here post your question:

Dear reader,
I have been trying to pass through the topology generation step for my protein, for which one residue (Thr) has been phosphorylated. After following a lot of forums, websites and the gromacs manual itself, I edited all the possible residue topology files, starting with aminoacids.rtp. When I first edited the rtp file, it seemed easy, as the job was done. However, the pro_new_pdb generated by the cleaved the protein into two chains, which is obviously incorrect. So I went on to make changes in other files step by step after seeing the errors. But after all that, when I ran it, it is giving me a very silly error, which is as follows:

In the chosen force field there is no residue type for ‘THX’

The residue looks like this
ATOM 2808 N THX A 174 231.841 -74.271 -80.471 1.00 0.00 N
ATOM 2809 H THX A 174 231.591 -73.451 -81.001 1.00 0.00 H
ATOM 2810 CA THX A 174 231.141 -75.531 -80.731 1.00 0.00 C
ATOM 2811 HA THX A 174 230.571 -75.901 -79.881 1.00 0.00 H
ATOM 2812 CB THX A 174 230.081 -75.331 -81.901 1.00 0.00 C
ATOM 2813 HB THX A 174 230.651 -75.081 -82.791 1.00 0.00 H
ATOM 2814 CG2 THX A 174 229.231 -76.511 -82.181 1.00 0.00 C
ATOM 2815 1HG2 THX A 174 228.451 -76.411 -82.951 1.00 0.00 H
ATOM 2816 2HG2 THX A 174 229.861 -77.351 -82.471 1.00 0.00 H
ATOM 2817 3HG2 THX A 174 228.771 -76.881 -81.261 1.00 0.00 H
ATOM 2818 OG1 THX A 174 229.141 -74.291 -81.511 1.00 0.00 O
ATOM 2819 C THX A 174 232.111 -76.601 -81.201 1.00 0.00 C
ATOM 2820 O1 THX A 174 232.911 -76.371 -82.101 1.00 0.00 O
ATOM 2821 P3 THX A 174 227.940 -74.052 -82.816 1.00 0.00 P
ATOM 2822 O2 THX A 174 227.269 -72.653 -82.656 1.00 0.00 O
ATOM 2823 O3 THX A 174 228.744 -74.140 -84.379 1.00 0.00 O
ATOM 2824 O4 THX A 174 226.709 -75.306 -82.719 1.00 0.00 O

I am unable to figure out what went wrong, bcs the rtp file is the same as it was after the first change where it seemed to work. Then what exactly does this current error indicate. I am attaching the aminoacids.rtp in (.xvg format). Any lead would be appreciated.
aminoacids_rtp.xvg (80.2 KB)

Is it supposed to be canonical phosphorylation of threonine (O-phosphothreonine)? If so, the phosphate should be bound to the hydroxyl, replacing the hydrogen there. Right now the phosphate is connected to the previous carbonyl group, with the phosphorus having 5 bonds, which makes little sense chemically. Also, [ bonds ] include atom O which is not defined in [ atoms ].

The residue type can be defined in a local copy of residuetypes.dat, that’s probably what the error is about, but the problems outlined above will persist.

In order to create the phospho-threonine, I did remove the H from the OH manually and using Biovia DSV, I added the PO3(2-) to the O [by fusing the fragment]. Would that be wrong to do so? I have attached the photo. Here the magnified O-H was what edited, but saving it as PDB gave me a coordinate file where the PO3(4 atoms) were saved at the end of the aminoacid sequence as the last residue, that too as HETATM. The file opened as a desired structure but to make the PO3 a part of the THR side chain, I manually brought them up to THR and added right after the O1 because the Phosphate is supposed to be bonded to the O1.

I have clearly mentioned the THX as protein type in the residuetype.dat in the ‘top’ directory (which I assume is common for all the forcefield?). Or do I need to modify something else inside the amber99sb.ff directory? I have already made changes to .rtp .r2b . arn and .hdb files of the aminoacids inside the amber99sb.ff directory. So what else has to be done for the FF to recognize THX as a residue?

I’d try copying residuetype.dat to your local directory to see if that error goes away.

I don’t know Biovia, but apart from manipulating the structure (which you will eventually need), your .rtp has to make sense too. I looked up the file you provided and I can see many problematic lines, from the fact that you still keep the hydroxyl hydrogen to naming issues (O vs OG1 vs O1) to the weird C-P bond that definitely shouldn’t be there (it will attempt to connect P to the C from the previous residue):

I realized the error and have made correction. Instead of doing it manually, i used CHARMM-GUI to phosphorylate my residue, so now I am confident that its correct. I have made corrections to the aa.rtp and rt.dat files which goes by the name THX.

PDB coordinate:

ATOM 2808 N THX A 174 231.841 -74.271 -80.471 1.00 0.00 PROA N
ATOM 2809 HN THX A 174 231.708 -73.522 -81.115 1.00 0.00 PROA H
ATOM 2810 CA THX A 174 231.141 -75.531 -80.731 1.00 0.00 PROA C
ATOM 2811 HA THX A 174 230.646 -75.837 -79.821 1.00 0.00 PROA H
ATOM 2812 CB THX A 174 230.081 -75.331 -81.901 1.00 0.00 PROA C
ATOM 2813 HB THX A 174 230.601 -75.029 -82.835 1.00 0.00 PROA H
ATOM 2814 OG1 THX A 174 229.141 -74.291 -81.511 1.00 0.00 PROA O
ATOM 2815 P THX A 174 227.955 -73.873 -82.500 1.00 0.00 PROA P
ATOM 2816 O1P THX A 174 228.493 -73.339 -83.771 1.00 0.00 PROA O
ATOM 2817 O2P THX A 174 227.055 -75.020 -82.755 1.00 0.00 PROA O
ATOM 2818 OT THX A 174 227.115 -72.732 -81.800 1.00 0.00 PROA O
ATOM 2819 HT THX A 174 227.633 -72.001 -81.455 1.00 0.00 PROA H
ATOM 2820 CG2 THX A 174 229.231 -76.511 -82.181 1.00 0.00 PROA C
ATOM 2821 1HG2 THX A 174 228.406 -76.572 -81.439 1.00 0.00 PROA H
ATOM 2822 2HG2 THX A 174 229.838 -77.439 -82.113 1.00 0.00 PROA H
ATOM 2823 3HG2 THX A 174 228.789 -76.426 -83.197 1.00 0.00 PROA H
ATOM 2824 C THX A 174 232.111 -76.601 -81.201 1.00 0.00 PROA C
ATOM 2825 O THX A 174 232.911 -76.371 -82.101 1.00 0.00 PROA O

.rtp entry

[ THX ]
[ atoms ]
N N -0.41570 1
H H 0.27190 2
CA CT -0.03890 3
HA H1 0.10070 4
CB CT 0.36540 5
HB H1 0.00430 6
OG1 OH -0.67610 7
P P 1.50000 8
O1P OP -0.80000 9
O2P OP -0.80000 10
OT OH -0.67610 11
HT HC 0.06420 12
CG2 CT -0.24380 13
1HG2 HC 0.06420 14
2HG2 HC 0.06420 15
3HG2 HC 0.06420 16
C C 0.59730 17
O OH -0.56790 18
[ bonds ]
N H
N CA
CA HA
CA CB
CA C
CB HB
CB CG2
CB OG1
CG2 HG21
CG2 HG22
CG2 HG23
OG1 P
C O
-C P
P OT
P O1P
P O2P
OT HT
[ impropers ]
-C CA N H
CA +N C O1

But the error continues to happen:
In the chosen force field there is no residue type for ‘THX’

Do I need to edit something else?

you need to add the defitnion for THX wherever it required in the gromacs topology related files.

Can you please which one to be particular? I have already modified the residuetypes.dat in /gromacs2022/shae/gromacs/top/ directory. The aminoacids.rtp also belong to the amber99sb.ff directory in the given directory. Is there something else?