Modeling the composition of ternary III-V nanowires and axial nanowire heterostructures