From: robin on
"Terence" <tbwright(a)cantv.net> wrote in message news:217ce2ae-2efc-46b2-8e08-8a1abddf3689(a)x5g2000prf.googlegroups.com...
| No, Terence was not the poster of the sourcecode ([LINK] == http://www.meami.org),

You only have to go back 9 posts to see that you were in fact the poster of that sentence.

Quote:
________________________________
From: "Terence" <tbwright(a)cantv.net>
Newsgroups: comp.lang.fortran,comp.programming,sci.math,comp.infosystems,rec.org.mensa
Sent: Saturday, 10 October 2009 6:09 PM
Subject: Re: * Program ALPHATEST (FORTRAN 77)

You don't say why you are posting this.
It is not F77 code but F90 code (e.g. the use of KIND and
status='unknown' and varibe names longer than 6 characters and
comments defiened as an asterisk in column 1 instead of "C")..



From: glen herrmannsfeldt on
In comp.lang.fortran Richard Heathfield <rjh(a)see.sig.invalid> wrote:
> In <hb18j1$ii1$1(a)naig.caltech.edu>, glen herrmannsfeldt wrote:
(snip regarding decades and moon landing)

>>> The decade in question was the 197th, 1961-1970.

>> Why did NASA decide that the moon landing had to be in 1969?
>> It seems that they didn't believe that they had one more year.

> JFK set 1970 as a limit, not a target. As you rightly asked, "by what
> year", not "in what year".

Maybe, but as I understand it NASA considered the goal to be 1969.
July gave them some more chances before December 1969.

Note that unlike centuries (20th, 21st) decades are rarely
if ever described that way, but usually the 60's, or the 70's.
Technically NASA had until the end of December 1970, but the
public wasn't going to give them that long, and so they couldn't
schedule it that way.

-- glen
From: Terence on
No, no and NO!

Ron Shepard poted the message responded to by Robin.
....
>| century you mean before 1909, then that is a different matter. :-)

Then Robin responded to this, WHETHER OR NOT HE MEANT TO, BY :-

>In omitting the poster, you have confused who sent what.
>I did not say that; it was Terence (whose POST ID I have restored).

But Terence's POST ID was in ever message he (I) posted!!
Which is why I responded to Robin that it WASn't my posting but Ron's
response to my posting.

And OK, a centry runs xx*100 +01 to (XX+1)*100, and not xx00-xx99.
I still think I get 99 out of 100.

The reference was STILL "last century" as I said, which I lived over
2/3 of, plus all I clock up in this one, still (of course) programming
in F77. (The WORD as given). :o)>


Even the concept "AD" is pretty well considered to be off by about 4
years anyway, just as the census in Bethleham was in June -3 as per
Roman records, and not December 25 0001.


From: http://alexslemonade.org on
On Oct 13, 1:41 am, Terence <tbwri...(a)cantv.net> wrote:
> No, no and NO!
>
> Ron Shepard poted the message responded to by Robin.
> ...
>
> >| century you mean before 1909, then that is a different matter. :-)
>
> Then Robin responded to this, WHETHER OR NOT HE MEANT TO, BY :-
>
> >In omitting the poster, you have confused who sent what.
> >I did not say that; it was Terence (whose POST ID I have restored).
>
Results 1 - 3 for iso_c_interop. (0.17 seconds)

Nabble - gcc - fortran - [PATCH, gfortran testsuite]: Do not ...
20 posts - 7 authors - Last post: Aug 20
current gcc/gfortran with iso_c_interop for the i386/x64 platforms.
I ....
if IEEE_SET_UNDERFLOW is written according to iso_c_interop ? ...
www.nabble.com/-PATCH,-gfortran-testsuite-:-Do-not-generate-denormals-in-gfortran.dg-boz_9.f90-td25082961.html

Tim Prince - Re: [PATCH, gfortran testsuite]: Do not load ...
Aug 24, 2009 ...
straightforward in current gcc/gfortran with iso_c_interop for the
i386/x64 platforms.
I don't have any other targets available to test ...
gcc.gnu.org/ml/fortran/2009-08/msg00356.html

J3/04-230 Date: 02 February 2004 To: J3 From: Aleksandar Donev ......
which one should be able to write an equivalent module: MODULE GL USE
ISO_C_INTEROP TYPEDEF :: GLenum=>INTEGER(C_INT), & GLboolean=>CHARACTER
(C_CHAR), . ...
www.j3-fortran.org/doc/year/04/04-230.txt

J3/04-230

Date: 02 February 2004
To: J3
From: Aleksandar Donev
Subject: TYPEDEF facility


Title: TYPEDEF facility

Submitted by: J3

Status: For Consideration

References: J3/03-256

Basic Functionality:

Bring back the previously removed TYPEALIAS facility as a TYPEDEF
facility to be used in C Interop. This facility would allow one to
give
alias names to other types. This facility may be restricted to
Index: gfortran.dg/boz_9.f90
===================================================================
--- gfortran.dg/boz_9.f90 (revision 150988)
+++ gfortran.dg/boz_9.f90 (working copy)
@@ -1,6 +1,5 @@
! { dg-do run }
! { dg-options "-fno-range-check" }
-! { dg-options "-fno-range-check -mieee" { target alpha*-*-* } }
!
! PR fortran/34342
!
@@ -10,40 +9,40 @@
implicit none

real,parameter :: r2c = real(int(z'3333'))
-real,parameter :: rc = real(z'3333')
+real,parameter :: rc = real(z'50CB9F09')
double precision,parameter :: dc = dble(Z'3FD34413509F79FF')
-complex,parameter :: z1c = cmplx(b'10101',-4.0)
-complex,parameter :: z2c = cmplx(5.0, o'01245')
+complex,parameter :: z1c = cmplx
(b'11000001010001101101110110000011', 3.049426e-10)
+complex,parameter :: z2c = cmplx(4.160326e16,
o'6503667306')

real :: r2 = real(int(z'3333'))
-real :: r = real(z'3333')
+real :: r = real(z'50CB9F09')
double precision :: d = dble(Z'3FD34413509F79FF')
-complex :: z1 = cmplx(b'10101',-4.0)
-complex :: z2 = cmplx(5.0, o'01245')
+complex :: z1 = cmplx(b'11000001010001101101110110000011',
3.049426e-10)
+complex :: z2 = cmplx(4.160326e16, o'6503667306')

if (r2c /= 13107.0) call abort()
-if (rc /= 1.83668190E-41) call abort()
+if (rc /= 2.732958e10) call abort()
if (dc /= 0.30102999566398120d0) call abort()
-if (real(z1c) /= 2.94272678E-44 .or. aimag(z1c) /= -4.0) call abort
()
-if (real(z2c) /= 5.0 .or. aimag(z2c) /= 9.48679060E-43) call abort()
+if (real(z1c) /= -1.242908e1 .or. aimag(z1c) /= 3.049426e-10) call
abort()
+if (real(z2c) /= 4.160326e16 .or. aimag(z2c) /= 5.343285e-7) call
abort()

if (r2 /= 13107.0) call abort()
-if (r /= 1.83668190E-41) call abort()
+if (r /= 2.732958e10) call abort()
if (d /= 0.30102999566398120d0) call abort()
-if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
-if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
+if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
()
+if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
()

r2 = dble(int(z'3333'))
-r = real(z'3333')
+r = real(z'50CB9F09')
d = dble(Z'3FD34413509F79FF')
-z1 = cmplx(b'10101',-4.0)
-z2 = cmplx(5.0, o'01245')
+z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10)
+z2 = cmplx(4.160326e16, o'6503667306')

-if (r2 /= 13107.0) call abort()
-if (r /= 1.83668190E-41) call abort()
+if (r2 /= 13107d0) call abort()
+if (r /= 2.732958e10) call abort()
if (d /= 0.30102999566398120d0) call abort()
-if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
-if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
+if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
()
+if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
()

call test4()
call test8()
@@ -52,34 +51,34 @@

subroutine test4
real,parameter :: r2c = real(int(z'3333', kind=4),
kind=4)
-real,parameter :: rc = real(z'3333', kind=4)
-complex,parameter :: z1c = cmplx(b'10101',-4.0, kind=4)
-complex,parameter :: z2c = cmplx(5.0, o'01245', kind=4)
+real,parameter :: rc = real(z'50CB9F09', kind=4)
+complex,parameter :: z1c = cmplx
(b'11000001010001101101110110000011', 3.049426e-10, kind=4)
+complex,parameter :: z2c = cmplx(4.160326e16, o'6503667306',
kind=4)

real :: r2 = real(int(z'3333', kind=4), kind=4)
-real :: r = real(z'3333', kind=4)
-complex :: z1 = cmplx(b'10101',-4.0, kind=4)
-complex :: z2 = cmplx(5.0, o'01245', kind=4)
+real :: r = real(z'50CB9F09', kind=4)
+complex :: z1 = cmplx(b'11000001010001101101110110000011',
3.049426e-10, kind=4)
+complex :: z2 = cmplx(4.160326e16, o'6503667306', kind=4)

if (r2c /= 13107.0) call abort()
-if (rc /= 1.83668190E-41) call abort()
-if (real(z1c) /= 2.94272678E-44 .or. aimag(z1c) /= -4.0) call abort
()
-if (real(z2c) /= 5.0 .or. aimag(z2c) /= 9.48679060E-43) call abort()
+if (rc /= 2.732958e10) call abort()
+if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
()
+if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
()

if (r2 /= 13107.0) call abort()
-if (r /= 1.83668190E-41) call abort()
-if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
-if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
+if (r /= 2.732958e10) call abort()
+if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
()
+if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
()

r2 = real(int(z'3333'), kind=4)
-r = real(z'3333', kind=4)
-z1 = cmplx(b'10101',-4.0, kind=4)
-z2 = cmplx(5.0, o'01245', kind=4)
+r = real(z'50CB9F09', kind=4)
+z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10,
kind=4)
+z2 = cmplx(4.160326e16, o'6503667306', kind=4)

if (r2 /= 13107.0) call abort()
-if (r /= 1.83668190E-41) call abort()
-if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
-if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
+if (r /= 2.732958e10) call abort()
+if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
()
+if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
()
end subroutine test4



interoperable types only if so desired. A proper and better designed
Fortran TYPEALIAS facility may then be developed separately, not
compromising the very urgent C Interop void created by the removal of
TYPEALIAS.

Rationale:

C has a typedef facility which allows one to give aliases to existing
C
types. These are used very widely, and therefore we need to provide a
way to easily interface with libraries that use them. Header files are
central to "portability" in C, and they usually mainly consist of
preprocessing directives like #define's, function prototypes and
typedef's. The first seem outside the scope of Interop and can be
emulated with PARAMETERs, the second are
handled already, and now we also need to be able to handle typedef's.
The goal is to be able to write a Fortran module that emulates a
header
file provided by the vendor of a library, and that someday it may
even
be possible to do an automatic .h->.f90 conversion (at least an
initial
stage thereof). Here is a short piece of the include file GL/gl.h
which
is the central include file for the OpenGL library:

....
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef void GLvoid;
....
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
....
GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );

for which one should be able to write an equivalent module:

MODULE GL
USE ISO_C_INTEROP

TYPEDEF :: GLenum=>INTEGER(C_INT), &
GLboolean=>CHARACTER(C_CHAR), ...

TYPE(GLenum), PARAMETER :: GL_BYTE=...

INTERFACE
SUBROUTINE glTexCoord1dv(v)
TYPE(GLdouble), DIMENSION(*), INTENT(IN) :: v
END SUBROUTINE
...
END INTERFACE

END MODULE GL

As another example, consider writing a Fortran interface to the MPICH
implementation of MPI. Typically, this will be a module that contains
various constants, type parameters, and interfaces. MPI uses many
typealiases, which are needed when writing interfaces. For example,
MPI_Datatype is typically an alias for int. But one cannot assume
this,
nor that it is indeed an integer. One cannot get away with our untyped
C_PTR, since arguments of type MPI_Datatype are passed by value, not
by
reference. It is necessary for any kind of portability that one be
able
to write:

TYPEDEF :: MPI_Datatype=>INTEGER(KIND=C_INT)

in the module for the interface to MPICH.

Estimated Impact:

The complication is mostly syntactic. The same issues we had with
TYPEALIAS remain. If we restrict this facility only to interoperable
types some of the problems may go away (for example, no more
parameterized types).

Detailed Specification:

Same as previous TYPEALIAS, but called TYPEDEF, possibly restricted
only to interoperable types.

History:




Support a cure for childhood cancer: Alex's Lemonade

©2009 MeAmI.org "Search for the People!"
> But Terence's POST ID was in ever message he (I) posted!!
> Which is why I responded to Robin that it WASn't my posting but Ron's
> response to my posting.
>
> And OK, a centry runs xx*100 +01 to (XX+1)*100, and not xx00-xx99.
> I still think I get 99 out of 100.
>
> The reference was STILL "last century" as I said, which I lived over
> 2/3 of, plus all I clock up in this one, still (of course) programming
> in F77. (The WORD as given).  :o)>
>
> Even the concept "AD" is pretty well considered to be off by about 4
> years anyway, just as the census in Bethleham was in June -3 as per
> Roman records, and not December 25 0001.

From: http://alexslemonade.org on
On Oct 13, 7:22 pm, "http://alexslemonade.org"
<marty.musa...(a)gmail.com> wrote:
> On Oct 13, 1:41 am, Terence <tbwri...(a)cantv.net> wrote:> No, no and NO!
>
> > Ron Shepard poted the message responded to by Robin.
> > ...
>
> > >| century you mean before 1909, then that is a different matter. :-)
>
> > Then Robin responded to this, WHETHER OR NOT HE MEANT TO, BY :-
>
> > >In omitting the poster, you have confused who sent what.
> > >I did not say that; it was Terence (whose POST ID I have restored).
>
>  Results 1 - 3 for iso_c_interop. (0.17 seconds)
>
> Nabble - gcc -fortran- [PATCH, gfortran testsuite]: Do not ...
> 20 posts - 7 authors - Last post: Aug 20
> current gcc/gfortran with iso_c_interop for the i386/x64 platforms.
> I ....
> if IEEE_SET_UNDERFLOW is written according to iso_c_interop ? ...www.nabble.com/-PATCH,-gfortran-testsuite-:-Do-not-generate-denormals...
>
> Tim Prince - Re: [PATCH, gfortran testsuite]: Do not load ...
> Aug 24, 2009 ...
> straightforward in current gcc/gfortran with iso_c_interop for the
> i386/x64 platforms.
> I don't have any other targets available to test ...
> gcc.gnu.org/ml/fortran/2009-08/msg00356.html
>
> J3/04-230 Date: 02 February 2004 To: J3 From: Aleksandar Donev ......
> which one should be able to write an equivalent module: MODULE GL USE
> ISO_C_INTEROP TYPEDEF :: GLenum=>INTEGER(C_INT), & GLboolean=>CHARACTER
> (C_CHAR), . ...www.j3-fortran.org/doc/year/04/04-230.txt
>
>                                                         J3/04-230
>
> Date:      02 February 2004
> To:        J3
> From:      Aleksandar Donev
> Subject:   TYPEDEF facility
>
> Title: TYPEDEF facility
>
> Submitted by: J3
>
> Status: For Consideration
>
> References: J3/03-256
>
> Basic Functionality:
>
> Bring back the previously removed TYPEALIAS facility as a TYPEDEF
> facility to be used in C Interop. This facility would allow one to
> give
> alias names to other types. This facility may be restricted to
> Index: gfortran.dg/boz_9.f90
> ===================================================================
> --- gfortran.dg/boz_9.f90 (revision 150988)
> +++ gfortran.dg/boz_9.f90 (working copy)
> @@ -1,6 +1,5 @@
>  ! { dg-do run }
>  ! { dg-options "-fno-range-check" }
> -! { dg-options "-fno-range-check -mieee" { target alpha*-*-* } }
>  !
>  ! PRfortran/34342
>  !
> @@ -10,40 +9,40 @@
>  implicit none
>
>  real,parameter             :: r2c = real(int(z'3333'))
> -real,parameter             :: rc  = real(z'3333')
> +real,parameter             :: rc  = real(z'50CB9F09')
>  double precision,parameter :: dc  = dble(Z'3FD34413509F79FF')
> -complex,parameter          :: z1c = cmplx(b'10101',-4.0)
> -complex,parameter          :: z2c = cmplx(5.0, o'01245')
> +complex,parameter          :: z1c = cmplx
> (b'11000001010001101101110110000011', 3.049426e-10)
> +complex,parameter          :: z2c = cmplx(4.160326e16,
> o'6503667306')
>
>  real             :: r2 = real(int(z'3333'))
> -real             :: r  = real(z'3333')
> +real             :: r  = real(z'50CB9F09')
>  double precision :: d  = dble(Z'3FD34413509F79FF')
> -complex          :: z1 = cmplx(b'10101',-4.0)
> -complex          :: z2 = cmplx(5.0, o'01245')
> +complex          :: z1 = cmplx(b'11000001010001101101110110000011',
> 3.049426e-10)
> +complex          :: z2 = cmplx(4.160326e16, o'6503667306')
>
>  if (r2c /= 13107.0) call abort()
> -if (rc  /= 1.83668190E-41) call abort()
> +if (rc  /= 2.732958e10) call abort()
>  if (dc /= 0.30102999566398120d0) call abort()
> -if (real(z1c) /= 2.94272678E-44 .or. aimag(z1c) /= -4.0) call abort
> ()
> -if (real(z2c) /= 5.0 .or. aimag(z2c) /= 9.48679060E-43) call abort()
> +if (real(z1c) /= -1.242908e1 .or. aimag(z1c) /= 3.049426e-10) call
> abort()
> +if (real(z2c) /= 4.160326e16 .or. aimag(z2c) /= 5.343285e-7) call
> abort()
>
>  if (r2 /= 13107.0) call abort()
> -if (r  /= 1.83668190E-41) call abort()
> +if (r  /= 2.732958e10) call abort()
>  if (d /= 0.30102999566398120d0) call abort()
> -if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
> -if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
> +if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
> ()
> +if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
> ()
>
>  r2 = dble(int(z'3333'))
> -r = real(z'3333')
> +r = real(z'50CB9F09')
>  d = dble(Z'3FD34413509F79FF')
> -z1 = cmplx(b'10101',-4.0)
> -z2 = cmplx(5.0, o'01245')
> +z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10)
> +z2 = cmplx(4.160326e16, o'6503667306')
>
> -if (r2 /= 13107.0) call abort()
> -if (r  /= 1.83668190E-41) call abort()
> +if (r2 /= 13107d0) call abort()
> +if (r  /= 2.732958e10) call abort()
>  if (d /= 0.30102999566398120d0) call abort()
> -if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
> -if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
> +if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
> ()
> +if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
> ()
>
>  call test4()
>  call test8()
> @@ -52,34 +51,34 @@
>
>  subroutine test4
>  real,parameter             :: r2c = real(int(z'3333', kind=4),
> kind=4)
> -real,parameter             :: rc  = real(z'3333', kind=4)
> -complex,parameter          :: z1c = cmplx(b'10101',-4.0, kind=4)
> -complex,parameter          :: z2c = cmplx(5.0, o'01245', kind=4)
> +real,parameter             :: rc  = real(z'50CB9F09', kind=4)
> +complex,parameter          :: z1c = cmplx
> (b'11000001010001101101110110000011', 3.049426e-10, kind=4)
> +complex,parameter          :: z2c = cmplx(4.160326e16, o'6503667306',
> kind=4)
>
>  real             :: r2 = real(int(z'3333', kind=4), kind=4)
> -real             :: r  = real(z'3333', kind=4)
> -complex          :: z1 = cmplx(b'10101',-4.0, kind=4)
> -complex          :: z2 = cmplx(5.0, o'01245', kind=4)
> +real             :: r  = real(z'50CB9F09', kind=4)
> +complex          :: z1 = cmplx(b'11000001010001101101110110000011',
> 3.049426e-10, kind=4)
> +complex          :: z2 = cmplx(4.160326e16, o'6503667306', kind=4)
>
>  if (r2c /= 13107.0) call abort()
> -if (rc  /= 1.83668190E-41) call abort()
> -if (real(z1c) /= 2.94272678E-44 .or. aimag(z1c) /= -4.0) call abort
> ()
> -if (real(z2c) /= 5.0 .or. aimag(z2c) /= 9.48679060E-43) call abort()
> +if (rc  /= 2.732958e10) call abort()
> +if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
> ()
> +if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
> ()
>
>  if (r2 /= 13107.0) call abort()
> -if (r  /= 1.83668190E-41) call abort()
> -if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
> -if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
> +if (r  /= 2.732958e10) call abort()
> +if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
> ()
> +if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
> ()
>
>  r2 = real(int(z'3333'), kind=4)
> -r = real(z'3333', kind=4)
> -z1 = cmplx(b'10101',-4.0, kind=4)
> -z2 = cmplx(5.0, o'01245', kind=4)
> +r = real(z'50CB9F09', kind=4)
> +z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10,
> kind=4)
> +z2 = cmplx(4.160326e16, o'6503667306', kind=4)
>
>  if (r2 /= 13107.0) call abort()
> -if (r  /= 1.83668190E-41) call abort()
> -if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()
> -if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort()
> +if (r  /= 2.732958e10) call abort()
> +if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort
> ()
> +if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort
> ()
>  end subroutine test4
>
> interoperable types only if so desired. A proper and better designedFortranTYPEALIAS facility may then be developed separately, not
> compromising the very urgent C Interop void created by the removal of
> TYPEALIAS.
>
> Rationale:
>
> C has a typedef facility which allows one to give aliases to existing
> C
> types. These are used very widely, and therefore we need to provide a
> way to easily interface with libraries that use them. Header files are
> central to "portability" in C, and they usually mainly consist of
> preprocessing directives like #define's, function prototypes and
> typedef's. The first seem outside the scope of Interop and can be
> emulated with PARAMETERs, the second are
> handled already, and now we also need to be able to handle typedef's.
> The goal is to be able to write aFortranmodule that emulates a
> header
> file provided  by the vendor of a library, and that someday it may
> even
> be possible to do an automatic .h->.f90 conversion (at least an
> initial
> stage thereof). Here is a short piece of the include file GL/gl.h
> which
> is the central include file for the OpenGL library:
>
> ...
> typedef unsigned int    GLenum;
> typedef unsigned char   GLboolean;
> typedef unsigned int    GLbitfield;
> typedef void            GLvoid;
> ...
> #define GL_BYTE                                 0x1400
> #define GL_UNSIGNED_BYTE                        0x1401
> ...
> GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
> GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
>
> for which one should be able to write an equivalent module:
>
> MODULE GL
>    USE ISO_C_INTEROP
>
>    TYPEDEF :: GLenum=>INTEGER(C_INT), &
>               GLboolean=>CHARACTER(C_CHAR), ...
>
>    TYPE(GLenum), PARAMETER :: GL_BYTE=...
>
>    INTERFACE
>       SUBROUTINE glTexCoord1dv(v)
>          TYPE(GLdouble), DIMENSION(*), INTENT(IN) :: v
>       END SUBROUTINE
>       ...
>    END INTERFACE
>
> END MODULE GL
>
> As another example, consider writing aFortraninterface to the MPICH
> implementation of MPI. Typically, this will be a module that contains
> various constants, type parameters, and interfaces. MPI uses many
> typealiases, which are needed when writing interfaces. For example,
> MPI_Datatype is typically an alias for int. But one cannot assume
> this,
> nor that it is indeed an integer. One cannot get away with our untyped
> C_PTR, since arguments of type MPI_Datatype are passed by value, not
> by
> reference. It is necessary for any kind of portability that one be
> able
> to write:
>
> TYPEDEF :: MPI_Datatype=>INTEGER(KIND=C_INT)
>
> in the module for the interface to MPICH.
>
> Estimated Impact:
>
> The complication is mostly syntactic. The same issues we had with
> TYPEALIAS remain. If we restrict this facility only to interoperable
> types some of the problems may go away (for...
>
> read more »

V = 180i + 450j/*

Covert Tunnelling in ICMP 0x00 ECHO REPLY messages

Many thanks to FuSyS and Richard Stevens ^_^

Dark Schneider X1999

*/

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>

#define ICMP_ECHOREPLY 0
#define ICMP_ECHO 8

// definizione di alcune costanti

#define IP_HDR 20
#define ICMP_HDR 8
#define ICMP_MINLEN 8
#define MAXMESG 4096
#define MAXPACKET 5004
#define LAST 1
#define REPLY 1
#define ECHO_TAG 0xF001
#define ECHO_LAST 0xF002

// Strutture e Variabili
// Lancio un doveroso Porko D*io liberatorio... dopo ore ho trovato
come fare
// a togliermi dalle palle la fottuta icmp.dll (winsock maledette)

// IP Header
struct ip
{
unsigned char Hlen:4;
unsigned char Version:4;
unsigned char Tos;
unsigned short LungTot;
unsigned short Id;
unsigned short Flags;
unsigned char Ttl;
unsigned char Proto;
unsigned short Checksum;
unsigned int SourceIP;
unsigned int DestIP;

};

// ICMP Header
struct icmp {
BYTE Type;
BYTE Code;
USHORT CheckSum;
USHORT Id;
USHORT Seq;
ULONG Dati;
};

SOCKET sockfd;
u_int icmp_init =1;
struct sockaddr_in clisrc;

// Funzione di checksum

USHORT checksum(USHORT *buffer, int size)
{

unsigned long cksum=0;

while(size >1)
{
cksum+=*buffer++;
size -=sizeof(USHORT);
}

if(size )
{
cksum += *(UCHAR*)buffer;
}

cksum = (cksum >> 16) + (cksum & 0xffff);
cksum += (cksum >>16);
return (USHORT)(~cksum);
}

// Reimplemento bcopy e bzero... Ma perche' cavolo windows non le
// rende disponibili?

void bzero(char *pnt, int dim_pnt )
{
memset((char *)&pnt, 0, dim_pnt);
};

void bcopy(char *src, char *dest, int dim_src)
{
memmove((char *)&dest, (char *)&src, dim_src);
};

// Micro$oft Sucks
// Funzioni di gestione dei pacchetti ICMP
// Fankulo a quegli stronzi maledetti che si sono inventati la
icmp.dll
// Brutti bastardi pezzi di merda, la compatibilita' ve la siete
ficcata su
// per il culo?
// Micro$oft Sucks

void ICMP_init(void)
{
if(icmp_init)
{
if((sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) ==
INVALID_SOCKET)
{
fprintf(stderr, "impossibile creare raw ICMP socket");
exit(0);
}
}
icmp_init = 0;
};

void ICMP_reset(void)
{
closesocket(sockfd);
icmp_init = 1;
};

int ICMP_send(char *send_mesg, size_t mesglen, ULONG dest_ip, int
echo, int last)
{
int sparato;
struct tunnel
{
struct icmp icmp;
UCHAR data[MAXMESG];
} icmp_pk;
int icmplen = sizeof(struct icmp);
int pack_dim;
struct sockaddr_in dest;
int destlen;

if(mesglen > MAXMESG) return(-1);

if(icmp_init) ICMP_init();

destlen = sizeof(dest);
bzero((char *)&dest, destlen);
dest.sin_family = AF_INET;
dest.sin_addr.s_addr = dest_ip;
pack_dim = mesglen + sizeof(struct icmp);
memset(&icmp_pk, 0, pack_dim);
icmp_pk.icmp.Type = ICMP_ECHOREPLY;
bcopy(send_mesg, (char *)&icmp_pk.icmp.Dati, mesglen);
icmp_pk.icmp.CheckSum = checksum((USHORT *) &icmp_pk.icmp, (sizeof
(struct icmp) + mesglen));
if(echo) icmp_pk.icmp.Seq = ECHO_TAG;
if(last) icmp_pk.icmp.Seq = ECHO_LAST;

if(sparato = sendto(sockfd, (char *)&icmp_pk, pack_dim, 0, (struct
sockaddr *)&dest, destlen) < 0)
{
perror("RAW ICMP SendTo: ");
return(-1);
}
else if(sparato != pack_dim)
{
perror("dimensioni pacchetto IP errate: ");
return(-1);
}
return(sparato);
};

int ICMP_recv(char *recv_mesg, size_t mesglen, int echo)
{
struct recv
{
struct ip ip;
struct icmp icmp;
char data[MAXMESG];
} rcv_pk;
int pack_dim;
int accolto;
int iphdrlen;
int clilen = sizeof(clisrc);

if(icmp_init) ICMP_init();
while(1)
{
pack_dim = mesglen + sizeof(struct ip) + sizeof(struct icmp);
memset(&rcv_pk, 0, pack_dim);
if((accolto = recvfrom(sockfd, (char *)&rcv_pk, pack_dim, 0, (struct
sockaddr *) &clisrc, &clilen)) < 0) continue;

iphdrlen = rcv_pk.ip.Hlen << 2;
if(accolto < (iphdrlen + ICMP_MINLEN)) continue;
accolto -= iphdrlen;

if(!echo)
{
if(!rcv_pk.icmp.Id && !rcv_pk.icmp.Code && rcv_pk.icmp.Type ==
ICMP_ECHOREPLY && rcv_pk.icmp.Seq != ECHO_TAG && rcv_pk.icmp.Seq !=
ECHO_LAST) break;
}
if(echo)
{
if(!rcv_pk.icmp.Id && !rcv_pk.icmp.Code && rcv_pk.icmp.Type ==
ICMP_ECHOREPLY && (rcv_pk.icmp.Seq == ECHO_TAG || rcv_pk.icmp.Seq ==
ECHO_LAST)) break;
}
}
if(!echo)
{
accolto -= ICMP_HDR;
bcopy((char *)&rcv_pk.icmp.Dati, recv_mesg, accolto);
n = 200819. 2. 782
therefore increment t
s = a * sp + b * sq mod N. where. sp=mdp mod (p) and sq=mdq mod (q)
a/b = (rp. m+1. ± sp. m )/(rq. m+1. ± sq. m )
[a, b, s:1] presents a plot of the mod-4 prime race over the interval
[a, b]
Let it ride: http://meami.org (C) All Rights Reserved.
+
http://buildasearch.com/meami
c=Copywrite(C) 2009. [at] (c) Copyright: http://MEAMI.ORG
! Programma FINALE

! versione risc1 IBM
! versione FINALE nel caso assiale
! versione FINALE nel caso rombico (non funziona in assenza di ZFS)

C PARAMAGNETIC ENHANCEMENT IN NMRD PROFILE
C
C THIS PROGRAM REQUIRES THE INPUT FILE PAR.DAT
C 0 BEFORE A PARAMETER MEANS IT HAS TO BE ASSUMED AS CONSTANT
C 1 BEFORE A PARAMATER MEANS IT HAS TO BE CHANGED IN THE FITTING
C
C
C INTERNAL FITTING IS PERFORMED IN THE PARAMETERS:
C d , Ddiff , RK , A/h , MOLAR FRACTION , TAUM
C
C SUBROUTINES:
C FUNCZFS: SET PARAMETERS IN FITTING PROCEDUREC
C FUNCINT: SET PARAMETERS IN INTERNAL FITTING PROCEDURE
C DIAG: WRITE ENERGY MATRIX AND CALCULATE EXPECTATION VALUES
C POWELL: FITTING PROCEDURE
C CONNECTED SUBROUTINES:
C LINMIN
C F1DIM
C MNBRAK
C MRENT
C XISTEP
C POWELLINT: INTERNAL FITTING PROCEDURE
C F01BCF....X04BAF: CALCULATE EIGENVALUES AND EIGENFUNCTIONS
C GAUINT: PERFORME INTEGRATION ON ANGLES
C TUNO: PERFORME CALCULATION OF T1M
C TDUE: PERFORME CALCULATION OF T2M
C TUNOISO: PERFORME CALCULATION OF T1M IN AXIAL CASE
C
C THETA AND PHI ARE THE POLAR ANGLES DEFINING THE WATER PROTON
DIRECTION
C IN THE MOLECULAR FRAME
C
C BETA AND GAMMA ARE THE EULER ANGLES DEFINING THE MOLECULAR FRAME
WITH
C RESPECT TO THE HTTP://MEAMI.ORG/ FRAME


IMPLICIT REAL*8(A-H,O-Z)
PARAMETER(PI2 = 6.2831853, VL = 2.9979D+10)
COMMON /SET/SET
COMMON /RK10/ SPIN, SI
COMMON /GAMMAH/ GAMMAI
COMMON /B31/ TPUNO(500)
COMMON /B32/ PP(500),Z(500)
COMMON /TAUDELTA/ TAUDELTA
COMMON /B4/ NVMEM,NPT(10),NPTOT
COMMON /WATER/ ACQ
COMMON /T1T2/ IREL
COMMON /INDEX/ INDEX
COMMON /ALFASTEP/ ALFASTEP
COMMON /STAMPA/INDEXSTAMPA
COMMON /TOT/ DPARATOT,EPARATOT,APARTOT,APERTOT,APERTOT2,ACONIND
COMMON/INDA/ INDDPARA(10),INDAPAR(10),INDAPER(10),INDEPARA(10)
& ,INDED(10),INDAMOLFRA(10),INDS4(10),INDAPER2(10)
COMMON /C1M/DM(10),DDM(10),CONCM(10)
COMMON /IPERFM/AZM(10),AYM(10),AXM(10),THETAM(10),RKM(10),
& TAUCM(10),DPARAM(10),EPARAM(10),PHIM(10),S4M(10),
& GXM(10),GYM(10),GZM(10)
COMMON /TAU1M/ TAUS0M(10,10),TAURM(10,10),TAUVM(10,10),
& TAUMM(10,10)
COMMON /MOLFRAZM/ AMOLFRAM(10)
COMMON /CONTATM/ ACONTM(10)
COMMON /CICLE/ NVEST
COMMON /BPARA/B1(10),B2(10),B3(10),B4(10),B5(10),B6(10),B7(10),
& B8(10),B9(10),B10(10),B11(10),B12(10),B13(10),B14(10),B15(10),
& B16(10),B17(10),B18(10),B19(10),B20(10),B21(10)
CHARACTER*20 FILENAME
COMMON/TEMPERATURE/ TEMP(10)
COMMON /TMSTART/ TM11(10),TM21(10)

C DIMENSION=MAX NUMBER OF PARAMETERS (21)
DIMENSION P(21)
DIMENSION P1(21)
COMMON /PPAR/ P2(21)
DIMENSION XI(21,21)

INDEX=1
INDEXSTAMPA=0

C CONSTANTS READ IN FILE PAR.DAT
OPEN (1, STATUS = 'OLD', FILE = 'PARC.DAT')
OPEN (4, FILE="PAR.OUT")
C OUTPUT FILE
READ(1,'(A)')FILENAME
C NUCLEAR MOLECULAR SPIN
READ(1,*)SI
C GAMMA OF THE INVESTIGATED PARTICLE
READ(1,*)GAMMAI
C ELECTRON SPIN
READ(1,*)SPIN
C T1 OR T2 CALCULATION
READ(1,*)IREL
C LIMITS OF THE FIELD
READ(1,*)X1,X2,X3
IF(X3.EQ.1)THEN
XMIN=X1
XMAX=X2
ELSE
XMIN=LOG10(GAMMAI*X1/6.283)
XMAX=LOG10(GAMMAI*X2/6.283)
ENDIF
C NUMBER OF POINTS TO BE CALCULATED
READ(1,*)NUMPUN
IF(XMIN.EQ.XMAX)NUMPUN=1
C NUMBER OF SETS OF DATA FOR FITTING
READ(1,*)SET
IF(SET.EQ.0) SET=1
C TEMPERATURE
READ(1,*)(TEMP(K),K=1,SET)

J=1
IND=1
IND1=1
IND2=1
NV=0
NVEST=0
NPLUS=0
NPLUS2=0
C CORRELATION TIMES
READ(1,*)B1(J), (TAUS0M(J,K),K=1,2),TAUDELTA
IF(B1(J).GE.2)THEN
TS1=TAUS0M(J,1)
TS2=TAUS0M(J,2)
DO K=1,SET
TAUS0M(J,K)=TS1*EXP(TS2/TEMP(K))
END DO
IF(B1(J).EQ.3)NPLUS=NPLUS+1
ENDIF
IF(B1(J).EQ.1)THEN
P(IND)=TAUS0M(J,1)
P1(IND1)=TAUS0M(J,1)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
IF(B1(J).EQ.2)THEN
P(IND)=TS1
P1(IND1)=TS1
P(IND+1)=TS2
P1(IND1+1)=TS2
WRITE(4,'(2X,4(E10.4,2X))') TS1,TS2
IND=IND+2
IND1=IND1+2
ENDIF

READ(1,*)B2(J), (TAURM(J,K),K=1,2)
IF(B2(J).GE.2)THEN
TR1=TAURM(J,1)
TR2=TAURM(J,2)
DO K=1,SET
TAURM(J,K)=TR1*EXP(TR2/TEMP(K)) !Stokes
END DO
IF(B2(J).EQ.3) NPLUS=NPLUS+1
ENDIF
IF(B2(J).EQ.1)THEN
P(IND)=TAURM(J,1)
P1(IND1)=TAURM(J,1)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
IF(B2(J).EQ.2)THEN
P(IND)=TR1
P1(IND1)=TR1
P(IND+1)=TR2
P1(IND1+1)=TR2
WRITE(4,'(2X,4(E10.4,2X))') TR1,TR2
IND=IND+2
IND1=IND1+2
ENDIF

READ(1,*)B3(J), (TAUVM(J,K),K=1,2)
IF(B3(J).GE.2)THEN
TV1=TAUVM(J,1)
TV2=TAUVM(J,2)
DO K=1,SET
TAUVM(J,K)=TV1*EXP(TV2/TEMP(K))
END DO
IF(B3(J).EQ.3) NPLUS=NPLUS+1
ENDIF
IF(B3(J).EQ.1)THEN
P(IND)=TAUVM(J,1)
P1(IND1)=TAUVM(J,1)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
IF(B3(J).EQ.2)THEN
P(IND)=TV1
P1(IND1)=TV1
P(IND+1)=TV2
P1(IND1+1)=TV2
WRITE(4,'(2X,4(E10.4,2X))') TV1,TV2
IND=IND+2
IND1=IND1+2
ENDIF
IF (TAURM(J,1).EQ.0.AND.TAUVM(J,1).EQ.0)THEN
TAUCM(J)=TAUS0M(J,1)
IF(B1(J).EQ.1) P(IND-1)=TAUS0M(J,K)
IF(B1(J).EQ.1) P1(IND1-1)=TAUS0M(J,K)
ENDIF
C PARAMETERS OF ZERO FIELD SPLITTING
READ(1,*)B11(J), DPARAM(J)
DPARAM(J) = PI2*VL*DPARAM(J)
IF(B11(J).EQ.1)THEN
P(IND)=DPARAM(J)
P1(IND1)=DPARAM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/VL/PI2
INDDPARA(J)=IND
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B12(J), EPARAM(J)
EPARAM(J) = PI2*VL*EPARAM(J)
IF(B12(J).EQ.1)THEN
P(IND)=EPARAM(J)
P1(IND1)=EPARAM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/VL/PI2
INDEPARA(J)=IND
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B19(J), S4M(J)
S4M(J) = PI2*VL*S4M(J)
IF(B19(J).EQ.1)THEN
P(IND)=S4M(J)
P1(IND1)=S4M(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/VL/PI2
INDS4(J)=IND
IND=IND+1
IND1=IND1+1
ENDIF
C PARAMETER OF G-TENSOR
READ(1,*)B17(J), GSER
GXM(J)=GSER/2.003
IF(B17(J).EQ.1)THEN
P(IND)=GXM(J)
P1(IND1)=GXM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B18(J), GSER
GYM(J)=GSER/2.003
IF(B18(J).EQ.1)THEN
P(IND)=GYM(J)
P1(IND1)=GYM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B20(J), GSER
GZM(J)=GSER/2.003
IF(B20(J).EQ.1)THEN
P(IND)=GZM(J)
P1(IND1)=GZM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
C PARAMETERS OF HYPERFINE COUPLING
READ(1,*)B9(J), AXM(J)
C CONVERTION FROM CM-1 TO S-1.RAD
AXM(J)=PI2*VL*AXM(J)
IF(B9(J).EQ.1)THEN
P(IND)=AXM(J)
P1(IND1)=AXM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/VL/PI2
INDAPAR(J)=IND
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B10(J), AYM(J)
AYM(J)=PI2*VL*AYM(J)
IF(B10(J).EQ.1)THEN
P(IND)=AYM(J)
P1(IND1)=AYM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/VL/PI2
INDAPER(J)=IND
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B21(J), AZM(J)
AZM(J)=PI2*VL*AZM(J)
IF(B21(J).EQ.1)THEN
P(IND)=AZM(J)
P1(IND1)=AZM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/VL/PI2
INDAPER2(J)=IND
IND=IND+1
IND1=IND1+1
ENDIF
C PARAMETERS OF OUTER-SPHERE
READ(1,*)B13(J), DM(J)
DM(J)=DM(J)*1.E-8
IF(B13(J).EQ.1)THEN
P(IND)=DM(J)
P2(IND2)=DM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)/1.E-8
INDED(J)=IND
IND=IND+1
IND2=IND2+1
ENDIF
READ(1,*)B14(J), DDM(J)
IF(B14(J).EQ.1)THEN
P(IND)=DDM(J)
P2(IND2)=DDM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND2=IND2+1
ENDIF
READ(1,*)B15(J), CONCM(J)
IF(B15(J).EQ.1)THEN
P(IND)=CONCM(J)
P2(IND2)=CONCM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND2=IND2+1
ENDIF
C NUMBER OF DIFFERENT SITES
READ(1,*) ACQ
C PARAMETERS FOR DIFFERENT SITES
DO J=1,ACQ
READ(1,*)B4(J), (TAUMM(J,K),K=1,2)
IF(B4(J).GE.2)THEN
TM1=TAUMM(J,1)
TM2=TAUMM(J,2)
TM11(J)=TAUMM(J,1)
TM21(J)=TAUMM(J,2)
DO K=1,SET
TAUMM(J,K)=TM1*EXP(TM2/TEMP(K))
END DO
IF(B4(J).EQ.3) NPLUS2=1
ENDIF
IF(B4(J).EQ.1)THEN
P(IND)=TAUMM(J,1)
P2(IND2)=TAUMM(J,1)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND2=IND2+1
ENDIF
IF(B4(J).EQ.2)THEN
P(IND)=TM1
P2(IND2)=TM1
P(IND+1)=TM2
P2(IND2+1)=TM2
WRITE(4,'(2X,4(E10.4,2X))') TM1,TM2
IND=IND+2
IND2=IND2+2
ENDIF
READ(1,*)B5(J), AMOLFRAM(J)
AMOLFRAM(J)=AMOLFRAM(J)*1.E-3/111.
IF(B5(J).EQ.1)THEN
P(IND)=AMOLFRAM(J)
P2(IND2)=AMOLFRAM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)*111./1.E-3
INDAMOLFRA(J)=IND
IND=IND+1
IND2=IND2+1
ENDIF
READ(1,*)B6(J), RKM(J)
IF(B6(J).EQ.1)THEN
P(IND)=RKM(J)
P2(IND2)=RKM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND2=IND2+1
ENDIF
READ(1,*)B16(J), ACONTM(J)
IF(B16(J).EQ.1)THEN
P(IND)=ACONTM(J)
P2(IND2)=ACONTM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND2=IND2+1
ENDIF
READ(1,*)B7(J), THETAM(J)
IF(B7(J).EQ.1)THEN
P(IND)=THETAM(J)
P1(IND1)=THETAM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF
READ(1,*)B8(J), PHIM(J)
IF(B8(J).EQ.1)THEN
P(IND)=PHIM(J)
P1(IND1)=PHIM(J)
WRITE(4,'(2X,4(E10.4,2X))') P(IND)
IND=IND+1
IND1=IND1+1
ENDIF

C NUMBER OF FITTING PARAMETERS
NV=NV+B1(J)+B2(J)+B3(J)+B4(J)+B5(J)+B6(J)+B7(J)+B8(J)+B9(J)+
& B10(J)+B11(J)+B12(J)+B13(J)+B14(J)+B15(J)+B16(J)+B17(J)
& +B18(J)+B19(J)+B20(J)+B21(J)-NPLUS*3-NPLUS2*3
C NUMBER OF FITTING PARAMETERS IN EXTERNAL CICLE
NVEST=NVEST+B1(J)+B2(J)+B3(J)+B7(J)+B8(J)+B9(J)+
& B10(J)+B11(J)+B12(J)+B17(J)
& +B18(J)+B19(J)+B20(J)+B21(J)-NPLUS*3
NPLUS=0
NPLUS2=0
END DO

NVMEM=NV
DPARATOT=0.
EPARATOT=0.
APERTOT=0.
APERTOT2=0.
APARTOT=0.
ACONTOT=0.
ACONIND=0.
DO J=1,ACQ
DPARATOT=DPARAM(J)+DPARATOT
EPARATOT=EPARAM(J)+EPARATOT
APERTOT=AZM(J)+APERTOT
APERTOT2=AXM(J)+APERTOT2
APARTOT=AYM(J)+APARTOT
ACONTOT=ACONTM(J)+ACONTOT
END DO

C DEFINITION OF NMX: DIMENSION OF ENERGY MATRIX
IF(DPARATOT.EQ.0..AND.EPARATOT.EQ.0.
& AND.GX.EQ.GZ.AND.GX.EQ.GY.AND.SPIN.EQ.0.5)THEN
NMX=2.*(2*SI+1.)
ELSE
IF(APERTOT.EQ.0.AND.APARTOT.EQ.0.AND.APERTOT2.EQ.0.AND.
& GX.EQ.GZ.AND.GX.EQ.GY.AND.EPARATOT.EQ.0)THEN
SI=0.5
NMX=2*SPIN+1.
ELSE
NMX = (2*SI + 1)*(2*SPIN+1)
ENDIF
ENDIF
IF(IREL.NE.1) NMX = (2*SI + 1)*(2*SPIN+1)
IF(ACONTOT.NE.0) THEN
IF(APERTOT.NE.0.OR.APARTOT.NE.0.OR.APERTOT2.NE.0.OR.
& GX.NE.GZ.OR.GX.NE.GY.OR.EPARATOT.NE.0.OR.DPARATOT.NE.0)THEN
NMX = (2*SI + 1)*(2*SPIN+1)
ACONIND=1.
ENDIF
ENDIF


READ(1,*) (NPT(K),K=1, SET)
READ(1,*) FTOL
READ(1,*) ALFASTEP

C Z: FREQUENCIES, PP: RATE

NPTOT=0
DO K=1,SET
NPTOT=NPTOT+NPT(K)
END DO

DO 11
I=1,NPTOT
READ(1,*) Z(I),PP(I)
11 CONTINUE

CLOSE(1)
OO=10


IF (NPT(1).EQ.0)GOTO 250

C STARTING FITTING PROCEDURE


IF(NVEST.EQ.0)THEN
CALL FUNCZFS(P2,FUNC,NMX,NV)
NP=NV
N=NV
ITER=1000
CALL POWELLINT(P2,XI,N,NP,FTOL,ITER,FRET,NMX)
DO J=1,NP
WRITE(6,'(2X,4(E10.4,2X))') P2(J),2
END DO
ELSE
NP=NVEST
N=NVEST
ITER=1000
CALL POWELL(P1,XI,N,NP,FTOL,ITER,FRET,NMX)
ENDIF

WRITE(4,*) 'ERROR=', FRET/(NPTOT-NV)
DO J=1,ACQ
IF(B5(J).EQ.1)P2(INDAMOLFRA(J))=P2(INDAMOLFRA(J))*111/1.E-3
IF(B9(J).EQ.1)P1(INDAPAR(J))=P1(INDAPAR(J))/PI2/VL
IF(B10(J).EQ.1)P1(INDAPER(J))=P1(INDAPER(J))/PI2/VL
IF(B21(J).EQ.1)P1(INDAPER2(J))=P1(INDAPER2(J))/PI2/VL
IF(B11(J).EQ.1)P1(INDDPARA(J))=P1(INDDPARA(J))/PI2/VL
IF(B12(J).EQ.1)P1(INDEPARA(J))=P1(INDEPARA(J))/PI2/VL
IF(B13(J).EQ.1)P2(INDED(J))=P2(INDED(J))/1.E-8
IF(B19(J).EQ.1)P1(INDS4(J))=P1(INDS4(J))/PI2/VL
END DO



C WRITE RESULTS OF FITTING PROCEDURE
IF(NVEST.NE.0)THEN
JI=1
IF(B1(1).EQ.2)THEN
DO K=1,SET
WRITE(4,'(2X,4(E10.4,2X))')P1(JI)*EXP(P1(JI+1)/TEMP(K))
END DO
JI=JI+2
ENDIF
IF(B2(1).EQ.2)THEN
DO K=1,SET
WRITE(4,'(2X,4(E10.4,2X))')P1(JI)*EXP(P1(JI+1)/TEMP(K))
END DO
JI=JI+2
ENDIF
IF(B3(1).EQ.2)THEN
DO K=1,SET
WRITE(4,'(2X,4(E10.4,2X))')P1(JI)*EXP(P1(JI+1)/TEMP(K))
END DO
JI=JI+2
ENDIF
DO J=JI,NVEST
WRITE(4,'(2X,4(E10.4,2X))') P1(J)
END DO
ENDIF

DO JJ=1,ACQ
IF(NV-NVEST.NE.0)THEN
JI=1
IF(B4(JJ).EQ.2)THEN
DO K=1,SET
WRITE(4,'(2X,4(E10.4,2X))')P2(JI)*EXP(P2(JI+1)/TEMP(K))
END DO
JI=JI+2
ENDIF
DO J=JI,NV-NVEST
WRITE(4,'(2X,4(E10.4,2X))') P2(J)
END DO
ENDIF
END DO

WRITE(4,*) 'MAGN. FIELD, OBSED., CAL. '


DO 1 I=1,NPTOT
WRITE(4,'(2X,3(F8.3,2X))') Z(I),PP(I)/CONCM(1)*0.001,
& TPUNO(I)/CONCM(1)*0.001
1 CONTINUE
CLOSE(4)
DO J=1,ACQ
IF(B5(J).EQ.1)P2(INDAMOLFRA(J))=P2(INDAMOLFRA(J))/111*1.E-3
IF(B9(J).EQ.1)P1(INDAPAR(J))=P1(INDAPAR(J))*PI2*VL
IF(B10(J).EQ.1)P1(INDAPER(J))=P1(INDAPER(J))*PI2*VL
IF(B21(J).EQ.1)P1(INDAPER2(J))=P1(INDAPER2(J))*PI2*VL
IF(B11(J).EQ.1)P1(INDDPARA(J))=P1(INDDPARA(J))*PI2*VL
IF(B12(J).EQ.1)P1(INDEPARA(J))=P1(INDEPARA(J))*PI2*VL
IF(B13(J).EQ.1)P2(INDED(J))=P2(INDED(J))*1.E-8
IF(B19(J).EQ.1)P1(INDS4(J))=P1(INDS4(J))*PI2*VL
END DO

OO=0
250 CONTINUE

C CALCULATION OF THE CURVE
OPEN (44, FILE=FILENAME)
DO K=1,SET
NPT(K)=NUMPUN
END DO
INDEXSTAMPA=1
DO K=1,SET
DO I=1,NPT(K)
ZE = XMIN + (XMAX - XMIN)*FLOAT(I)/FLOAT(NPT(K))
ADD=0
DO IJK=1,K-1
ADD=ADD+NPT(IJK)
END DO
PP(I+1+ADD)=PP(I+ADD)
Z(I+ADD) = 10.**ZE/1000000.
END DO
END DO
NVEST=30+OO
CALL FUNCZFS(P1,FUNC,NMX,NV)
CLOSE(44)
STOP
END




SUBROUTINE FUNCZFS(P,FUNC,NMX,NV)
IMPLICIT REAL*8(A-H,O-Z)
DIMENSION P(NV)
DIMENSION XI2(21,21)
PARAMETER(PI2 = 6.2831853, VL = 2.9979D+10)
COMMON /SET/SET
COMMON /PPAR/ P2(21)
COMMON /RK10/ SPIN, SI
COMMON /WATER/ ACQ
COMMON /STAMPA/INDEXSTAMPA
COMMON /STEPGAMMA/ STEPGAMMA
COMMON /B4/ NVMEM,NPT(10),NPTOT
COMMON /B31/ TPUNO(500)
COMMON /B32/ PP(500),Z(500)
COMMON /C1M/DM(10),DDM(10),CONCM(10)
COMMON /IPERFM/AZM(10),AYM(10),AXM(10),THETAM(10),RKM(10),
& TAUCM(10),DPARAM(10),EPARAM(10),PHIM(10),S4M(10),GXM(10),
& GYM(10),GZM(10)
COMMON /TAU1M/ TAUS0M(10,10),TAURM(10,10),TAUVM(10,10),
& TAUMM(10,10)
COMMON /MOLFRAZM/ AMOLFRAM(10)
COMMON /CONTATM/ ACONTM(10)
COMMON /INDA/ INDDPARA(10),INDAPAR(10),INDAPER(10),INDEPARA(10)
& ,INDED(10),INDAMOLFRA(10),INDS4(10),INDAPER2(10)
COMMON /C1/D,DD,CONC
COMMON /IPERF/AZ,AY,AX,THETA,RK,TAUC,DPARA,EPARA,PHI,S4
COMMON /GTENSOR/ GX,GY,GZ
COMMON /TAU1/ TAUS0
COMMON /TAU/ TAUR,TAUV,TAUM
COMMON /MOLFRAZ/ AMOLFRA
COMMON /CONTAT/ ACONT
COMMON /GAMMAH/ GAMMAI
COMMON /TM/ TMUNO,TMUNOCONT,TMUNOCROSS
COMMON /CICLE/ NVEST
COMMON /TMAT/ TMAT(500,10),TMATCONT(500,10),TMATCROSS(500,10)
COMMON /BPARA/B1(10),B2(10),B3(10),B4(10),B5(10),B6(10),B7(10),
& B8(10),B9(10),B10(10),B11(10),B12(10),B13(10),B14(10),B15(10),
& B16(10),B17(10),B18(10),B19(10),B20(10),B21(10)
COMMON/TEMPERATURE/ TEMP(10)
DIMENSION TS1(10),TS2(10),TR1(10),TR2(10),TV1(10),TV2(10)
COMMON /TMSTART/ TM11(10),TM21(10)



C SET PARAMETERS
FB=0.
FBW=0.
IF(NVEST.LT.30)THEN
WRITE(6,*)'PARAMETERS: '
DO J=1,ACQ
IF(B5(J).EQ.1)P(INDAMOLFRA(J))=P(INDAMOLFRA(J))*111/1.E-3
IF(B9(J).EQ.1)P(INDAPAR(J))=P(INDAPAR(J))/PI2/VL
IF(B10(J).EQ.1)P(INDAPER(J))=P(INDAPER(J))/PI2/VL
IF(B21(J).EQ.1)P(INDAPER2(J))=P(INDAPER2(J))/PI2/VL
IF(B11(J).EQ.1)P(INDDPARA(J))=P(INDDPARA(J))/PI2/VL
IF(B12(J).EQ.1)P(INDEPARA(J))=P(INDEPARA(J))/PI2/VL
IF(B13(J).EQ.1)P(INDED(J))=P(INDED(J))/1.E-8
IF(B19(J).EQ.1)P(INDS4(J))=P(INDS4(J))/PI2/VL
END DO
DO I=1,NV
WRITE(6,'(2X,E10.4)')P(I)
END DO
DO J=1,ACQ
IF(B5(J).EQ.1)P(INDAMOLFRA(J))=P(INDAMOLFRA(J))/111*1.E-3
IF(B9(J).EQ.1)P(INDAPAR(J))=P(INDAPAR(J))*PI2*VL
IF(B10(J).EQ.1)P(INDAPER(J))=P(INDAPER(J))*PI2*VL
IF(B21(J).EQ.1)P(INDAPER2(J))=P(INDAPER2(J))*PI2*VL
IF(B11(J).EQ.1)P(INDDPARA(J))=P(INDDPARA(J))*PI2*VL
IF(B12(J).EQ.1)P(INDEPARA(J))=P(INDEPARA(J))*PI2*VL
IF(B13(J).EQ.1)P(INDED(J))=P(INDED(J))*1.E-8
IF(B19(J).EQ.1)P(INDS4(J))=P(INDS4(J))*PI2*VL
END DO
ENDIF


DO 223 K=1,SET
DO I=1, NPT(K)
IND=1
TPUNOTOT=0
J=1
TAUS0=TAUS0M(J,1)
TAUR=TAURM(J,1)
TAUV=TAUVM(J,1)
IF(TAUR.EQ.0.AND.TAUV.EQ.0.)TAUC=TAUCM(J)
AX=AXM(J)
AY=AYM(J)
AZ=AZM(J)
DPARA=DPARAM(J)
EPARA=EPARAM(J)
GX=GXM(J)
GY=GYM(J)
GZ=GZM(J)
S4=S4M(J)
IF(INDEXSTAMPA.EQ.0.OR.NVEST.EQ.40)THEN
D=DM(J)
DD=DDM(J)
CONC=CONCM(J)
ENDIF

C
PARAMETERS**************************************************************
IF(B1(J).EQ.1)THEN
TAUS0=P(IND)
IND=IND+1
ENDIF
IF(B1(J).EQ.2)THEN
TS1(K)=P(IND)
TS2(K)=P(IND+1)
IND=IND+2
ENDIF
IF(B2(J).EQ.1)THEN
TAUR=P(IND)
IND=IND+1
ENDIF
IF(B2(J).EQ.2)THEN
TR1(K)=P(IND)
TR2(K)=P(IND+1)
IND=IND+2
ENDIF
IF(B3(J).EQ.1)THEN
TAUV=P(IND)
IND=IND+1
ENDIF
IF(B3(J).EQ.2)THEN
TV1(K)=P(IND)
TV2(K)=P(IND+1)
IND=IND+2
ENDIF
IF(B1(J).EQ.1.AND.TAUR.EQ.0.AND.TAUV.EQ.0)THEN
TAUC=P(IND-1)
ENDIF
IF(B11(J).EQ.1)THEN
DPARA=P(IND)
IND=IND+1
ENDIF
IF(B12(J).EQ.1)THEN
EPARA=P(IND)
IND=IND+1
ENDIF
IF(B19(J).EQ.1)THEN
S4=P(IND)
IND=IND+1
ENDIF
IF(B17(J).EQ.1)THEN
GX=P(IND)
IND=IND+1
ENDIF
IF(B18(J).EQ.1)THEN
GY=P(IND)
IND=IND+1
ENDIF
IF(B20(J).EQ.1)THEN
GZ=P(IND)
IND=IND+1
ENDIF
IF(B9(J).EQ.1)THEN
AX=P(IND)
IND=IND+1
ENDIF
IF(B10(J).EQ.1)THEN
AY=P(IND)
IND=IND+1
ENDIF
IF(B21(J).EQ.1)THEN
AZ=P(IND)
IND=IND+1
ENDIF

IND2=1 !!!!!!!!!!!!!!!!!!!!!!!!!
IF(B13(J).EQ.1) IND2=IND2+1
IF(B14(J).EQ.1) IND2=IND2+1
IF(B15(J).EQ.1) IND2=IND2+1 !!!!!!!!!!!!!!!!!

DO J=1,ACQ
IF(INDEXSTAMPA.EQ.0.OR.NVEST.EQ.40)THEN
TAUM=TAUMM(J,1)
AMOLFRA=AMOLFRAM(J)
RK=RKM(J)
ACONT=ACONTM(J)
ENDIF

IF(INDEXSTAMPA.EQ.1)THEN !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF(B4(J).EQ.0)TAUM=TAUMM(J,1)
IF(B4(J).EQ.1)THEN
TAUM=P2(IND2)
IND2=IND2+1
ENDIF
IF(B4(J).EQ.2)THEN
TM11(J)=P2(IND2)
TM21(J)=P2(IND2+1)
IND2=IND2+2
ENDIF
IF(B5(J).EQ.0)AMOLFRA=AMOLFRAM(J)
IF(B5(J).EQ.1)THEN
AMOLFRA=P2(IND2)
IND2=IND2+1
ENDIF
IF(B6(J).EQ.0)RK=RKM(J)
IF(B6(J).EQ.1)THEN
RK=P2(IND2)
IND2=IND2+1
ENDIF
IF(B16(J).EQ.0)ACONT=ACONTM(J)
IF(B16(J).EQ.1)THEN
ACONT=P2(IND2)
IND2=IND2+1
ENDIF
ENDIF !!!!!!!!!!!!!!!!!!!!!!!!!!!!


THETA=THETAM(J)
PHI=PHIM(J)

IF(B7(J).EQ.1)THEN
THETA=P(IND)
IND=IND+1
ENDIF
IF(B8(J).EQ.1)THEN
PHI=P(IND)
IND=IND+1
ENDIF



IF(B1(J).EQ.2)TAUS0=TS1(1)*EXP(TS2(1)/TEMP(K))
IF(B2(J).EQ.2)TAUR=TR1(1)*EXP(TR2(1)/TEMP(K)) !stokes
IF(B3(J).EQ.2)TAUV=TV1(1)*EXP(TV2(1)/TEMP(K))
IF(B4(J).EQ.2)TAUM=TM11(J)*EXP(TM21(J)/TEMP(K))
IF(B1(J).EQ.3)TAUS0=TAUS0M(J,K)
IF(B2(J).EQ.3)TAUR=TAURM(J,K)
IF(B3(J).EQ.3)TAUV=TAUVM(J,K)
IF(B4(J).EQ.3)TAUM=TAUMM(J,K)
C*******************************************************************************

ADD=0
DO IJK=1,K-1
ADD=ADD+NPT(IJK)
END DO
IPLUS=I+ADD

C PROTON LARMOR FREQUENCY
BZ=Z(IPLUS)*1000000
C CONSTANTS IN DIPOLAR RELAXATION
RK1=10.*2.46502D-52/(2.6752D8)**2*GAMMAI**2*(RK*1.E-10)**(-6)
IF (AMOLFRA.EQ.0.)RK1=10./(SPIN*(SPIN+1.)*2./15.)/TAUS0*1.E-9
IF(RK.EQ.0) RK1=0.
C CONSTANT OF CONTACT RELAXATION
CONA=(ACONT*6.28*1.E6*1.0546E-34)


IF(TAUC.EQ.0.AND.TAUS0.EQ.0) GOTO 56
CALL GAUINT (BZ,TAUM,NMX)


C STORE CONTRIBUTIONS FOR TUNO
TMAT(IPLUS,J)=TMUNO
TMATCONT(IPLUS,J)=TMUNOCONT
TMATCROSS(IPLUS,J)=TMUNOCROSS

C CALCULATION OF TPUNO
TMUNO=TMUNO*RK1+CONA*CONA*TMUNOCONT+SQRT(RK1)*CONA*TMUNOCROSS

TPUNO1=1./(1./TMUNO+TAUM)*AMOLFRA
IF(AMOLFRA.EQ.0.)TPUNO1=1./(1./TMUNO+TAUM)
TPUNO(IPLUS)=TPUNO1/CONC*0.001

TPUNOTOT=TPUNOTOT+TPUNO(IPLUS)

END DO
56 CONTINUE
C CALCULATION OF OUTER-SPHERE CONTRIBUTION
TERM=0
IF(DD.NE.0)THEN
V=BZ*2.*3.14
TAUD=D**2/DD
CZ=SQRT(2*V*TAUD)
ZZ=SQRT(2*V*TAUD*658.)
GEI=(1.+5.*CZ/8.+CZ**2/8.)/(1.+CZ+CZ**2/2.+CZ**3/6.+4.*
& CZ**4/81.+CZ**5/81.+CZ**6/648.)
GES=(1.+5.*ZZ/8.+ZZ**2/8.)/(1.+ZZ+ZZ**2/2.+ZZ**3/6.+4.*
& ZZ**4/81.+ZZ**5/81.+ZZ**6/648.)
PRIMO=32.*3.14/405.*(2.6752E4*1.7608E7*1.0546E-27)**2*6.022E20
SECONDO=SPIN*(SPIN+1)*CONC/(D*DD)
TERZO=(3.*GEI+7.*GES)
TERM=(PRIMO*SECONDO*TERZO)
ENDIF
TPUNOTOT=TPUNOTOT+TERM

TPUNO(IPLUS)=TPUNOTOT
C DIFFERENCE BETWEEN EXPERIMENTAL AND FITTING VALUES
FB=((PP(IPLUS)-TPUNO(IPLUS))**2)/PP(IPLUS)+FB
FBW=SQRT((PP(IPLUS)-TPUNO(IPLUS))**2)/PP(IPLUS)+FBW
IF (STEPGAMMA.NE.1) WRITE(6,'(2X,2(E10.4))')Z(IPLUS),TPUNO
(IPLUS)
IF(INDEXSTAMPA.EQ.1)WRITE(44,'(2X,2(E10.4))')6.283d+6*Z(IPLUS)/
& (GAMMAI) ,TPUNO(IPLUS)
END DO

223 CONTINUE


FUNC=FBW
IF(INDEXSTAMPA.EQ.0)WRITE(6,*)' ERROR',
& '=',FBW/(NPTOT-NVMEM),'**********'


IF(NV.NE.NVMEM)THEN

C INTERNAL FITTING PROCEDURE
NP2=NVMEM-NV
N2=NVMEM-NV
ITER2=1000
FRET2=0.
CALL POWELLINT(P2,XI2,N2,NP2,FTOL,ITER2,FRET2,NMX)
WRITE(6,*)' ERROR',
& '=', FRET2/(NPTOT-NVMEM)
DO J=1,NP2
WRITE(6,'(2X,E10.4)')P2(J)
END DO
FUNC=FRET2
ENDIF


RETURN
END


SUBROUTINE FUNCINT(P,FUNC,NMX,NV)
IMPLICIT REAL*8(A-H,O-Z)
DIMENSION P(NV)
PARAMETER(PI2 = 6.2831853, VL = 2.9979D+10)
COMMON /SET/SET
COMMON /RK10/ SPIN, SI
COMMON /WATER/ ACQ
COMMON /STAMPA/INDEXSTAMPA
COMMON /STEPGAMMA/ STEPGAMMA
COMMON /B4/ NVMEM,NPT(10),NPTOT
COMMON /B31/ TPUNO(500)
COMMON /B32/ PP(500),Z(500)
COMMON /C1M/DM(10),DDM(10),CONCM(10)
COMMON /IPERFM/AZM(10),AYM(10),AXM(10),THETAM(10),RKM(10),
& TAUCM(10),DPARAM(10),EPARAM(10),PHIM(10),S4M(10),GXM(10),
& GYM(10),GZM(10)
COMMON /TAU1M/ TAUS0M(10,10),TAURM(10,10),TAUVM(10,10),
& TAUMM(10,10)
COMMON /MOLFRAZM/ AMOLFRAM(10)
COMMON /CONTATM/ ACONTM(10)
COMMON/INDA/ INDDPARA(10),INDAPAR(10),INDAPER(10),INDEPARA(10)
& ,INDED(10),INDAMOLFRA(10),INDS4(10),INDAPER2(10)
COMMON /C1/D,DD,CONC
COMMON /IPERF/AZ,AY,AX,THETA,RK,TAUC,DPARA,EPARA,PHI,S4
COMMON /GTENSOR/ GX,GY,GZ
COMMON /TAU1/ TAUS0
COMMON /TAU/ TAUR,TAUV,TAUM
COMMON /MOLFRAZ/ AMOLFRA
COMMON /CONTAT/ ACONT
COMMON /GAMMAH/ GAMMAI
COMMON /TM/ TMUNO,TMUNOCONT,TMUNOCROSS
COMMON /CICLE/ NVEST
COMMON /TMAT/ TMAT(500,10),TMATCONT(500,10),TMATCROSS(500,10)
COMMON /BPARA/B1(10),B2(10),B3(10),B4(10),B5(10),B6(10),B7(10),
& B8(10),B9(10),B10(10),B11(10),B12(10),B13(10),B14(10),B15(10),
& B16(10),B17(10),B18(10),B19(10),B20(10),B21(10)
COMMON/TEMPERATURE/ TEMP(10)
DIMENSION TM1(10),TM2(10)


C SET PARAMETERS
FB=0.
FBW=0.

DO 223 K=1,SET
DO I=1, NPT(K)
IND=1
TPUNOTOT=0
J=1

C PARAMETERS OF INTERNAL
FITTING*********************************************
IF(B13(J).EQ.1)THEN
D=P(IND)
IND=IND+1
ELSE
D=DM(J)
ENDIF
IF(B14(J).EQ.1)THEN
DD=P(IND)
IND=IND+1
ELSE
DD=DDM(J)
ENDIF
IF(B15(J).EQ.1)THEN
CONC=P(IND)
IND=IND+1
ELSE
CONC=CONCM(J)
ENDIF


DO J=1,ACQ


IF(B4(J).EQ.1)THEN
TAUM=P(IND)
IND=IND+1
ENDIF
IF(B4(J).EQ.2)THEN
TM1(1)=P(IND)
TM2(1)=P(IND+1)
IND=IND+2
ENDIF
IF(B4(J).EQ.0) TAUM=TAUMM(J,1)

IF(B5(J).EQ.1)THEN
AMOLFRA=P(IND)
IND=IND+1
ELSE
AMOLFRA=AMOLFRAM(J)
ENDIF
IF(B6(J).EQ.1)THEN
RK=P(IND)
IND=IND+1
ELSE
RK=RKM(J)
ENDIF
IF(B16(J).EQ.1)THEN
ACONT=P(IND)
IND=IND+1
ELSE
ACONT=ACONTM(J)
ENDIF

IF(B4(J).EQ.2)TAUM=TM1(1)*EXP(TM2(1)/TEMP(K))
IF(B4(J).EQ.3)TAUM=TAUMM(J,K)
C*******************************************************************************

ADD=0
DO IJK=1,K-1
ADD=ADD+NPT(IJK)
END DO
IPLUS=I+ADD

BZ=Z(IPLUS)*1000000.
RK1=10.*2.46502D-52/(2.6752D8)**2*GAMMAI**2*(RK*1.E-10)**(-6)
IF (AMOLFRA.EQ.0.)RK1=10./(SPIN*(SPIN+1.)*2./15.)/TAUS0*1.E-9
IF(RK.EQ.0) RK1=0.
CONA=(ACONT*6.28*1.E6*1.0546E-34)


C READ CALCULATED CONTRIBUTIONS TO TMUNO
TMUNO=TMAT(IPLUS,J)
TMUNOCONT=TMATCONT(IPLUS,J)
TMUNOCROSS=TMATCROSS(IPLUS,J)

C CALCULATION OF TMUNO
TMUNO=TMUNO*RK1+CONA*CONA*TMUNOCONT+SQRT(RK1)*CONA*TMUNOCROSS
TPUNO1=1./(1./TMUNO+TAUM)*AMOLFRA
IF(AMOLFRA.EQ.0.)TPUNO1=1./(1./TMUNO+TAUM)
TPUNO(IPLUS)=TPUNO1/CONC*0.001

TPUNOTOT=TPUNOTOT+TPUNO(IPLUS)
END DO
56 CONTINUE
C CALCULATION OF OUTER-SPHERE CONTRIBUTION
TERM=0
IF(DD.NE.0)THEN
V=BZ*2.*3.14
TAUD=D**2/DD
CZ=SQRT(2*V*TAUD)
ZZ=SQRT(2*V*TAUD*658.)
GEI=(1.+5.*CZ/8.+CZ**2/8.)/(1.+CZ+CZ**2/2.+CZ**3/6.+4.*
& CZ**4/81.+CZ**5/81.+CZ**6/648.)
GES=(1.+5.*ZZ/8.+ZZ**2/8.)/(1.+ZZ+ZZ**2/2.+ZZ**3/6.+4.*
& ZZ**4/81.+ZZ**5/81.+ZZ**6/648.)
PRIMO=32.*3.14/405.*(2.6752E4*1.7608E7*1.0546E-27)**2*6.022E20
SECONDO=SPIN*(SPIN+1)*CONC/(D*DD)
TERZO=(3.*GEI+7.*GES)
TERM=(PRIMO*SECONDO*TERZO)
ENDIF
TPUNOTOT=TPUNOTOT+TERM

C DIFFERENCES BETWEEN EXPERIMENTAL AND FITTED VALUES
TPUNO(IPLUS)=TPUNOTOT
FB=((PP(IPLUS)-TPUNO(IPLUS))**2)/PP(IPLUS)+FB
FBW=SQRT((PP(IPLUS)-TPUNO(IPLUS))**2)/PP(IPLUS)+FBW
!IF (STEPGAMMA.NE.1) WRITE(6,'(2X,2(E10.4))')Z(IPLUS),TPUNO
(IPLUS)
IF(INDEXSTAMPA.EQ.1) WRITE(44,'(2X,2(E10.4))') 6.283d+6*Z
(IPLUS)/
& (GAMMAI), TPUNO(IPLUS)
END DO

223 CONTINUE
FUNC=FBW
RETURN
END

FUNCTION E(BZ,BETA,THETA,TAUC,NMX,PHI,GAMMA)
IMPLICIT REAL*8(A-H,O-Z)
COMMON /A3/ T11,T12,T13
COMMON /T1T2/ IREL
COMMON /ECOM/ ECONT,ECROSS
COMMON /STEPGAMMA/ STEPGAMMA
COMMON /TOT/ DPARATOT,EPARATOT
OMI=BZ*6.2831853
CALL DIAG(BETA,GAMMA,BZ,NMX)

CCCCCCCCCCCCCCCCCCCCCCCC modificare CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

IF(IREL.EQ.1.AND.STEPGAMMA.GT.1)CALL TUNO(BETA,OMI,THETA,
& TAUC,NMX,PHI,GAMMA)
IF(IREL.EQ.1.AND.STEPGAMMA.EQ.1)CALL TUNOISO(BETA,OMI,THETA,
& TAUC,NMX)
! IF(IREL.EQ.1)CALL TUNO(BETA,OMI,THETA,TAUC,NMX,PHI,GAMMA)
IF(IREL.EQ.2)CALL TDUE(BETA,OMI,THETA,TAUC,NMX,PHI,GAMMA)
E=T11*SIN(BETA)
ECONT=T12*SIN(BETA)
ECROSS=T13*SIN(BETA)
RETURN
END

SUBROUTINE DIAG(BETA,GAMMA,BZ,NMX)
IMPLICIT REAL*8(A-H,O-Z)
PARAMETER(PI2 = 6.2831853, VL = 2.9979D+10)
common /butto/ taurb,tausb
COMMON /RK10/ SPIN, SI
COMMON /T1T2/ IREL
COMMON /INDEX/ INDEX
COMMON /STEPGAMMA/ STEPGAMMA
COMMON /TAUDELTA/ TAUDELTA
COMMON /TAUE/ TAUE
COMMON /CONTAT/ ACONT
COMMON /TOT/ DPARATOT,EPARATOT,APARTOT,APERTOT,APERTOT2,ACONIND
COMMON /IPERF/AZ,AY,AX,THETA,RK,TAUC,DPARA,EPARA,PHI,S4
COMMON /GTENSOR/ GX,GY,GZ
COMMON /TAU/ TAUR,TAUV,TAUM
COMMON /TAU1/ TAUS0
COMMON /AOLD/ OMOLD(10000),COLD(10000,4)
dimension cold1(10000,4),cold2(10000,4)
COMPLEX*16 C(100,100,19)
COMPLEX*16 Cn1(100,100,19)
COMPLEX*16 Cn2(100,100,19)
COMMON /A1/ OM(1000,1000),C
PARAMETER(MBRANC=90)
COMPLEX*16 SZ(MBRANC,MBRANC),SP(MBRANC,MBRANC),SM(MBRANC,MBRANC)
DIMENSION CO1(MBRANC),CO2(MBRANC), CO3(MBRANC)
COMPLEX*16 SZT(MBRANC,MBRANC),SPT(MBRANC,MBRANC)
COMPLEX*16 SMT(MBRANC,MBRANC)
COMPLEX*16 TZ,TP,TM
COMPLEX*16 cpp,cpm,cpz,cmp,cmm,cmz,czz,czp,czm
COMPLEX*16 ammcp1,ammcp2,ammcp3,ammcp4,ammcp5,ammcp6,ammcp7,
& ammcp8,ammcp9
COMPLEX*16 ammcm1,ammcm2,ammcm3,ammcm4,ammcm5,ammcm6,ammcm7,
& ammcm8,ammcm9
COMPLEX*16 ammcz1,ammcz2,ammcz3,ammcz4,ammcz5,ammcz6,ammcz7,
& ammcz8,ammcz9
COMPLEX*16 primo,secondo,terzo,quarto,quinto,sesto,settimo,
& ottavo,onono
COMPLEX*16 a1,b1,c1,d1,e1,f1,g1,h1,ai1,al1,trhoa,trhob,trhoc
COMPLEX*16 a,b,cp,a11,a12,a13,a21,a22,a23,a31,a32,a33
COMPLEX*16 a44,a55,a66,a77,a88,a99,a45,a54,a78,a87
COMPLEX*16 t10,t21,t3,t4,t5,t6,t78,t8,t11,t12
COMPLEX*16 rpzpz,rzmzm,r1223,rpmpm
complex*16 ak11,ak12,ak13,ak21,ak22,ak23,ak31,ak32,ak33
complex*16 cz1,cz2,cz3,cz4,cz5,cz6,cz7,cz8,cz9
complex*16 cp1,cp2,cp3,cp4,cp5,cp6,cp7,cp8,cp9
complex*16 cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9
COMPLEX*16 rhoa,rhob,rhoc,rt1
common /stoccolma/ disp
DIMENSION WR( MBRANC )
COMPLEX*16 AR(MBRANC,MBRANC),ZR(MBRANC,MBRANC )
COMPLEX*16 aaa(3,3)
DIMENSION ARR(MBRANC,MBRANC),ARI(MBRANC,MBRANC)
DIMENSION ZRR(MBRANC,MBRANC),ZRI(MBRANC,MBRANC)
DIMENSION WK1(MBRANC),WK2(MBRANC),WK3(MBRANC)
integer lda,num,ipvt(3),info,job
complex*16 det(2),work(3),zrn(3,3)
COMMON /GAMMAH/GAMMAI
complex a44zfs,a55zfs,a44zee,a55zee

CT=COS(BETA)
ST=SIN(BETA)

C CALCULATION OF CORRELATION TIME
WI=2*3.1416*BZ
WS=658.2*WI
IF(TAUV.EQ.0.AND.TAUR.EQ.0)THEN
TAUC=TAUS0
IF(TAUM.EQ.0)THEN
TAUE=TAUS0
ELSE
TAUE=1./(1./TAUS0+1./TAUM)
ENDIF
ELSE
STI=WS**2*TAUV**2
IF (TAUDELTA.EQ.2)THEN
delta=taus0*VL*PI2
RTAUS=2.*(TAUS0*VL*PI2)**2*(4.*SPIN*(SPIN+1)-3)/50.*
& (TAUV/(1+STI)+4*TAUV/(1+4*STI))
! write(6,*)rtaus
! stop !cance
ELSE
delta=0
RTAUS=(0.2/TAUS0)*(1./(1.+STI)+4./(1.+4.*STI))
ENDIF
IF(TAUR.EQ.0)THEN
RTAUC=RTAUS
ELSE
RTAUC=RTAUS+1./TAUR
ENDIF
IF(TAUM.NE.0)THEN
RTAUC=RTAUC+1./TAUM
ENDIF
TAUC=1./RTAUC
IF (ACONT.NE.0)THEN
IF (TAUM.EQ.0)THEN
RTAUE=RTAUS
ELSE
RTAUE=RTAUS+1./TAUM
ENDIF
TAUE=1./RTAUE
ENDIF
ENDIF
IF (STEPGAMMA.GT.1)THEN
COEFFH=-1.
ELSE
COEFFH=1.
ENDIF

IF(ACONIND.EQ.1.)GO TO 456

IF (DPARATOT.EQ.0..AND.EPARATOT.EQ.0..AND.SPIN.EQ.0.5.AND.
& GX.EQ.GY.AND.GX.EQ.GZ.AND.IREL.EQ.1)THEN

C MATRIX OF ENERGY FOR HYPERFINE COUPLING
X=BZ*3.1415927*658.2
ZC=X*CT
ZS=X*ST
DO 200 I=1,(2.*SI+1.)*2.
DO 200 J=1,(2.*SI+1.)
*2.
200 AR(I,J)
=0.
SSI = SI*(SI + 1.)
DO I = 1, (2.*SI+1.)*2., 2
COEF = SI - (I - 1)/2

AR(I,I) = ZC*GZ + (SI-I/2)*AZ/2.
AR(I+1,I+1) = -(ZC*GZ + (SI-I/2)*AZ/2.)
AR(I,I+1) = COEFFH*ZS*GY
AR(I+1,I) = COEFFH*ZS*GY
AR(I+1,I+2) = 0.5*(AX+AY)/2.*SQRT(SSI-(COEF-1.)*COEF)
AR(I+2,I+1) = 0.5*(AX+AY)/2.*SQRT(SSI-(COEF-1.)*COEF)
END DO


IF (INDEX.EQ.1)THEN
WRITE(6,*)'DIM. MATRIX', NMX
OPEN(UNIT=17,FILE='MAT')
DO I=1,(2.*SI+1)*(2.*SPIN+1)
DO J=1,(2.*SI+1)*(2.*SPIN+1)
WRITE(17,*)AR(I,J)
END DO
WRITE(17,*)' '
END DO
CLOSE(17)
ENDIF
INDEX=INDEX+1

C DIAGONALISATION OF THE MATRIX OF ENERGY
DO 45 I=1,NMX
DO 45 J=1,NMX
ARR(I,J)=REAL(AR(I,J))
ARI(I,J)=IMAG(AR(I,J))
45 CONTINUE
CALL F02AXF(ARR,MBRANC,ARI,MBRANC,NMX,WR,ZRR,MBRANC,ZRI,MBRANC
$ ,WK1,WK2,WK3,0)
DO 46 I=1,NMX
DO 46 J=1,NMX
ZR(I,J)=CMPLX(ZRR(I,J),ZRI(I,J))
46 CONTINUE


I=1
OM(1,1)=0.
OMOLD(1)=0.
DO 700 K=1,NMX
DO 700 L=1,NMX
IF (K.EQ.L)GO TO 700
I=I+1
OM(K,L)=WR(K)-WR(L)
C DIFFERENCES IN ENERGY LEVELS
OMOLD(I)=WR(K)-WR(L)
700 CONTINUE



C CALCULATION OF CORRELATION FUNCTIONS
DO 400
K=1,NMX
DO 400
L=1,NMX

TZ=0
DO 1500
J=1,NMX
TZ=-((-1.)**J)*ZR(J,K)*CONJG(ZR(J,L))
+TZ
1500
CONTINUE
SZ(K,L)=TZ/
2.
SZT(K,L)=SZ
(K,L)

TP=0
DO J=1,NMX,2
TP=ZR(J,K)*CONJG(ZR(J+1,L))+TP
END DO
SP(K,L)
=TP
SPT(K,L)=SP
(K,L)

TM=0
DO J=2,NMX,2
TM=ZR(J,K)*CONJG(ZR(J-1,L))
+TM
END DO
SM(K,L)
=TM
SMT(K,L)=SM
(K,L)
400
CONTINUE

GO TO 567
ENDIF

IF (APARTOT.EQ.0.AND.APERTOT.EQ.0.AND.APERTOT2.EQ.0.
& AND.EPARATOT.EQ.0.AND.GX.EQ.GY.AND.GX.EQ.GZ.AND.IREL.EQ.1)THEN
IF (INDEX.EQ.1)THEN
WRITE(6,*)'DIM. MATRIX', NMX
ENDIF
INDEX=INDEX+1

C MATRIX OF ENERGY IN ZERO FIELD SPLITTING

X=BZ*2*3.1415927*658.2
ZC=X*CT
ZS=X*ST
DO 5200 I=1,NMX
DO 5200 J=1,NMX
5200 AR(I,J)=0.





S = FLOAT(NMX - 1)/2.
SS = S*(S + 1.)
DO I = 1, NMX
COEF = S - DFLOAT(I - 1)
AR(I,I) = COEF*ZC*GZ + DPARA*(COEF**2 - SS/3.)
IF(I.LT.NMX) THEN
AR(I,I+1) = COEFFH*0.5*ZS*GY*SQRT(SS-(COEF-1.)*COEF)
AR(I+1,I) = AR(I,I+1)
END IF
END DO

IF (INDEX.EQ.2)THEN
OPEN(UNIT=17,FILE='MAT')
DO I=1,(2.*SI+1)*(2.*SPIN+1)
DO J=1,(2.*SI+1)*(2.*SPIN+1)
WRITE(17,*)AR(I,J)
END DO
WRITE(17,*)' '
END DO
CLOSE(17)
ENDIF
INDEX=INDEX+1


DO 145 I=1,NMX
DO 145 J=1,NMX
ARR(I,J)=REAL(AR(I,J))
ARI(I,J)=IMAG(AR(I,J))
145 CONTINUE
CALL F02AXF(ARR,MBRANC,ARI,MBRANC,NMX,WR,ZRR,MBRANC,ZRI,MBRANC
$ ,WK1,WK2,WK3,0)
DO 146 I=1,NMX
DO 146 J=1,NMX
ZR(I,J)=CMPLX(ZRR(I,J),ZRI(I,J))
146 CONTINUE


I=1
OM(1,1)=0.
OMOLD(1)=0.
DO 570 K=1,NMX
DO 570 L=1,NMX
IF (K.EQ.L)GO TO 570
I=I+1
OM(K,L)=WR(K)-WR(L)
OMOLD(I)=WR(K)-WR(L)
570 CONTINUE



C PER SPIN (SZ) DIVERSI DA 1/2
DO J=1,NMX
CO1(J)=(NMX-(2*J-1))/2.
END DO

DO J=1,NMX-1
CO2(J)=SQRT(SS-CO1(J+1)*(CO1(J+1)+1.))
END DO
DO J=2,NMX
CO3(J)=SQRT(SS-CO1(J-1)*(CO1(J-1)-1.))
END DO

omega1=abs(wr(2)-wr(3)) !omold(5)) !ZFS
omega2=abs(wr(1)-wr(2)) !omold(3)) !ZFS
omega3=abs(wr(3)-wr(1)) !omold(2)) !ZFS
cmp=zrr(3,3)
czp=zrr(2,3)
cpp=zrr(1,3)
cmm=zrr(3,1) !solo Zeeman
czm=zrr(2,1)
cpm=zrr(1,1)
cmz=zrr(3,2)
czz=zrr(2,2)
cpz=zrr(1,2)


bfield=bz*6.283/GAMMAI

C*****************************************************************************
C*********** CACLULATION OF ELECTRONIC R2
************************************
C*********** IN AXIAL ROUTINE
************************************
C*****************************************************************************

!nuovo calcolo R2
!++00
a1=cpp*conjg(cpp)-2*czp*conjg(czp)+cmp*conjg(cmp)
b1=cpp*conjg(czp)-czp*conjg(cmp)
c1=conjg(czp)*cmp-czp*conjg(cpp)
d1=cpp*conjg(cmp)
e1=cmp*conjg(cpp)
f1=cpz*conjg(cpz)-2*czz*conjg(czz)+cmz*conjg(cmz)
g1=cpz*conjg(czz)-czz*conjg(cmz)
h1=cmz*conjg(czz)-czz*conjg(cpz)
ai1=cmz*conjg(cpz)
al1=cpz*conjg(cmz)
t10=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

!0++0
a1=cpz*conjg(cpp)-2*czz*conjg(czp)+cmz*conjg(cmp)
b1=cpz*conjg(czp)-czz*conjg(cmp)
c1=cmz*conjg(czp)-czz*conjg(cpp)
d1=cpz*conjg(cmp)
e1=cmz*conjg(cpp)
f1=cpp*conjg(cpz)-2*czp*conjg(czz)+cmp*conjg(cmz)
g1=cpp*conjg(czz)-czp*conjg(cmz)
h1=cmp*conjg(czz)-czp*conjg(cpz)
ai1=cpp*conjg(cmz)
al1=cmp*conjg(cpz)
t3=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

!0000
a1=cpz*conjg(cpz)-2*czz*conjg(czz)+cmz*conjg(cmz)
b1=cpz*conjg(czz)-czz*conjg(cmz)
c1=cmz*conjg(czz)-czz*conjg(cpz)
d1=cmz*conjg(cpz)
e1=cpz*conjg(cmz)
f1=cpz*conjg(cpz)-2*czz*conjg(czz)+cmz*conjg(cmz)
g1=cpz*conjg(czz)-czz*conjg(cmz)
h1=cmz*conjg(czz)-czz*conjg(cpz)
ai1=cmz*conjg(cpz)
al1=cpz*conjg(cmz)
t4=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

!0--0
a1=cpz*conjg(cpm)-2*czz*conjg(czm)+cmz*conjg(cmm)
b1=cpz*conjg(czm)-czz*conjg(cmm)
c1=cmz*conjg(czm)-czz*conjg(cpm)
d1=cpz*conjg(cmm)
e1=cmz*conjg(cpm)
f1=cpm*conjg(cpz)-2*czm*conjg(czz)+cmm*conjg(cmz)
g1=cpm*conjg(czz)-czm*conjg(cmz)
h1=cmm*conjg(czz)-czm*conjg(cpz)
ai1=cpm*conjg(cmz)
al1=cmm*conjg(cpz)
t5=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

!++++
a1=cpp*conjg(cpp)-2*czp*conjg(czp)+cmp*conjg(cmp)
b1=cpp*conjg(czp)-czp*conjg(cmp)
c1=conjg(czp)*cmp-czp*conjg(cpp)
d1=cpp*conjg(cmp)
e1=cmp*conjg(cpp)
f1=cpp*conjg(cpp)-2*czp*conjg(czp)+cmp*conjg(cmp)
g1=cpp*conjg(czp)-czp*conjg(cmp)
h1=conjg(czp)*cmp-czp*conjg(cpp)
ai1=cpp*conjg(cmp)
al1=cmp*conjg(cpp)
t6=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

!-++-
a1=cpp*conjg(cpm)-2*czp*conjg(czm)+cmp*conjg(cmm)
b1=cpp*conjg(czm)-czp*conjg(cmm)
c1=cmp*conjg(czm)-czp*conjg(cpm)
d1=cpp*conjg(cmm)
e1=cmp*conjg(cpm)
f1=cpm*conjg(cpp)-2*czm*conjg(czp)+cmm*conjg(cmp)
g1=cpm*conjg(czp)-czm*conjg(cmp)
h1=cmm*conjg(czp)-czm*conjg(cpp)
ai1=cpm*conjg(cmp)
al1=cmm*conjg(cpp)
t78=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1
rpzpz=-(2*t10*tauv
& -t6*tauv
& -2*t3*
& tauv/(1+omega1**2*tauv**2)
& -t78*
& tauv/(1+omega3**2*tauv**2)
& -t4*tauv
& -t5*
& tauv/(1+omega2**2*tauv**2))


!----
a1=cpm*conjg(cpm)-2*czm*conjg(czm)+cmm*conjg(cmm)
b1=cpm*conjg(czm)-czm*conjg(cmm)
c1=cmm*conjg(czm)-czm*conjg(cpm)
d1=cpm*conjg(cmm)
e1=cmm*conjg(cpm)
f1=cpm*conjg(cpm)-2*czm*conjg(czm)+cmm*conjg(cmm)
g1=cpm*conjg(czm)-czm*conjg(cmm)
h1=cmm*conjg(czm)-czm*conjg(cpm)
ai1=cpm*conjg(cmm)
al1=cmm*conjg(cpm)
t12=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

!00--
a1=cpz*conjg(cpz)-2*czz*conjg(czz)+cmz*conjg(cmz)
b1=cpz*conjg(czz)-czz*conjg(cmz)
c1=cmz*conjg(czz)-czz*conjg(cpz)
d1=cmz*conjg(cpz)
e1=cpz*conjg(cmz)
f1=cpm*conjg(cpm)-2*czm*conjg(czm)+cmm*conjg(cmm)
g1=cpm*conjg(czm)-czm*conjg(cmm)
h1=cmm*conjg(czm)-czm*conjg(cpm)
ai1=cpm*conjg(cmm)
al1=cmm*conjg(cpm)
t11=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

rzmzm=-(2*t11*tauv
& -t3*
& tauv/(1+omega1**2*tauv**2)
& -t4*tauv
& -2*t5*
& tauv/(1+omega2**2*tauv**2)
& -t78*
& tauv/(1+omega3**2*tauv**2)
& -t12*tauv)



a1=cpp*conjg(cpz)-2*czp*conjg(czz)+cmp*conjg(cmz)
b1=cpp*conjg(czz)-czp*conjg(cmz)
c1=cmp*conjg(czz)-czp*conjg(cpz)
d1=cpp*conjg(cmz)
e1=cmp*conjg(cpz)
f1=cpm*conjg(cpz)-2*czm*conjg(czz)+cmm*conjg(cmz)
g1=cpm*conjg(czz)-czm*conjg(cmz)
h1=cmm*conjg(czz)-czm*conjg(cpz)
ai1=cpm*conjg(cmz)
al1=cmm*conjg(cpz)
t8=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

r1223zee=-t8*
& (tauv/(1+omega1**2*tauv**2)+
& tauv/(1+omega2**2*tauv**2))

c******************************************************************************
c******************** R1223zfs
************************************************
if ((dpara.gt.ws).or.(beta.gt.0.07)) then
cmp=zrr(3,3) !ZFS
czp=zrr(2,3)
cpp=zrr(1,3)
cmm=zrr(3,2)
czm=zrr(2,2)
cpm=zrr(1,2)
cmz=zrr(3,1)
czz=zrr(2,1)
cpz=zrr(1,1)
omega1=abs(wr(1)-wr(3)) !omold(5)) !ZFS
omega2=abs(wr(1)-wr(2)) !omold(3)) !ZFS
omega3=abs(wr(3)-wr(2)) !omold(2)) !ZFS

a1=cpp*conjg(cpz)-2*czp*conjg(czz)+cmp*conjg(cmz)
b1=cpp*conjg(czz)-czp*conjg(cmz)
c1=cmp*conjg(czz)-czp*conjg(cpz)
d1=cpp*conjg(cmz)
e1=cmp*conjg(cpz)
f1=cpm*conjg(cpz)-2*czm*conjg(czz)+cmm*conjg(cmz)
g1=cpm*conjg(czz)-czm*conjg(cmz)
h1=cmm*conjg(czz)-czm*conjg(cpz)
ai1=cpm*conjg(cmz)
al1=cmm*conjg(cpz)
t8=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

r1223zfs=-t8*
& (tauv/(1+omega1**2*tauv**2)+
& tauv/(1+omega2**2*tauv**2))

endif
omega1=abs(wr(2)-wr(3)) !omold(5)) !ZFS
omega2=abs(wr(1)-wr(2)) !omold(3)) !ZFS
omega3=abs(wr(3)-wr(1)) !omold(2)) !ZFS
cmp=zrr(3,3)
czp=zrr(2,3)
cpp=zrr(1,3)
cmm=zrr(3,1) !solo Zeeman
czm=zrr(2,1)
cpm=zrr(1,1)
cmz=zrr(3,2)
czz=zrr(2,2)
cpz=zrr(1,2)

c******************************************************************************

! ++-0
a1=cpp*conjg(cpp)-2*czp*conjg(czp)+cmp*conjg(cmp)
b1=cpp*conjg(czp)-czp*conjg(cmp)
c1=conjg(czp)*cmp-czp*conjg(cpp)
d1=cpp*conjg(cmp)
e1=cmp*conjg(cpp)
f1=cpm*conjg(cpz)-2*czm*conjg(czz)+cmm*conjg(cmz)
g1=cpm*conjg(czz)-czm*conjg(cmz)
h1=cmm*conjg(czz)-czm*conjg(cpz)
ai1=cpm*conjg(cmz)
al1=cmm*conjg(cpz)
t51=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

! +0-+
a1=cpp*conjg(cpz)-2*czp*conjg(czz)+cmp*conjg(cmz)
b1=cpp*conjg(czz)-czp*conjg(cmz)
c1=cmp*conjg(czz)-czp*conjg(cpz)
d1=cpp*conjg(cmz)
e1=cmp*conjg(cpz)
f1=cpp*conjg(cpm)-2*czp*conjg(czm)+cmp*conjg(cmm)
g1=cpp*conjg(czm)-czp*conjg(cmm)
h1=cmp*conjg(czm)-czp*conjg(cpm)
ai1=cpp*conjg(cmm)
al1=cmp*conjg(cpm)
t52=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

! 00-0
a1=cpz*conjg(cpz)-2*czz*conjg(czz)+cmz*conjg(cmz)
b1=cpz*conjg(czz)-czz*conjg(cmz)
c1=cmz*conjg(czz)-czz*conjg(cpz)
d1=cmz*conjg(cpz)
e1=cpz*conjg(cmz)
f1=cpm*conjg(cpz)-2*czm*conjg(czz)+cmm*conjg(cmz)
g1=cpm*conjg(czz)-czm*conjg(cmz)
h1=cmm*conjg(czz)-czm*conjg(cpz)
ai1=cpm*conjg(cmz)
al1=cmm*conjg(cpz)
t53=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

! -0--
a1=cpm*conjg(cpz)-2*czm*conjg(czz)+cmm*conjg(cmz)
b1=cpm*conjg(czz)-czm*conjg(cmz)
c1=cmm*conjg(czz)-czm*conjg(cpz)
d1=cpm*conjg(cmz)
e1=cmm*conjg(cpz)
f1=cpm*conjg(cpm)-2*czm*conjg(czm)+cmm*conjg(cmm)
g1=cpm*conjg(czm)-czm*conjg(cmm)
h1=cmm*conjg(czm)-czm*conjg(cpm)
ai1=cpm*conjg(cmm)
al1=cmm*conjg(cpm)
t54=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

r1213=-(t51*tauv+t51*
& tauv/(1+omega2**2*tauv**2)
& -t52*
& tauv/(1+omega3**2*tauv**2)
& -t53*
& tauv/(1+omega2**2*tauv**2)
& -t54*tauv)


! 0-+-
a1=cpz*conjg(cpm)-2*czz*conjg(czm)+cmz*conjg(cmm)
b1=cpz*conjg(czm)-czz*conjg(cmm)
c1=cmz*conjg(czm)-czz*conjg(cpm)
d1=cpz*conjg(cmm)
e1=cmz*conjg(cpm)
f1=cpm*conjg(cpp)-2*czm*conjg(czp)+cmm*conjg(cmp)
g1=cpm*conjg(czp)-czm*conjg(cmp)
h1=cmm*conjg(czp)-czm*conjg(cpp)
ai1=cpm*conjg(cmp)
al1=cmm*conjg(cpp)
t41=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

r2331=-t41*
& (tauv/(1+omega3**2*tauv**2)+
& tauv/(1+omega2**2*tauv**2))



rt2a=(rpzpz+rzmzm+sqrt((rpzpz-rzmzm)**2+4*r1223**2))/2
rt2b=(rpzpz+rzmzm-sqrt((rpzpz-rzmzm)**2+4*r1223**2))/2



!++--
a1=cpp*conjg(cpp)-2*czp*conjg(czp)+cmp*conjg(cmp)
b1=cpp*conjg(czp)-czp*conjg(cmp)
c1=conjg(czp)*cmp-czp*conjg(cpp)
d1=cpp*conjg(cmp)
e1=cmp*conjg(cpp)
f1=cpm*conjg(cpm)-2*czm*conjg(czm)+cmm*conjg(cmm)
g1=cpm*conjg(czm)-czm*conjg(cmm)
h1=cmm*conjg(czm)-czm*conjg(cpm)
ai1=cpm*conjg(cmm)
al1=cmm*conjg(cpm)
t21=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1

rpmpm=-(2*t21*tauv
& -t6*tauv
& -t3*
& tauv/(1+omega1**2*tauv**2)
& -2*t78*
& tauv/(1+omega3**2*tauv**2)
& -t5*
& tauv/(1+omega2**2*tauv**2)
& -t12*tauv)




C*****************************************************************************
C*********** CALCULATION OF ELECTRONIC R1
************************************
C*********** IN AXIAL ROUTINE
************************************
C*****************************************************************************


! originali

a1=cpz*cpp-2*czz*czp+cmz*cmp
b1=cpz*czp-czz*cmp
c1=cmz*czp-czz*cpp
d1=cpz*cmp
e1=cmz*cpp
f1=cpp*cpz-2*czp*czz+cmp*cmz
g1=cpp*czz-czp*cmz
h1=cmp*czz-czp*cpz
ai1=cpp*cmz
al1=cmp*cpz
trhoa=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1
rhoa=2*trhoa*
& tauv/(1+omega1**2*tauv**2)
a1=cpp*cpm-2*czp*czm+cmp*cmm
b1=cpp*czm-czp*cmm
c1=cmp*czm-czp*cpm
d1=cpp*cmm
e1=cmp*cpm
f1=cpm*cpp-2*czm*czp+cmm*cmp
g1=cpm*czp-czm*cmp
h1=cmm*czp-czm*cpp
ai1=cpm*cmp
al1=cmm*cpp
trhob=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1
rhob=2*trhob*
& tauv/(1+omega3**2*tauv**2)
a1=cpz*cpm-2*czz*czm+cmz*cmm
b1=cpz*czm-czz*cmm
c1=cmz*czm-czz*cpm
d1=cpz*cmm
e1=cmz*cpm
f1=cpm*cpz-2*czm*czz+cmm*cmz
g1=cpm*czz-czm*cmz
h1=cmm*czz-czm*cpz
ai1=cpm*cmz
al1=cmm*cpz
trhoc=a1*f1/6.-(c1*g1+b1*h1)/2.+e1*ai1+d1*al1
rhoc=2*trhoc*
& tauv/(1+omega2**2*tauv**2)

C******************************************************************************
C********** WRITING RELAXATION RATES IN AXIAL TOUTINE
*************************
C******************************************************************************
part=(rhoa+rhob+rhoc)
if(abs(rhoa/2.+rhoc/2.).gt.abs(rhob))then
rt1=(part-sqrt(part**2-3.*(rhoa*rhob+rhoa*rhoc+rhob*rhoc)))
else
rt1=(part+sqrt(part**2-3.*(rhoa*rhob+rhoa*rhoc+rhob*rhoc)))
endif


rt11=(part-sqrt(part**2-3.*(rhoa*rhob+rhoa*rhoc+rhob*rhoc)))
rt12=(part+sqrt(part**2-3.*(rhoa*rhob+rhoa*rhoc+rhob*rhoc)))
rt1=rt1*sqrt(abs(dpara-ws)/(dpara+ws))+(rt11+rt12)/2*
^ (1-sqrt(abs(dpara-ws)/(dpara+ws)))
bfield=bz*6.283/GAMMAI

if (beta.gt.1.55) then
endif
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

C*****************************************************************************
C*************** DEFINITION OF SUPERMATRIX
***********************************
C*************** IN AXIAL ROUTINE
***********************************
C*****************************************************************************


a=delta**2/5.*rhoa
b=delta**2/5.*rhoc
cp=delta**2/5.*rhob
d=1./taur
e=wi
! write(6,*)a,b,cp,d,e
a11=(d*(3*b*cp+3*a*(b+cp)+2*(a+b+cp)*d+d*d)*(d*(cp+d)+a*
& (b+cp+d)+b*(cp+2*d))+(4*b*b*(cp+d)+2*d*(cp+d)**2+
& a*a*(b+cp+2*d)+b*(cp*cp+6*cp*d+4*d*d)+a*(4*b*b+6*b*
& (cp+d)+(cp+2*d)**2))*e*e+(a+cp+d)*e**4)/
& ((d**2+e**2)*((3*b*cp+3*a*(b+cp)+2*(a+b+cp)*d+d*d)**2+
& 2*(2*a*a+a*b+2*b*b+a*cp+b*cp+2*cp*cp+2*(a+b+cp)*d+d*d)*
& e*e+e**4))
a12=(d*(3*b*cp+3*a*(b+cp)+2*(a+b+cp)*d+d*d)*(b*cp+a*
& (b+cp+d))+(a*a*(b+cp+2*d)-b*cp*(2*(b+cp)+3*d)-
& a*(2*b*b+cp*(2*cp+d)+b*(3*cp+d)))*e*e-a*e**4)/
& ((d**2+e**2)*((3*b*cp+3*a*(b+cp)+2*(a+b+cp)*d+d*d)**2+
& 2*(2*a*a+a*b+2*b*b+a*cp+b*cp+2*cp*cp+2*(a+b+cp)*d+d*d)*
& e*e+e**4))
a13=(d*(3*b*cp+3*a*(b+cp)+2*(a+b+cp)*d+d*d)*(a*(b+cp)+cp*(b+d))-
& (2*a*a*(b+cp)+cp*(2*b*b-2*cp*d+b*(-cp+d))+a*(2*b*b+cp*
& (-cp+d)+3*b*
First  |  Prev  | 
Pages: 1 2 3 4
Prev: Python 1 , Lisp 0
Next: icanhaz.cnt 1-2-1 baby!