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 package ffx.potential.bonded;
39
40 import static java.lang.String.format;
41
42 import ffx.potential.bonded.AminoAcidUtils.AminoAcid3;
43 import ffx.potential.parameters.ForceField;
44 import ffx.potential.parameters.RelativeSolvationType;
45 import java.util.HashMap;
46 import java.util.Map;
47 import java.util.logging.Logger;
48
49
50
51
52
53
54
55
56 public class RelativeSolvation {
57
58 private static final Logger logger = Logger.getLogger(RelativeSolvation.class.getName());
59
60 private final Map<String, Double> nonStdEnergies;
61
62 private final SolvationLibrary solvationLibrary;
63
64
65
66
67
68
69
70
71 public RelativeSolvation(SolvationLibrary solvationLibrary, ForceField forceField) {
72 this.solvationLibrary = solvationLibrary;
73 nonStdEnergies = new HashMap<>();
74 for (RelativeSolvationType rsType : forceField.getRelativeSolvationTypes().values()) {
75 String resName = rsType.getResName();
76 double e = rsType.getSolvEnergy();
77 if (nonStdEnergies.put(resName, e) != null) {
78 logger.warning(format(" Repeat relative solvation for %s", resName));
79 }
80 }
81 }
82
83
84
85
86
87
88
89
90
91
92
93 public double getSolvationEnergy(Residue residue, boolean checkZeroes)
94 throws IllegalArgumentException {
95 String resName = "";
96 double energy;
97 Residue theRes =
98 (residue instanceof MultiResidue) ? ((MultiResidue) residue).getActive() : residue;
99 switch (theRes.getResidueType()) {
100 case AA -> {
101 if (theRes instanceof MultiResidue) {
102 resName = ((MultiResidue) theRes).getActive().getName();
103 } else {
104 resName = theRes.getName();
105 }
106 energy = getAASolvationEnergy(theRes);
107 }
108 case NA -> {
109 if (theRes instanceof MultiResidue) {
110 resName = ((MultiResidue) theRes).getActive().getName();
111 } else {
112 resName = theRes.getName();
113 }
114 energy = getNASolvationEnergy(theRes);
115 }
116 default -> energy = 0;
117 }
118 if (checkZeroes && energy == 0) {
119 throw new IllegalArgumentException(
120 format(" Zero de-solvation energy for residue %s: likely not in solvation library.",
121 resName));
122 }
123 return energy;
124 }
125
126
127 @Override
128 public String toString() {
129 return "Relative solvation library: " + solvationLibrary.toString();
130 }
131
132
133
134
135
136
137
138 private double getAASolvationEnergy(Residue residue) {
139 return switch (solvationLibrary) {
140 case WOLFENDEN -> getWolfendenSolvationEnergy(residue);
141 case CABANI -> getCabaniSolvationEnergy(residue);
142 case EXPLICIT -> getExplicitSolvationEnergy(residue);
143 case GK -> getGKSolvationEnergy(residue);
144 case MACCALLUM_SPC -> getMacCallumSPCSolvationEnergy(residue);
145 case MACCALLUM_TIP4P -> getMacCallumTIP4PSolvationEnergy(residue);
146 default -> 0;
147 };
148 }
149
150
151
152
153
154
155
156 private double getNASolvationEnergy(Residue residue) {
157 return 0;
158 }
159
160
161
162
163
164
165
166
167 private double getGKSolvationEnergy(Residue residue) {
168 return getExplicitSolvationEnergy(residue);
169 }
170
171
172
173
174
175
176
177
178 private double getExplicitSolvationEnergy(Residue residue) {
179 AminoAcid3 name = residue.getAminoAcid3();
180 return switch (name) {
181 case ALA -> 0.58;
182 case CYS -> -0.85;
183 case CYD -> -69.82;
184 case ASP -> -69.45;
185 case ASH -> -4.00;
186 case GLU -> -71.40;
187 case GLH -> -3.61;
188 case PHE -> -1.59;
189 case GLY -> 0.67;
190 case HIS -> -45.36;
191 case HID -> -8.42;
192 case HIE -> -7.53;
193 case ILE -> 0.14;
194 case LYS -> -43.98;
195 case LYD -> +0.35;
196 case MET -> -3.48;
197 case ASN -> -5.89;
198 case PRO -> 7.82;
199 case GLN -> -6.89;
200 case ARG -> -42.57;
201 case SER -> -2.14;
202 case THR -> 0.58;
203 case VAL -> 0.10;
204 case TRP -> -4.64;
205 case TYR -> 1.76;
206 case TYD -> -41.71;
207 case UNK -> nonStdEnergies.getOrDefault(residue.getName().toUpperCase(), 0.0);
208 default -> 0;
209 };
210 }
211
212
213
214
215
216
217
218
219 private double getMacCallumTIP4PSolvationEnergy(Residue residue) {
220 AminoAcid3 name = residue.getAminoAcid3();
221 return switch (name) {
222 case ALA -> 9.8;
223 case CYS -> -0.5;
224 case ASP -> -30.5;
225 case GLU -> -19.0;
226 case PHE -> -1.2;
227 case HIS -> -28.0;
228 case ILE -> 12.2;
229 case LYS -> -13.6;
230 case LEU -> 13.7;
231 case MET -> -7.1;
232 case ASN -> -34.5;
233 case GLN -> -31.4;
234 case ARG -> -43.9;
235 case SER -> -20.2;
236 case THR -> -20.3;
237 case VAL -> 12.0;
238 case TRP -> -16.2;
239 case TYR -> -18.8;
240 case UNK -> nonStdEnergies.getOrDefault(residue.getName().toUpperCase(), 0.0);
241 default -> 0;
242 };
243 }
244
245
246
247
248
249
250
251
252 private double getMacCallumSPCSolvationEnergy(Residue residue) {
253 AminoAcid3 name = residue.getAminoAcid3();
254 return switch (name) {
255 case ALA -> 9.3;
256 case CYS -> -1.1;
257 case ASP -> -30.1;
258 case GLU -> -18.8;
259 case PHE -> -1.4;
260 case HIS -> -27.2;
261 case ILE -> 11.9;
262 case LYS -> -8.6;
263 case LEU -> 12.6;
264 case MET -> -5.1;
265 case ASN -> -34.3;
266 case GLN -> -30.8;
267 case ARG -> -46.3;
268 case SER -> -18.5;
269 case THR -> -19.3;
270 case VAL -> 11.3;
271 case TRP -> -15.1;
272 case TYR -> -18.2;
273 case UNK -> nonStdEnergies.getOrDefault(residue.getName().toUpperCase(), 0.0);
274 default -> 0;
275 };
276 }
277
278
279
280
281
282
283
284
285 private double getCabaniSolvationEnergy(Residue residue) {
286 AminoAcid3 name = residue.getAminoAcid3();
287 switch (name) {
288 case ALA:
289 return 8.4;
290 case CYS:
291 return -5.2;
292 case ASP:
293 return -28.1;
294 case GLU:
295 return -27.1;
296 case PHE:
297 return -3.7;
298 case HIS:
299 return -27.4;
300 case ILE:
301 return 8.7;
302 case LYS:
303 return -15.5;
304 case LEU:
305 return 9.7;
306 case MET:
307 return 9.0;
308 case ASN:
309 return -40.6;
310 case GLN:
311 return -18.7;
312 case ARG:
313 return -30.1;
314 case SER:
315 return -21.4;
316 case THR:
317 return -21.0;
318 case VAL:
319 return 8.2;
320 case TRP:
321 return -12.3;
322 case TYR:
323 return -25.7;
324 case UNK:
325 return nonStdEnergies.getOrDefault(residue.getName().toUpperCase(), 0.0);
326 case GLY:
327 case PRO:
328 default:
329 return 0;
330 }
331 }
332
333
334
335
336
337
338
339
340 private double getWolfendenSolvationEnergy(Residue residue) {
341 AminoAcid3 name = residue.getAminoAcid3();
342 switch (name) {
343 case ALA:
344 return 8.1;
345 case CYS:
346 return -5.1;
347 case ASP:
348 return -27.5;
349 case GLU:
350 return -26.6;
351 case PHE:
352 return -3.1;
353 case HIS:
354 return -42.1;
355 case ILE:
356 return 8.8;
357 case LYS:
358 return -18.0;
359 case LEU:
360 return 9.4;
361 case MET:
362 return -6.1;
363 case ASN:
364 return -39.9;
365 case GLN:
366 return -38.7;
367 case ARG:
368 return -44.8;
369 case SER:
370 return -20.8;
371 case THR:
372 return -20.1;
373 case VAL:
374 return 8.2;
375 case TRP:
376 return -24.3;
377 case TYR:
378 return -25.2;
379 case UNK:
380 return nonStdEnergies.getOrDefault(residue.getName().toUpperCase(), 0.0);
381 case GLY:
382 case PRO:
383 default:
384 return 0;
385 }
386 }
387
388
389
390
391
392
393
394
395
396
397
398
399
400 public enum SolvationLibrary {
401 WOLFENDEN, CABANI, EXPLICIT, GK, MACCALLUM_SPC, MACCALLUM_TIP4P, OPLS_EXPLICIT, OPLS_GK, AUTO, NONE
402 }
403 }