[lammps-users] Modifying fix.cpp and fix.h to work by region

Hello all,

I need to modify the fix addforce command to work by regions, and I'm
having a bit of trouble. The fix_add_force.cpp and .h files make no
mention of groups or regions, but the fix.cpp and fix.h files do.
This presents a problem, since I don't want every fix to work by
regions, just the one. In any case, I'm not familiar with C++ code
and can't get LAMMPS to accept any changes I try to make. Here's what
I've done:

Copied fix.cpp and .h into new files fixmod.cpp and fixmod.h


    #include "group.h"

    igroup = group->find(arg[1]);
    if (igroup == -1) error->all("Could not find fix group ID");
    groupbit = group->bitmask[igroup];


    #include "region.h"

    igroup = domain->find(arg[1]);
    if (igroup == -1) error->all("Could not find fix region ID");
    groupbit = domain->bitmask[igroup];

(got the region code from the set command and modified to match. I
figured it would be easier to leave igroup as it is instead of
changing to iregion, which gives me more errors)

As it stands now, I'm getting errors related to my use of 'domain'
when I try to build LAMMPS. Note, I have not modified style_user.h at
all yet.

Any ideas?

Heath Rice

You'd need to include domain.h to use it in
another file. Also it has no variable bitmask (see domain.h)
so that line won't work. Probably you want something like:


to test atom positions.