Taylor Robertson
Ansys Employee

I think the question is about constructing a non axially symmetric phase target. If you refer to the phase equation being solved for here, you can see that is actually axially symmetric because you can write it as a function of r^2. For that reason it is sufficient to solve it along y=0,.
This is exactly what is being done in the lines of code, you shared.
If you have a phase target that is not axially symmetric, you would probably need to write this as a function of two variables, with x, and y being the easiest choice, due the rectangular tiling of the meta atoms. I would suggest looping over x, y and constructing a 2D phase target array with. Then you could solve for the phase target at each position using scaler values. It would probably be OK to convert x_mask, y_mask from vectors to 2D arrays. The use array operations instead of loop, but this might be a bit more difficult. It could look something like this.
for (n =1:length(x_mask(n)){
for(m = 1:length(y_mask(m)){
phase_target(m,n) = f ( x_mask(n),y_mask(m)) ;
Next when you create the radius mask, this would need to be a 2D array, but you could use the 2D version of interp - Script command.
Finally, adding the pillars would no longer be cylindrically symmetric, so again you could make this a two level loop of x and y instead of just r.
I hope this answers your question. Let us know if you have any trouble with the details.

Best Regards