modify the gemdphi calculation function to assign valid gemdphi to LCT w...

...hen gem is available in reasonable position