force calculation

i want to find out the force acting on a particle in fluid subjected to temperature gradient. For the same i want to attach the particle at a particular location in simulation box so that if i know the spring constant and the displacement of centre of mass of particle i can find out the forces. How can i implement the same in lammps

There are several “spring” fixes, which attach tethers

to particles. E.g. fix spring.

Steve