1+ /*
2+ * Copyright (C) 2019 The Chemistry Development Kit (CDK) project
3+ *
4+ * Contact: cdk-devel@lists.sourceforge.net
5+ *
6+ * This program is free software; you can redistribute it and/or modify it
7+ * under the terms of the GNU Lesser General Public License as published by
8+ * the Free Software Foundation; either version 2.1 of the License, or (at
9+ * your option) any later version. All we ask is that proper credit is given
10+ * for our work, which includes - but is not limited to - adding the above
11+ * copyright notice to the beginning of your source code files, and to any
12+ * copyright notice that you may distribute with programs based on this work.
13+ *
14+ * This program is distributed in the hope that it will be useful, but WITHOUT
15+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17+ * License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public License
20+ * along with this program; if not, write to the Free Software
21+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22+ */
23+
24+ package org .openscience .cdk .geometry .surface ;
25+
26+ import org .hamcrest .CoreMatchers ;
27+ import org .junit .Test ;
28+ import org .openscience .cdk .interfaces .IAtom ;
29+ import org .openscience .cdk .interfaces .IAtomContainer ;
30+ import org .openscience .cdk .interfaces .IChemFile ;
31+ import org .openscience .cdk .interfaces .IChemObjectBuilder ;
32+ import org .openscience .cdk .io .PDBReader ;
33+ import org .openscience .cdk .silent .SilentChemObjectBuilder ;
34+ import org .openscience .cdk .tools .manipulator .ChemFileManipulator ;
35+
36+ import javax .vecmath .Point3d ;
37+ import java .io .InputStream ;
38+ import java .util .HashSet ;
39+ import java .util .List ;
40+ import java .util .Map ;
41+ import java .util .Set ;
42+
43+ import static org .junit .Assert .assertThat ;
44+
45+ public class NumericalSurfaceTest {
46+
47+ @ Test
48+ public void testCranbinSurface () throws Exception {
49+ IChemObjectBuilder bldr = SilentChemObjectBuilder .getInstance ();
50+ IChemFile chemFile ;
51+ String path = "/data/pdb/1crn.pdb" ;
52+ try (InputStream in = getClass ().getResourceAsStream (path );
53+ PDBReader pdbr = new PDBReader (in )) {
54+ chemFile = pdbr .read (bldr .newInstance (IChemFile .class ));
55+ }
56+ IAtomContainer mol = ChemFileManipulator .getAllAtomContainers (chemFile ).get (0 );
57+ NumericalSurface surface = new NumericalSurface (mol );
58+ Map <IAtom , List <Point3d >> map = surface .getAtomSurfaceMap ();
59+ assertThat (map .size (), CoreMatchers .is (222 ));
60+ assertThat (mol .getAtomCount (), CoreMatchers .is (327 ));
61+ }
62+
63+ }
0 commit comments