Calculation of liquid-liquid phase separation in a ternary system of a polymer in a mixture of a solvent and a nonsolvent