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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
*DECK NXTTPS
SUBROUTINE NXTTPS(IPRINT,NPIN ,IDGPP ,ITSYM ,DRAPIN)
*
*----------
*
*Purpose:
* To test if pins satisfy required symmetry.
*
*Copyright:
* Copyright (C) 2005 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*Author(s):
* G. Marleau.
*
*Parameters: input
* IPRINT print level.
* NPIN number of pins.
* IDGPP pin direction.
* ITSYM flag for symmetries to test.
* DRAPIN pin position/angle/height/radius.
*
*Reference:
* G. Marleau,
* New Geometries Processing in DRAGON: The NXT: Module,
* Report IGE-260, Polytechnique Montreal,
* Montreal, 2005.
*
*----------
*
IMPLICIT NONE
*----
* Subroutine arguments
*----
INTEGER IPRINT,NPIN,IDGPP,ITSYM(4)
DOUBLE PRECISION DRAPIN(-1:4,NPIN)
*----
* Functions
*----
DOUBLE PRECISION XDRCST,PI
*----
* Local parameters
*----
INTEGER IOUT
CHARACTER NAMSBR*6
PARAMETER (IOUT=6,NAMSBR='NXTTPS')
DOUBLE PRECISION DCUTOF,DZERO,DONE,DTWO
PARAMETER (DCUTOF=1.0D-6,DZERO=0.0D0,DONE=1.0D0,DTWO=2.0D0)
*----
* Local variables
*----
INTEGER IPLOC
INTEGER IS,IP,JP,NPIR
DOUBLE PRECISION DNAP,PIO2,TWOPI
INTEGER ITSYR(4)
*----
* Processing starts:
* print routine openning output header if required
* and initialize various parameters.
*----
IPLOC=IPRINT
IF(IPLOC .GE. 100) THEN
WRITE(IOUT,6000) NAMSBR
IF(IPLOC .GE. 1000) THEN
WRITE(IOUT,*) 'Symmetry =',ITSYM
WRITE(IOUT,*) 'Npin =',NPIN
DO IP=1,NPIN
WRITE(IOUT,'(6F20.12)') (DRAPIN(JP,IP),JP=-1,4)
ENDDO
ENDIF
ENDIF
*----
* Rotate symmetry factors for cell directions
*----
DO IS=1,4
ITSYR(IS)=ITSYM(IS)
ENDDO
IF(IDGPP .EQ. 1) THEN
ITSYR(1)=ITSYM(2)
ITSYR(2)=ITSYM(3)
ITSYR(3)=ITSYM(1)
ITSYR(4)=ITSYM(4)
IF(ITSYR(4) .EQ. 1) CALL XABORT(NAMSBR//
> ': X=Y symmetry invalid for pin in direction X')
ELSE IF(IDGPP .EQ. 2) THEN
ITSYR(1)=ITSYM(3)
ITSYR(2)=ITSYM(1)
ITSYR(3)=ITSYM(2)
ITSYR(4)=ITSYM(4)
IF(ITSYR(4) .EQ. 1) CALL XABORT(NAMSBR//
> ': X=Y symmetry invalid for pin in direction Y')
ENDIF
PI=XDRCST('Pi',' ')
PIO2=PI/DTWO
TWOPI=DTWO*PI
*----
* Scan over symmetrization options (in plane only)
*----
DO 100 IS=1,3
IF(ITSYR(IS) .EQ. 1) THEN
*----
* Scan over symmetrized pin
*----
IF(IPLOC .GE. 1000) THEN
WRITE(IOUT,'(A3,1X,I8,I8)') 'IS=',IS,ITSYR(IS)
ENDIF
DO 110 IP=1,NPIN
*----
* Find location of pin after symmetrisation
*----
IF(IS .EQ. 1) THEN
*----
* X symmetry
* Symmetric pin should be at \pi-\varphi
*----
DNAP=PI-DRAPIN(-1,IP)
ELSE IF(IS .EQ. 2) THEN
*----
* Y symmetry
* Symmetric pin should be at -\varphi
*----
DNAP=-DRAPIN(-1,IP)
ELSE IF(IS .EQ. 3) THEN
*----
* Z symmetry
* Symmetric pin should be at \varphi
*----
DNAP=DRAPIN(-1,IP)
ELSE IF(IS .EQ. 4) THEN
*----
* X=Y symmetry
* Symmetric pin should be at \pi/2-\varphi
*----
DNAP=PIO2-DRAPIN(-1,IP)
ENDIF
*----
* Position angle in range 0 to 2*Pi
*----
IF(ABS(DNAP) .LE. DCUTOF) THEN
DNAP=DZERO
ELSE IF(DNAP .GT. DCUTOF) THEN
NPIR=INT((DNAP+DCUTOF)/TWOPI)
DNAP=DNAP-DBLE(NPIR)*TWOPI
ELSE
NPIR=INT((DNAP-DCUTOF)/TWOPI)
DNAP=DNAP-DBLE(NPIR-1)*TWOPI
ENDIF
IF(IPLOC .GE. 1000) THEN
WRITE(IOUT,'(A3,1X,I8,2F20.12)')
> 'IP=',IP,DRAPIN(0,IP),DNAP
ENDIF
IF(DRAPIN(0,IP) .LT. DCUTOF) THEN
*----
* For centered pin, test for radial position only
*----
DO JP=1,NPIN
*----
* Verify if pin coincide
* with symmetrized pin
*----
IF(IPLOC .GE. 1000) THEN
WRITE(IOUT,'(A3,1X,I8,3F20.12)')
> 'JP=',JP,DRAPIN(0,JP),DRAPIN(-1,JP),
> ABS(DRAPIN(0,IP)-DRAPIN(0,JP))
ENDIF
IF(ABS(DRAPIN(0,IP)-DRAPIN(0,JP)) .LT. DCUTOF)
> GO TO 115
ENDDO
*----
* no pin coincide, symmetry not satisfied, abort
*----
CALL XABORT(NAMSBR//': Symmetric pin not found (C)')
ELSE
*----
* For pin not centered, test for angular and radial position
*----
DO JP=1,NPIN
*----
* Verify if pin coincide
* with symmetrized pin
*----
IF(IPLOC .GE. 1000) THEN
WRITE(IOUT,'(A3,1X,I8,4F20.8)')
> 'JP=',JP,DRAPIN(0,JP),DRAPIN(-1,JP),
> ABS(DRAPIN(0,IP)-DRAPIN(0,JP)),
> ABS(DNAP-DRAPIN(-1,JP))
ENDIF
IF(ABS(DRAPIN(0,IP)-DRAPIN(0,JP)) .LT. DCUTOF) THEN
IF(ABS(DNAP-DRAPIN(-1,JP)) .LT. DCUTOF) GO TO 115
ENDIF
ENDDO
*----
* no pin coincide, symmetry not satisfied, abort
*----
CALL XABORT(NAMSBR//': Symmetric pin not found (O-C)')
ENDIF
115 CONTINUE
110 CONTINUE
ENDIF
100 CONTINUE
*----
* Processing finished:
* print routine closing output header if required
* and return
*----
IF(IPLOC .GE. 100) THEN
WRITE(IOUT,6001) NAMSBR
ENDIF
RETURN
*----
* Output formats
*----
6000 FORMAT('(* Output from --',A6,'-- follows ')
6001 FORMAT(' Output from --',A6,'-- completed *)')
END
|