21INTEGER (KIND=c_int) FUNCTION read_pdb (pdb_f, lpdb) bind (C,NAME='read_pdb_')
33INTEGER (KIND=c_int),
INTENT(IN) :: lpdb
34INTEGER,
DIMENSION(:),
ALLOCATABLE :: linea
35LOGICAL :: with_cell = .false.
36CHARACTER (KIND=c_char),
DIMENSION(*),
INTENT(IN) :: pdb_f
37CHARACTER (LEN=lpdb) :: pdb_file
38CHARACTER (LEN=4) :: aname
39CHARACTER (LEN=6) :: rid
41CHARACTER (LEN=1) :: alb
42CHARACTER (LEN=3) :: acc
43CHARACTER (LEN=1) :: cic
45CHARACTER (LEN=1) :: ic
46DOUBLE PRECISION :: oca
48CHARACTER (LEN=2) :: sym
49CHARACTER (LEN=2) :: cha
50REAL,
DIMENSION(6) :: cell
51CHARACTER (LEN=11) :: spg
55 pdb_file(
i:
i) = pdb_f(
i)
59inquire (file=pdb_file, exist=isok)
62 open (unit=20, file=pdb_file,
action=
'read', status=
'old')
67 read (20,
'(A6)',
end=999) rid
69 if (rid.eq.
'HETATM' .or. rid.eq.
'ATOM ') na=na+1
70 if (rid.eq.
'CRYST1') with_cell = .true.
75 if (
allocated(linea))
deallocate(linea)
76 allocate (linea(l), stat=err)
78 call show_error (
"Impossible to allocate memory"//char(0), &
79 "Function: read_pdb"//char(0),
"Table: LINEA"//char(0))
83 read (20,
'(A6)',
end=888) rid
86 if (rid.eq.
'HETATM' .or. rid.eq.
'ATOM ') linea(l) = 1
87 if (rid.eq.
'CRYST1') linea(l) = 2
91 if (
allocated(fullpos))
deallocate(fullpos)
92 allocate (fullpos(na,3,ns), stat=err)
94 call show_error (
"Impossible to allocate memory"//char(0), &
95 "Function: read_pdb"//char(0),
"Table: FULLPOS"//char(0))
97 if (
allocated(tab_of_type))
deallocate(tab_of_type)
98 allocate (tab_of_type(na), stat=err)
100 call show_error (
"Impossible to allocate memory"//char(0), &
101 "Function: read_pdb"//char(0),
"Table: TAB_OF_TYPE"//char(0))
106 if (linea(j) .eq. 1)
then
108 read (20, 001) rid, &
125 else if (linea(j) .eq. 2)
then
126 read (20, 002) rid, &
140 if (
allocated(linea))
deallocate(linea)
142 call cell_data_from_pdb (cell(1), cell(2), cell(3), cell(4), cell(5), cell(6))
153001
FORMAT (a6,i5,1x,a4,a1,a3,1x,a1,i4,a1,3x,f8.3,f8.3,f8.3,f6.2,f6.2,10x,a2,a2)
154002
FORMAT (a6,f9.3,f9.3,f9.3,f7.2,f7.2,f7.2,1x,a11,i4)
206CHARACTER (LEN=2) FUNCTION atompdb(LIN, PDBSTR)
209CHARACTER (LEN=2),
INTENT(IN) :: pdbstr
210INTEGER,
INTENT(IN) :: lin
215 if (pdbstr(pa:pa) .ne.
' ')
then
252 if (atsym(pa) .eq.
atompdb)
then
257 write (6,
'("Warning reading PDB file: atom symbol not found line: ",i10)') lin