summaryrefslogtreecommitdiff
path: root/support/ochem/bicyclib.pm
blob: 0c2f54eddaf8cc5e1bdcc081209d9335e2109d25 (plain)
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
174
175
176
#
# bicyclib.pm
# library module for bicyclic compounds
#
print "module bicyclib version 1.0 1999-04-12\n";

# Norbornan
# parameter: "bc221h", , , startpos, bliste, radius
sub bc221h_default_
{
    my ($iAnz, $p1, $p2, $iStart, $BT, $bAromat, $rRadius) = @_;
    $$iAnz = 7;
    $$iStart = $$p1 = $$p2 = 0;
    $$rRadius = $rLenN;
    $$bAromat = $false;
    @$BT = (9, 9, 9, 0, 0, 0, 9, 0);
}

sub bc221h_
{
    my ($XYstart, $rRadius, $rRadius_bak, $iAnz, $p1, $p2, $iStart, 
			$M, $rLena, $rThetaa, $XYa, $BLa, $t, $b, $r) = @_;

    $$rRadius_bak = $$rRadius = abs($$rRadius);
    my ($dx, $dy) = (cos(30*$pi/180)*$$rRadius, sin(30*$pi/180)*$$rRadius);
    my ($sx, $sy) = (0.6*$$rRadius, 0.7*$$rRadius);
    my $l1 = sqrt($sx*$sx+$sy*$sy);
    @$XYa = (loc->new(0,0), loc->new($dx,$dy), loc->new(2*$dx,0), 
	     loc->new($sx+2*$dx,$sy), loc->new($sx+$dx,$sy+$dy), loc->new($sx,$sy),
	     loc->new($dx*1.5,$sy*3));
    my $XYshift = loc->new($$XYa[$iStart]);
    grep(($_->translate(- $XYshift->{"x"},
			- $XYshift->{"y"}) && 0), @$XYa);
    grep(($_->translate($XYstart) && 0), @$XYa);
    $M->eq(0,0);
    $M->translate($XYstart);
    @$rThetaa = (30, -30, getangle($$XYa[2], $$XYa[3]), 150, -150,
		getangle($$XYa[5], $$XYa[0]),  
		getangle($$XYa[1], $$XYa[6]), getangle($$XYa[4], $$XYa[6]));
    @$rLena = ($$rRadius, $$rRadius, $l1, $$rRadius, $$rRadius, $l1,
		getlength($$XYa[1], $$XYa[6]), getlength($$XYa[4], $$XYa[6]));
    @$BLa = (0, 1, 2, 3, 4, 5, 1, 4);   # start atom
    @$r = (-140, -120, -80, 10, 30, 150, 90);
    @$t = (150, 30, 30, 30, 150, 150, 150);
    @$b = (-90, 150, -90, -90, 30, -90, 30);
}


# Norpinan-Geruest
# parameter: "bc311h", , , startpos, bliste, radius
sub bc311h_default_
{
    my ($iAnz, $p1, $p2, $iStart, $BT, $bAromat, $rRadius) = @_;
    $$iAnz = 7;
    $$iStart = $$p1 = $$p2 = 0;
    $$rRadius = $rLenN;
    $$bAromat = $false;
    @$BT = (0, 0, 0, 9, 9, 9, 9, 0);
}

sub bc311h_
{
    my ($XYstart, $rRadius, $rRadius_bak, $iAnz, $p1, $p2, $iStart, 
			$M, $rLena, $rThetaa, $XYa, $BLa, $t, $b, $r) = @_;

    $$rRadius_bak = $$rRadius = abs($$rRadius);
    my ($dx, $dy) = (cos(30*$pi/180)*$$rRadius, sin(30*$pi/180)*$$rRadius);
    my ($sx, $sy) = ($$rRadius, sin(30*$pi/180)*(2*$$rRadius));
    my $l1 = sqrt($sx*$sx+$sy*$sy);
    @$XYa = (loc->new(0,0), loc->new($dx,-$dy), loc->new(2*$dx,0), 
	    loc->new($sx+2*$dx,-$sy), loc->new($sx+$dx,$dy-$sy), loc->new($sx,-$sy),
	    0);
    $$XYa[6] = getpos($$XYa[5], -120,$$rRadius);
    @$rThetaa = (-30, +30, getangle($$XYa[2], $$XYa[3]), 
	    150, -150, getangle($$XYa[5], $$XYa[0]),
	    -120,  getangle($$XYa[1], $$XYa[6]));
    @$rLena = ($$rRadius, $$rRadius, $l1, $$rRadius, $$rRadius, $l1,
	    $$rRadius, getlength($$XYa[1], $$XYa[6]));
    my $XYshift = loc->new($$XYa[$iStart]);
    grep(($_->translate(- $XYshift->{"x"},
			- $XYshift->{"y"}) && 0), @$XYa);
    grep(($_->translate($XYstart) && 0), @$XYa);
    $M->eq(0,0);
    $M->translate($XYstart);
    @$BLa = (0, 1, 2, 3, 4, 5, 5, 1);   # start atom
    @$r = (142, -60, 82, -37, 90, -60, -120);
    @$t = (90, -30, 90, 30, 90, 10, 180);
    @$b = (-150, -150, -20, -90, -120, -90, -60);
}

# Bizyklo[2.2.2]oktan
# parameter: "bc222o", , , startpos, bliste, radius
sub bc222o_default_
{
    my ($iAnz, $p1, $p2, $iStart, $BT, $bAromat, $rRadius) = @_;
    $$iAnz = 8;
    $$iStart = $$p1 = $$p2 = 0;
    $$rRadius = $rLenN;
    $$bAromat = $false;
    @$BT = (0, 0, 9, 9, 9, 0, 9, 9, 0);
}

sub bc222o_
{
    my ($XYstart, $rRadius, $rRadius_bak, $iAnz, $p1, $p2, $iStart, 
			$M, $rLena, $rThetaa, $XYa, $BLa, $t, $b, $r) = @_;

    $$rRadius_bak = $$rRadius = abs($$rRadius);
    my ($dx, $dy) = (cos(30*$pi/180)*$$rRadius, sin(30*$pi/180)*$$rRadius);
    my ($sx, $sy) = (0.6*$$rRadius, 0.7*$$rRadius);
    my $l1 = sqrt($sx*$sx+$sy*$sy);
    @$XYa = (loc->new(0,0), loc->new($dx,$dy), loc->new(2*$dx,0), 
	     loc->new(2*$dx-$sx,-$sy), loc->new($dx-$sx,$dy-$sy), loc->new(-$sx,-$sy),
	     0,0);
    $$XYa[6] = getpos($$XYa[4], 90, $$rRadius);
    $$XYa[7] = getpos($$XYa[1], 90, $$rRadius);
    my $XYshift = loc->new($$XYa[$iStart]);
    grep(($_->translate(- $XYshift->{"x"},
			- $XYshift->{"y"}) && 0), @$XYa);
    grep(($_->translate($XYstart) && 0), @$XYa);
    $M->eq(0,0);
    $M->translate($XYstart);
    @$rThetaa = (30, -30, getangle($$XYa[2], $$XYa[3]), 150, -150,
		getangle($$XYa[5], $$XYa[0]),  
		90, getangle($$XYa[6], $$XYa[7]), 90);
    @$rLena = ($$rRadius, $$rRadius, $l1, $$rRadius, $$rRadius, $l1,
		$$rRadius, $l1, $$rRadius);
    @$BLa = (0, 1, 2, 3, 4, 5, 4, 6, 1);   # start atom
    @$r = (135, 45, 30, -80, -120, -138, 140, 70);
    @$t = (150, 30, 30, 30, 150, 150, 150, 150);
    @$b = (-90, 150, -90, -90, -90, -90, 20, 30);
}


# Tropin-Geruest
# parameter: "bc321o", , , startpos, bliste, radius
sub bc321o_default_
{
    my ($iAnz, $p1, $p2, $iStart, $BT, $bAromat, $rRadius) = @_;
    $$iAnz = 8;
    $$iStart = $$p1 = $$p2 = 0;
    $$rRadius = $rLenN;
    $$bAromat = $false;
    @$BT = (0, 0, 0, 9, 9, 9, 9, 0, 0);
}

sub bc321o_
{
    my ($XYstart, $rRadius, $rRadius_bak, $iAnz, $p1, $p2, $iStart, 
			$M, $rLena, $rThetaa, $XYa, $BLa, $t, $b, $r) = @_;

    $$rRadius_bak = $$rRadius = abs($$rRadius);
    my ($dx, $dy) = (cos(30*$pi/180)*$$rRadius, sin(30*$pi/180)*$$rRadius);
    my ($sx, $sy) = ($$rRadius, sin(30*$pi/180)*(2*$$rRadius));
    my $l1 = sqrt($sx*$sx+$sy*$sy);
    @$XYa = (loc->new(0,0), loc->new($dx,-$dy), loc->new(2*$dx,0), 
	    loc->new($sx+2*$dx,-$sy), loc->new($sx+$dx,$dy-$sy), 
	    loc->new($sx,-$sy), 0, 0);
    $$XYa[6] = getpos($$XYa[5],-100,$$rRadius);
    $$XYa[7] = getpos($$XYa[1],-100,$$rRadius);
    @$rThetaa = (-30, +30, getangle($$XYa[2], $$XYa[3]), 
	    150, -150, getangle($$XYa[5], $$XYa[0]),
	    -100, getangle($$XYa[6], $$XYa[7]), -100);
    @$rLena = ($$rRadius, $$rRadius, $l1, $$rRadius, $$rRadius, $l1,
	    $$rRadius, getlength($$XYa[6], $$XYa[7]), $$rRadius);
    my $XYshift = loc->new($$XYa[$iStart]);
    grep(($_->translate(- $XYshift->{"x"},
			- $XYshift->{"y"}) && 0), @$XYa);
    grep(($_->translate($XYstart) && 0), @$XYa);
    $M->eq(0,0);
    $M->translate($XYstart);
    @$BLa = (0, 1, 2, 3, 4, 5, 5, 6, 1);   # start atom
    @$r = (143, 100, 82, -37, 90, -60, -100, -120);
    @$t = (90, -30, 90, 30, 90, -150, -30, -20);
    @$b = (-150, -150, -20, -90, -60, -45, -150, -160);
}