Semipermeable moving sphere- wall in DPD simulation

I made a DPD simulation using pair_style hybrid dpd with srp:

units lj
atom_style angle

pair_style hybrid dpd 1.0 1.0 12345 srp 0.8 * min exclude yes
pair_coeff * * dpd 25.0 1.5 1.0
pair_coeff * * srp 25.0 0.5
pair_coeff 1 1 dpd 25.0 4.5 1.0
pair_coeff 2 2 dpd 25.0 4.5 1.0 #explicit solvent
pair_coeff 1 2 dpd 20.0 4.5 1.0
pair_coeff 1 3 none
pair_coeff 2 3 none
pair_coeff 3 3 srp 25.0 0.5

bond_style …

angle_style …

fix 1 all nve

For further analysis of the system I need to calculate the bulk modulus by increasing osmotic pressure to the dissolved molecule. The sphere should have a harmonic repulsion to the dissolved molecule - but not the the solvent. Decreasing the sphere radius should increase osmotic pressure. I thought about proceeding with something like:

fix wall/harmonic
fix wall/piston

but I’m not really sure how to proceed. Any help?

This sounds more like you need fix wall/region

Thank you, I added:

region bulk_sphere sphere 10.63808103 10.83978639 11.97201475 7.220775 # x y z (of center of (network)mass) and sphere radius/max distance of network bead to center of mass + delta

fix wall net wall/region bulk_sphere harmonic 1.0 0.0 2.5

compute myStress net stress/atom NULL

I’m not sure if that is right. To calculate the osmotic pressure I need the averaged xx, yy and zz components of the stress tensor. So I tried:
compute 2 net reduce ave c_myStress[*]
compute 3 net reduce ave c_myStress[1] c_myStress[2] c_myStress[3]

even after reading 8.3.1. Output from LAMMPS (thermo, dumps, computes, fixes, variables) — LAMMPS documentation I’m not sure if the output is quite right:

dump stress_dum net custom 10 stress.dat c_myStress[1] c_myStress[2] c_myStress[3]

are the dumped components averaged? The components of the stress tensor should probably be positiv, so I’m pretty sure something is wrong:
0.0000000000000000e+00 2.5000000000000000e+01
0.0000000000000000e+00 2.5000000000000000e+01
0.0000000000000000e+00 2.5000000000000000e+01
ITEM: ATOMS c_myStress[1] c_myStress[2] c_myStress[3]
-8.21637 -11.5477 -9.66462
-2.29577 2.86818 -2.80744
-9.17369 -15.4777 -5.14194
-3.08181 -8.81003 -15.2949
-5.07655 -10.7768 -10.5143

Sorry, but this is at a level where you need to discuss with your adviser/supervisor/colleagues or people that are familiar with the kind of research you are doing. What LAMMPS does is described in the manual. If you have a question about specifics of the documentation or find an instance where the description is in conflict with the behavior, I can try to help you. But you are now essentially asking me how to do your research and that is outside the scope of this category (and my availability). Any time you write “I don’t know if this is right” you either have to discuss with somebody knowledgeable in your area of research whether this is the correct approach or you need to construct a simple test (for just that command) where you can verify that what is written in the documentation and thus what you are using as input works as described and expected. That is your job as a researcher.