Applying constraints to different molecules in a same system

GROMACS version: 2019.6
GROMACS modification: Yes/No

Dear Community,

I am trying to simulate a hydrophobic polymer in Madrid-2019 sulfate salt with TIP4P/2005 water.

My polymer has 32 monomers connected via bonds and angles. The bond is constrained, but the angle is not.

Now I have the sulfate model where I have a virtual site and the sulfate model is rigid. So I use “constraints = all-angles” in the mdp file when I simulate sulfate + water (no polymer) and it works perfectly.

But now when I want to simulate the polymer + sulfate + water, I want to keep the angles of the polymer flexible and the bonds of the polymer constrained and also keeping all the bonds and angles constrained in the sulfate. How do I do that? So far I could not find any solution. Any help would be appreciated. Thank you. I attach the topology here for convenience.

1. Polymer

[ moleculetype ]
; Name nrexcl
POL 2

[ atoms ]
; nr type resnr resid atom cgnr charge mass
1 P 1 POL P 1 0.000 14.0270
2 P 1 POL P 2 0.000 14.0270
3 P 1 POL P 3 0.000 14.0270
4 P 1 POL P 4 0.000 14.0270
5 P 1 POL P 5 0.000 14.0270
6 P 1 POL P 6 0.000 14.0270
7 P 1 POL P 7 0.000 14.0270
8 P 1 POL P 8 0.000 14.0270
9 P 1 POL P 9 0.000 14.0270
10 P 1 POL P 10 0.000 14.0270
11 P 1 POL P 11 0.000 14.0270
12 P 1 POL P 12 0.000 14.0270
13 P 1 POL P 13 0.000 14.0270
14 P 1 POL P 14 0.000 14.0270
15 P 1 POL P 15 0.000 14.0270
16 P 1 POL P 16 0.000 14.0270
17 P 1 POL P 17 0.000 14.0270
18 P 1 POL P 18 0.000 14.0270
19 P 1 POL P 19 0.000 14.0270
20 P 1 POL P 20 0.000 14.0270
21 P 1 POL P 21 0.000 14.0270
22 P 1 POL P 22 0.000 14.0270
23 P 1 POL P 23 0.000 14.0270
24 P 1 POL P 24 0.000 14.0270
25 P 1 POL P 25 0.000 14.0270
26 P 1 POL P 26 0.000 14.0270
27 P 1 POL P 27 0.000 14.0270
28 P 1 POL P 28 0.000 14.0270
29 P 1 POL P 29 0.000 14.0270
30 P 1 POL P 30 0.000 14.0270
31 P 1 POL P 31 0.000 14.0270
32 P 1 POL P 32 0.000 14.0270

[ bonds ]
; ai aj fu b0 kb
1 2 1 0.1530 330000.0
2 3 1 0.1530 330000.0
3 4 1 0.1530 330000.0
4 5 1 0.1530 330000.0
5 6 1 0.1530 330000.0
6 7 1 0.1530 330000.0
7 8 1 0.1530 330000.0
8 9 1 0.1530 330000.0
9 10 1 0.1530 330000.0
10 11 1 0.1530 330000.0
11 12 1 0.1530 330000.0
12 13 1 0.1530 330000.0
13 14 1 0.1530 330000.0
14 15 1 0.1530 330000.0
15 16 1 0.1530 330000.0
16 17 1 0.1530 330000.0
17 18 1 0.1530 330000.0
18 19 1 0.1530 330000.0
19 20 1 0.1530 330000.0
20 21 1 0.1530 330000.0
21 22 1 0.1530 330000.0
22 23 1 0.1530 330000.0
23 24 1 0.1530 330000.0
24 25 1 0.1530 330000.0
25 26 1 0.1530 330000.0
26 27 1 0.1530 330000.0
27 28 1 0.1530 330000.0
28 29 1 0.1530 330000.0
29 30 1 0.1530 330000.0
30 31 1 0.1530 330000.0
31 32 1 0.1530 330000.0

[ angles ]
; ai aj ak fu theta0 ktheta
1 2 3 2 111.000 100.000
2 3 4 2 111.000 100.000
3 4 5 2 111.000 100.000
4 5 6 2 111.000 100.000
5 6 7 2 111.000 100.000
6 7 8 2 111.000 100.000
7 8 9 2 111.000 100.000
8 9 10 2 111.000 100.000
9 10 11 2 111.000 100.000
10 11 12 2 111.000 100.000
11 12 13 2 111.000 100.000
12 13 14 2 111.000 100.000
13 14 15 2 111.000 100.000
14 15 16 2 111.000 100.000
15 16 17 2 111.000 100.000
16 17 18 2 111.000 100.000
17 18 19 2 111.000 100.000
18 19 20 2 111.000 100.000
19 20 21 2 111.000 100.000
20 21 22 2 111.000 100.000
21 22 23 2 111.000 100.000
22 23 24 2 111.000 100.000
23 24 25 2 111.000 100.000
24 25 26 2 111.000 100.000
25 26 27 2 111.000 100.000
26 27 28 2 111.000 100.000
27 28 29 2 111.000 100.000
28 29 30 2 111.000 100.000
29 30 31 2 111.000 100.000
30 31 32 2 111.000 100.000

3. Sulfate

[moleculetype]
; name nrexcl
SO4 1

[atoms]
;nr type resnr residu atom cgnr charge
1 OSO4 1 SO4 O1 1 -0.65 24.01565
2 OSO4 1 SO4 O2 1 -0.65 24.01565
3 OSO4 1 SO4 O3 1 -0.65 24.01565
4 OSO4 1 SO4 O4 1 -0.65 24.01565
5 SSO4 1 SO4 S5 1 0.9 0.0

[constraints]
;i j funct dist
; dist_OX=0.149; dist_XX=2*sqrt(2/3)*dist_OX
1 2 1 0.243316
1 3 1 0.243316
1 4 1 0.243316
2 3 1 0.243316
2 4 1 0.243316
3 4 1 0.243316

[exclusions]
1 2 3 4 5
2 1 3 4 5
3 1 2 4 5
4 1 2 3 5
5 1 2 3 4

[ virtual_sitesn ]

; Site funct from
5 1 1 2 3 4

Best,
Abhishek