Hello,
I have a composite shape made of 4 rotated and translated half hyperboloids. This is suppose to model the intersection of 4 laser beams.
I’ve been working on a simulation of the interaction of a beam of atoms with these 4 laser beams. I do this using a montecarlo approach to decide if the atoms absorb photons from a particular beam (thus getting a momentum kick). They can then spontaneously decay (getting another kick). However, this simulation first has a free propagation part, which relies on the method DistFromOutside to check whether the atom will go through the volume defined by the beams and also estimate this distance.
Unfortunately, My program’s memory usages spikes incredibly when I shift the position of the laser beams causing some of the atoms to “miss” them (this does not happen when the atoms all go through the laser area, meaning that the method DistFromOutside gives a “finite” value).
I’m puzzled as to why this is happening. The following is a part of my code:
dist_atom_mol = beams->DistFromOutside( pos , dir );
if ( dist_atom_mol > 2 * molcham_rmin * 100 )
atom_out = 1;
dtp[0] = ( dist_atom_mol / 100 ) / v.Mag() / sampling;
//------LVIS propagation prior to molasses beams------//
while ( atom_out == 0 && ! beams->Contains( pos ) )
{.....
The indicator atom_out just tells me if the atom will miss the laser region. Thus it will not enter the while loop that follows. I then use the computed distance to calculate a time step that I will use inside the loop.
I decided that I should better understand the DistFromOutside method to make sure that is not causing problems, so I wrote a very simple script (attached file) that creates a Box shape and then I create two points outside of it. Using DistFromOutside I ask what the distance to the box is. Point 1 correctly gives the distance. Point 2 distance to the box is intentionally asked in a direction that there is no possible way it will intersect the box. However, upon playing with the method’s options I don’t get the expected behavior.
For example if I choose iact = 0, I had no real expectations for what the value of safe_distance would be and I got 10. What bothered me is that despite specifying my own STEP = 100., the method still returned the default STEP value of 1.e30 (given by a call to some function Big() ).
Then I chose iact = 1 and I got the exact same behavior. I suppose Safe_distance = 10 (?). In line of this I lowered my proposed STEP to 9 so the method would return 9, as described in the manual. Well, it didn’t. It returned 1.e30 still and now safe_distance = 0. what!?
I tried options 2 and 3 and got same problems. I’ve tried all options on my actual code without any success. It’s possible I have some bugs lurking in my code and I will try to debug, but I was puzzled by DistFromOutside behavior.
Any help is greatly appreciated
Thanks!
create_box.C (1.63 KB)