14.09.2014 Views

CASINO manual - Theory of Condensed Matter

CASINO manual - Theory of Condensed Matter

CASINO manual - Theory of Condensed Matter

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

an error which may take two weeks <strong>of</strong> your life to track down (and this could be much better spent<br />

doing other things). You can get the idea just by looking at the developer version source code in<br />

<strong>CASINO</strong>/src (the standard version is ‘obfuscated’ and practically unreadable) but let’s emphasize the<br />

main points:<br />

• Don’t use more than one module per physical file, as Hitachi compilers won’t (or didn’t used<br />

to) allow this!<br />

• Capitalization outside <strong>of</strong> character context: use upper-case letters for keywords whose use is<br />

primarily at compile time (statements that delimit program and subprogram boundaries, declaration<br />

statements <strong>of</strong> variables). Use lower-case letters for everything else, including the bulk<br />

<strong>of</strong> run-time code. Description <strong>of</strong> routines is to be enclosed in a little box with a description <strong>of</strong><br />

what it does and an author. Later changes are to be documented at the bottom <strong>of</strong> this box. For<br />

example:<br />

SUBROUTINE rubbish<br />

!-------------------------------------------------------------------------!<br />

! Routine to write words to the screen. !<br />

! !<br />

! MDT 8.2000 !<br />

! !<br />

! Changes: !<br />

! -------- !<br />

! 3/2001 MDT - added capability to write ‘Hello’ !<br />

! 5/2001 MDT - added additional capability to write ‘Donkey!’ !<br />

!-------------------------------------------------------------------------!<br />

USE dsp<br />

USE parallel<br />

IMPLICIT NONE<br />

INTEGER i,j,k,some_integer<br />

REAL(dp) a<br />

CHARACTER(llength)my_name<br />

i=0<br />

do j=1,10<br />

write(6,*)’Hello’<br />

do k=1,1000000<br />

i=i+1<br />

write(6,*)’Donkey!’<br />

enddo<br />

enddo<br />

! etc.<br />

END SUBROUTINE rubbish<br />

• Contents <strong>of</strong> if, do and case blocks should be indented by one space.<br />

• In general don’t put spaces between words, e.g.,<br />

if(something_is_true)a=b+c<br />

not<br />

if ( something_is_true ) a = b + c<br />

• Do not use ‘.eq.’, ‘.ne.’, ‘.lt.’, ‘.le.’, etc.; use the Fortran 90 versions instead, i.e., ‘==’, ‘/=’, ‘

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!