From a834b9ea6a18d9e67bdecb031c926c87d512b84c Mon Sep 17 00:00:00 2001 From: EnricoTrizio Date: Fri, 13 Dec 2024 09:50:49 +0100 Subject: [PATCH] Fixed test --- mlcolvar/tests/test_utils_io.py | 54 +-------------------------- mlcolvar/tests/test_utils_io_graph.py | 53 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 52 deletions(-) create mode 100644 mlcolvar/tests/test_utils_io_graph.py diff --git a/mlcolvar/tests/test_utils_io.py b/mlcolvar/tests/test_utils_io.py index 4c9b7f7..34d2fa9 100644 --- a/mlcolvar/tests/test_utils_io.py +++ b/mlcolvar/tests/test_utils_io.py @@ -2,7 +2,7 @@ import urllib from mlcolvar.utils.io import load_dataframe from mlcolvar.utils.io import test_datasetFromFile -from mlcolvar.utils.io import test_datasesetFromTrajectories, test_create_dataset_from_trajectories +from mlcolvar.utils.io import test_datasesetFromTrajectories example_files = { "str": "mlcolvar/tests/data/state_A.dat", @@ -26,54 +26,4 @@ def test_loadDataframe(file_type): if __name__ == "__main__": test_datasetFromFile() - test_datasesetFromTrajectories() - text = """ -CRYST1 2.000 2.000 2.000 90.00 90.00 90.00 P 1 1 -ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H -ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H -ENDMODEL -ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H -ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H -END -""" - test_create_dataset_from_trajectories(text, None) - - text = """ -CRYST1 2.000 2.000 2.000 90.00 90.00 90.00 P 1 1 -ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H -ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H -ATOM 4 OH2 XXXXW 2 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 5 H1 XXXXW 2 0.300 0.300 0.000 1.00 0.00 WT1 H -ATOM 6 H2 XXXXW 2 0.300 -0.300 0.000 1.00 0.00 WT1 H -ENDMODEL -ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H -ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H -ATOM 4 OH2 XXXXW 2 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 5 H1 XXXXW 2 0.300 0.300 0.000 1.00 0.00 WT1 H -ATOM 6 H2 XXXXW 2 0.300 -0.300 0.000 1.00 0.00 WT1 H -END -""" - test_create_dataset_from_trajectories(text, 'not resname XXXX') - - text = """ -CRYST1 2.000 2.000 2.000 90.00 90.00 90.00 P 1 1 -ATOM 1 OH2 XXXXW 1 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 2 OH2 TIP3W 2 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 3 H1 XXXXW 1 0.300 0.300 0.000 1.00 0.00 WT1 H -ATOM 4 H1 TIP3W 2 0.700 0.700 0.000 1.00 0.00 WT1 H -ATOM 5 H2 XXXXW 1 0.300 -0.300 0.000 1.00 0.00 WT1 H -ATOM 6 H2 TIP3W 2 0.700 -0.700 0.000 1.00 0.00 WT1 H -ENDMODEL -ATOM 1 OH2 XXXXW 1 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 2 OH2 TIP3W 2 0.000 0.000 0.000 1.00 0.00 WT1 O -ATOM 3 H1 XXXXW 1 0.300 0.300 0.000 1.00 0.00 WT1 H -ATOM 4 H1 TIP3W 2 0.700 0.700 0.000 1.00 0.00 WT1 H -ATOM 5 H2 XXXXW 1 0.300 -0.300 0.000 1.00 0.00 WT1 H -ATOM 6 H2 TIP3W 2 0.700 -0.700 0.000 1.00 0.00 WT1 H -END -""" - test_create_dataset_from_trajectories(text, 'not resname XXXX') \ No newline at end of file + test_datasesetFromTrajectories() \ No newline at end of file diff --git a/mlcolvar/tests/test_utils_io_graph.py b/mlcolvar/tests/test_utils_io_graph.py new file mode 100644 index 0000000..7da38a5 --- /dev/null +++ b/mlcolvar/tests/test_utils_io_graph.py @@ -0,0 +1,53 @@ +from mlcolvar.utils.io import test_create_dataset_from_trajectories + +if __name__ == "__main__": + text = """ +CRYST1 2.000 2.000 2.000 90.00 90.00 90.00 P 1 1 +ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H +ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H +ENDMODEL +ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H +ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H +END +""" + test_create_dataset_from_trajectories(text, None) + + text = """ +CRYST1 2.000 2.000 2.000 90.00 90.00 90.00 P 1 1 +ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H +ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H +ATOM 4 OH2 XXXXW 2 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 5 H1 XXXXW 2 0.300 0.300 0.000 1.00 0.00 WT1 H +ATOM 6 H2 XXXXW 2 0.300 -0.300 0.000 1.00 0.00 WT1 H +ENDMODEL +ATOM 1 OH2 TIP3W 1 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 2 H1 TIP3W 1 0.700 0.700 0.000 1.00 0.00 WT1 H +ATOM 3 H2 TIP3W 1 0.700 -0.700 0.000 1.00 0.00 WT1 H +ATOM 4 OH2 XXXXW 2 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 5 H1 XXXXW 2 0.300 0.300 0.000 1.00 0.00 WT1 H +ATOM 6 H2 XXXXW 2 0.300 -0.300 0.000 1.00 0.00 WT1 H +END +""" + test_create_dataset_from_trajectories(text, 'not resname XXXX') + + text = """ +CRYST1 2.000 2.000 2.000 90.00 90.00 90.00 P 1 1 +ATOM 1 OH2 XXXXW 1 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 2 OH2 TIP3W 2 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 3 H1 XXXXW 1 0.300 0.300 0.000 1.00 0.00 WT1 H +ATOM 4 H1 TIP3W 2 0.700 0.700 0.000 1.00 0.00 WT1 H +ATOM 5 H2 XXXXW 1 0.300 -0.300 0.000 1.00 0.00 WT1 H +ATOM 6 H2 TIP3W 2 0.700 -0.700 0.000 1.00 0.00 WT1 H +ENDMODEL +ATOM 1 OH2 XXXXW 1 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 2 OH2 TIP3W 2 0.000 0.000 0.000 1.00 0.00 WT1 O +ATOM 3 H1 XXXXW 1 0.300 0.300 0.000 1.00 0.00 WT1 H +ATOM 4 H1 TIP3W 2 0.700 0.700 0.000 1.00 0.00 WT1 H +ATOM 5 H2 XXXXW 1 0.300 -0.300 0.000 1.00 0.00 WT1 H +ATOM 6 H2 TIP3W 2 0.700 -0.700 0.000 1.00 0.00 WT1 H +END +""" + test_create_dataset_from_trajectories(text, 'not resname XXXX') \ No newline at end of file