Multiple molecules for two types of molecules

GROMACS version: 5.1
GROMACS modification: No

I want to simulate two types of small molecules in the system, and each type there are multiple of them.
E.g. 15 x molecule A, 3 x molecule B

I have created the pdb file containing all molecules randomly arranged in the box, topped up with water as well.

The question i have is, since there are two types of molecules, can i have two ,itp files for each molecule or do the .itp files need to be combined?

When i had two separate .itp files, there was this error:

So i thought that gromacs did not recognise two different .itp files even when i #include both of them in file, with correct names for [ moleculetypes ] defined in each .itp file.
Thus, i went to combine the .itp files into a single file, and then i received this error:

The thing is, i cant simply change atom numbers in .itp to match those in solvated.pdb because of multiple molecules.
Would it be ok to use -maxwarn 1 to ignore those atom name warnings and let the atom names from topology be used instead of those in pdb file?

I’m not sure how to go about this step, would appreciate advice if anyone has done this before.


If i used -maxwarn 1, i am able to proceed with energy minimization.
But i havent never seen the system run so slow before, even in energy minimization. It runs for around 17 steps before it no longer seems to continue. Maybe it does, but it is extremely slow.

Here is my em.mdp file. Could it be any settings that cause such slow speeds?

em.mdp (831 Bytes)

I have tested the same energy minimization without solvent and it seems to run just fine, and at the regular speed of printing each step out.
Now i’m wondering how the presence of solvent could drastically influence processing speed…

Do not use -maxwarn 1 unless you know what you are doing.

Yes, you can have them separately. I have had 14 different molecules in the same system, all with separate .itp files.

The order of the atoms in the molecule .itp file have to be exactly the same as for the molecule that was inserted into the entire system coordinate file. Plus you need to ensure that the order of sections in the molecule .itp are correct, see

Walk before you can run. Ensure the .itp for each molecule is set up correctly by setting up an energy minimisation of a single molecule in a box.

If you get that working, then make up your entire system coordinate box, include the molecule .itp files in the file, and ensure that entires in the [ molecules ] exactly match the order that the molecules were added to the system coordinate file (and appear in that coordinate file).

I realised it was this order of atoms/molecules that caused all the subsequent problems.

Lets say my system consists of 3x molecule A and 15x molecule B.

At the very beginning, i used gmx insert-molecules to randomise molecule A in system.
Then i used gmx insert-molecules again to randomise molecule B in system.

If .itp file only has atom order for molecule A/B for example, but i have multiple A and B in system and in pdb file, their atom numbers run consecutively, how would this play out?
I dont suppose i can split the atom numbering within pdb file to start from 1 for each molecule because this would be another error?

Numbering doesn’t matter, grompp takes care of all that. What is important is the order.

As you have noted, having a combined molecule .itp file can be a bad idea, as what ever is in the system coordinate file has to match that exactly. So you can’t add differing numbers of the molecules if the combined molecule .itp contains 1 of each.

I’ve already given you the solution to your problem, two separate molecule .itp files, and bam, problem solved. You just need to ensure that the atoms are in the same order in both the molecule .itp file and molecule coordinate file.

i have simplified the system to have just 1x moleculeA and 6x molecule B.
Now with separate .itp files as well.
Order is correct for #include in the .top file and .pdb file.

But i am still getting the atomtypes error.

I saw on researchgate that someone had created another .itp file just for atomtypes and pairtypes of both molecule A and B together, leaving [ moleculetypes ] in their corresponding individual .itp files.
Is this necessary?

Follow the link above and ensure that the format for your .itp files follows that. Or put up the files on a file server somewhere so that we can look at them. [ atomstypes ] isn’t meant to appear in the .itp files, it normally kept within the forcefield files. Apologies, I overlooked that, that is what the

Invalid order for directive atomtypes

error means, you have a second [ atomtypes ] section. First is in the FF (ffnonbonded.itp ), second for some reason you have it your .itp file. Some more explanation of what you are doing is warranted.

ok i just got a realisation that .itp files do not always need to contain atomtypes or pairtypes sections.
Either multiple .itp files used should be #include with the very first .itp file referencing atomtypes and pairtypes, or have a separate .itp file to contain atomtypes pairtypes while other molecule.itp files do not have those two sections at all.
Thanks for pointing that out!

The next issue i got is this:

With .pdb having multiple same molecules, should each molecule be given a ‘model’ section or it doesnt matter?

Here are the required files:

Delete first 43 lines from loratadine.itp. You are better off placing those within the FF files, if for some reason you have edited the FF values. If it is a custom FF, don’t edit your installed version, make a copy in the directory you are running things in, and make the changes there.

You’d be better off too having a different residue name for both of those molecules, makes it easier for visualisation when you can just pick via residue name.

The error is caused by what I have pointed out a few times already. The atoms have to be in exactly the same order in the .itp file and the coordinate file, plus the order of molecules has to be the same between both the topology and the coordinate file. The solvated.pdb has loratadine first (I think, bit hard to tell for sure as the residue names are the same), where as your topology says otherwise:

[ molecules ]
;Compound #mols
kleptosehpb 6
loratadine 1
SOL 17622

Oh! Im so sorry i missed that out. Kept mistaking what you meant as the [ moleculetypes ] present within .itp files.
One question about that: now that i know that order of [ molecules ] in file is important, is the order of #include “molecule.itp” important in the same way?
If [ molecules ] in is A before B, must i have #include “A” before #include “B”?

I havent come across this topic before. Usually id use the ff within gromacs and if needed, i’ll download the full ff folder from charmm for example. I havent done any editing of ff items before.
What do you mean by placing the loratadine lines within ff files?

Thanks a lot for your help and patience @Dr_DBW !
NVT is currently running smoothly now :)