Gibbs Ensemble MCExamination of Java Code. General
//Performs basic GEMC trial
//At present, suitable only for single-component systems
int i = (int)(rand.nextDouble()*iTotal); //select type of trial to perform
if(i < iDisplace) { //displace a randomly selected atom
if(rand.nextDouble() < 0.5) {atomDisplace.doTrial(firstPhase);}
else {atomDisplace.doTrial(secondPhase);}
else if(i < iVolume) { //volume exchange
else { //molecule exchange
if(rand.nextDouble() < 0.5) {
trialExchange(firstPhase,secondPhase,firstPhase.parentSimulation.firstSpecies);
trialExchange(secondPhase,firstPhase,firstPhase.parentSimulation.firstSpecies);
public class IntegratorGEMC extends Integrator