      SUBROUTINE CONFIG(IMC)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      PARAMETER(MAXELE=15)
      COMMON /C4/ NELEC,X(3,MAXELE),WTOT
C
C CALCULATE THE POINTS USING SINGLE AVERAGED BIASED SELECTION
C
      NUP=6
      CALL XNFIND(X,WTOT1,NUP)
C
      WTOT=WTOT1
      RETURN
      END
C
      SUBROUTINE XNFIND(X,WXT,NUP)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      PARAMETER(MAXPTS=65)
      DIMENSION X(3,NUP)
      COMMON /PTS/ SPTS(MAXPTS),SVAL(MAXPTS),SINT(MAXPTS),SDER(MAXPTS)
      COMMON /MISC/ PI
C
C CHOOSE A RANDOM 3D CARTEASIAN POINT X
C RADIAL PART PICKED FROM THE DISTRIBUTION SINT OF ORBITAL #IORB
C ANGULAR PARTS CHOSEN RANDOMLY
C
      WXT=1
      DO I=1,NUP
        TEMP=RNDMF(0.0)*SINT(MAXPTS)
        CALL LOCATE(SINT,MAXPTS,TEMP,INEW)
        EP=2*(TEMP-SINT(INEW))
        R=SPTS(INEW)+EP/(SVAL(INEW)+SQRT(SVAL(INEW)*
     1    SVAL(INEW)+SDER(INEW)*EP))
        PHI=2.0*PI*RNDMF(0.0)
        AMU=2.0*RNDMF(0.0)-1.0
        AMSU=SQRT(1.0-AMU*AMU)
C NOW CONVERT TO CARTESIAN COORDINATES
        X(1,I)=R*AMSU*SIN(PHI)
        X(2,I)=R*AMSU*COS(PHI)
        X(3,I)=R*AMU
        WX=SVAL(INEW)+(R-SPTS(INEW))*SDER(INEW)
        WX=WX/(4.0*PI*R*R*SINT(MAXPTS))
        WXT=WXT*WX
      ENDDO
      RETURN
      END
