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
|
//package nt;
import javax.swing.*;
import java.awt.*;
import java.net.URL;
import java.awt.event.*;
import java.applet.*;
public class P35 extends JPanel implements ActionListener
{
JTextPane salida;
JScrollPane ssalida;
JPanel botpanel;
JButton B1, B2, B3;
JLabel l1;
MoleculaT M1, M2, M3;
String inf;
public P35 (MoleculaT A, MoleculaT B, MoleculaT C)
{
M1 = A;
M2 = B;
M3 = C;
setLayout (new BorderLayout ());
salida = new JTextPane ();
salida.setEditable (false);
Font fon = new Font ("Courier", 1, 12);
salida.setFont (fon);
inf = "";
ssalida = new JScrollPane (salida);
ssalida.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
ssalida.setBorder (BorderFactory.
createCompoundBorder (BorderFactory.createTitledBorder ("Output PDB structure"), BorderFactory.createEtchedBorder (1)));
botpanel = new JPanel ();
botpanel.setLayout (new FlowLayout ());
B1 = new JButton ("Heterojunction");
B1.addActionListener (this);
botpanel.add (B1);
B2 = new JButton ("Single-Walled Nanotube");
B2.addActionListener (this);
botpanel.add (B2);
B3 = new JButton ("Multi-Walled Nanotube");
B3.addActionListener (this);
botpanel.add (B3);
l1 = new JLabel ("The ouput is also echoed in the Java console. If you cannot copy the text from here, copy the PDB from the Java console.");
add (l1, BorderLayout.NORTH);
add (ssalida, BorderLayout.CENTER);
add (botpanel, BorderLayout.SOUTH);
}
public void actionPerformed (ActionEvent ev)
{
String etiq = ev.getActionCommand ();
if (etiq == "Heterojunction") {
inf = M1.getInfo ();
printpdb (M1);
} else if (etiq == "Single-Walled Nanotube") {
inf = M2.getInfo ();
printpdb (M2);
} else if (etiq == "Multi-Walled Nanotube") {
inf = M3.getInfo ();
printpdb (M3);
}
}
public void printpdb (String s)
{
salida.setText (s + " " + this.getRootPane ().getUIClassID ());
}
public void printpdb (MoleculaT mol)
{
formato fo = new formato (8, "#0.000");
formato fdec = new formato (7, "#0.000"); //para los doble precision
formato fi = new formato (5, "#####"); //para los enteros
StringBuffer pdb =
new
StringBuffer
("REMARK ==============================================================================\n"
+ "REMARK " + inf + "\n" +
"REMARK File generated by CoNTub 1.0 build 22. July 26th 2004\n"
+
"REMARK Cite as: S.Melchor, J.A. Dobado. J. Chem. Inf. Comp. Sci. 44, 1639-1646 (2004)\n"
+
"AUTHOR Software available at http://www.ugr.es/local/gmdm/java/contub/contub.html\n"
+
"AUTHOR For questions and comments: http://www.ugr.es/local/gmdm\n"
+ "REMARK ==============================================================================\n");
Minimol mmol = new Minimol (mol);
for (int i = 0; i < mmol.nvert; i++) {
String lab = mmol.minietiqs[i];
pdb.append ("HETATM" + fi.aCadena (i + 1) + " " +
lab + " " + fi.aCadena (i + 1) +
" " +
fdec.aCadena (mmol.miniverts[i].x) + fdec.aCadena (mmol.miniverts[i].y) + fdec.aCadena (mmol.miniverts[i].z) + "\n");
}
for (int i = 0; i < mmol.nvert; i++) //CONECTIVIDAD
{
pdb.append ("CONECT" + fi.aCadena (i + 1));
for (int j = 1; j <= mmol.miniconec[i][0]; j++)
pdb.append (fi.aCadena (mmol.miniconec[i][j] + 1));
pdb.append ("\n");
}
pdb = pdb.append ("END");
if (mmol.nvert >= 1) {
salida.setText (pdb + "");
System.out.print (pdb + "");
} else if (mmol.nvert == 0)
salida.setText ("Hmm.. It seems there is no molecule at all. Just use the Create Button");
else
salida.setText ("Error raro");
}
}
|