fix gcmc / hybrid md + regions

Hi folks,

there is probably some conceptional problem hidden
in the assumptions made in the gcmc code which shows
up immediately if doing hybrid mc/md runs with regions.

For example: gcmc with small molecules (spc water) - if one
move is attempted in FixGCMC::attempt_molecule_translation_full(),
the c.o.m. of the molecule is determined, and some random displacement
is attempted on the c.o.m. *If regions are used*, this randomized
displacement is *repeated until the c.o.m. is within the target region*
as stated in the fix gcmc command.

When combining gcmc with nvt or similar, the gcmc procedures are invoked
after N MD steps, just as the gcmc parameter N says. But, if MD is
applied to the group of the molecules to-be-inserted, there is a high
chance for finding the molecule outside it's gcmc insertion region -
which is not necessarily wrong and should in principle be possible
(there is a 1/1 chance the molecule will return to the region somewhat
later).

In the current state - if the molecule is moved outside the insertion
region by more than the maximum displacement length, the gcmc procedures
will just start an infinite loop because none of the function test
whether the molecule was before the move inside the region. This
is simply assumed.

[fix_gcmc.cpp:1570 - ifinite loop]
...
while(domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) {
    rsq = 1.1;
    while (rsq > 1.0) {
       rx = 2*random_equal->uniform() - 1.0;
       ry = 2*random_equal->uniform() - 1.0;
       rz = 2*random_equal->uniform() - 1.0;
       rsq = rx*rx + ry*ry + rz*rz;
    }
    coord[0] = com[0] + displace*rx;
    coord[1] = com[1] + displace*ry;
    coord[2] = com[2] + displace*rz;
}
...

So, how would we proceed from here? Should this (hybrid MC/MD)
be considered and the source at several places modified or should
this possibility be ignored?

Thanks & Regards

M.