Number of coordinates in coordinate file does not match topology

GROMACS version: 2021.4
GROMACS modification:
I started to MD simulate an enzyme with a metal ion and followed the following steps;

  1. pdb2gmx convertion
  2. creation of simulation box
  3. solvation of the simulation box
  4. placed the metal ion replacing a water molecule
  5. electro-neutralization of the system with chloride ions
  6. reduction of number of water molecules equal to number of ions added from the topology file
  7. creation of index file
  8. energy minimisation step
    But, the command gmx grompp -c b4em.pdb -f em01.mdp -n index -p system.top -o em01.tpr gave en error indicating the Number of coordinates in coordinate file (b4em.pdb, 64272) does not match topology (system.top, 67186)
    I have checked with the number of atoms in the two files but found no error in the followed steps.
    And also, this gives [file system.top, line 15]: System has non zero total charge:5.000 Total charge should normally be an integer.
    This is another issue I am facing because in the electro-neutralisation step I have added required number of chloride ions.
    Please help me with this…

If you have added Na/Cl ions using genion, you do not have to modify the number of water molecule manually in the .top file (step 6) - it is done by the tool automatically.

Another possibility is a mistake in step 4: manually adding the ions is error prone (you need to fiddle with coordinates and add the ions to the topology in the correct order). Can you please describe in details how you have proceeded?

Yet another possibility is that you are not using the last .gro file, but one from an ealier step - hence the mismatch.

After solvation step, I randomly selected a water molecule in the active site of the enzyme and replaced that water molecule with the metal ion I am using. This was done in the b4em.pdb file by removing the two hydrogen atom coordinates of the replacing water and changed the atom name O (oxygen) to the As(arsenic) Then for the electro-neutralisation step also followed the same process; randomly selected water molecules replaced with Cl- ions. Number of cl- ions were calculated such that the sum of the charge of the protein and the As(V) is cancelled by the number of cl- ions. In the b4em.pdb file the order of the energy groups was protein, As,Cl and water. And in the system.top file same order was considered and removed a number of water molecules that equal to the sum of As and Cl- ions added. Then for the onward md steps used the b4em.pdb file and the edited system.top file.

Still I am unable to find the mistake here.

It seems you are reusing the same structure file for all steps (b4em.pdb), which might cause problems. Diagnostic would be easier if you used separate structure file for all steps (e.g. gmx pdb2gmx -o prot.gro ..., then gmx editconf -f prot.gro -o box.gro, gmx solvate -f box.gro -o solv.gro copy and edit enzymeion.gro, etc).

Futhermore, can you write down all the gmx command you have used for the steps?

There are also possible problems with the procedure your describe to add the arsenic ions: by removing the two hydrogen atoms, the atom numbering becomes incorrect, – furthermore , the [ molecules ] section of the topology need to have the same order as the structure file, not only the same number. That means that, for instance, if uou have the following section:

[ molecules ]
; Compound        #mols
Protein             1
SOL         6961
AS                1
SOD              20
CLA              21

You need to have a structure file like this:

<protein atom lines>
<water atom lines>
<your arsenic atom>
<ions>

Something like this will not work:

<protein atom lines>
<some water atom lines>
<your arsenic atom>
<some more water atom lines>
<ions>

I would suggest the following protocol:

  1. Find the water molecule you want to replace with arsenic
  2. Open the structure file, and switch the atom coordinate of that molecule with the last molecule
  3. Now, remove the last water line and add the arsenic atom
  4. If using .gro, edit the number of atom at the very top of the file.
  5. Edit the molecule section of the topology like so:
[ molecules ]
; Compound        #mols
Protein             1
SOL         6961   ;  substract 1 here
AS                1
  1. Proceed to neutralize the system with genion instead of manually

Here are the list of commands I have used up to energy minimisation step.

  1. gmx pdb2gmx -f protein00.pdb -inter -p system.top -o protein01.pdb
  2. gmx editconf -f protein01.pdb -o box.pdb -bt cubic -d 1.2
  3. gmx solvate -cp box.pdb -cs -o b4em.pdb -p system.top
  4. gmx make_ndx -f b4em.pdb -o index.ndx
  5. gmx grompp -c b4em.pdb -f em01.pdb -n index.ndx -p system.top -o em01.tpr
  6. gmx mdrun -v -s em01.tpr -c em01.pdb -g em01.log -nice 0

And also, the order of adding arsenic ion and chloride ions in the b4em.pdb file after step 3, was same as the order in the topology file; i.e.

Thank you for the suggestions and I will try them.
Thank you once again.

And another doubt to get clarified is, when inserting the arsenic ion can we do that using pymol software.?
i.e. before starting the md steps first using the pymol software we bring the arsenic ion closer to the active site residues of the protein (Using AutoDock was unable to do the docking of metal ion with the protein). From the output file we then separate the protein and arsenic in to two pdb files as protein00.pdb and arseinc.pdb. Then we give the pdb2gmx command for the protein (input pdb is protein00.pdb and output is protein01.pdb). And before creating the simulation box we combine the protein01.pdb and arsenic.pdb with the command cat protein01.pdb arsenic.pdb >> complex.pdb . Then create the simulation box for the complex.pdb and do solvation step. For the electro-neutralisation of the system add chloride ions by randomly replacing water molecules and include in the b4em.pdb file . Next change the order and the number of molecules in the topology file according to the b4em.pdb. Then continue the rest of the md steps.
Is this method OK and accurate?

The problem with the method is not about the ideas, it is about exactly how the file are modified. The error Number of coordinates in coordinate file and System has non zero total charge:5.000 Total charge should normally be an integer are because somehow the modification was not done right.

You can use PyMol to get the coordinate for the ions, but concatenating pdb files like cat protein01.pdb arsenic.pdb >> complex.pdb will lead to problem.

I suggest the following:

gmx pdb2gmx -f protein00.pdb -inter -p system.top -o prot.gro

gmx editconf -f prot.gro -o box.gro -bt cubic -d 1.2

Copy box.gro to complex.gro. Open complex.gro, add a line for the arsenic ion. At the bottom of the file, you will see something like this

    1CPD     H3   12   2.385   2.523   2.354
    1CPD     H4   13   2.371   2.426   2.498
    1CPD     H5   14   2.185   2.130   2.198
   4.64298   4.64298   4.64298

Add you arsenic ion at the line before the last line, from the coordinate you get from arsenic.pdb you generated with PyMol. Note that .gro file are in nanometer instead of angstrom: divide the coordinate by 10. gro file have specific column number, so take care that the coordinate are aligned with the previous one. After modification, this will look something like this (except for 15 - this should be increased from the line before by the AS line, and the coordinate):

    1CPD     H3   12   2.385   2.523   2.354
    1CPD     H4   13   2.371   2.426   2.498
    1CPD     H5   14   2.185   2.130   2.198
    2AS      AS   15   1.522   2.544   2.311
   4.64298   4.64298   4.64298

At the top of the .gro file, the second to top line is the number of atoms (here, 14). Increase it by one:

CPD_GMX.gro created by acpype (Rev: 365) on Thu Sep 15 11:36:27 2022
   14
    1CPD      C    1   2.363   2.211   2.260
    1CPD     C1    2   2.426   2.314   2.321
    1CPD     C2    3   2.201   2.411   2.365

Modify the last section of system.top

[ molecules ]
; Compound        #mols
Protein             1
AS                1

then, solvating:
gmx solvate -cp complex.gro -cs spc216.gro -o solv.gro -p system.top

Neutralizing the system with genion:
gmx grompp -c solv.gro -f em.mdp -p system.top -o genion.tpr
gmx genion -s genion.tpr -p system.top -o solvions.gro -neutral

gmx grompp -c solvions.gro -f em.mdp -p system.top -o em.tpr
gmx mdrun -v -deffnm em -nice 0

Note that, your forcefiel definition files should contain parameters for the AS atom, otherwise you cannot proceed anyway. Are you sure this is the case? What forcefield are you using?

@ebriand Now the problem is OK. This time I used the genion option for the neutralizing step as you mentioned and the problem got solved. So might be I have done a mistake somewhere in editing b4em.pdb file. Thank you very much for helping me.