From 5d1f3436d8f863261109bcd9bb0cf85a70be0bd0 Mon Sep 17 00:00:00 2001 From: pranjii Date: Thu, 9 Dec 2021 05:01:25 +0530 Subject: [PATCH 1/4] Issue #3467 --- benchmarks/benchmarks/analysis/rms.py | 4 ++-- package/MDAnalysis/analysis/encore/covariance.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/benchmarks/analysis/rms.py b/benchmarks/benchmarks/analysis/rms.py index 3d34f386c5a..bd1040cee04 100644 --- a/benchmarks/benchmarks/analysis/rms.py +++ b/benchmarks/benchmarks/analysis/rms.py @@ -34,9 +34,9 @@ def setup(self, num_atoms, weights, center, superposition): self.u.trajectory[-1] self.B = self.u.atoms.positions.copy()[:num_atoms] except: - self.A = self.u.atoms.coordinates().copy()[:num_atoms] + self.A = self.u.atoms.positions.copy()[:num_atoms] self.u.trajectory[-1] - self.B = self.u.atoms.coordinates().copy()[:num_atoms] + self.B = self.u.atoms.positions.copy()[:num_atoms] def time_rmsd(self, num_atoms, weights, center, superposition): """Benchmark rmsd function using a setup similar to diff --git a/package/MDAnalysis/analysis/encore/covariance.py b/package/MDAnalysis/analysis/encore/covariance.py index 352d934f9d5..0887749c010 100644 --- a/package/MDAnalysis/analysis/encore/covariance.py +++ b/package/MDAnalysis/analysis/encore/covariance.py @@ -215,7 +215,7 @@ def covariance_matrix(ensemble, # Select the same atoms in reference structure reference_atom_selection = reference.select_atoms( ensemble.get_atom_selection_string()) - reference_coordinates = reference_atom_selection.atoms.coordinates() + reference_coordinates = reference_atom_selection.atoms.positions # Flatten reference coordinates reference_coordinates = reference_coordinates.flatten() From 4436a07fa95817e091df21065df94ce9a482b238 Mon Sep 17 00:00:00 2001 From: pranjii Date: Sat, 11 Dec 2021 02:56:23 +0530 Subject: [PATCH 2/4] #3467 --- testsuite/MDAnalysisTests/analysis/test_encore.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/MDAnalysisTests/analysis/test_encore.py b/testsuite/MDAnalysisTests/analysis/test_encore.py index b579c02bdbb..7aa547d32fb 100644 --- a/testsuite/MDAnalysisTests/analysis/test_encore.py +++ b/testsuite/MDAnalysisTests/analysis/test_encore.py @@ -395,6 +395,11 @@ def test_dres_error_estimation(self, ens1): assert stdev < stdev_upper_bound, "Unexpected standard deviation for" \ " bootstrapped samples in Dim. reduction Ensemble imilarity" + def test_covariance_matrix(self, + ens1, ens2): + covariance_of_matrix = encore.covariance.covariance_matrix(ensemble = ens1, reference = ens2) + assert covariance_of_matrix is np.zeros(len(ens1), 3) + class TestEncoreClustering(object): @pytest.fixture(scope='class') def ens1_template(self): From f08867d110444b69166cc4cf7fd733d2e7669a44 Mon Sep 17 00:00:00 2001 From: pranjii Date: Sat, 11 Dec 2021 03:05:03 +0530 Subject: [PATCH 3/4] pep8 edits --- testsuite/MDAnalysisTests/analysis/test_encore.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_encore.py b/testsuite/MDAnalysisTests/analysis/test_encore.py index 7aa547d32fb..2d855fc7840 100644 --- a/testsuite/MDAnalysisTests/analysis/test_encore.py +++ b/testsuite/MDAnalysisTests/analysis/test_encore.py @@ -395,9 +395,10 @@ def test_dres_error_estimation(self, ens1): assert stdev < stdev_upper_bound, "Unexpected standard deviation for" \ " bootstrapped samples in Dim. reduction Ensemble imilarity" - def test_covariance_matrix(self, - ens1, ens2): - covariance_of_matrix = encore.covariance.covariance_matrix(ensemble = ens1, reference = ens2) + def test_covariance_matrix(self, ens1, ens2): + covariance_of_matrix = encore.covariance.covariance_matrix(ensemble=ens1, + reference=ens2) + assert covariance_of_matrix is np.zeros(len(ens1), 3) class TestEncoreClustering(object): From 63b60f64eceb4d8ce2011a0b2cf674828117cd5e Mon Sep 17 00:00:00 2001 From: pranjii Date: Sat, 11 Dec 2021 03:10:29 +0530 Subject: [PATCH 4/4] pep8 edits 2 --- testsuite/MDAnalysisTests/analysis/test_encore.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_encore.py b/testsuite/MDAnalysisTests/analysis/test_encore.py index 2d855fc7840..0e36272892f 100644 --- a/testsuite/MDAnalysisTests/analysis/test_encore.py +++ b/testsuite/MDAnalysisTests/analysis/test_encore.py @@ -396,8 +396,8 @@ def test_dres_error_estimation(self, ens1): " bootstrapped samples in Dim. reduction Ensemble imilarity" def test_covariance_matrix(self, ens1, ens2): - covariance_of_matrix = encore.covariance.covariance_matrix(ensemble=ens1, - reference=ens2) + covariance_of_matrix = encore.covariance_matrix(ensemble=ens1, + reference=ens2) assert covariance_of_matrix is np.zeros(len(ens1), 3)