Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Reading Fortran Code 1

Status
Not open for further replies.

jamez05

Programmer
Jul 29, 2005
130
US
Hi,

I have a bunch of Fortran code that I'm trying to analyze.
Below is a piece that I'm trying to make sense of. Any insight is appreciated:

Code:
real value
integer lun,lm,caller,chem,idloc
logical found,setmole
real ssen,ssemes,a
integer i,ib,ih,eh,ssemit,ssenum,ssebak

      a=0.
      i=ssemit()
      a=a+ssemes('C{*} ','Carbon(s):',47.6,1,1,lun)
      a=a+ssemes('RBr ','Bromine(s):',76.1,2,1,lun)
      a=a+ssemes('RCl ','Chlorine(s):',62.0,3,1,lun)
      a=a+ssemes('RF ','Florine(s):',30.5,4,1,lun)
      a=a+ssemes('RI ','Iodine(s):',98.9,5,1,lun)
      a=a+ssemes('N{*} ','Nitrogen(s):',41.9,6,1,lun)
      a=a+ssemes('O{*} ','Oxygen(s):',36.2,7,1,lun)
      a=a+ssemes('P{*} ','Phosphorus:',73.5,8,1,lun)
      a=a+ssemes('S{*} ','Sulfur(s):',67.7,9,1,lun)
      ib=ssenum('R?R ')
      ih=0
      eh=0
      do i=1,numatm
        ih=ih+atmhyd(i)                   ! Implicit Hydrogens
        if (atmtyp(i).eq.hydro)eh=eh+1    ! Explicit Hydrogen
      enddo
      a=a+ssen(ih+eh,'Hydrogen(s):',24.7,1,lun)
      a=a+ssen(ih+ib,'Bond(s):',-19.0,1,lun)
      i=ssebak()
 
Here's a more specific question:

ssemes must be a function correct?

Also, there is some code that looks like this:
Code:
data bhbond(polar)/6/

Does anyone know what that does?

Thanks

James
 
Not sure what exactly you do not understand

ssemit, ssemes, ssenum, ssen and sseback are functions.

No idea what 1un means. I've never seen that one before

What ssemes takes as a parameter looks like

1) a wildcard string, probably in some form of chemical element mnemonic
2) a description of what it is, probably for tracing purposes
3) not sure what this is - some variant of atomic weight perhaps
4) a sort of sequence number - seems to be sequential. Possibly an array index
5) they are all 1 so possibly an array index
6) no idea what 1un is - it gives an error on my compiler.

Do you have a declaration of polar? Something like
Code:
integer polar, bhbond(20)
parameter (polar = 4)
With the above declaration, bhbond(polar)/6/ just sets the 4th element of bhbond to 6.
 
Thanks for your reply.

The lun seems to be a variable used for diplaying
error messages. The information you provided helps
get me in the right direction.

There is a declaration for polar:
Code:
integer *4 polar
parameter (polar = 7)
integer bhbond(polar)
 
Yes, I found some documentation buried in a file cabinet and that's what lun stands for. Interesting project, but limited documentation and I'm learning as I go.

Great experience, just hoping I can handle it.
 
Just realized - I read l as 1. Looks the same as I have my font set to small. Only looks different when I enlarge the font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top