refactored electron positioning calculations