Skip to Content.
Sympa Menu

forum - Re: [abinit-forum] Re: Reading header of binary file: Fortran code question...

forum@abinit.org

Subject: The ABINIT Users Mailing List ( CLOSED )

List archive

Re: [abinit-forum] Re: Reading header of binary file: Fortran code question...


Chronological Thread 
  • From: Anglade Pierre-Matthieu <anglade@gmail.com>
  • To: forum@abinit.org
  • Subject: Re: [abinit-forum] Re: Reading header of binary file: Fortran code question...
  • Date: Tue, 2 Jun 2009 15:51:52 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=LguG0XtH7zLHTr/WCBvd6Kmoxk8P4N6VRNjn1qLvPMB3D6nDtgNCTQoM0jjvVjKAZB zbdbqlOTM6EPF5/o91zW2Aqh5aBhK43LdXB7tPc4WDi25293hHiFV3fof2KtN8xY4ojN cZu91EymovCcTMWp9dWlS6cAry9F12h7gg+Pc=

Close to what I had in mind for a C translation. (I think, the C++
translation would have used a "." since fortran variables are closer
to references than pointers.)
Also the writing is made using a unit number "unit" like in the libc
write function (under linux cf. "man 2 open") ; and is not
necessarily formatted. Don't forget to add the comments by Damien and
Matthieu on your other thread and I guess you get almost the whole
picture.

best

PMA

On Tue, Jun 2, 2009 at 3:15 PM, Rob <spamrefuse@yahoo.com> wrote:
>
> Anglade Pierre-Matthieu wrote:
>>
>> A "%" in fortran is more or less equivalent to the "->" operator in C.
>> Moreover, in fortran it is possible to avoid using a do (C for) loop
>> for output by using the shortcut (table(i),i=1,n). Does this make the
>> documentation any clearer ?
>
> Hmm, let me try to convert one fortran snippet into C, and please
> correct me if I'm wrong:
>
> write(unit=unit)(pawrhoij(iatom)%nrhoijsel(1:nspden),iatom=1,natom)
>
> for (iatom = 1; iatom <= natom; ++iatom) {
>  for(i = 1; i <= nspden; ++i) {
>    printf("%g", pawrhoij [iatom] -> nrhoijsel [i]);
>  }
> }
>
> Rob.
>
>
>
>



--
Pierre-Matthieu Anglade




Archive powered by MHonArc 2.6.15.

Top of Page