11
5/24/2018 Artigo-CdigoFortranParaBCCeFCC-slidepdf.com http://slidepdf.com/reader/full/artigo-codigo-fortran-para-bcc-e-fcc 1/11 Computer Physics  Communications 52  (1989)  249—259  249 North-Holland, Amsterdam FORTRAN CODE FOR THE THREE-DIMENSIONAL ISING MODEL ON bcc  AND fcc LATFICES J.-M.  DROUFFE Service de Physique Théorique,  Centre d’Etudes Nucléaires,  CEN  Saclay, 91191 Gif-Sur- Yvette  Cedex, France and K.J.M.  MORIARTY’  Department  of Physics,  Universitaire Inslelling Antwerpen,  Universiteitsplein 1,  B-2610 Antwerpen-Wilrgk,  Belgium Received  12  July  1988 In order to test  universality, the three-dimensional Ising model with  the microcanonical method with  demons is  formulated on  the bcc  and  fcc lattices. PROGRAM SUMMARY Titles  of  programs:  BCC64  and FCC64  Keywords:  Ising model,  phase transitions,  critical  exponents, correlation  functions, magnetization,  microcanonical  methods, Catalogue numbers:  ABFY and ABFZ  regular lattices,  body-centered cubic,  face-centered cubic,  uni - versality Programs obtainable  from:  CPC  Program  Library,  Queen’s University of Belfast,  N.  Ireland (see  application form in  this  Nature  of the  physical problem issue)  Universality is the  principle  whereby  the important  physical parameters associated with  the ferromagnetic  phase  transition Computer:  CDC CYBER 205  (Model  642);  Installation:  John  in  the three-dimensional Ising  model, e.g.,  the critical  expo- von  Neumann National Supercomputer  Center,  665  College  nents, are independent  of the regualr cubic  lattice used  for  the Road East, Princeton, NJ 08540,  USA  calculations.  We wish to establish universality for  the three-di - mensional Ising model. Operating system: CDC CYBER 2 00  VSOS 2.3.5  Method of solution Programming language  tLsed:  CDC FORTRAN 200  The  three-dimensional  Ising model with  the  niicrocanonical method with  demons [1], previously formulated  on  the  simple  High speed  storage required:  13  Kwords  for BCC64  and 13  cubic regular  lattice  [2], is  reformulated  on  the body-centered Kwords  for  FCC64  cubic (bce)  and face-entered cubic (fcc)  regular  lattices.  Number of bits  in a  word:  64  Restrictions on  the complexity  of the  program As with our previous  simple cubic regular lattice programs,  the Peripherals used:  terminal, line  printer  only  restriction  on  the program is  the  amount  of CPU time required,  which is  large.  This  requirement  is  dictated  by  the  Number  of lines  in  combined programs  and test  decks:  487  for  size  of  the  errors  in  our  critical  exponents  needed  for BCC64 and 466 for  FCC64  present-day  calculations.  Again there  is no  restriction  on  the fast  memory because very little of the memory  is used. Permanent  addresses:  Institute  for  Advanced  Study,  Prince- ton,  NJ  08540, USA  and John  von  Neumann National  Typical running time Supercomputer  Center,  665  College  Road  East, Princeton,  The test  runs on  an 82  x 64  lattice with  10  sweeps  through the NJ 08540,  USA.  lattice  took  3.12  and  3.86  s  for the bbc and  fcc  lattices, respectively, on  the CDC CYBER 205. OO1O-4655/89/$03.50  ©  Elsevier Science  Publishers  B.V. (North-Holland  Physics  Publishing Division)

Artigo - Código Fortran Para BCC e FCC

  • Upload
    asfis

  • View
    37

  • Download
    1

Embed Size (px)

Citation preview

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    1/11

    Computer Physics Communications52 (1989) 249259 249

    North-Holland, Amsterdam

    FORTRAN CODEFOR THE THREE-DIMENSIONAL ISING MODEL

    ON bcc AND fccLATFICES

    J.-M. DROUFFE

    Service de Physique Thorique, Centre dEtudesNuclaires, CEN Saclay, 91191 Gif-Sur- Yvette Cedex, France

    and

    K.J.M. MORIARTY

    DepartmentofPhysics, Universitaire Inslelling Antwerpen, Universiteitsplein 1, B-2610 Antwerpen- Wilrgk, Belgium

    Received 12 July 1988

    In order to test universality,thethree-dimensionalIsing model with themicrocanonical method with demonsis formulated

    on thebcc and fcclattices.

    PROGRAM SUMMARY

    Titles ofprograms: BCC64 andFCC64 Keywords: Ising model, phase transitions, critical exponents,correlation functions, magnetization, microcanonical methods,

    Catalogue numbers: ABFYand ABFZ regular lattices, body-centeredcubic, face-centered cubic, uni-versality

    Programs obtainable from: CPC Program Library, Queens

    University ofBelfast, N. Ireland(see application form in this Nature ofthephysicalproblemissue) Universality is the principle whereby the important physical

    parametersassociated with theferromagnetic phase transition

    Computer: CDC CYBER 205 (Model 642); Installation: John in the three-dimensional Ising model, e.g., the critical expo-

    von Neumann National Supercomputer Center, 665 College nents,areindependent oftheregualr cubic lattice used for the

    RoadEast, Princeton, NJ 08540, USA calculations. We wish to establish universality for the three-di-mensional Ising model.

    Operating system:CDCCYBER 2 00 VSOS 2.3.5Methodofsolution

    Programming language tLsed: CDC FORTRAN 200 The three-dimensional Ising model with the niicrocanonicalmethodwith demons[1], previously formulated on the simple

    High speed storage required: 13 Kwords for BCC64 and 13 cubic regular lattice [2], is reformulated on thebody-centered

    Kwords for FCC64 cubic (bce) and face-entered cubic (fcc) regular lattices.

    Numberofbits in a word: 64 Restrictions on thecomplexity oftheprogram

    As with our previous simple cubicregular lattice programs, the

    Peripherals used: terminal,line printer only restriction on the program is the amount ofCPU timerequired, which is large. This requirement is dictated by the

    Numberoflines in combined programs and testdecks: 487 for size of the errors in our critical exponents needed for

    BCC64and 466 for FCC64 present-day calculations. Again there is no restriction on thefastmemory because very little ofthememory is used.

    Permanent addresses: Institute for Advanced Study, Prince-

    ton, NJ 08540, USA and John von Neumann National Typical running time

    Supercomputer Center, 665 College Road East, Princeton, The test runson an82 x 64 latticewith 10 sweeps through the

    NJ 08540, USA. lattice took 3.12 and 3.86 s for the bbc and fcc lattices,respectively,on theCDCCYBER 205.

    OO1O-4655/89/$03.50 Elsevier Science Publishers B.V.

    (North-Holland Physics Publishing Division)

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    2/11

    250 J. -M. Drouffe, K.J.M. Moriarty /Three-dimensionalIsingmodelon bceandfcc lattices

    References [2] M. Creutz, P. Mitra and K.J.M. Moriarty, Comput. Phys.

    [1] M. Creutz, Phys. Rev. Lett. 50(1983)1411. Commun.33 (1984) 361; J. Stat. Phys. 42 (1986) 823.

    G. Bhanot, M. Creutzand H. Neuberger, NucI. Phys. B235 M. Creutz andK.J.M. Moriarty. Comput. Phys. Commun.

    [FSI1] (1984)417. 39 (1986) 173.

    LONGWRITE-UP

    1. Introduction In the Ising model, magneticdipoles representthe spinof the elementary magnets and these can

    The Ising model is a simple model for magnetic be oriented inthe up anddown directionsalong a

    systems and is used to study the magnetic phase suitably chosen quantization direction. Eventransition. Near the critical inverse temperature /3.~ thoughwe are dealing witha spin-1/2systemour

    (= 1/kT~),where k is the Boltzmann constant spins are chosen from the set { + 1, 1}. The

    and T~is the critical temperature, observable Hamiltonian of the system is given by

    quantities such as the magnetization M vary as H

    (/3 /3,~)where c s is called a critical exponent. S,Sj,

    Oneof the most powerful principles inthe theory c~ .i)

    of phasetransitions is that the critical exponents where only nearest neighbor interactions are al-

    for a particular system should be independent of lowed. The model is non-dynamical in the sense

    the regular discrete space structure into which the thatno mechanism to change a spinorientation issystem is embedded. This is the principle of uni- stated and so in this form only the equilibrium

    versality. In order to test the principle of univer- properties of the Ising model may be calculated.

    sality for the three-dimensional Ising model we In the microcanonical method with demons,

    haveto formulate the theory onmore thanjust the auxiliary variables called demons hop around

    regular cubic lattice previously discussed [1]. In the regular lattice trying to flip the spins of the

    the present paper we discuss the implementation sites upon which they land. A simple criterion

    of the three-dimensional Ising model on the based on energy constraint determines if a spinbody-centered cubic (bcc) and the face-centered should be flipped or not. Because random num-

    cubic(fcc) regular lattices. In section 2 we give a bers are onlyused to determine the arbitrarypathshort outline of the theory along with a descrip- through the lattice rather than being used in our

    tion of the bcc and fcc lattice geometries. Code acceptanceor rejection criterion, we do not need

    descriptions are given in section 3 and we con- high-grade random numbers. As long as all sites

    eludein section 4 witha description of the perfor- are visited in a reasonable period of steps, any

    mance of ourcodes.

    2. Outline of the theory

    Traditionally the Ising model has been studied

    in numerical simulations using stochastic methods,

    principle among which was the method ofMetropolis et al. [2].For the last few years, we

    have been exploiting an alternate deterministic I ~method (3] which allows one to go beyond thestudy of the usual equilibrium physics toexamine

    non-equilibrium phenomena[4]. Fig. 1. Aunit cube ofthesimple cubic lattice.

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    3/11

    J. -M. Drouffe, KJ.M. Moriarty/Three-dimensionalIsingmodelon bceandfcc lattices 251

    randomnumber sequencewill beadequate for our

    purposes.Forthe study ofequilibrium phenomena there

    are thus two mainreasons why the microcanonical

    method with demons is to be preferred over the

    traditional canonical methods, which are: themethod is about an order of magnitudefaster and

    thus saves computer time and high-grade random

    numbers are notneeded.

    In previous studies[1],the cubic lattice which is

    shown infig. 1 was used. We now wish to discuss

    the bcelattice, shown in fig. 2, andthe fcc lattice

    which is shown in fig. 3. The critical temperatures Z

    for the bcc and fcc lattices were previously estab- x

    lished [5] to be $~CC=0.1575 and $~ 0.1021, Fig. 3. The face-centered cubic (fcc) lattice with its four

    respectively, embedded (, 0, +, X) cubic lattices. Thewavy lines show

    the12 interactions ofone spin.

    3. Code descriptions3) BETA is the thermometer. As one uses mi-

    The codesfor the two kindsoflattices are very crocanonical simulation,the energy ratherthan

    similar and canbe describedsimultaneously.They the temperature is fixed. The temperatureconsistof the following routines: shouldthus be measured. This isdone bymea-

    suring the mean amount of energy available for

    1) BCC64andFCC64are themain driver routines the demons. Indeed, demons are in thermal

    for bce and fcc lattices, respectively. Theym i- equilibrium withthe system andthus share thetialize thevarious arrays, call the Monte Carlo same temperature. This is a verysimple systemprocedure and write the results, for which the relationship between mean en-

    2) MONTE performs the simulation and is the ergyand temperature is analytically known.

    most interesting part of the package. 4) CORX and CORZ measure the correlations

    between spins in the x- and z-directions, re-spectively.

    __________ 5) AMIX randomly reshuffles the energy of the

    demons (in order toincrease the stochasticity

    of the process).

    6) IBCOUNT counts the number of bits set to 1ina 64-bit computer word. It is foolish to do

    ~ this task in FORTRAN, and we quote this____________ I routine onlyfor completeness. (Some alternate

    I FORTRAN routines are contained in the ap-

    I I pendix.) It is important to replace it by anI I assemblerversion (depending of course on the

    y I I computer) or Q8 calls [6] in the case of the

    t .,-~ ,~ CYBER 205 in order to access a reasonable____ computing speed.

    Fig. 2. The body-centered cubic (bce) lattice with its two

    embedded cubic lattices. The wavy lines show the 8 interac- Let us descnbe more completely the way the

    tions ofonespin, spins are stored in the computer. One wants to

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    4/11

    252 J.-M. Drouffe. K.J.M. Moriarty /Three-dimensional Isingmodelon bce and/cc lattices

    perform simultaneously (in parallel) the update seemrathertricky, but insures efficiencyand yields

    for 64non-interacting spins. With a cubic lattice, the simultaneous updating fora rowof 64 spins.

    this requires splitting the lattice into odd- andeven-sublattices. With our present case of bce and

    fcc lattices, this complication isnot required, since 4. Performance of the codesspins in a rowalong a principal direction do not

    interact between themselves. However, the geome- Test run outputs for both BCC64 and FCC64

    try is slightly more complex. We use the following are presented at the end of this paper. These

    representations: correspond toruns on 82 x 64 lattices. The Mflip

    a) bce lattice is made of two staggered cubic rate (million spinupdates per second) achieved is

    lattices, the nodes of which lie respectively at 0.8 and1.0 Mflipsfor BCC64 andFCC64. respec-

    coordinates (1, j, k)and(i + ~, j+ ~, k+ ~). tively.The 6 4 spins of a whole row (i.e., with i and j

    fixed, kvaryingfrom 1 to64) are gatheredin a

    computer wordlocatedat addressSPIN(2(i+j AcknowledgementsX nx) + ni), where ni (= 1 or 2) is the sub-

    lattice number and nx is the lattice size along We would like to thank Lloyd M. Thorndyke

    the x-direction. The reader will check easily and Carl S . Ledbetter of ETA Systems, Inc. and

    that the 8 neighbors ofa given node are con- Robert M. Price, Tom Roberts and Gil Williams

    tamed in 8 words at addresses shifted by a of Control Data Corporation for their continued

    definite amount. Hence verysimple operations interest, support andencouragement and access to

    allow one to gain access simultaneously to the the Scientific Information Services CDC CYBERneighbors of a whole row of 64 spins. 205 at KansasCity, MO [Grant No. 13578] where

    b) Similar results are valid for the fcc lattice, some of these calculations were performed, the

    which is split into four lattices, the nodes of National Allocation Committee for the Johnvonwhichlie respectively at (1, j, k), (i, i+ -~, k Neumann National Supercomputer Center for+ ~),(i +~ j, k+~) and (i + ~, J + ~, k). A access to the two CDC CYBER 205s at JVNC

    full row of spins is now stored at address [Grant Nos. 110128, 171812, 171813, 551701,

    SPIN(4 x (i ~i~fx nx) + nI). 551702, 551703, 551704 and551705], the Control

    Data Corporation PACER Fellowship grants

    Now there are 64 demons, one for each spinin [Grant Nos. 85PCR06, 86PCRO1 and 88PCRO1]the row. Eachof them hasan available amount of for financial support,ETASystems, Inc. for finan-

    energy ranging from0 to 7 . This amount needs 3 cial support [Grant Nos. 304658 and 1312963], the

    bits for its binary representation, which are con- Natural Sciences and Engineering Research

    tamed in the words DMN1, DMN2 and DMN3 Council of Canada [Grant Nos. NSERC A8420(from low to high significance). The energy for and NSERC A9030] for financial support,

    flipping each spin,which alsoneed threebits to be Dalhousie University for financial support, Scotia

    characterized, is subtracted from this energy by High End Computing, Ltd. for financial support,

    elementary logical operations in the DO-loop the Continuing Education Division, Technical

    labelled 5 in MONTE. The overflow carry bit is University of Nova Scotia for financial support,also computed (in ACCEPT). Its physical inter- Atlantic Canada OpportunitiesAgency(Grant No.pretation is that itis set on ifthe available energy A-AP-2060-339, 905)forfinancialsupport andthe

    of thedemon is not sufficient to perform the flip. Canada/Nova Scotia Technology Transfer andHence the word ACCEPT is the image of the Industrial Innovation Agreement (Grant Nos.

    spins whichare tobe flipped, and DPi, DP2 and 87TFIIO1 and88TT1101) for further financial sup-DP3 are the new values of DMN1, DMN2 and port. Wewould like tothank D. Clark, E. Hook

    DMN3 for these spins. Update can then be per- and M. OBrien forassistance in the preparation

    formedusing logical operations. Thismethod may of this code. Oneof the authors(K.J.M.M.) would

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    5/11

    J. -M. Drouffe,KJ.M. Moriarty/Three-dimensional Isingmodelon bceandfcc lattices 253

    like to thank IBM Belgium and Professor Dr. References

    Jozef Devreese for his appointment to the IBM[1] M . Creutz, P. Mitra andK.J.M. Monarty, Comput. Phys.

    Professorship in Computer Science (Europe) Commun.33 (1984) 361; J. Stat. Phys. 42 (1986) 823.

    (1986). M. Creutz andK.J.M. Moriarty, Comput.Phys. Commun.

    39 (1986) 173.[2] MonteCarlo Methods in Statistical Physics, ed. K. Binder

    (Springer-Verlag,Berlin, 1979).

    Appendix [3] M . Creutz, Phys. Rev. Lett. 50 (1983) 1411.

    For completeness, we give some alternate forms for ~ G. Bhanot, M. Creutzand H. Neuberger,NucI. Phys. B235subroutine ISCOUNT (X) . The first one is [FS11] (1984) 417.

    FUNCTION IHCOUNT(X) [4] M. Creutz, Ann. Phys. (NY) 167 (1986) 6 2.CHARACTERn8 XDI~NSION NBITS(O~l5) [5] F.J. Wegner, J. Math. Phys. 12 (1971) 2259.DATA NBITS/O,l,1,2,1,2,2,3,l,2,2,3,2,3,3,4/

    IBCOUNT-D [6] M. Creutz, K.J.M. Moriarty and M. 0 Bnen, Comput.

    I-ICHAR(X(N:N)) Phys. Commun. 42 (1986) 191.DOCOUNTIBCOUNT*NBITS (AND (I, 15) ) DNBITS (SHIFT (I, 4)

    1 C ON TI NU ERETURNEND

    Difficulties in coding the counting of the number of set bits

    in X are doe to the absence of a Standard in the definition ofSHIFT. AND in FOrtrao 77. A problem often encountered is is

    the uSe of AND(float,hexadecimal) with two different type ofargumesto. This is avoided here and replaced by

    SND(isteger,integer( which is probably safer.In a primitive version, a possibility of using only integers

    is as follows

    FUNCTION ISCOUNT (IX)

    DATA MSK/281479271 743489/IBCOUTD

    IyIxDO 1 N1,16

    ISCOUNTISCOUNTOAND (MAN, ID )

    1 IYSHIFT)IY.1( (or IYIY/2(IBCOUNTM4D (IBCOUNT~SNIFT( I5COUNT, 1 6)

    * +SHIFT)IBCOUNT,32)+SRIFT)IBCOUNT,48),127(

    RETURN

    END

    The magic velse of MDX io XDIDlODDDOOSlDCDl . I t isassumed here that integers takes S word of 64 bits for their

    Storage....

    Finally, a third version is

    FUNCTION IBCOUNT(X(DATA XMSK/XODDlDDDlODOlIDCl/

    S BCDUN T S

    DO 1 N1,16

    IBCOUNTIBCOUNT*AND (XISSK, y)1 YSNIFT)Y,1(

    IRCOUHTAND(ISCOUNT*SMIFT(IBC(ThDT, 16)

    +5HIFT(IBCOUNT,32) uSHIFT )IBCOUNT, 48) , 127)RETURNEND

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    6/11

    254 J.-M. Drouffe, K.J.M. Moriarty/Three-dimensional Ising modelon bce andfcc lattices

    TESTRUN OUTPUT

    Body-centered cubic lattice Face-centered cubic lattice

    ISING MODEL ON B.C.C. LATTICE ISING MODEL ON F.C.C. LATTICE

    LATTICE SIZE: 8 X 8 X 64 LATTICE SIZE: 8 X 8 5 64

    ELATT 0.3989257812500 EDENN 2.441406250000SE0S04 ELATT 1.4267578125000 EDEN 0.I03906251000010

    ETOT 0.3991699218750 ETOT 1.430664S6250S0

    AVERAGE OVER 15 ITERATIONS, EACN WITH 10 SWEEPS AVERAGE OVER 10 ITERATIONS, EACW WITS G D SWEEPSRUNNING AT 0.8346910318414 MFLIPS RI)NNING AT 1.0902061769921 MFLIPSBETA 0.01256001957489 SSSJ 0.6318125950113 BETA 0.08277190671069 SISJ 0.4205658340454

    MAGNETIEATION 0.61896484374999 MAGNETIZATION= 2.8076171886937E0555

    AVERAGE OVER GD ITERATIONS, EACN WITH 10 SWEEPS AVERAGE OVER 10 ITERATIONS, EACH WITS 15 SWEEPS

    RUNNING AT 0.7764457890706 MFLIPS RUNNING AT 0.9933309082090 SOLIPS

    BETA 0 .0024705 27268114 SISJ 0. 6383688100179 BETA 0. S8301801719065 1152 0.4205852826436MAGNETIZATIONN 0.03198486328123 MAGNETIZATION 7.8735311563313E00I4

    CORR)IX/4) 0.03330078124999 C050)IX/4)= 0.01154785116251

    CORR(IX/2) 0.13105468749998 CORR(IX/2) = 0.001196289062505CORR)IX/2, IY/2) 0.03227539062498 CORR(IX/2, 10/2) 0.002856445312502

    AVERAGE OVER 10 ITERATIONS, EACH WITS iS SWEEPS AVERAGE OVER SE ITERATIONS, EACH WITS 10 SWEEPSRUNNING AT 0.7764553561865 MFLIPD RUNNING AT 0.9932622578529 MFLIPSBETA 0.SD161446H12S243 SISJ 0.6379946136474 OETA 0.08296423661213 5152 0.42I58S035614S

    MAGNETIZATION 0.03086181640624 MAGNETIZATION 4.138183593624910004CORR)IX/4( 0.02949218749999 COBB )IX/4) = 0.007H61328125012CORR (IX/2) 0.02773437499999 COBB )IX/2) 0.001098632812510

    CORR)IX/2, 00/2) 0.03364257812499 CORR(Ix/2, 11/2) l .2207S3S255101E0054

    AVERAGE OVER 10 ITERATIONS, EACH WITS 10 SWEEPS AVERAGE OVER 10 ITERATIONS, EACH WITH 10 SWEEPS

    RUNNING AT 0.7764833229543 MFLIPS RUNNING AT 0.9931189657596 MFLIPSBETA 0 .5528659 15843232 SISS 0. 6385393524170 BETA 0. 08298387861085 S152 0.4205825869242MAGNETIZATION 0.03090576171874 MAGNETIZATION 4.284667968619310004

    CORR)IX/4) 0.03002929687500 CORR)IX/4) 0.009936523437502CORR)IX/2) 0.02763671874998 CORR)IX/2) 0.001147460937502CORR)IX/2,IY/2) 0.02890624999999 CORR)IX/2, 01/2) 0.004630671875000

    AVERAGE OVER 10 ITERATIONS, EACN WITN 10 SWEEPS AVERAGE OVER 10 ITERATIONS, EACN HITS SO SWEEPS

    RUNNING AT 0.7764546202461 MELIPS RUNNING AT 0.9933983634150 MFLIPS

    BETA 0.003114944641885 5552 0.6386502838134 BETA 0.08273409118185 SSSJ 0.4205628426069MAGNETIZATION 0.03117919921874 MAGNETIZATION 1.721191406289HE0514

    CORR(IX/4) 0.03242187499999 CORR(IX/4( 0.01064453125000

    CORR(IX/2) 0.03129882812498 CORR(IX/2) 3.906250050585355554CORR)EX/2, 11/2) 0.02705078124999 000R)IX/2, 01/2) 0.003393554687491

    *** AVERAGES AFTER DISGAR.DING FIRST BATCH n AVERAGES AFTER DISGAP.0ING FIRST BATCHAV. BETA 0.002515213968369 +/ 3.28G928613B067E0004 AV. BETA 0.08292505090086 *1 6.4617164137075E555S

    AV. MAO. 0.03123291015624 -5/ 2.6029711253524E5154 AV. MAG. 2.929687000952110005 + 1 2.88H1175532524E5004

    AV. CORR)ZX/4( 0.13131103510624 */ 9.D94252957823DE5004 AV. COHR(IS/4( 0.009997558593756 +/ 7.H47S736651923E5054AV. CORR(IX/2( 0.02943115234374 9/ 0.501009254035745 Ay. COBH)IS/2) 9.582519531292610004 - s / 1.90256153H1960E0514AV. CORR)EX/2,IY/2) 0.53D46874999999-s/D.0S1512752787164 AV. COBR(IX/2,IY/2)= 9 . 94873046H7784E0054+/0.0E1761830999457CORR(IX/4)/CORR)IX/2( 1.0645402997841 / 0.01067990584121 cop R:IS/4)/CO RR(I X/2) (3.179547811877 *3 4.7181597237550

    CORR)OX/2(/CORR( IX/2,IY/2) 0.9749206184189 +3 0.06852382702320 (::sOMxr2:/CORR)Ix/2,Iy,2) ~.I)223401H4534 +/ 2.2986174662950

    PROGRAM LISTINGBody-centeredcubic lattice

    PROGRaM BCC64(LIST,00TPUTLIST( : SNBR) )SHIFT)OPIN)N(, KSHIFT31+32) CAN BE REPLACED 50SNBR( (5OIFT )SPIN(N( , KSBIFT)* THIS IS A FORTRAN PROGRAM FOR STUDYING IN THE SUBROUTINES MONTE AND ENERGY. CORRELATION FUNCTIONS OF THE THREEDIMENSIONAL

    * ISING MODEL ON A BODY-CENTERED CUBIC LATTICE * THE PROGRAM IS EXACTLY TOE SAME AS CUBIC LATTICE PROGRAM,6 4*2**No2~P. EXCEPT 1/ THE ABOVE MENTIONED MODIFICATIONS, IN PARTICULAR FOR

    * THERE ARE TWV STAGGERED CUBIC LATTICES. 1:(I,J,K( * IMAX, SO THE INSTRUCTION 0 0 2 4 : IMAX_2*IS*IY IS

    2:)I+l/2,J+1/2,K51/2(, S,J,i6 INTEGERS RUNNING FROM CORRECT AND SPIN SHOULD BE DIMENSIONED ACCORDINGLY.* 0 TO IXl, 0 TO 1 1 - 1 , 1 TO II. 2/ THE ROUTINES MONTE AND ENERGY.

    * SPUN CONTAINS THE ISING FIELDS FOR I AND . 2 FIXED. 3/ A THIRD DEMON DMB3, SO THAT THE CALL 0127 TO MONTE* AS THE PROGRAM IS CONTRUCTED FOR LARGE SIMULATIONS, * SHOULD HAVE AN ADDITIONAL ARGUMENT AND A STATEMENT

    * 0 5 0 5 CHOSEN AS A MULTIPLE OF THE NUMBER OF BITS IN A WORD. DMN3AS4IX(DMN3( SHOULD BE ADDED BEFORE.* HERE I T I S ASSUMED THAT THIS NUMBER IS 6 4 AND II I S 6 4 * 4/ TOE INITIALIZATION PROCEDURE 0049 10 0072.

    * SO ONE WORD CONTAINS A ROW OF SPINS. 5/ AN ADDITIONAL MEASURE OF ENERGY AFTER LINE 0154.

    * THE PROGRAM SHOULD BE REWRITTEN IF A DIFFERENT NUMBER 6/ MODIFICATIONS TO FUNCTION BETA. OF WORDS IS USED TO CONTAIN A SPIN ROW. *

    IF N_IOJ*IX, FOR DETAILED INFORMATION AND REFERENCES S E E T H E PAPER:* SPIN(2N+l) CONTAINS LATTICE 1 SPINS FOR ALL K. FORTRAN CODE FOR THE THREE-DIMENSIONAL* SPIN(2*N+2) CONTAINS LATTICE 2 SPINS FOR ALL S. ISING MODEL ON B.C.C. AND F.C.C. LATTICES*

    * SPIN IS DIMENSIONED TO IMAX2*IX*IY. BY J.N. DROUFFE, SERVICE DE PHYSIQUE THEORIQUE,* CAUTION: FOR A MORE RAPID ADDRESSING. * CENTRE DElUDES NIJCLEAIRES, CNN SACLAY,

    * DRAB IS EXPECTED T O B E A POWE R OF 2. * 91191 GIF-SUR-YVEYTE CEDER, FRANCE AND* OF NOT, REPLACE THE INSTRUCTIONS AND)MSK,...) BY MOD)..., OMAN) K.J.M. MORIARTY, DEPARTMENT OF PHYSICS.

    WHICH OF COURSE IS LESS EFFICIENT. UNIVERSITAIRE INSTELLING* FOR THE SAME REASON. SPIN SHOULD BE DIMENSEONED FROM ANTWEHPEN, UNIVEBSITEIT5PLEIN 1,* 0 TO IMAX-l, ONLY IN THE ROUTINES MONTE AND ENERGY. B-2615 ANTWERPEN-WILRIJK,

    ALL COMPILERS DO NOT ACCEPT THE GENERALIZED DIMENTIOHING: BELGIUM

    * DIMENSION SPIN(O:127(* IF NOT ACCEPTED, REPLACE TOE CONVENTIONAL CALLS * THIS PROGRAM MEASURES CORRELATIONS FOR 3 SEPARATIONS.

    * CALL MONTE). - .,SPIN , ...) AND CALL ENERGY(SPIN , . .. ( * N(1(,N)2),N(3) A RE T O B E SET TO T HE DESIRED SEPARATIONS.* BY* CALL MONTE).. .,SPIN)2(,...( AND CALL ENEROY(SPIN)2),...) CORRELATIONS IN X-DIRECTION ARE BEING MEASURED.

    * AND ODE THE CONVENTIONAL DIMENSIONING: DIMENSION SPIN(12H) . * CORRELATIONS SN I-DIRECTION MAY BE MEASURED BY

    * IF THE COMPILER SHIFTS RIGHT CIRULAR FOB NEGATIVE VALUES USING SUBROUTINE CORD PROVIDED (BUT NOT USED HERE).OF B IN THE INTRINSIC FUNCTION SOIFT) ,B( THEN

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    7/11

    J. -M. Drouffe,KJ.M. Moriarty/Three-dimensional Ising model on bce andfcc lattices 255

    DIMENSION SPIN)l28( IEDIED4ISUM

    DIMENSION N)3(.IC(3),CS)3),CS2)3),ICORR)3),CORR)3) 7 ISISSIMAG

    OXB IF(MEAS.EQ.1(GOTO 8

    ITH

    CALL CORX)SPIN,IMAX,N,IC)N(1(IX/4N)2) .IX/2 ICORR)1)ICORR(1) +IC(1)

    N(3)CIXSIYIY(/ 2 ICORR(2(ICORR)2)+IC)2(IMAX_2*IX*IY ICORR(3) ICORR ( 3 ) SIC ( 3 )

    8 CONTINUE

    * 2. INITIALIZING THE SPINSRATE_IMAXNIT*NSWEEP*64/ (lEG (SECOND)) T( C

    * PARAMETER E DETERMINES APPROXIMATE TOTAL ENERGY PER B OND PRINT, RUNNING AT ,RATE, NFLIPS

    E.655 CALCULATE AVERAGE DEMON ENERGY AND MAGNETIZATIONSDC E - S D ) IMAXD65155/(IXIY) EDIED/ (64.NSWEEPNITIMAX)52 (KIIXIYiCl) /2 51. IS/(32. *NSWEEP*NIT*IMAX)

    DO 1 I52+2,IMAX,2

    IPIN)ID(MASS(64) 5 DETERMINE BETA AND OISJ

    SPZM(I(AMIX(MASK(Kl)(

    5151+1 BETBETA ( E D )

    DO 2 12,S2,2 SISJ1.ETOT44ED/)3.IM.sX(SPIN)Il(..MASS)64( PRINT, BETA .BET, SISJ , 5052

    2 SPIN(I)APIIX(MASX(Kl)) PRINT, MAGNETIZATION ,SIF (MEAS.EQ.1(GOTO 11

    * 3. INITIALIZING THE DEMONS

    * OTHERWISE CALCULATE CORRELATIONS

    DaMSS.DMN2I. DO 9 11,3

    DMB3D. 9 CORR(I)1.ICORR)I(/(32.NITIMAX(

    * 4. MEASURING INITIAL ENERGIES pRINT, CORR(IX/4) ,CORR)l(PRINT. CORR(IX/2( ,CORR(2)

    EDEHCOUNT(DMNG(/)64FLOAT(IMAX(( PRINT. CORR)1X12,IY/2( ,CORR(3)

    EENERGY (SPIN, IX, IMAX)ETOTE+ED ACCUMULATE RESULTS OF MEASUREMENT

    PRINT, 1

    PRINT. ISING M O D E L O N B.C.C. LATTICE BSBS+BETPRINT BS2BS2*BET*2

    PRINT ANSAH4S+SPRINT. LATTICE SIZE: .05, X . 0 0 . X 64 AMS2A14S2*.D2

    PRINT

    PRINT DO 15 M1,3

    PRINT, ELATT , E , GEM- ,ED CS(M(CD(M)+CORR(M(PRINT, ETOT ,ETOT 11 CD2(M(CS2(M(+CORR(M(*o2

    * 5 . SIMULATION * CALCULATE RATIOS OF CORRELATIONS

    THREE ITERATION PARAMETERS ARE INVOLVED: R1CORT5(1( /CORR(2(* SWEEP NSWEEP TIMES, MEASURING DEMON ENERGY ~ R2R2+CORR(2( /CORR(3)* MAGNETIZATION WITHIN MONTE( T H I S CAN BE SUPPRESSED R1ERGE+(CORR(1( /CORR(2) (2

    * BY REMOVING TWO LINES IN MO NTE) R 2E R 2E-5) COR R (2(/COR R (3((*2

    THEN MEASURE CORRELATIONS (EXCEPT AFTER 1ST SET OF SWEEPS) 11 CONTINUE

    CALCULATE AVERAGES AFTER NIT MEASUREMENTS

    REPEAT NBATCH TIMED AND FIND GRAND AVERAGES. * MAJOR L OOP OVER

    NSWEEP1S * 6 . FINAL CALCULATIONSNIT1O

    MBATCH5 BSBS/ABATCS

    BS2SQRT((RS2/ANATCSBS2( / (ABATCHl. CA B A T C H 1 . NBATCH-1. ANSANI/ABATCHRiS. AMS2SQRT)(AMS2/ABATCHAI4I2(/)ARATCH1.((

    B52S.

    5)45 S. PRINT*5)412S. PRINT, AVERAGES AFTER DISGAJ8DING FIRST BATCH

    RiI. PRINT*, AV. BETA ,BS, *1- ,BS2R2O. PRINT, AV. MAO. .&MS. sf . 5 1 4 5 2

    R1ES.

    R2EE. DO 12 M1,3DO 5 11,3 CS(M(CS(M(/ABATCH

    CS)I(1. 12 CS2(M(_IQRT((CS2(M(/ARATCH_CS)M(**2(/(ABATCH_i.((

    5 CS2(I)S.PRINT,AV . CORR(IX/4( ,CS)l(, + 1 , C S 2 ( 1 )

    * MAJOR LOOP STARTS PRINT*, AV. CORR(IX/2( ,CS(2(, +1 ,CD2(2(PRINT, AV. CORR(IX/2,II/2( ,CS(3(, +/,CS2(3(

    DI Si MEASG,MBATCH RiRI/ABATCH

    R2R2/ABATCHPRINT RGESQRT( (R1E/ABATCH_R1**2( / )ABATCHl.(PRINT R2ESQRT C )R2E/ABATCH-R22( / )ABATCH1 . C

    PRINT, A V E R A G E O V E R .NIT. ITERATIONS+,, E A C H W IT H ,NSWEEP. SWEEPS PRINT, CORR(IX/4(/CORR(IX/2) , R i , 9/- ,RiE

    PRINT, CORR(IX/2(/CORR)IX/2.IY/2( ,R2, 9/ .R2E

    ISOS PRINT

    ISS PRINT

    DO 6 11,3 STOP6 ICORR(I(D END

    * NO TE THE TIME - M O N IT O R SPEED OF PROGRAM FUNCTION BETA(E)

    TSECOND))

    DO H ITER1,NIT * FINDS BETA GIVEN AVERAGE DEMON ENERGY E

    DO 7 NSW1,HSWEEP XLIX0. l .5

    SCRAMBLE DEMONS RANDOMLYDO 1 N1,50

    DMNGAMIX (DOMi) RM (XL+XH( / 2

    DSQC2AMIX(DMB2( AMIXNB

    DNN3ANIX )DMB3( FN (8 (A+)Oi1)7MAEM( fAt (1EM)IF)FN.GT.E( THEN

    OLL MONTE )DMN1,DMN2, DMB3, SPIN, IX , IRAN, 150)4,1)451)

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    8/11

    256 J.-M. Drouffe, K.J. M.Moriarty/Three-dimensional Ising model on bce and fcc lattices

    SE NBOWIEL ILlW 5 START SIMULATION

    ENDIF 1 DP1DMN1

    S DP2.DMN21 CO TINIJ DP3COMPL)DCn43(

    BETAR-ALOO(XN)/0 oLD-SPIN (NROW(

    THE FOLLOWING IF STATEMENT CAN BE REPLACED BYRETURN 5 N2AND(MSS,NROH-l(

    END

    IF THE COMPUTER USES 2S COMPLE ME NT ARITHMETIC.

    IF ((WOW .EQ. I) THENFUNCTION ENERGY )SPIN,II,IMAX) N2MSK

    * ELSEN2NROHS

    DIMENSION SPIN(S:i27(,SNSB(0) ENDIF

    * CONSTANTS Nl.AND(MOK,N2+2)

    MSKIMAXG SNBR(1( SPIN(Ni)

    IXT2II2 SNBR(2(SPIN(N2) INITIALIZATIONS SNBR(3(IHOFT(SPIN)Nl),KGHIFT31+32)

    ISS SNBR)4)SHIFT(SPIN(N2(,S501FT3i*32)SSHIFT1 * THE FOLLOWING IF STATEMENT CAR BE REPLACED BYDO 1 NROWH,MSK * N2AND(MSK,N2KSHIFTIIT2)

    OLDSPIN (NROW) 5 IF THE COMPUTER USES 2S COMPLEMENT ARITHMETIC.* THE FOLLOWING IF STATEMENT CAR BE REPLACED BY IF ((N2 .LE. I IT 2( 05W (ESHIFT EQ 5)) THEN

    * N2AND(MSK,NROW-i( N2MSK-IXT2*NBOH

    * IF THE COMPUTER USES 2S COMPLE ME NT ARITHMETIC. ELSEIF (NROH EQ. 0) THEN NS-AND)MOK,N2KSHIFTIXT2)

    521455 ENDIFELSE NlAND (MOE, N2+2)

    N2NROWG SNBR(5(SPIN(NG(

    ENDIF SNBR(6(SPIN)N2)NlAND(MSK,N2S2( SNHR)7(SHIFT(SPIN)Nl),KSOIFT31,32)

    SNBR(i(SPIN)Ni) SNSR)9)SHIFT)SPIN)N2),KSOIFT3S+32)SNBR(2USPIN(02( DO 5 NEBRG,0

    SNBR(3CSHIFT(SPIN(Ni),KSHIFT3l-532( CIOR)OLD,SNRB(NEBR))SNBR)4)SHOFT(SPIN(N2(,KSHIFT

    531-532( ZAND)DPG,C(

    THE FOLLOWING IF STATEMENT C R 2 4 BE REPLACED ST DPSIOR(DP1,C)* N2RAND (MSX,N2KSHIFTZXT2) CAND)I,DP2(

    IF THE COMPUTER USES 2S COMPLE ME NT ARITHMETIC. DP2.XOR(DP2,Z)

    IF ((N2 .LE. IXT2( AND. )KSHIFT EQ . 1)) THEN ZAND)C,DP3)N2MSX-IXT2SNROW 0P3XOR)0P3,C)

    ELSE 5 ACCEPTIOR)ACCEPT,Z)N2AND(MO5,N2-KSHIFTIXT2) ACCEPT CHARGES WH E R E APPLICABLE AND SCRAMBLE DEMONS

    ENDIF SPIN (NROW) IOR)OLD,RCCEpT(

    NiAND)MGK,N2+2) DMN1SHIFT(OR)AND)DMIO1,COMPL(ACCEPT)),AND)Dpi,ACCEpT)),37)

    SNBR)5(GPIN(NG) S)W2GHIFT)OB(AND)DMN2,COMPL)ACCEPT)(,AN5)DP2,ACCEPT)),23)SNBR(6)SPIN(N2( Is013SHIFT)OR)ASW)DMB3,COMPL)ACCEPT)),AJW(Dp3,ACCEPT)),3l)

    5NBR(7)SHIFT)5PUN)Ni(,KSHZFT31+32) THE MElT TWO LINES MEASURE DEMON ENERGY AND MAGNETIZATIONUNBR(H(SHIFT(SPIN(N2(,KSHIFT31932) ISUNNISUMSIBCOUNT(D)WI(-52I5COUNT)D)042)-4OBCOUNT)O5543)

    DO 2 NBR1,H IMAG-IMAG-SOBCOUNT(UPZN(NROW))

    2 IEIESIBCOUNT)IOR)OLD,SNBR)NBR(C) END LOOPKSHIFT-KSHIFT NROOfrAND (MIS, NROW-SIHOP)

    1 CONTINUE KSHIFT-SSHIFT

    ENERGTIE/(IMAX256.) IF (NROW.NE 5 ) GOTO 1RETURN RETURN

    END END

    FUNCTION AMIxCIMB) SUBROUTINE CORX)SPIN,IMAX,N,IC)

    o PERMUTES BITS SEMIRANDOMLY. * COUNTS ANTIPARALLEL SPINS SEPARATED BY N SITES

    * IN THE X DIRECTION AND PLACES RESULTS IN IC.L..INT(32RANFU(PGAND( M ASK C L ) D M 5 0 ) IF N EXCEEDS IX , SEPARATION DEVELOPS COMPONE NT IN Y DIRECTION.

    P2AND( M ASK C L) ,SHIFT ( D M 5 4 , L )P3AND(COMPL)MASK(2LC(,DMB( DIMENSION DPINC12H(,N)3),IC(3),NBR(3(

    AMIXSHIFT(OR(P2,OR)SHIFT(P1,64L),P3C),INT)64RARFO)) CHANGE DIMENSION OF SPIN IF REQUIRED.

    RETURN

    END IC(i(U

    IC ( 2 ( DIC ( 3( O

    FUNCTION ISCOUNT (I) DO 1 NROWl.OMAN

    * DO S 851,3

    NBR C M ) -NROW+N C M ) 2 THIS FUNCTION RETURNS THE NUMBER OF SET IF (NBR ( M C .GT. I R A ) ) ) NBR C M ) -NBR ( 4 ) -SMAllBITS IN WORD X. S IC)M(1C(M(*IBCOUNT(XOR(SPIN(NROW(,SPIN(NBR)M)U)

    * FOR A 64BIT MACHINE I T I S AWIIWARD TO DO THIS IN FORTRAN; IT RETURN* WOULD BE BETTER TO WRITE AN EQUIVALENT END

    o FUNCTION IN ASSEMBLY LANGUAGE.

    IBEINTE SUBROUTINE CORE (SPIN, I MAX, N , I C)

    Y X

    DO S N1,64UBCOUNTIBCOUNT+AND(1,Y( COUNTS ANTIPAR.ALLEL SPINS SEPARATED BY N SITES

    1 Y5HIFT(Y,i( IN THE I DIRECTION AND PLACES RESULTS IN IC.

    RETURN O NL Y EVEN VALUES OF N ARE CONSIDERED SEAS.END

    DIMENSION DPIN(i2H(,N(3), IC)3(,SNBR)3)

    SUBROUTINE MONTECDPW1,DMN2,DPW3,SPIN,IX,IMAN,ISISM,IMAG) * CHANGE DIMENSION OP SPIN IF REQUIRED.

    IC)S)U IHOP SHOULD BE RELATIVELY PRIME TO IMAX. AND OF THE FORM 4*N+1 IC)2(1* IF NOT, THE MODIFICATION ALGORITHM FOR KSHIFT SHOULD BE REVISED IC(3(I

    DIMENSION SPIN(H:127),SN5R(H(* CONSTANTS DO 1 NROWl,IMAX

    MSKIMAXZ DO 1 1 4 1 . 3IST2IX2 SNBR)15)SHIFT)SPIN(NROW( ,N(M(/2)IHOPS3 1 IC)M(IC)M(-SIBCOENTCXOR(SPIN)NROW),SNBRCM)))

    * INITIALIZATIONSISUMI RETURN

    IMAGH END

    KUHIFTG

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    9/11

    f.M. Drouffe,KJ.M. Moriarty/Three-dimensional Isingmodel o n bce andfcc lattices 257

    Face-centeredcubic lattice

    PROGRAM FCC64)LIST,OUTPUTLINT( 3 . INITIALIZING THE DEMONS

    ;HIS IS A FORTRAN PROGRAM FOR STUDYING DMNSMASS( (IENFLIP(/2>

    * CORRELATION FUNCTIONS OF THE THREE-DIMENSIONAL DMB2S.

    o ISING MODE L ON A FACE-CENTERED CUBIC LATTICE 642*0N2**P. * 4. MEASURING INITIAL ENERGIES

    THERE ARE FOUR STAGGERED CUBIC LATTICES. 1 : ) I . J . S (

    2 : )I.3*l/2,R*i/2( 3:(I1/2,3.K*i/2) 4:)I+1/2.J-Si/2.K(, EDIBCOUNT)DMBi(/)49.*IMAX( 1.3,10 INTEGERS RUNNING FROM S TO I X - i , 0 TO D Y - i . 1 TO ID. EENERGY(SPIN, IX. UMAX)

    * SPIN CONTAINS THE ISING FIELDS FOR I AND 3 FIXED. ETOTE*ED* AS THE PROGRAM ID CONTRUCTED FOR LARGE SIMULATIONS, PRINT. 1

    I I I S CHOSEN AS A MULTIPLE OF THE NUMBER OF BITS IN A WORD. PRINT, 11150 MODEL ON F.C.C. LATTICE

    HERE IT 1 5 ASSUMED THAT THIS NUMBER II 6 4 AND I I I S 6 4 PRINT SQ ONE WORD CONTAINS A ROW OF SPINS. PRINT

    * THE PR OGR AM SHOULD BE REWRITTEN IF A DIFFERENT NUMBER PRINT. LATTICE SIDE: ,IX, I ,IY, I 64

    OF WORDS IS USED TO CONTAIN A SPIN ROW. PRINT5

    IF NI+3IX, PRINTo SPIN(2NSl( CONTAINS LATTICE 1 SPINS FOR ALL K. PRINT. ELATT , E , ESEM ,ED* SPIN(2N*2) CONTAINS LATTICE 2 SPINS FOR ALL ~ pRINT. ETOT .ETOT

    SPIN)2N+3( CONTAINS LATTICE 3 OPENS FOR ALL X.

    SpIN)2N+4C CONTAINS LATTICE 4 SPINS FOR ALL S. 5. SIMULATION

    SPIN IS DIMENSIONED TO IMAX4IXIY.

    * CAUTION: FIR A MORE RAPID ADDRESSING, S THREE ITERATION P ARAMETERS ARE INVOLVED:

    XMAS IS EXPECTED TO BE A POWER OF 2 . * SWEEP MSWEEP TIMED, MEASURING DEMON ENERGY AND IF NOT, REPLACE THE INSTRUCTIONS AND(MSK. . ..( BY MODC. . ~ MAGNETIZATION WITHIN MONTE)THIS CAN BE SUPPRESSEDo WHIC5 OF COURSE IS LESS EFFICIENT. * BY REMOVING TWO LINEI IN MONTE)* FOR THE SAME R E A S ON , S P IN SHOULD BE DIMENSIONED FROM * THEN MEASURE CORRELATIONS (EXCEPT AFTER 1 ST S E T OF SWEEPS)

    * I TO XMAS-i, ONLY IN THE ROUTINES MONTE AND ENERGY. CALCULATE AVERAGES AFTER NIT MEASUREMENTS

    * ALL COMPILERS DO NOT ACCEPT THE GENERALIZED DIMENTIONING: REPEAT NBATCB TIMED AND FIND GRAND AVERAGED.* DIMENSION SPIN)S:255C

    IF NOT ACCEPTED. REPLACE THE CONVENTIONAL CALLS NSWEEPi0

    * CALL MONTE).. ..SPIN ...) AND CALL ENERGY(SPIN , . ..( NITGS BY NBATCHS

    * CALL MONTE).. ..SPZN)2(, ...( AND CALL ENERGY(SPIN(2(, AND USE THE CONVENTIONAL DIMENSIONING: DIMENSION DPIN(2N6(. ABATCHS.NBATCH-l. IF THE COMPILER SHIFTS RIGHT CIRULAR FOR NEGATIVE VALUES BS. . O.

    OF B IN THE INTRINSIC FUNCTION SHIFT( .R C THEN BS20.

    * SNBR) (SHIFT(DPIN(Nl, KSHIFT31+32C CAM BE REPLACED BY ANDS. SNBRC (SHIFT(SPIN(NC,KSHIFT( AMS2O. IN THE SUBROUTINES MONTE AND ENERGY. RiI.

    RD-I.* THE PR OGR AM IS EXACTLY THE SAME AS CUBIC LATTICE PROGRAM, R1EO.

    EXCEPT 1/ THE AB OVE MENTIONED MODIFICATIONS. IN PARTICULAR FOR ROEH. IRA)), SO THE INSTRUCTION S D 2 4 : IM51C2*IXIY SHOULD BE DO 5 11,3

    CHANGED TO IMA)E.4IXIT AND SPIN SHOULD BE DIMENSIONED CS(I(I.

    * ACCORDINGLY. 5 CO2(I(0.* 2/ THE ROUTINES MONTE AND ENERGY.

    * MAJOR LOOP STARTS FOR DETAILED INFORMATION AND REFERENCES SEE THE PAPER:* FORTRAN CODE FOR TH E THREE-DIMENSIONAL DO 11 MEASl,NBATCH* ISING MO DEL O N R.C.C. AND F.C.C. LATTICES

    o BY J.-M. DROUFFE, SERVICE SE PHYSIQUE THEORIQUE. PRINT

    CENTRE DETUDES NUCLEAIRES. CEN SA CLAY. PRINT 91191 OIFSUR-TVETTE CEDEX, FRANCE AND PRINT, AVERAGE OVER NIT, ITERATIONS

    K.J.M. MORIARTY. DEPARTMENT OF PHYSICS, +, , EACH WITH ,NSWEEP, SwEEpS

    * UNIVERSITAIRE INSTELLIHG ANTWERPEN, UNIVERSITEITSPLEIN S.

    B2610 ANTWERPENWILRIJK, lEDI

    BELGIUM ISS

    * THIS PR OGR AM MEASURES CORRELATIONS FOR 3 SEPARATIONS. DO 6 11,3

    * N)1),N(2(,N(3( ARE TO BE SET TO THE DESIRED SEPARATIONS. H ICORR)I(D

    CORRELATIONS IN X-DIRECTION ARE BEING MEASURED. NOTE THE TIME -- MO NITO R SPEED OF PR OGR AM

    * CORRELATIONS IN 1-DIRECTION MA Y B E M E A S U RE D BY TDECOND)(* USING SUBROUTINE CORD PROVIDED (BUT NOT USED HERE>.

    DO 8 ITERG,NIT

    DIMENSION SPIN(256)

    DIMENSION N(3(,IC(3),CSC3C,CS2(3),ICORR)3(,CORRC3( DO 7 NSW1,NSWEEP

    IlH SCRAMBLE DEMONS RANDOMLY

    ITB DMNSAI4IX )DMNS(DMN2AMIX ( D M 5 8 2 C

    N)l(IX/4

    N(2(IX/2 CALL SGONTE(DMN1,DM502.SPIN, IX , IRA)), ISUM,IMAG)N(3()IX+IYIYC/2

    IMAX4IXIY IEDIED*ISSM

    7 OSIS+IMAG* 2. INITIALIZING THE SPINS

    IF(MEAS.EQ.l(GOTO 8* PARAMETER E DETERM INES APPROXIMATE TOTAL ENERGY PER BOND

    CALL CORX)SPIN,IMA)C,N, IC)E. 655IE2ENT)EIMA)C48( ICORA)1(ICORR(1)+IC)L(

    KS)IE128IMAX( /16 ICORR)2)ICORR)2(+IC)2)DI 1 Il,IMAX ICORR)3)ICORR)3(+IC)3)

    B CONTINUE

    1 SPIN(I)MASX(32( RATEIMAXWITSN0WEEP64/)i.E6(SECOND))T()IM4IMAX/4 PRINT. RUNNING AT ,RATE, MFLIPS

    KlSD/IM4DO 2 I4,IMAX,4 * CALCULATE AVERAGE DEMON ENERGY AND MAGNETIZATIONSPIN(I(SHIFT)SPIN)I),Si(

    2 SPIN(I3)SHIFT(SPIN)I3),64K1( EDIED/)64.NSWEEP~NITIMAX(8124MOD)KI,IM4( S1.IS/)32.NSWEEPNIYIMAX(

    IF )K2.EQ.0(GOTO 4

    DO 3 14,152,4 * DETERMINE BETA AND SISJSPIW(I)SHIFT)5PIN)I(,1C

    3 SPIN(I3(SHIFT)SPIN(I3(,H3)

    4 NFLIP2MIWS)2IX,52, IMAXK2(+IMAX*16~(5l*IM4+I52/4)

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    10/11

    258 J. -M. Drouffe, KJ.M.Moriarty/T h r e e - d i m e n s i o n a l Ising modelon bce andfcc lattices

    BETBETA(ED) NSRRIOD )MSK,NROW*JSHIFT)SISJS.ETOT-54*ED/)3.IMAX) ONBR(l)SPIN)NI(

    PRINT. BETA .BET, SIUJ ,GISJ SNBR)2(UHIFT(SPIN)Ni(,JGHIFT)

    PRINT, MAGNETIZATION ,S NGAND(MSK,NROW+JSHIFTUS-114)IF (MEAS.EQ.1(GOTO Is SNBR(3(SPINCNGC

    SNSR(4(IHIFT)OPIN(Ni) ,JGHIFT)* OTHERWISE CALCULATE CORRELATIONS NSAND(MSK,NROW*2)

    SNBR)5(SPINCNQ(

    DI 9 113 SNBR)6(SHIFT(SPIN)Ni),JSHIFT)9 CORR(I(5.ICORR)I)/)32.NITI14A25( NSAND(MSK,NROW2(

    SNBR(7)UPINCNQ(

    PRINT. CORR(IX/4( ,COAR(I) SNBR)H)SNIFT(SPINCNS(,JSHIFT)PRINT, CORR(IX/2C ,CORR)2) 5NBR( 9(5PIN)AND)MOK,NROWJSHIFT))

    PRINT, COBR)IX/2,IT/2( ,CORN(3) 5MBR(G5(5PIN)AND(MSS,NROW*3JSHIFT((SNBR)11USPINCAMDCMSS,NROW-S(31I4CJSHIFT))

    * ACCUMULATE RESULTS OF ME ASUR E ME NT SNBR)12)5PIN(AND(MSK,NROW(iSII4CJOHIFT()

    1 ) 0 2 NBRS,12

    BSRAS+BET 2 INNIE+IBCOUNT (105 (OLD , SNBR (NBA)))BS2BS2+BET2 JIHIFTJSHIFT

    ANS..AMS+S S CONTINUEAMS2AMS2+S2 ENEROTIE/)1MAX

    0256.)

    RETURN

    DO 15 M1,3 ENDCS ( M ( CS ( M C SCORN C M )

    15 CS2(M(CS2)M(+COAR(M)~2FUNCTION AMIX(DM54)

    * CALCULATE RATIOS OF CORRELATIONS

    R1R1+CORR(G(/CORR(2) * PERMUTES BITS SEMIRANDOMLY.

    R2R2+CORNC2C /CORR(3(

    R1E~R1E*(CORNCi)/COAR(2)(2 LINT(32RAMF(C(

    R2E+52E+)CORRC2(/CORRC3(C2 PSAMD(MASK(L(,DMN)

    11 CONTINUE P2AND)MASS(LC,DHIFT)DMN,L))

    P3AND(COMPL (MASK (2L( C .Dll)))

    * MAJOR LOOP OVERi,MI(WSOIFT)OB)P2,OR(SHIFT(Pl,64L),P3((,INT(64RA24F)U)

    * 6. FINAL CALCULATIONSRETURN

    BSRAS/ABATCH ENDBS2SQRTC(BO2/ABATCH.BU52(/(ABATCHG.C)

    AMHRMO/ABATCN

    AMD2SQRT) (AM52/ARATCHAIIS52) / )ABATCHi.) ( * FUNCTION IBCOUNT ( I )

    PRINT

    PRINT. 000 AVERAGES AFTER DIUGARDING FIRST B ATCH ~*, * THIS FUNCTION RETURNS THE NUMBER OF SETPRINT, AV. BETA ,BD, +/- ,BO2 BITS IN WORD X.

    PRINT, AV. MAG. . 5 1 5 5 , 9/- . 05 4 5 2* I T I S AWICWARD TO DO THIS IN FORTRAN; IT

    DO 12 M13 WOULD BE BETTER TO WRITE AN EQUIVALENT

    CD C M ) CS C M ) /ABATC0 * FUNCTION IN ASSEMBLY LANGUAGE.

    12 CS2 CRCSORT) (CN2(M(/ABATCHCS)M(~2(/(ARATCHG.(

    IBCOUNT UPRINT, AU. CORN)IS/4) ,CS)l(, -5/ ,CS2CS) YX

    PRINT, AU. CORN(IX/2) ,CS(2), -5/ ,CS2)2) DO 1 N1,64

    PRINT5, AU. CORR(IX/2,IT/2) ,CO(3(, S/,CS2C3) IBCOUNT IBCOUNT+AND(1,Y(R1R1/ABATCH 1 YSHIFT(Y,1(

    R2R2 /A3ATCH RETURN

    R1EDQRT) CR1E/ARATCHRI2( /)ABATCHi. C C ENDR2ESQRTC CR2E/ABATCHR22C/)ABATCH-i . (C

    SUBROUTINE MONTE)DM541,DMN2. SPIN, IX,IMAX. SlUM, IMAG)

    PRINT, CORN)IX/4(/CORN)II/2( Ri, 9/ ,RlE *

    PRINT, CORRCII/2C/CORR(OI/2,IY/2) , R 2 , +3 ,R2EPRINT * lOOP SHOULD BE RELATIVELY PRIME TO IRA)).

    PRINT DIMENSION NPIN(I:255),SNBR)12(* CONSTANTS

    STOP MSKIMAX-I

    END 150P13* INITIALIZATIONS

    FUNCTION BETA)E( IOUMS* IMAGH

    I144IX

    0 FINDS BETA GIVEN AVERAGE DEMON ENERGY E JUOIFT1NROWRO

    F(X:Cx,2x253S3)/CG*XSX2+X3( START SIMULATION

    XLI 1 DPSCOMPLCDMNS(

    XHS . 5 DP2SOR)DP50i.DM552(ACCEPTAND (DMN1, DM502)

    DO 1 N1,50 OLNNSPINCNROW(XN (XL+XH( / 2 N1.AND ( M I I I , NROWSJSHEFT)AGXN8 SNBR(1)SPIN(NI)

    FNC8*)ASXNG(7AXN(/A/CiXN( SNBR)2CSHIFT(SPIN)N1( , JSHIFT)IFCFN.GT.E) THEN NiAMDCM5K,NROWS.2SHIFT)i-IIO))

    XHIOI SNBRC3)SPQN (Ni)ELSE SNBR)4)SHIFT)SPIN)N1( ,JSHIFT(

    ILIl)) NiAND (MIX. NROW+2)ENDIF DNBR(5(SPIN(Ni(

    O CONTINUE SNBR(6(DHIFT(SPIN(NIC.JNHIFT)

    BETAALOG(IN) 3 NOAND )MSK, NROW-2C

    INBR(7(.l)PIN(N1(

    RETURN SNBR(8(SNIFTCSPINCNQ) ,JSHIFT)END SNBR( 9(-SPIN)AND(MSS,NROW-JSHIFT)C

    SNBR(SH).5PIN(AND(MSS.NROW-F3JSHIFT()FUNCTION ENERGYCSPIN, IX . XMAS) SNBRC11(DPIN(AND)MSS,NROW.F(3_I14(*JSNIFT()

    SNBR(12CSPIN(AND(MSK.NRIW(5+1I4(JSHIFT()

    MEASURE LATTICE ENERGY DO H MEBRS,12DIMENSION DPIN(S:255),SNBR)12( CXOR(OLD,SNBR(NEBR)(

    CONSTANTS ACCEPTXOR(ACCEPT,AMD(C,DPS,DP2))MSRRIMAX1 DP2XOR(DP2,AND(C,DP]))

    * INITIALIZATIONS I DP1XOR(DPG,CCXES * ACCEPT CHANGES WH E R E APPLICABLE AND SCR AMB LE DE MONSIX44IS SPIN )NROW( SOB (OLD, ACCEPT(

    3SHXFTS DM541UHIFT(OR(AMD(DMN1,COMPL(ACCEPTU,AND(DP1,ACCEPT)),37)DO 1 NROWS,MSK * DMB2SHIFT(OR(AND)DMN2,00M.PL(ACCEPTU,AND)1P2,ACCEPTU,23)

    OLDSPIN(NROW( THE NEST TW O LINES MEASURED DEMON ENERGY AND MAGNETIZATION

  • 5/24/2018 Artigo - C digo Fortran Para BCC e FCC

    11/11

    J. -M . Drouffe, KiM. Moriarty/Three-dimensional Isingmodel on bce and/cc lattices 259

    ISUMISUM+IBCOUNT( 5 8 041) +2IBCOUNT )DMB2(

    IMAGIMAG+IBCOSNT (SPIN)NRQWC)0 END LOOP

    NROWRAND CMOS, N R O W - E X N O P )

    JSHIFT3SHIFTIF)NRIW.NE.S( GO TO S

    RETURN

    END

    SUBROUTINE CORE CURIO,I l k ? . ) ) , N, IC)

    * COUNTS ANTIPARALLEL SPINS SEPARATED BY N DOTES

    IN THE S DIRECTION AND PLACES RESULTS IN IC.

    IF N EXCEEDS IX, SEPARATION DEVELOPS COMPONE NT IN Y DIRECTION.

    DIMENSION SPIN)256),N(3(,IC(3) ,NBR(3) CHANGE DIMENSION OF SPIN IF REQUIRED.

    IC(i(S

    XC)2).H

    IC)3(BDO S NROWRS,IMAX

    DO 1 aMl,3

    NBB ( MC NROW+N ( M C 2IF CNBR)M( .GT.IMAS(NBR)M(RABR(M)-IMAX

    S IC)M(IC(M)-FIBCOUWT)XOR(SPIN(NROW(,SPIN(NBR(M((((

    RETIJRN

    END

    SUBROUTINE CORZ(SPIN, IMAX,N, IC )

    * COUNTS ANTIPARALLEL SPINS SEPARATED BY N SITES IN TNE Z DIRECTION AND PLACES RESULTS IN IC.

    ONLY EVEN VALUES OF N ARE CONSIDERED HERE.

    DIMENSION SPIN(256(,N(3),IC)3).SNBR)3(

    * CHANGE DIMENSION OF SPIN IF REQUIRED.

    IC(1)5

    IC)2)I

    IC)3)S

    DO 1 MRIWQ,IMAX

    DO 1 M5,3SNBRC M ) SHIFT CSPIN ( (W O W) , N C M ) /21

    O IC(M(1C)N(*IBCOUNT(IOR(SPIN)NROW),SNBR(M)))

    RETURNEND