コード例 #1
0
def test_lammpstraj_get_step_struct(db_test_app, data_regression):
    path = os.path.join(TEST_DIR, "input_files", "trajectory.lammpstrj")
    data = LammpsTrajectory(path)
    data_regression.check(
        recursive_round(data.get_step_structure(-1).attributes,
                        2,
                        apply_lists=True))
コード例 #2
0
def test_create_structure(db_test_app, data_regression):
    path = os.path.join(TEST_DIR, "input_files", "trajectory.lammpstrj")
    with io.open(path) as handle:
        traj_block = next(iter_trajectories(handle))

    structure = create_structure(traj_block)
    data_regression.check(
        recursive_round(structure.attributes, 2, apply_lists=True))
コード例 #3
0
def test_lammpstraj_get_step_struct(db_test_app, data_regression):  # pylint: disable=unused-argument
    """Get the structure data for a given trajectory step"""
    path = os.path.join(TEST_DIR, 'input_files', 'trajectory.lammpstrj')
    data = LammpsTrajectory(path)
    data_regression.check(
        recursive_round(data.get_step_structure(-1).attributes,
                        2,
                        apply_lists=True))
コード例 #4
0
def test_create_structure(db_test_app, data_regression):  # pylint: disable=unused-argument
    """Test that one can create an structure from a trajectory step"""
    path = os.path.join(TEST_DIR, 'input_files', 'trajectory.lammpstrj')
    with io.open(path) as handle:
        traj_block = next(iter_trajectories(handle))

    structure = create_structure(traj_block)
    data_regression.check(
        recursive_round(structure.attributes, 2, apply_lists=True))
コード例 #5
0
def sanitize_results(results_dict, round_dp_all=None, round_energy=None):
    """Sanitize the results dictionary for test regression."""
    results_dict.pop("parser_version")
    results_dict.pop("warnings")
    results_dict.pop("steps_per_second", None)
    results_dict.pop("total_wall_time", None)
    if round_energy and "energy" in results_dict:
        results_dict["energy"] = round(results_dict["energy"], round_energy)
    if round_dp_all:
        results_dict = tests.recursive_round(results_dict, round_dp_all)
    return results_dict
コード例 #6
0
def sanitize_results(results_dict, round_dp_all=None, round_energy=None):
    """Sanitize the results dictionary for test regression."""
    results_dict.pop('parser_version')
    results_dict.pop('warnings')
    results_dict.pop('steps_per_second', None)
    results_dict.pop('total_wall_time', None)
    if round_energy and 'energy' in results_dict:
        results_dict['energy'] = round(results_dict['energy'], round_energy)
    if round_dp_all:
        results_dict = tests.recursive_round(results_dict, round_dp_all)
    return results_dict