Skip to content

Commit f717043

Browse files
committed
MoleculeFlip force diff species
1 parent 6da9abe commit f717043

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/moves.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ end
202202
function Arianna.sample_action!(action::MoleculeFlip, ::DoubleUniform, parameters, system::Particles, rng)
203203
molecule_i = rand(rng, DiscreteUniform(1, system.Nmol))
204204
start_mol, end_mol = get_start_end_mol(system, molecule_i)
205-
action.i, action.j = sample(rng, start_mol:end_mol, 2; replace=false)
205+
i, j = sample(rng, start_mol:end_mol, 2; replace=false)
206+
while system.species[i] == system.species[j]
207+
i, j = sample(rng, start_mol:end_mol, 2; replace=false)
208+
end
209+
action.i, action.j = i, j
206210
end
207211

208212
###############################################################################

0 commit comments

Comments
 (0)