# Algorithm to find phase boundaries

I am looking for an algorithm/library to find phase boundaries as a function of some parameters. E.g. in the Hubbard model, the phase diagram as a function of U and doping hosts metal/insulator transitions. Suppose I have a code that can determine the phase at any arbitrary point in the phase diagram (e.g. takes U and doping as input, solves the model, and returns the gap). I want to find the entire domain where the system metallic. Is there some algorithm that, given an initial point, can tell me which direction to go in the phase diagram to find the phase boundary, and then follow the phase boundary around the domain?

I suppose I could minimize the gap wrt U and doping, but if the initial point is in the metallic phase, this wont help.

Update: I tried something along the lines of a random walk starting at an initial point and then, once I found a boundary, I just “zig-zagged” along it to explore. It’s not particularly robust, however, and I am open to suggestions from experts.

Thanks! Ty

• The solution you gave seems best to me. In your solution, there are few things that can be improved. One can improve how to choose the initial point closest to the boundary, how to handle exotic cases such as coexistence region, how to proceed with the random walk at the point where three or more different regions meet, etc. I believe no robust algorithm is possible (aside from ML/DL) since existence of such algorithm would also mean that we don't need to do DFT calculations for various doped materials and trend can be inferred from some amount of data which is not generally correct. Thoughts? Commented Apr 26 at 10:04
• Thanks for the advice! I think we still need to do the DFT calculations etc... I don't mean I want an algorithm to predict phases. I want an algorithm to explore a phase diagram assuming I can calculate the phase at every point. The goal is, rather than just calculating all points in phase space explicitly, I can start somewhere and, once I find a phase boundary, I can 'walk' along it through the phase diagram. I can conceive several algorithms to do this but don't want to 'reinvent the wheel'. Commented Apr 26 at 13:52
• An obvious problem with my algorithm is that we can get 'trapped' in regions of the phase diagram and, unless we judiciously choose starting points, will never see those other phases. Could you expand on your improvements? Commented Apr 26 at 13:53