Skip to content

Commit 1bf61af

Browse files
Luckickjohnmay
authored andcommitted
Add a method for Numerical Surface: Can get both coordinates and atom type
getAllPointswithAtomType(): Will return an ArrayList, where each element will include both Coordinates and Atom Type by Atom.getAtomicNumber().
1 parent 075d63a commit 1bf61af

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

descriptor/qsarmolecular/src/main/java/org/openscience/cdk/geometry/surface/NumericalSurface.java

100644100755
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import javax.vecmath.Point3d;
3232
import java.util.ArrayList;
3333
import java.util.Iterator;
34+
import org.openscience.cdk.geometry.surface.Point_Type;
3435

3536
/**
3637
* A class representing the solvent accessible surface area surface of a molecule.
@@ -165,7 +166,7 @@ private void init() {
165166
logger.info("Obtained points, areas and volumes");
166167

167168
}
168-
169+
169170
/**
170171
* Get an array of all the points on the molecular surface.
171172
*
@@ -189,6 +190,29 @@ public Point3d[] getAllSurfacePoints() {
189190
}
190191
return (ret);
191192
}
193+
194+
public ArrayList<Point_Type> getAllPointswithAtomType() {
195+
int npt = 0;
196+
for (int i = 0; i < this.surfPoints.length; i++)
197+
npt += this.surfPoints[i].size();
198+
//Point3d[] ret = new Point3d[npt];
199+
ArrayList<Point_Type> point_types = new ArrayList<Point_Type>(npt);
200+
//ArrayList<Integer> atomtype = new ArrayList<Integer>(npt);
201+
int j = 0;
202+
for (int i = 0; i < this.surfPoints.length; i++) {
203+
ArrayList arl = this.surfPoints[i];
204+
//atomtype.add(this.atoms[i].getAtomicNumber());
205+
for (Iterator it = arl.iterator(); it.hasNext();) {
206+
//ret[j] = (Point3d) it.next();
207+
Point_Type point_type = new Point_Type();
208+
point_type.setAtom(this.atoms[i].getAtomicNumber());
209+
point_type.setCoord((Point3d) it.next());
210+
point_types.add(point_type);
211+
j++;
212+
}
213+
}
214+
return (point_types);
215+
}
192216

193217
/**
194218
* Get an array of the points on the accessible surface of a specific atom.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (C) 2004-2007 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
7+
* modify it under the terms of the GNU Lesser General Public License
8+
* as published by the Free Software Foundation; either version 2.1
9+
* of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19+
*/
20+
21+
package org.openscience.cdk.geometry.surface;
22+
23+
import javax.vecmath.Point3d;
24+
25+
26+
public class Point_Type
27+
{
28+
public int number;
29+
public Point3d coord;
30+
// Add constructor, get, set, as needed.
31+
32+
public int getAtom() {
33+
return number;
34+
}
35+
36+
public void setAtom(int number) {
37+
this.number = number;
38+
}
39+
40+
public Point3d getCoord() {
41+
return coord;
42+
}
43+
44+
public void setCoord(Point3d coord) {
45+
this.coord = coord;
46+
}
47+
}
48+
49+

0 commit comments

Comments
 (0)