-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAtom.java
More file actions
173 lines (149 loc) · 3.9 KB
/
Atom.java
File metadata and controls
173 lines (149 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import org.apache.commons.math3.geometry.euclidean.threed.*;
/** A class representing an atom. It includes information about the symbol, the position, and the VDW parameters for an atom.
*/
public class Atom
{
/** A symbol (C, N, H, etc.) corresponding to the atom type */
private String symbol;
/** A vector representing the position of the atom */
private Vector3D position;
/** The Van Der Waals paramater epsilon used for force field calculations */
private double epsilon;
/** The Van Der Waals parameter sigma used for force field calculations */
private double sigma;
/** The partial charge calculated from macromodel */
private double partialCharge;
/** The formal charge of the atom */
private int formalCharge;
public Atom(String symbol, double x, double y, double z)
{
this.symbol = symbol;
this.position = new Vector3D(x,y,z);
setVDW();
formalCharge = 0;
partialCharge = 0.0;
}
public Atom(String symbol, Vector3D position)
{
this.symbol = symbol;
this.position = position;
setVDW();
formalCharge = 0;
partialCharge = 0.0;
}
/**
@return string representation of atom
*/
public String toString()
{
//return(symbol);
String returnString = String.format("%2s %10.6f %10.6f %10.6f", symbol, position.getX(), position.getY(), position.getZ());
return(returnString);
}
public void setSymbol(String symbol)
{
this.symbol = symbol;
}
/**
@return string with the atom symbol (C, N, O, etc.)
*/
public String getSymbol()
{
return(symbol);
}
/**
allows user to change the position of an atom
*/
public void setPosition(double x, double y, double z)
{
this.position = new Vector3D(x,y,z);
}
public void setPosition(Vector3D position)
{
this.position = position;
}
public Vector3D getPosition()
{
return(position);
}
public Atom cloneAtom()
{
Atom newAtom = new Atom(symbol, position);
newAtom.setFormalCharge( formalCharge );
newAtom.setPartialCharge( partialCharge );
return(newAtom);
}
/** sets default Van Der Waals values for the atom
*/
private void setVDW()
{
if (symbol.equals("H"))
{
sigma = 2.50;
epsilon = 0.03;
}
else if (symbol.equals("C"))
{
sigma = 3.75;
epsilon = 0.105;
}
else if (symbol.equals("N"))
{
sigma = 3.25;
epsilon = 0.17;
}
else if (symbol.equals("O"))
{
sigma = 2.96;
epsilon = 0.21;
}
else if (symbol.equals("Si"))
{
sigma = 3.83;
epsilon = 0.40;
}
else if (symbol.equals("S"))
{
sigma = 3.60;
epsilon = 0.355;
}
else
{
System.out.println("Warning! Atom symbol " + symbol + " has no VDW parameters! Defaulting to carbon parameters.");
sigma = 3.75;
epsilon = 0.105;
}
}
public double getSigma()
{
return sigma;
}
public void setSigma(Double sigma)
{
this.sigma = sigma;
}
public void setEpsilon(Double epsilon)
{
this.epsilon = epsilon;
}
public double getEpsilon()
{
return epsilon;
}
public int getFormalCharge()
{
return formalCharge;
}
public double getPartialCharge()
{
return partialCharge;
}
public void setPartialCharge(double partialCharge)
{
this.partialCharge = partialCharge;
}
public void setFormalCharge(int formalCharge)
{
this.formalCharge = formalCharge;
}
}