Number of coordinates did not match in coordinated file with the topology file

Thank you so much for your help. While I was able to solve this problem for this system, I am again encountering it for another one. I had the .itp files for the molecule I am now simulating but could not generate .top files using pdb2gmx as my residue is not defined in the database. I manually made a topology file using the info in the .itp file and reconciled it with my pdb structure but in the solvation step I again get this error. Using the command you’ve given, to study my pdb and top files, I found that my pdb files lack hydrogen atom. Since the .itp files are taken from another researcher, I don’t want to edit those, rather find out why my pdb file lacks hydrogen and how can i get a compatible pdb/gro structure files. Could you please help me with this as well?

Hi!

I was preparing files for simulation of a protein-DNA-small molecule/ligand complex in water. The system has 4 protein chains- A, B, C, and D-, 4 DNA chains- E, F, G, and H, two molecules of the drug moxifloxacin (MFX)- chains W and X-, and 4 Mg2+ ions, all identified by chain ID “Z”. Since I read in the GROMACS manual that GROMACS does not handle chain IDs of multi-chain complexes well while creating .gro files, I chose to use PDB files as the output files of each preparatory step giving coordinate files as part of the output, instead of .gro files. I ran the initial topology file generation using pdb2gmx as follows:

gmx pdb2gmx -v -f prot_WT_AMBER.pdb -o Gyr_prot_WT.pdb -water tip3p -ignh -missing

I chose AMBER99SB-ILDN as the force field and used a copy of the force field folder within my working directory as I had modified it so that it would accommodate phosphotyrosine residues within two of the protein chains. The topol.top topology file was generated successfully. Subsequently, I appended the coordinates of the two ligand molecules (two copies of MFX) to the end of the coordinate records of the protein-DNA complex and saved the modified file as a separate PDB file called Gyr_MFX_WT.pdb, which I then used as input for defining a new box around the structure. I then managed to also add TIP3P water molecules in the solvation step:

gmx editconf -f Gyr_MFX_WT.pdb -o Gyr_MFX_WT_nb_pull.pdb -center 6.6977 6.6977 6.6977 -box 20.000 13.3953 13.3953

gmx solvate -cp Gyr_MFX_WT_nb.pdb -cs spc216.gro -o Gyr_MFX_WT_solv.pdb -p topol.top

However, the subsequent preparatory step prior to addition of ions, run with grompp, resulted in a fatal error stating that there was an invalid order for the [ atomtypes ] directive in the .itp file for one of the two MFX molecules. I read in a response to a similar issue raised in this forum that the solution is to collect (cut) the atomtype data from the particular ligands’ .itp files and paste them just after the inclusion statement for the main force field file. I did this. The following is an excerpt of the relevant portion of my topol.top file, after I had made this modification:

; Include forcefield parameters
#include “./amber99sb-ildn.ff/forcefield.itp”

[ atomtypes ]
;name bond_type mass charge ptype sigma epsilon Amb
h1 h1 0.00000 0.00000 A 2.47135e-01 6.56888e-02 ; 1.39 0.0157
ha ha 0.00000 0.00000 A 2.59964e-01 6.27600e-02 ; 1.46 0.0150
hc hc 0.00000 0.00000 A 2.64953e-01 6.56888e-02 ; 1.49 0.0157
f f 0.00000 0.00000 A 3.11815e-01 2.55224e-01 ; 1.75 0.0610
o o 0.00000 0.00000 A 2.95992e-01 8.78640e-01 ; 1.66 0.2100
nh nh 0.00000 0.00000 A 3.25000e-01 7.11280e-01 ; 1.82 0.1700
ca ca 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860
c3 c3 0.00000 0.00000 A 3.39967e-01 4.57730e-01 ; 1.91 0.1094
ce ce 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860
cf cf 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860
n3 n3 0.00000 0.00000 A 3.25000e-01 7.11280e-01 ; 1.82 0.1700
hn hn 0.00000 0.00000 A 1.06908e-01 6.56888e-02 ; 0.60 0.0157
os os 0.00000 0.00000 A 3.00001e-01 7.11280e-01 ; 1.68 0.1700
cx cx 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860
c c 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860

; Include chain topologies
#ifdef POSRES
#include “topol_Protein_chain_A.itp”
#include “topol_Protein_chain_B.itp”
#include “topol_Protein_chain_C.itp”
#include “topol_Protein_chain_D.itp”
#include “topol_DNA_chain_E.itp”
#include “topol_DNA_chain_F.itp”
#include “topol_DNA_chain_G.itp”
#include “topol_DNA_chain_H.itp”
#include “MFX_W_final_dock_with_H_GMX.itp”
#include “MFX_X_final_dock_with_H_GMX.itp”
#include “topol_Ion_chain_Z.itp”
#endif

; Include water topology
#include “./amber99sb-ildn.ff/tip3p.itp”

#ifdef POSRES_WATER
; Position restraint for each water oxygen
[ position_restraints ]
; i funct fcx fcy fcz
1 1 1000 1000 1000
#endif

; Include topology for ions
#include “./amber99sb-ildn.ff/ions.itp”

[ system ]
; Name
Protein in water

[ molecules ]
; Compound #mols
Protein_chain_A 1
Protein_chain_B 1
Protein_chain_C 1
Protein_chain_D 1
DNA_chain_E 1
DNA_chain_F 1
DNA_chain_G 1
DNA_chain_H 1
MFX_W 1
MFX_X 1
Ion_chain_Z 4
SOL 110462

However, upon re-running the grompp command (shown below) I got the following fatal error:

gmx grompp -f ions.mdp -c Gyr_MFX_WT_solv.pdb -p topol.top -o ions.tpr -maxwarn 4

WARNING 1 [file ffbonded.itp, line 68]:
Bondtype Bond was defined previously (e.g. in the forcefield files), and
has now been defined again. This could happen e.g. if you would use a
self-contained molecule .itp file that duplicates or replaces the
contents of the standard force-field files. You should check the contents
of your files and remove such repetition. If you know you should override
the previous definition, then you could choose to suppress this warning
with -maxwarn.

old: 0.148 439320 0.148 439320
new: P O2 1 0.14866 401250.0

WARNING 2 [file ffbonded.itp, line 349]:
Bondtype Angle was defined previously (e.g. in the forcefield files), and
has now been defined again. This could happen e.g. if you would use a
self-contained molecule .itp file that duplicates or replaces the
contents of the standard force-field files. You should check the contents
of your files and remove such repetition. If you know you should override
the previous definition, then you could choose to suppress this warning
with -maxwarn.

old: 108.23 836.8 108.23 836.8
new: OS P O2 1 115.460 367.360

ERROR 1 [file topol_Protein_chain_A.itp, line 39245]:
No default Angle types

ERROR 2 [file topol_Protein_chain_B.itp, line 39245]:
No default Angle types

Fatal error:
number of coordinates in coordinate file (Gyr_MFX_WT_solv.pdb, 356052)
** does not match topology (topol.top, 356064)**

This is particularly vexing as I checked the numbers of coordinates/atoms in each .itp file and found them to match the number of coordinates/atoms of the corresponding chain in the output cordinates file from the solvation step (Gyr_MFX_WT_solv.pdb) (both sets of atoms- from the topologies and from the coordinates file, total 356052), but neither set of atoms, either from the topologies (.itp files) or from the coordinates file could account for the extra 12 atoms in the topology, as alluded to by referring to the topol.top file, in the fatal error message shown above. I have not managed to identify these 12 atoms yet. Please help me to solve this mismatch in the number of coordinates.

[Please note that visual inspection of the atom indices and arithmetic subtraction lead to the conclusion that the coordinates file, after solvation, contained only 31386 “SOL” (water) atoms, but a search (Ctrl + F) within the file as well as a grep command-based analysis of the number of instances of “OW” within the file indicated that the actual number of solvent atoms was 331386, which is exactly 300,000 more, but still does not account for the extra 12 atoms needed to bring the total up to 356064, as alluded to in the fatal error message.]

topol.top (3.1 KB)

Correction:
The chain topology .itp files were included without the #ifdef POSRES…#endif code ecapsulating it. I added these later in an attempt to test whether this would make a difference. It didn’t.

Please help me resolve the coordinate discrepancy problem.

Hi ,
can you please help us with the same error if you got some solution

Command line:
gmx grompp -f em.mdp -p GB_GMX.top -c GB_GMX.gro -o GB_min.tpr

Ignoring obsolete mdp entry ‘ns_type’
Setting the LD random seed to -6329186

Generated 2145 of the 2145 non-bonded parameter combinations
Generating 1-4 interactions: fudge = 0.5

Generated 2145 of the 2145 1-4 parameter combinations

Excluding 3 bonded neighbours molecule type ‘C4N’

Excluding 3 bonded neighbours molecule type ‘C4N’

Excluding 3 bonded neighbours molecule type ‘THG’


Program: gmx grompp, version 2024.5-conda_forge
Source file: src/gromacs/gmxpreprocess/grompp.cpp (line 706)

Fatal error:
number of coordinates in coordinate file (GB_GMX.gro, 142)
does not match topology (GB_GMX.top, 268)
I got this error how to resolve this