1# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
2# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
3#
4# MDAnalysis --- https://www.mdanalysis.org
5# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
6# (see the file AUTHORS for the full list of names)
7#
8# Released under the GNU Public Licence, v2 or any higher version
9#
10# Please cite your use of MDAnalysis in published work:
11#
12# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
13# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
14# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
15# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
16# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
17#
18# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
19# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
20# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
21#
22from __future__ import absolute_import
23import MDAnalysis as mda
24import numpy as np
25
26from MDAnalysisTests.datafiles import waterPSF, waterDCD
27from MDAnalysis.analysis.lineardensity import LinearDensity
28from numpy.testing import assert_almost_equal
29
30
31def test_serial():
32    universe = mda.Universe(waterPSF, waterDCD)
33    sel_string = 'all'
34    selection = universe.select_atoms(sel_string)
35
36    xpos = np.array([0., 0., 0., 0.0072334, 0.00473299, 0.,
37                          0., 0., 0., 0.])
38    ld = LinearDensity(selection, binsize=5).run()
39    assert_almost_equal(xpos, ld.results['x']['pos'])
40