Charge-induced transition between miscible and immiscible in nanometer-sized alloying particles