We present a simple and fast algorithm to test the thermodynamic stability and determine the necessary chemical environment for the production of a multiternary material, relative to competing phases and compounds formed from the constituent elements. If the material is found to be stable, the region of stability, in terms of the constituent elemental chemical potentials, is determined from the intersection points of hypersurfaces in an (n - 1)-dimensional chemical potential space, where n is the number of atomic species in the material. The input required is the free energy of formation of the material itself, and that of all competing phases. Output consists of the result of the test of stability, the intersection points in the chemical potential space and the competing phase to which they relate, and, for two- and three-dimensional spaces, a file which may be used for visualization of the stability region. We specify the use of the program by applying it both to a ternary system and to a quaternary system. The algorithm automates essential analysis of the thermodynamic stability of a material. This analysis consists of a process which is lengthy for ternary materials, and becomes much more complicated when studying materials of four or more constituent elements, which have become of increased interest in recent years for technological applications such as energy harvesting and optoelectronics. The algorithm will therefore be of great benefit to the theoretical and computational study of such materials. Program summary: Program title: CPLAP. Catalogue identifier: AEQO_v1_0. Program summary URL: http://cpc.cs.qub.ac.uk/summaries/AEQO_v1_0.html. Program obtainable from: CPC Program Library, Queen's University, Belfast, N. Ireland. Licensing provisions: Standard CPC licence, http://cpc.cs.qub.ac.uk/licence/licence.html. No. of lines in distributed program, including test data, etc.: 4301. No. of bytes in distributed program, including test data, etc.: 28851. Distribution format: tar.gz. Programming language: FORTRAN 90. Computer: Any computer with a FORTRAN 90 compiler. Operating system: Any OS with a FORTRAN 90 compiler. RAM: 2 megabytes. Classification: 16.1, 23. Nature of problem:. To test the thermodynamic stability of a material with respect to competing phases and standard states of the constituent atomic species and, if stable, determine the range of chemical potentials consistent with its synthesis. Solution method:. Assume that the formation of the material of interest occurs, rather than that of competing phases and standard states of the constituent elemental species. From this assumption derive a series of conditions on the elemental chemical potentials. Convert these conditions to a system of m linear equations with n unknowns, where m > n. Solve all combinations of n linear equations, and test which solutions are compatible with the conditions on the chemical potentials. If none are, the system is unstable. Otherwise, the compatible results define boundary points of the stability region within the space spanned by the chemical potentials. Restrictions:. The material growth environment is assumed to be in thermal and diffusive equilibrium. Additional comments:. For two- and three-dimensional spaces spanned by the chemical potentials, files are produced for visualization of the stability region (if it exists). Running time:. Less than one second.