# Error with virtual sites

**URL:** <https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111>\
**Category:** User discussions\
**Created:** [November 18, 2020, 1:48pm UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111 "2020-11-18T13:48:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yasser.almeida](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@yasser.almeida](https://gromacs.bioexcel.eu/u/yasser.almeida)\
**Post date:** [November 18, 2020, 1:48pm UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/1 "2020-11-18T13:48:08Z")

</div>

GROMACS version: 2020.1  
GROMACS modification: No  
Hi all,

I am trying to set virtual sites (VS) located at the COM of water TIP3P water molecules. However, I get the error with `grompp`:

```
ERROR 1 [file VS-water_mapping.itp, line 121]:
  The total mass of the construting atoms is zero

```

(The error message has a typo, btw).

Water coordinates mapped are:

```
(...)
  114TIP3 OH2 340 2.512 2.491 2.441
  114TIP3 H1 341 2.606 2.472 2.435
  114TIP3 H2 342 2.473 2.410 2.474
(...)

```

and the line in the mapping .itp file is:

```
#define mapping virtual_sitesn
[mapping]
(...)
6955	2	340	341	342
(...)

```

The masses of the atoms are well defined in the force field.

Any thoughts?

Thanks in advance.

Best  
-Yasser

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [November 18, 2020, 7:40pm UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/2 "2020-11-18T19:40:51Z")

</div>

Hi,  
Maybe the problem is in the order in which the files are included in the topol.top  
Is the water .itp included before VS-water\_mapping.itp?

Kind regards  
Alessandra

---

<div class="post-metadata">

**Author:** ![yasser.almeida](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@yasser.almeida](https://gromacs.bioexcel.eu/u/yasser.almeida)\
**Post date:** [November 19, 2020, 8:29am UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/3 "2020-11-19T08:29:42Z")

</div>

Hi Alessandra,

Thank you for your reply.

> [@alevilla](#):
>
> Is the water .itp included before VS-water\_mapping.itp?

Yes. Bellow is a fragment of my `.top` file.

```
; Include forcefield parameters
#include "./FF/forcefield.itp"

; Restrained water
#include "./FF/restrained_water.itp"

(...)

; Include mapping of VS onto restrained waters
#include "./FF/VS-water_mapping.itp"

[system]
; Name
Waters and VSs

[molecules]
; Compound #mols
TP3R 137
(...)
VS 137

```

That is also the order in my `.gro` file. The restrained waters come first and the VS are at the end of the file. The VS are defined under the [atomtypes] directive in `forcefield.itp` as:

```
[atomtypes]
; type atnum mass charge ptype sigma epsilon
  (...)
  VS 0 0.0000	0.00 A 0.0 0.0

```

Best,  
-Yasser

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [November 19, 2020, 9:18am UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/4 "2020-11-19T09:18:50Z")

</div>

Hi,  
Thank you. From the data you sent I can not see where you include the water topology. Your water is called TP3R. Thus water topology looks like

[moleculetype]  
; molname nrexcl  
TP3R 2  
[atoms]  
…

Is this before the virtual site definition?  
Second, you can check that the atom types of the TP3R (not atom name) are properly defined (with a mass) in the ffnonbonded.itp.

I hope it helps  
Alessandra

---

<div class="post-metadata">

**Author:** ![yasser.almeida](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@yasser.almeida](https://gromacs.bioexcel.eu/u/yasser.almeida)\
**Post date:** [November 19, 2020, 9:42am UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/5 "2020-11-19T09:42:23Z")

</div>

Hi Alessandra,

Yes, the TP3R topology (TP3R is a just a name I use to define restrained TIP3 waters) is:

```
[moleculetype]
; name	nrexcl
TP3R 2

[atoms]
; nr type	resnr	residu	atom	cgnr	charge mass
     1 OT 1 TIP3 OH2 1 -0.834000 15.9994 
     2 HT 1 TIP3 H1 2 0.417000 1.0080 
     3 HT 1 TIP3 H2 3 0.417000 1.0080 

(...)

```

This topology is included before the VS definition.

The atom types are defined in a “mini”-`forcefield.itp` as:

```
[atomtypes]
; name	at.num mass charge ptype sigma epsilon
    HT 1 1.0080 0.417 A 4.00013524445e-02 1.924640e-01 
    OT 8 15.9994 -0.834 A 3.15057422683e-01 6.363864e-01 
	VS 0 0.0000 0.00 A 0.0 0.0 
(...)

```

Best,  
-Yasser

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [November 19, 2020, 10:37am UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/6 "2020-11-19T10:37:20Z")

</div>

You can’t use global atom numbers in the virtual site definition. The only valid options are the atom numbers in the `[moleculetype]` definition (which must also include the virtual site). So you need to add the VS as atom 4 in the TP3R definition and then

```
[virtual_sitesn]
4 2 1 2 3
```

This means the use of the virtual site applies globally to anything defined as T3PR.

---

<div class="post-metadata">

**Author:** ![yasser.almeida](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@yasser.almeida](https://gromacs.bioexcel.eu/u/yasser.almeida)\
**Post date:** [November 19, 2020, 3:04pm UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/7 "2020-11-19T15:04:11Z")

</div>

Dear Justin,

Thank you for your reply. I just realized that by inspecting the file `tip4p.itp` (in charmm36-jul2020.ff) which contains a virtual site. So, in analogy with this, I modified my setup as:

“mini”-`forcefield.itp`:

```
[atomtypes]
; name	at.num mass charge ptype	sigma epsilon
  HT 1 1.0080 0.417 A 4.00013524445e-02 1.924640e-01 
  OT 8 15.9994 -0.834 A 3.15057422683e-01 6.363864e-01 
  VS3	0 0.0000 0.00 A 0.0 0.0
(...)

```

`TP3R.itp`:

```
[moleculetype]
; name	nrexcl
TP3R 2

[atoms]
; nr	type	resnr	residu	atom	cgnr	charge	mass
     1 OT 1 TIP3 OH2 1 -0.834000 15.9994
     2 HT 1 TIP3 H1 1 0.417000 1.0080
     3 HT 1 TIP3 H2 1 0.417000 1.0080
	 4 VS3 1 TIP3 VS 1 0.000000 0.0000

[settles]
; OW funct doh dhh
  1 1 9.572000e-02 1.513900e-01

[exclusions]
	1	2	3	4
	2	1	3	4
	3	1	2	4
	4	1	2	3
	
[virtual_sitesn]
; vs	type_com mapped_atoms
   4 2	1	2	3

```

It’s that correct?

Best  
-Yasser

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [November 19, 2020, 7:38pm UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/8 "2020-11-19T19:38:48Z")

</div>

Looks reasonable. Try it and see :)

---

<div class="post-metadata">

**Author:** ![yasser.almeida](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@yasser.almeida](https://gromacs.bioexcel.eu/u/yasser.almeida)\
**Post date:** [November 20, 2020, 5:21pm UTC](https://gromacs.bioexcel.eu/t/error-with-virtual-sites/1111/9 "2020-11-20T17:21:58Z")

</div>

It worked!

Thanks
