From owner-chemistry@ccl.net Wed Jun 11 03:54:00 2014 From: "Mehboob Alam mehboob.cu+*+gmail.com" To: CCL Subject: CCL: How to read data from a specific line to another specific line in a file using FORTRAN 90/95 code Message-Id: <-50190-140611035002-28976-OdXi0fTVrHpb3EqcPN3M9w(_)server.ccl.net> X-Original-From: Mehboob Alam Content-Type: multipart/alternative; boundary=089e013d0502bd359104fb8ab057 Date: Wed, 11 Jun 2014 13:19:56 +0530 MIME-Version: 1.0 Sent to CCL by: Mehboob Alam [mehboob.cu###gmail.com] --089e013d0502bd359104fb8ab057 Content-Type: text/plain; charset=ISO-8859-1 Respected CCL members, I have a file containing several lines and I want to read data from 4 continuous lines. But the condition is that the reading should be started > from a line started with a character variable "name". For example, Below, I have given an example input file and lines which need to read are marked bold and blue. Sample input file: students are curious about their results The result will be published on 10th of march this year below is given name of the students and marks obtained by them *name subject marks* *krishna chemistry 85* *Ibrahim physics 82* *kayanuma chemistry 87* raju maths 99 End of Sample input file. Also note that the line number containing the character variable "name" andhow many lines are there after it are not known. Any help will be highly appreciated. With best regards, Md. Mehboob Alam Senior Research Fellow - CSIR-INDIA Department of Chemistry, University of Calcutta Kolkata - 700 009, India --089e013d0502bd359104fb8ab057 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Respected CCL members,

I have a file co= ntaining several lines and I want to read data from 4 continuous lines. But= the condition is that the reading should be started from a line started wi= th a character variable "name". For example, Below, I have given = an example input file and lines which need to read are marked bold and blue= .

Sample input file:

students ar= e curious about their results
The result will be published on 10t= h of march this year
below is given name of the students and mark= s obtained by them
name =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0subject =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0marks<= /div>
krishna =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 chemistry =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A085
Ibrahim =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0physics =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 82
kayanuma =A0 =A0 =A0 =A0 =A0 =A0 =A0chemist= ry =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 87
raju =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 maths =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A099

End of Sample input file= .

Also note that the line number containing the character= variable "name" andhow many lines are there after it are not kno= wn.

Any help will be highly appreciated.

With best regards,
Md. Meh= boob Alam
Senior Research Fellow - CSIR-INDIA
Department of C= hemistry,
University of Calcutta
Kolkata - 700 009, Ind= ia
--089e013d0502bd359104fb8ab057-- From owner-chemistry@ccl.net Wed Jun 11 05:47:00 2014 From: "Herbert Fruchtl herbert.fruchtl!=!st-andrews.ac.uk" To: CCL Subject: CCL: How to read data from a specific line to another specific line in a file using FORTRAN 90/95 code Message-Id: <-50191-140611053939-30337-t1uZdSO0CsIK+f2PnulNXQ##server.ccl.net> X-Original-From: Herbert Fruchtl Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Date: Wed, 11 Jun 2014 10:39:10 +0100 MIME-Version: 1.0 Sent to CCL by: Herbert Fruchtl [herbert.fruchtl##st-andrews.ac.uk] grep -A 4 name Herbert On 11/06/14 08:49, Mehboob Alam mehboob.cu+*+gmail.com wrote: > Respected CCL members, > > I have a file containing several lines and I want to read data from 4 continuous > lines. But the condition is that the reading should be started from a line > started with a character variable "name". For example, Below, I have given an > example input file and lines which need to read are marked bold and blue. > > Sample input file: > > students are curious about their results > The result will be published on 10th of march this year > below is given name of the students and marks obtained by them > *name subject marks* > *krishna chemistry 85* > *Ibrahim physics 82* > *kayanuma chemistry 87* > raju maths 99 > > End of Sample input file. > > Also note that the line number containing the character variable "name" andhow > many lines are there after it are not known. > > Any help will be highly appreciated. > > With best regards, > Md. Mehboob Alam > Senior Research Fellow - CSIR-INDIA > Department of Chemistry, > University of Calcutta > Kolkata - 700 009, India -- Herbert Fruchtl Senior Scientific Computing Officer School of Chemistry, School of Mathematics and Statistics University of St Andrews -- The University of St Andrews is a charity registered in Scotland: No SC013532 From owner-chemistry@ccl.net Wed Jun 11 06:39:01 2014 From: "Simon Halstead joyjoyhappyjoy~~yahoo.co.uk" To: CCL Subject: CCL: How to read data from a specific line to another specific line in a file using FORTRAN 90/95 code Message-Id: <-50192-140611063715-31485-SPus8hWK/kqeYFDR1IAFuw##server.ccl.net> X-Original-From: Simon Halstead Content-Type: multipart/mixed; boundary="679054512-1875015775-1402483028=:75405" Date: Wed, 11 Jun 2014 11:37:08 +0100 (BST) MIME-Version: 1.0 Sent to CCL by: Simon Halstead [joyjoyhappyjoy : yahoo.co.uk] --679054512-1875015775-1402483028=:75405 Content-Type: multipart/alternative; boundary="679054512-413812004-1402483028=:75405" --679054512-413812004-1402483028=:75405 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable If you want it in a fortran program, something like the attached file shoul= d work=0A=0ARegards,=0A=0ASimon=0A=0A=0A=0AOn 11/06/14 08:49, Mehboob Alam = mehboob.cu+*+gmail.com wrote:=0A> Respected CCL members,=0A>=0A> I have a f= ile containing several lines and I want to read data from 4 continuous=0A> = lines. But the condition is that the reading should be started from a line= =0A> started with a character variable "name". For example, Below, I have g= iven an=0A> example input file and lines which need to read are marked bold= and blue.=0A>=0A> Sample input file:=0A>=0A> students are curious about th= eir results=0A> The result will be published on 10th of march this year=0A>= below is given name of the students and marks obtained by them=0A> *name= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 subject=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 marks*=0A> *krishna=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = chemistry=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 85*=0A> *Ibrahim=A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 physics=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 82*=0A> *kayanuma=A0 =A0 =A0 =A0 =A0 =A0 =A0 chemistry=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 87*=0A> raju=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 maths=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 99=0A>=0A= > End of Sample input file.=0A>=0A> Also note that the line number containi= ng the character variable "name" andhow=0A> many lines are there after it a= re not known.=0A>=0A> Any help will be highly appreciated.=0A>=0A> With bes= t regards,=0A> Md. Mehboob Alam=0A> Senior Research Fellow - CSIR-INDIA=0A>= Department of Chemistry,=0A> University of Calcutta=0A> Kolkata - 700 009,= India=0A=0A-- =0AHerbert Fruchtl=0ASenior Scientific Computing Officer=0AS= chool of Chemistry, School of Mathematics and Statistics=0AUniversity of St= Andrews=0A--=0AThe University of St Andrews is a charity registered in Sco= tland:=0ANo SC013532=0A=0A=0A=0A-=3D This is automatically added to each me= ssage by the mailing script =3D-=0ATo recover the email address of the auth= or of the message, please change=0Athe strange characters on the top line t= o the ^^^ sign. You can also=0Alook up the X-Original-From: line in the mail = header.=0A=0A=0A=A0 =A0 =A0==0A=0AE-mail to administrat= ors: CHEMISTRY-REQUEST^^^ccl.net or use=0A=A0 =A0 =A0 http://www.ccl.net/cgi-= bin/ccl/send_ccl_message=0A=0A=0A=A0 =A0 =A0 http://= www.ccl.net/chemistry/sub_unsub.shtml=0A=0ABefore posting, check wait time = at: http://www.ccl.net=0A=0A=0AConferences: ht= tp://server.ccl.net/chemistry/announcements/conferences/=0A=0ASearch Messag= es: http://www.ccl.net/chemistry/searchccl/index.shtml=0A=0AIf your mail bo= unces from CCL with 5.7.1 error, check:=0A=A0 =A0 =A0 http://www.ccl.net/sp= ammers.txt=0A=0A--679054512-413812004-1402483028=:75405 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
If you want it in a fortran program, something lik= e the attached file should work

Regards,
Simon


On 1= 1/06/14 08:49, Mehboob Alam mehboob.cu+*+gmail.com wrote:
> Respected= CCL members,
>
> I have a file containing several lines and I = want to read data from 4 continuous
> lines. But the condition is tha= t the reading should be started from a line
> started with a characte= r variable "name". For example, Below, I have given an
> example inpu= t file and lines which need to read are marked bold and blue.
>
&g= t; Sample input file:
>
> students are curious about their results
> The result will be published on 10th of march this year> below is given name of the students and marks obtained by them
>= ; *name                   = ;     subject              &nb= sp;     marks*
> *krishna         =         chemistry          &= nbsp;         85*
> *Ibrahim      =             physics       = ;               82*
> *kayanuma&n= bsp;             chemistry     = ;             87*
> raju    =                     math= s                          99
>
> End of Sample input file.>
> Also note that the line number containing the character vari= able "name" andhow
> many lines are there after it are not known.
= >
> Any help will be highly appreciated.
>
> With best= regards,
> Md. Mehboob Alam
> Senior Research Fellow - CSIR-IN= DIA
> Department of Chemistry,
> University of Calcutta
>= Kolkata - 700 009, India

--
Herbert Fruchtl
Senior Scientifi= c Computing Officer
School of Chemistry, School of Mathematics and Stati= stics
University of St Andrews
--
The University of St Andrews is = a charity registered in Scotland:
No SC013532



-=3D This i= s automatically added to each message by the mailing script =3D-
To reco= ver the email address of the author of the message, please change
the st= range characters on the top line to the ^^^ sign. You can also
E-mail to subscribers= : CHEMISTRY^^^ccl.net or use:
      http://www.ccl.ne= t/cgi-bin/ccl/send_ccl_message

E-mail to administrators: CHEMISTRY-REQUEST^^^ccl.net or use
      htt= p://www.ccl.net/cgi-bin/ccl/send_ccl_message

Subscribe/Unsubscri= be:
      http://www.ccl.net/chemistry/sub_unsub.shtml

Before posting, check wait time at:
http://www.ccl.net

Job: http://www.ccl.net/jobs
Conferences: http://server.ccl.net/chemistry/announcements/conferences/

Se= arch Messages: http://www.ccl.net/chemistry/searchccl/index.shtml=
  &n= bsp;   h= ttp://www.ccl.net/spammers.txt

RTFI: http://www.ccl.net/c= hemistry/aboutccl/instructions/




=
--679054512-413812004-1402483028=:75405-- --679054512-1875015775-1402483028=:75405 Content-Type: application/octet-stream; name="name.f95" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="name.f95" UFJPR1JBTSBOQU1FCglJTVBMSUNJVCBOT05FCiEvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXAohXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC8KIVZBUklBQkxF UwohPT09PT09PT09CglDSEFSQUNURVIoTEVOPTEwKSAJOjoJV09SRAoJQ0hB UkFDVEVSKExFTj0yMCkgCTo6CUZJTEVJTgoJQ0hBUkFDVEVSKExFTj04MCkg CTo6CUxJTkUKCQoJSU5URUdFUgkJCQk6OglpCiEvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXAohXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXAoJV1JJVEUoKiwq KSAiV2hhdCBpcyB0aGUgbmFtZSBvZiB0aGUgaW5wdXQgZmlsZT8iCglSRUFE KCosKikgRklMRUlOCgkKCU9QRU4oMTEsRklMRT1GSUxFSU4sU1RBVFVTPSdP TEQnLEFDQ0VTUz0nU0VRVUVOVElBTCcsQUNUSU9OPSdSRUFEJykKCQoJRE8K CQlSRUFEKDExLCcoYTgwKScpIExJTkUKCQlSRUFEKExJTkUsKikgV09SRAoJ CQoJCUlGKChUUklNKFdPUkQpPT0nbmFtZScpLk9SLihUUklNKFdPUkQpPT0n TmFtZScpLk9SLihUUklNKFdPUkQpPT0nTkFNRScpKSBUSEVOIAoJCQkhRE8g V0hBVEVWRVIgT1BFUkFUSU9OUyBZT1UgV0FOVCBIRVJFIC0gVE8gUkVBRCA0 IExJTkVTLi4uLgoJCQkKCQkJRE8gaT0xLDQKCQkJCVJFQUQoMTEsJyhhODAp JykgTElORQoJCQlFTkQgRE8KCQkJCgkJRU5EIElGCglFTkQgRE8KCiA5OSBX UklURSgqLCopICJFbmQgb2YgZmlsZSByZWFjaGVkIgkKIS9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cCiFcL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cLyAgIAoh U1VCUk9VVElORVMKIS9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cCiFcL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wv XC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9c L1wvXC9cL1wvXC9cL1wvXC9cLyAgIApFTkQgUFJPR1JBTSBOQU1F --679054512-1875015775-1402483028=:75405-- From owner-chemistry@ccl.net Wed Jun 11 08:07:00 2014 From: "Javier Cerezo jcb1|a|um.es" To: CCL Subject: CCL: How to read data from a specific line to another specific line in a file using FORTRAN 90/95 code Message-Id: <-50193-140611051402-28670-2LeB1G4IdIaGmlh6ILO9IA[*]server.ccl.net> X-Original-From: Javier Cerezo Content-Type: multipart/alternative; boundary="------------050409050500040602000908" Date: Wed, 11 Jun 2014 11:13:53 +0200 MIME-Version: 1.0 Sent to CCL by: Javier Cerezo [jcb1!A!um.es] This is a multi-part message in MIME format. --------------050409050500040602000908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi Mehboob That's the way I tackle with this (maybe not too elegant but works): !Variable declaration ! Unit number integer :: unt=10 ! I/O status integer :: IOstatus ! line string character(len=240) :: line="" ! Other vars integer :: i, n_interesting_lines character(len=10) :: myvar !Open the file open(unt,file='myfile') ! First use INDEX function to identify the line that contains "name" do read(unt,'(A)',IOSTAT=IOstatus) line ! Two possible scenarios while reading: ! 1) End of file if ( IOstatus < 0 ) stop ! 2) Target line found if ( INDEX(line,"name") /= 0 ) exit enddo !Then, the last line can be re-read to extract any variable from it read(line,*) myvar ! Now read lines of interest do i=1,n_interesting_lines read(unt,'(A)',IOSTAT=IOstatus) line enddo Of course, this strategy needs that the target line contains a unique pattern (i.e. "name" in this case). However, in highly structured files (e.g. output from quantum chemistry packages) this requirement is normally met. If you don't know how many lines are you going to read, you can use another pattern (also possible to find in output from quantum chemistry packages) to identify the last line in a similar way using INDEX again (instead of the fixed loop: do i=1,n_interesting_lines). Javier El 11/06/14 09:49, Mehboob Alam mehboob.cu+*+gmail.com escribió: > Respected CCL members, > > I have a file containing several lines and I want to read data from 4 > continuous lines. But the condition is that the reading should be > started from a line started with a character variable "name". For > example, Below, I have given an example input file and lines which > need to read are marked bold and blue. > > Sample input file: > > students are curious about their results > The result will be published on 10th of march this year > below is given name of the students and marks obtained by them > *name subject marks* > *krishna chemistry 85* > *Ibrahim physics 82* > *kayanuma chemistry 87* > raju maths 99 > > End of Sample input file. > > Also note that the line number containing the character variable > "name" andhow many lines are there after it are not known. > > Any help will be highly appreciated. > > With best regards, > Md. Mehboob Alam > Senior Research Fellow - CSIR-INDIA > Department of Chemistry, > University of Calcutta > Kolkata - 700 009, India -- Javier CEREZO BASTIDA PostDoc Researcher ICCOM-CNR, UOS di Pisa 56124 PISA (ITALY) --------------050409050500040602000908 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Mehboob

That's the way I tackle with this (maybe not too elegant but works):

        !Variable declaration
        ! Unit number
        integer :: unt=10
        ! I/O status
        integer :: IOstatus
        ! line string
        character(len=240) :: line=""
        ! Other vars
        integer :: i, n_interesting_lines
        character(len=10) :: myvar

        !Open the file
        open(unt,file='myfile')

        ! First use INDEX function to identify the line that contains "name"
        do
            read(unt,'(A)',IOSTAT=IOstatus) line
            ! Two possible scenarios while reading:
            ! 1) End of file
            if ( IOstatus < 0 ) stop
            ! 2) Target line found
            if ( INDEX(line,"name") /= 0 ) exit
        enddo
        !Then, the last line can be re-read to extract any variable from it
        read(line,*) myvar
        ! Now read lines of interest
        do i=1,n_interesting_lines
            read(unt,'(A)',IOSTAT=IOstatus) line
        enddo

Of course, this strategy needs that the target line contains a unique pattern (i.e. "name" in this case). However, in highly structured files (e.g. output from quantum chemistry packages) this requirement is normally met. If you don't know how many lines are you going to read, you can use another pattern (also possible to find in output from quantum chemistry packages) to identify the last line in a similar way using INDEX again (instead of the fixed loop: do i=1,n_interesting_lines).

Javier



El 11/06/14 09:49, Mehboob Alam mehboob.cu+*+gmail.com escribió:
Respected CCL members,

I have a file containing several lines and I want to read data from 4 continuous lines. But the condition is that the reading should be started from a line started with a character variable "name". For example, Below, I have given an example input file and lines which need to read are marked bold and blue.

Sample input file:

students are curious about their results
The result will be published on 10th of march this year
below is given name of the students and marks obtained by them
name                        subject                    marks
krishna                   chemistry                    85
Ibrahim                  physics                       82
kayanuma              chemistry                   87
raju                         maths                          99

End of Sample input file.

Also note that the line number containing the character variable "name" andhow many lines are there after it are not known.

Any help will be highly appreciated.

With best regards,
Md. Mehboob Alam
Senior Research Fellow - CSIR-INDIA
Department of Chemistry,
University of Calcutta
Kolkata - 700 009, India


--
Javier CEREZO BASTIDA
PostDoc Researcher
ICCOM-CNR, UOS di Pisa
56124 PISA (ITALY)
--------------050409050500040602000908-- From owner-chemistry@ccl.net Wed Jun 11 20:01:00 2014 From: "James Buchwald buchwj++rpi.edu" To: CCL Subject: CCL: Converting wavefunction from one program to input for another Message-Id: <-50194-140611130307-9724-eDAy5arUVRUdMo0s1jdFiw-#-server.ccl.net> X-Original-From: James Buchwald Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="UTF-8" Date: Wed, 11 Jun 2014 13:03:00 -0400 Mime-Version: 1.0 Sent to CCL by: James Buchwald [buchwj(!)rpi.edu] Dear colleagues, I have an open shell wavefunction converged using the ORCA software package, and I am attempting to convert it to a $VEC input for the GAMESS-US software package. I cannot simply reconverge the SCF using the latter software package as I have made use of the broken symmetry feature of ORCA to transform the wavefunction significantly. Are there any utilities out there which can help to facilitate the conversion of a wavefunction from one software package to another? Best, James -- James R. Buchwald Graduate Student, Dept. of Chemistry and Chemical Biology Rensselaer Polytechnic Institute Graduate Researcher, Dinolfo Laboratory (802) 349-5142