########################################################## # Summary: # The following example uses fix wall/region to apply an inward harmonic force # -2*k*(r - (rc0-rc)) # to every particle (group "all") whose distance from the origin, r, # exceeds the inner radius, rc0-rc, (which is currently set to 30.0) # # here "rc" is the wall thickness parameter (used with fix wall/region) # and "rc0" is the size of the region (defined with the region command.) # (= 30.0 + wall_thickness in this example) # # How "hard" the surface is can be controlled by the "k" parameter # (currently set to 50.0 in the example below.) # ########################################################## # Define "rSphere", a spherical region (used by LAMMPS fix wall/region) # # sphere_center radius # x0 y0 z0 rc0 # | | | | # \|/ \|/ \|/ \|/ # V V V V region rSphere sphere 0 0 0 230.0 side in # This sets the parameter "rc0" equal to 230.0. # The "230.0" means we assume no particle will ever be further than 230.0 # from the center of the sphere (which we placed at the origin in this example). # I made this radius extremely large to make sure that this never happens. # (Depending on the size of your system, you may have to adjust this.) # Now apply an inward force applied to every particle which lies outside # a spherical region (of radius rc0-rc) # The energy of each particle (due to that force) is: # # Uexternal(r) = k*(rsurf-rc)^2 # where "rsurf" = the distance from the particle to the surface = rc0 - r # = k*((rc0-rc) - r)^2 # # k ignore rc # | | | # \|/ \|/ \|/ # V V V fix fxWall all wall/region rSphere harmonic 50.0 0.0 200.0 # Uexternal(r) = k*(r - (rc0-rc))^2 (if (rc0-rc) < r < rc0, 0 otherwise) # # Note that rc0-rc = 30.0 # = the "inner" sphere radius # For an explanation of these commands go here: # http://lammps.sandia.gov/doc/fix_wall_region.html # http://lammps.sandia.gov/doc/region.html