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
23
24from numpy.testing import assert_equal
25
26import MDAnalysis as mda
27
28from MDAnalysisTests.topology.base import ParserBase
29from MDAnalysisTests.datafiles import (
30    GMS_ASYMOPT,  # c1opt.gms.gz
31    GMS_SYMOPT,  # symopt.gms
32    GMS_ASYMSURF,  # surf2wat.gms
33)
34
35
36class GMSBase(ParserBase):
37    parser = mda.topology.GMSParser.GMSParser
38    expected_attrs = ['names', 'atomiccharges']
39    guessed_attrs = ['masses', 'types']
40    expected_n_residues = 1
41    expected_n_segments = 1
42
43
44class TestGMSASYMOPT(GMSBase):
45    expected_n_atoms = 6
46    ref_filename = GMS_ASYMOPT
47
48    def test_names(self, top):
49        assert_equal(top.names.values,
50                     ['O', 'H', 'H', 'O', 'H', 'H'])
51
52    def test_types(self, top):
53        assert_equal(top.atomiccharges.values,
54                     [8, 1, 1, 8, 1, 1])
55
56
57class TestGMSSYMOPT(GMSBase):
58    expected_n_atoms = 4
59    ref_filename = GMS_SYMOPT
60
61    def test_names(self, top):
62        assert_equal(top.names.values,
63                     ['CARBON', 'CARBON', 'HYDROGEN', 'HYDROGEN'])
64
65    def test_types(self, top):
66        assert_equal(top.atomiccharges.values,
67                     [6, 6, 1, 1])
68
69
70class TestGMSASYMSURF(TestGMSASYMOPT):
71    ref_filename = GMS_ASYMSURF
72