$darkmode
DENOPTIM
TinkerAtom.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Vishwesh Venkatraman <vishwesh.venkatraman@ntnu.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.integration.tinker;
20
25public class TinkerAtom implements Cloneable
26{
27 /*
28 * tinker assigned atom type
29 */
30 private int ffAtomType;
31
32 /*
33 * tinker assigned atom string
34 */
35 private String atomStr;
36
37 /*
38 * the original 3d coordinates from which the IC representation is calculated
39 */
40 private double[] xyz;
41
42 /*
43 * position of the atom in the list
44 */
45 private int xyzIndex;
46
47 /*
48 * store for distance, bond angle and the dihedral or third angle
49 */
50 private double[] distAngles;
51
52
53 /*
54 * atom neighbours, the first 3 members are the neighbours, the 4 position
55 * is reserved for the chiral definition (0/1/-1)
56 */
57 private int[] atmNb;
58
59 /*
60 * the vertex id with which the IC fragment is associated with
61 */
62 private long vtxId;
63
64//------------------------------------------------------------------------------
65
66 public TinkerAtom()
67 {
68 }
69
70//------------------------------------------------------------------------------
71
72 public TinkerAtom(int xyzIndex, String atomStr, int ffAtomType,
73 double[] xyz, int[] atmNb, double[] distAngles)
74 {
75 this.atomStr = atomStr;
76 this.ffAtomType = ffAtomType;
77 this.xyzIndex = xyzIndex;
78 this.atmNb = new int[4];
79 this.distAngles = new double[3];
80 this.xyz = new double[3];
81
82 for (int i=0; i<3; i++)
83 {
84 this.xyz[i] = xyz[i];
85 this.distAngles[i] = distAngles[i];
86 }
87 System.arraycopy(atmNb, 0, this.atmNb, 0, 4);
88 }
89
90
91//------------------------------------------------------------------------------
92
93 public void setAtomNeighbours(int[] atmNb)
94 {
95 this.atmNb = atmNb;
96 }
97
98//------------------------------------------------------------------------------
99
100 public int[] getAtomNeighbours()
101 {
102 return this.atmNb;
103 }
104
105//------------------------------------------------------------------------------
106
107 public void setDistAngle(double[] distAngles)
108 {
109 this.distAngles = distAngles;
110 }
111
112//------------------------------------------------------------------------------
113
114 public double[] getDistAngle()
115 {
116 return this.distAngles;
117 }
118
119//------------------------------------------------------------------------------
120
126 public void moveTo(double[] d)
127 {
128 xyz[0] = d[0];
129 xyz[1] = d[1];
130 xyz[2] = d[2];
131 }
132
133//------------------------------------------------------------------------------
134
142 public void moveTo(double a, double b, double c)
143 {
144 xyz[0] = a;
145 xyz[1] = b;
146 xyz[2] = c;
147 }
148
149//------------------------------------------------------------------------------
150
157 public void setXYZ(double[] xyz)
158 {
159 this.xyz = xyz;
160 }
161
162//------------------------------------------------------------------------------
163
169 public double[] getXYZ()
170 {
171 return xyz;
172 }
173
174//------------------------------------------------------------------------------
175
181 public void getXYZ(double[] x)
182 {
183 x[0] = xyz[0];
184 x[1] = xyz[1];
185 x[2] = xyz[2];
186 }
187
188//------------------------------------------------------------------------------
189
195 public int getXYZIndex()
196 {
197 return xyzIndex;
198 }
199
200//------------------------------------------------------------------------------
201
202 public void setXYZIndex(int xyzIndex)
203 {
204 this.xyzIndex = xyzIndex;
205 }
206
207
208//------------------------------------------------------------------------------
209
210 public String getAtomString()
211 {
212 return this.atomStr;
213 }
214
215//------------------------------------------------------------------------------
216
217 public void setAtomString(String atomStr)
218 {
219 this.atomStr = atomStr;
220 }
221
222//------------------------------------------------------------------------------
223
224 public int getAtomType()
225 {
226 return this.ffAtomType;
227 }
228
229//------------------------------------------------------------------------------
230
231 public void setAtomType(int ffAtomType)
232 {
233 this.ffAtomType = ffAtomType;
234 }
235
236//------------------------------------------------------------------------------
237
238 public void setVertexId(long vidx)
239 {
240 this.vtxId = vidx;
241 }
242
243//------------------------------------------------------------------------------
244
245 public long getVertexId()
246 {
247 return this.vtxId;
248 }
249
250
251//------------------------------------------------------------------------------
252
261 public boolean usesProperTorsion()
262 {
263 if ((this.atmNb[0] != 0) && (this.atmNb[1] != 0) &&
264 (this.atmNb[2] != 0) && (this.atmNb[3] == 0))
265 {
266 return true;
267 }
268
269 return false;
270 }
271
272//------------------------------------------------------------------------------
273
274 @Override
275 public String toString()
276 {
277 String s = "TinkerAtom (ff: " + ffAtomType +
278 " str: "+ atomStr +
279 " xyz: [" + xyz[0] + "; " + xyz[1] +
280 "; " + xyz[2] + "] " +
281 " id: " + xyzIndex +
282 " distAng: [" + distAngles[0] +
283 "; " + distAngles[1] + "; " + distAngles[2] +
284 "] " +
285 " nb: [" + atmNb[0] + "; " + atmNb[1] +
286 "; " + atmNb[2] + "; " + atmNb[3] + "] " +
287 " vtx: " +vtxId + ")";
288 return s;
289 }
290
291//------------------------------------------------------------------------------
292
293}
294
295
Based on the code from ffx.kenai.com Michael J.
Definition: TinkerAtom.java:26
boolean usesProperTorsion()
Evaluates whether this TinkerAtom's line refers to a torsion (chiral flag is 0) or to an inproper tor...
int getXYZIndex()
Gets the XYZ Index.
void moveTo(double a, double b, double c)
void moveTo(double[] d)
Add a vector to the Atom's current position vector.
void setDistAngle(double[] distAngles)
TinkerAtom(int xyzIndex, String atomStr, int ffAtomType, double[] xyz, int[] atmNb, double[] distAngles)
Definition: TinkerAtom.java:72