I am trying to define a new region of torus shape by modifying the region_cylinder source code.
From RegCylinder::surface_interior, there is a contact[n].radius value where region.h says it’s the “curvature of region at contact point”. Cylinder’s curved interior surface has -2radius for this value, sphere’s interior has -radius, and one of cone’s interior surface has a similar one as comparing to the cylinder.
It makes sense that there is a sign change from interior surface to exterior surface, but where do these values come from? Neither radius of curvature or Gaussian curvature applies to them. Should I just put -2radius for my torus interior curved surface?
As far as can be seen from looking at the source code and change history of LAMMPS, the radius member in the Contact struct is used/set by fix wall/gran/region and is initialized to the radius of the individual particle in contact with the (surface of the) region. Correspondingly, its value has to be set in such a way, that all extended particles (i.e. particles with a given radius like in granular (aka DEM) simulations) are properly considered that may be in contact with the surface of a region. That is determined by geometric considerations and thus different, if you have to consider a convex or concave surface.
p.s.: for more details you may want to contact the author for fix wall/gran/region directly.