module electrondistancemodule
contains
subroutine electrondistance(rx,ry,rz)

	implicit none
   ! integer, dimension(:), intent(inout) :: v    !global parameters !v(1) is valance electron, v(6) is core electron
    double precision, dimension(:), intent(in) :: rx,ry,rz
   ! double precision, intent(out) :: radius
    integer p1,p2,e1,e2,n1,n2,m,i,j
    double precision comx,comy,comz,mp,mne,d1,d2,d3,d4,d5,d6,r1,rn


mp=1836.1526    !proton/electron mass ratio
mne=1838.684    !neutron/electron mass ratio

p1=7
p2=12
e1=1
e2=6
n1=13
n2=18


!Center of Mass
comx=(rx(7)*mp+rx(8)*mp+rx(9)*mp+rx(10)*mp+rx(11)*mp+rx(12)*mp+rx(13)*mne+rx(14)*mne+rx(15)*mne+rx(16)*mne+rx(17)*mne+rx(18)*mne)/&
        (6.0*mp+6.0*mne)
comy=(ry(7)*mp+ry(8)*mp+ry(9)*mp+ry(10)*mp+ry(11)*mp+ry(12)*mp+ry(13)*mne+ry(14)*mne+ry(15)*mne+ry(16)*mne+ry(17)*mne+ry(18)*mne)/&
        (6.0*mp+6.0*mne)
comz=(rz(7)*mp+rz(8)*mp+rz(9)*mp+rz(10)*mp+rz(11)*mp+rz(12)*mp+rz(13)*mne+rz(14)*mne+rz(15)*mne+rz(16)*mne+rz(17)*mne+rz(18)*mne)/&
        (6.0*mp+6.0*mne)

!distance between nucleus and each electron
d1=sqrt((comx-rx(1))**2+(comy-ry(1))**2+(comz-rz(1))**2)  !d1 for electron 1
d2=sqrt((comx-rx(2))**2+(comy-ry(2))**2+(comz-rz(2))**2)  !d2 for electron 2
d3=sqrt((comx-rx(3))**2+(comy-ry(3))**2+(comz-rz(3))**2)  !d3 for electron 3
d4=sqrt((comx-rx(4))**2+(comy-ry(4))**2+(comz-rz(4))**2)  !d4 for electron 4
d5=sqrt((comx-rx(5))**2+(comy-ry(5))**2+(comz-rz(5))**2)  !d5 for electron 5
d6=sqrt((comx-rx(6))**2+(comy-ry(6))**2+(comz-rz(6))**2)  !d6 for electron 6



write(13,*) d1,d2,d3,d4,d5,d6



end subroutine electrondistance
end module electrondistancemodule
	  
