Exemple #1
0
 def test_reset(self):
     simulation = Simulation()
     simulation.lattice = Mock(spec=Lattice)
     simulation.atoms = Mock(spec=Species)
     simulation.atoms.atoms = [Mock(spec=Atom), Mock(spec=Atom)]
     simulation.reset()
     self.assertEqual(simulation.lattice.reset.call_count, 1)
     self.assertEqual(simulation.atoms.atoms[0].reset.call_count, 1)
     self.assertEqual(simulation.atoms.atoms[1].reset.call_count, 1)
Exemple #2
0
 def test_run_with_equilibration_steps(self):
     simulation = Simulation()
     simulation.is_initialised = Mock(return_value=(True, None))
     simulation.atoms = 'a'
     simulation.lattice = Mock(spec=Lattice)
     simulation.lattice.jump = Mock()
     simulation.reset = Mock()
     simulation.number_of_equilibration_jumps = 20
     simulation.number_of_jumps = 30
     simulation.run()
     self.assertEqual(simulation.lattice.jump.call_count, 20 + 30)
     self.assertEqual(simulation.reset.call_count, 1)