-1

I want to read only those lines that contains "ATOM" as the first word and write in a file using a Fortran code. I have tried to write a code but was unable to read that specific lines containing word "ATOM" only. I hope someone can help me in this regard.

enter image description here

Mark Plotnick
  • 9,598
  • 1
  • 24
  • 40
anupama
  • 1
  • 2
  • 2
    This is not a code writing service - please show us what you have done so far and explain what is wrong. That said googling "read pdb fortran" produces many hits - do any of those solve your problem? – Ian Bush Feb 19 '21 at 10:36

1 Answers1

0

you need something like this:

character*4 word

character*256 line

read(filename,1000) word,line

1000 format(A4,A256)

if (word .eq. 'ATOM') then

     write(10,1000) word,line
Ian Bush
  • 6,996
  • 1
  • 21
  • 27
Natsfan
  • 4,093
  • 3
  • 22
  • 29