-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbas2xyz.f95
212 lines (168 loc) · 4.33 KB
/
bas2xyz.f95
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
program bastoxyz
implicit none
integer :: i,j,k,nbatom
integer,dimension(:), allocatable :: numat
real*8, dimension(:,:), allocatable :: coord
character*128, dimension(:), allocatable :: charatom
character*128,dimension(117):: atomchar
character*128 :: outputxyz, inputbas
logical :: stay
!==========================================================================!
!=================Valeurs des atomchar à remplacer=========================!
!==========================================================================!
atomchar(1)= "H"
atomchar(2)= "He"
atomchar(3)= "Li"
atomchar(4)= "Be"
atomchar(5)= "B"
atomchar(6)= "C"
atomchar(7)= "N"
atomchar(8)= "O"
atomchar(9)= "F"
atomchar(10)= "Ne"
atomchar(11)= "Na"
atomchar(12)= "Mg"
atomchar(13)= "Al"
atomchar(14)= "Si"
atomchar(15)= "P"
atomchar(16)= "S"
atomchar(17)= "Cl"
atomchar(18)= "Ar"
atomchar(19)= "K"
atomchar(20)= "Ca"
atomchar(21)= "Sc"
atomchar(22)= "Ti"
atomchar(23)= "V"
atomchar(24)= "Cr"
atomchar(25)= "Mn"
atomchar(26)= "Fe"
atomchar(27)= "Co"
atomchar(28)= "Ni"
atomchar(29)= "Cu"
atomchar(30)= "Zn"
atomchar(31)= "Ga"
atomchar(32)= "Ge"
atomchar(33)= "As"
atomchar(34)= "Se"
atomchar(35)= "Br"
atomchar(36)= "Kr"
atomchar(37)= "Rb"
atomchar(38)= "Sr"
atomchar(39)= "Y"
atomchar(40)= "Zr"
atomchar(41)= "Nb"
atomchar(42)= "Mo"
atomchar(43)= "Tc"
atomchar(44)= "Ru"
atomchar(45)= "Rh"
atomchar(46)= "Pd"
atomchar(47)= "Ag"
atomchar(48)= "Cd"
atomchar(49)= "In"
atomchar(50)= "Sn"
atomchar(51)= "Sb"
atomchar(52)= "Te"
atomchar(53)= "I"
atomchar(54)= "Xe"
atomchar(55)= "Cs"
atomchar(56)= "Ba"
atomchar(57)= "La"
atomchar(58)= "Ce"
atomchar(59)= "Pr"
atomchar(60)= "Nd"
atomchar(61)= "Pm"
atomchar(62)= "Sm"
atomchar(63)= "Eu"
atomchar(64)= "Gd"
atomchar(65)= "Tb"
atomchar(66)= "Dy"
atomchar(67)= "Ho"
atomchar(68)= "Er"
atomchar(69)= "Tm"
atomchar(70)= "Yb"
atomchar(71)= "Lu"
atomchar(72)= "Hf"
atomchar(73)= "Ta"
atomchar(74)= "W"
atomchar(75)= "Re"
atomchar(76)= "Os"
atomchar(77)= "Ir"
atomchar(78)= "Pt"
atomchar(79)= "Au"
atomchar(80)= "Hg"
atomchar(81)= "Tl"
atomchar(82)= "Pb"
atomchar(83)= "Bi"
atomchar(84)= "Po"
atomchar(85)= "At"
atomchar(86)= "Rn"
atomchar(87)= "Fr"
atomchar(88)= "Ra"
atomchar(89)= "Ac"
atomchar(90)= "Th"
atomchar(91)= "Pa"
atomchar(92)= "U"
atomchar(93)= "Np"
atomchar(94)= "Pu"
atomchar(95)= "Am"
atomchar(96)= "Cm"
atomchar(97)= "Bk"
atomchar(98)= "Cf"
atomchar(99)= "Es"
atomchar(100)= "Fm"
atomchar(101)= "Md"
atomchar(102)= "No"
atomchar(103)= "Lr"
atomchar(104)= "Rf"
atomchar(105)= "Db"
atomchar(106)= "Sg"
atomchar(107)= "Bh"
atomchar(108)= "Hs"
atomchar(109)= "Mt"
atomchar(110)= "Ds"
atomchar(111)= "Rg"
atomchar(112)= "Cn"
atomchar(113)= "Uut"
atomchar(114)= "Fl"
atomchar(115)= "Uup"
atomchar(116)= "Lv"
atomchar(117)= "Uuh"
!===========================================================================!
!=============================lecture fichier xyz===========================!
!===========================================================================!
call getarg(1,inputbas)
inputbas=trim(inputbas)
open(10,file=inputbas,status='old',action='read')
read(10,*) nbatom
allocate(charatom(nbatom),coord(nbatom,3),numat(nbatom))
do i = 1, nbatom
read(10,*) numat(i),(coord(i,j),j=1,3)
enddo
close(10)
!==========================================================================!
!===============attribution du numéro atomique=============================!
!==========================================================================!
do i=1,nbatom
do j=1,117
if (numat(i) == j) then
charatom(i)= atomchar(j)
endif
enddo
enddo
!==========================================================================!
!===================ecriture du fichier output=============================!
!==========================================================================!
call getarg(2,outputxyz)
outputxyz=trim(outputxyz)
open(55,file=outputxyz,action='write')
write(55,'(9x,i3)') nbatom
write(55,*)
do i = 1,nbatom
write(55,'(1x,a3,4x,f10.6,4x,f10.6,4x,f10.6)') charatom(i),coord(i,1),coord(i,2),coord(i,3)
enddo
close(55)
!*************************************************************************!
!*****************libération de la mémoire********************************!
!*************************************************************************!
deallocate(numat,charatom,coord)
endprogram