Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 20, 2023
1 parent 00adcf5 commit 125f308
Show file tree
Hide file tree
Showing 120 changed files with 264 additions and 152 deletions.
1 change: 1 addition & 0 deletions CI/functional_tests/test_molten_salts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Perform a functional test on two molten salts.
"""

from typing import Tuple

import pytest
Expand Down
1 change: 1 addition & 0 deletions CI/functional_tests/test_water_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Functional test for the analysis of a GROMACS water simulation.
"""

from typing import List

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import dataclasses
import os

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
values.
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import dataclasses
import os

Expand Down Expand Up @@ -103,9 +104,7 @@ def test_calculator(tmp_path, desired_memory):
time_should_be = time_step * np.arange(0, vacf_range) * units.time
thermal_vel_SI = np.sqrt(3 * kT / mass) * units.length / units.time
relaxation_time_SI = relaxation_time * units.time
vacf_should_be = thermal_vel_SI**2 * np.exp(
-time_should_be / relaxation_time_SI
)
vacf_should_be = thermal_vel_SI**2 * np.exp(-time_should_be / relaxation_time_SI)
diff_coeff_should_be = diff_coeff * units.length**2 / units.time

np.testing.assert_allclose(res["time"], time_should_be, atol=1e-6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Test the outcome of molecular mapping.
"""

from typing import List, Tuple

import pytest
Expand Down
1 change: 1 addition & 0 deletions CI/integration_tests/visualizer/znvis_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Test that the visualizer runs.
"""

import os
import tempfile
import time
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/database/test_experiment_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import dataclasses
import os

Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/database/test_file_read.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test MDSuite file reading."""

import numpy as np

import mdsuite
Expand Down
13 changes: 6 additions & 7 deletions CI/unit_tests/database/test_simulation_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
-------
Test for module for the simulation database.
"""

import os
import tempfile
import unittest
Expand Down Expand Up @@ -52,13 +53,11 @@ def test_build_path_input(self):
"Pressure": (5000, 6),
"Temperature": (5000, 1),
}
architecture = database._build_path_input(
{
"Na": {"Forces": (200, 5000, 3)},
"Pressure": (5000, 6),
"Temperature": (5000, 1),
}
)
architecture = database._build_path_input({
"Na": {"Forces": (200, 5000, 3)},
"Pressure": (5000, 6),
"Temperature": (5000, 1),
})
self.assertDictEqual(assertion, architecture)
os.chdir("..")
temp_dir.cleanup()
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/experiment/test_Experiment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test MDSuite Experiment class."""

import pytest

from mdsuite.experiment.experiment import Experiment
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/experiment/test_run_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Description:
"""

from unittest.mock import Mock

from mdsuite.experiment.run import RunComputation
Expand Down
17 changes: 8 additions & 9 deletions CI/unit_tests/graph_modules/test_molecular_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Module to test the molecular graph module.
"""

from dataclasses import dataclass
from pathlib import Path

Expand Down Expand Up @@ -90,15 +91,13 @@ def test_apply_system_cutoff(self):
cutoff_tensor = tf.constant(cutoff_data, dtype=tf.float32)

# Middle range cutoff
target = tf.constant(
[
[0, 0, 0, 0, 1],
[0, 0, 1, 1, 1],
[0, 0, 0, 1, 1],
[0, 0, 0, 0, 0],
[1, 0, 1, 1, 0],
]
)
target = tf.constant([
[0, 0, 0, 0, 1],
[0, 0, 1, 1, 1],
[0, 0, 0, 1, 1],
[0, 0, 0, 0, 0],
[1, 0, 1, 1, 0],
])
mask = _apply_system_cutoff(cutoff_tensor, cutoff=5)
np.testing.assert_array_equal(np.diagonal(mask), zeros)
np.testing.assert_array_equal(mask, target)
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/memory_manager/test_memory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-------
Test for the memory manager module.
"""

import unittest

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/project/test_project_add_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os
import pathlib

Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/project/test_project_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os
from pathlib import Path
from tempfile import TemporaryDirectory
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/project/test_project_instantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Description:
"""

import pathlib

import mdsuite
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/project/test_project_load_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os
from tempfile import TemporaryDirectory

Expand Down
20 changes: 9 additions & 11 deletions CI/unit_tests/transformations/test_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ def test_unwrap_coordinates():
# x stays in box 0
# y jumps 0 -> -1 -> -1 -> 0
# z jumps 0 -> 1 -> 1 -> 2
pos = np.array(
[[[0.5, 0.1, 3.2]], [[0.6, 2.1, 0.9]], [[0.6, 2.1, 2.1]], [[0.6, 0.1, 0.1]]]
)
pos = np.array([
[[0.5, 0.1, 3.2]], [[0.6, 2.1, 0.9]], [[0.6, 2.1, 2.1]], [[0.6, 0.1, 0.1]]
])
pos = np.swapaxes(pos, 0, 1)
print(np.shape(pos))

Expand All @@ -172,14 +172,12 @@ def test_unwrap_coordinates():

output, carryover = trafo.transform_batch(input, carryover=last_carryover)

output_should_be = np.array(
[
[[4 * 1.1 + 0.5, 0.1, 3.2]],
[[4 * 1.1 + 0.6, -0.1, 4.2]],
[[4 * 1.1 + 0.6, -0.1, 5.4]],
[[4 * 1.1 + 0.6, 0.1, 6.7]],
]
)
output_should_be = np.array([
[[4 * 1.1 + 0.5, 0.1, 3.2]],
[[4 * 1.1 + 0.6, -0.1, 4.2]],
[[4 * 1.1 + 0.6, -0.1, 5.4]],
[[4 * 1.1 + 0.6, 0.1, 6.7]],
])
output_should_be = np.swapaxes(output_should_be, 0, 1)
carryover_should_be = {"last_pos": [[0.6, 0.1, 0.1]], "last_image_box": [[4, 0, 2]]}
assertDeepAlmostEqual(output.numpy(), output_should_be)
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/transformations/test_transformator_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
--------
If you use this module please cite us with:
"""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_calculator_helper_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Module for testing the calculator helper methods.
"""

import numpy as np
import pytest
from numpy.testing import assert_array_equal, assert_raises
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for MDSuite utils.constants."""

import dataclasses

import pytest
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_meta_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Test the meta functions module.
"""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_molecule_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Unit tests for the molecule data class.
"""

import pytest

import mdsuite
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_scaling_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
-------
Unit tests for the scaling functions module.
"""

import unittest

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Test the mdsuite testing modules.
"""

import time
import unittest

Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/utils/test_units.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test MDSuite units."""

import mdsuite as mds


Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import sys

import sphinx_rtd_theme
Expand Down
1 change: 1 addition & 0 deletions mdsuite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

try:
from importlib import metadata
except ImportError: # for Python<3.8
Expand Down
Loading

0 comments on commit 125f308

Please sign in to comment.