I've been working some more on this and have now got something that seems to give reliable results (code attached).
The biggest problem seems to be what you set the tip chord to. In the original script this was set to 1% of the root chord, but this was often giving the crazy results at the tips that I mentioned earlier. Increasing this to 5% of the root chord prevented those crazy results and now I'm getting a smooth load distribution that drops to 0 at the tips. I also tried 2%, that was better than 1%, but in some circumstances could still give some nasties.
Also I went with Daniel's advice and added an iterative loop to find that chord which gave the required area, although I did it slightly differently, using the error between the actual wing area and the desired wing area to work out the factor to change the chord by, which I think converges on the correct area more rapidly (although I probably should have been changing by the square root of the area, thinking about it now!).
Anyway, it now gives something like a smoothish trend when changing the n value. Varying the n from 0.8 to 3.8 where n=1 is a
straight tapered wing, n=2 is elliptical, less than one is elliptical the
wrong way, like this (n=0.8):
and greater than 2 is getting closed to a square wing like this (n=23.8):
you get the graphs below of CL and L/D. The efficiency improves as you increase n towards 2. I'm a bit surprised that it doesn't drop away more steeply above 2. I did try a wing with completely square tips, and this gave an L/D of 17.65, so I guess it shows that even a bit of rounding toward elliptical helps. This has satisfied my curiosity on this for the time being anyway, I don't think I'll play any more with it. I think it shows a nice example of scripting VSP with Python to run a batch of analyses though, hopefully of interest to someone.
Thank you to Daniel for writing the original script for generating the elliptical wing.