Esempio n. 1
0
def test_adjust_displacement_fit():
    """
    Test the accept_or_reject function when the movement is suitable, will pass the max_displacement is kept.
    """
    n_trials = 100.0
    n_accept = 40.0
    max_displacement = 1.0
    expected_value = 1.0   
    cal_max_displacement, n_trials, n_accept = mc_lj_potential.adjust_displacement(n_trials = n_trials, n_accept = n_accept, max_displacement = max_displacement)
    assert expected_value == cal_max_displacement
Esempio n. 2
0
def test_adjust_displacement_small():
    """
    Test the accept_or_reject function when the movement is too small, will pass the max_displacement is increased.
    """
    n_trials = 100.0
    n_accept = 43.0
    max_displacement = 1.0
    expected_value = 1.2   
    cal_max_displacement, n_trials, n_accept = mc_lj_potential.adjust_displacement(n_trials = n_trials, n_accept = n_accept, max_displacement = max_displacement)
    assert expected_value == cal_max_displacement
Esempio n. 3
0
def test_adjust_displacement_large():
    """
    Test the accept_or_reject function when the movement is too large that the max_displacement should be changed into a smaller value.
    """
    n_trials = 100.0
    n_accept = 37.0
    max_displacement = 1.0
    expected_vaule = 0.8
    cal_max_displacement, n_trials, n_accept = mc_lj_potential.adjust_displacement(n_trials = n_trials, n_accept = n_accept, max_displacement = max_displacement)
    assert expected_vaule == cal_max_displacement