- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
integer,protected:: &
fstart=0, &!0=>start from scratch
&!1=>read restart file
ldim=3, &!Lattice dimension
norb=3, &!Number of orbital calc.
nrsite=14, &!Nearest neighbour in real space
nasite=73109, &!Number of site in AS Map
ntype=2, &!Number of atom type
nsite=369902, &!Total number of n.n. in AS Map
maxrec=12, &!Number of recursion step
lorbit=9, &!Number of orbital(s+p+d)
nscf=101, &!SCF loop
imax=172, &
info=172, &
llmax=16, &
jl=7, &
ienum=7, &!Number of seeds for fitting
nkp=17, &!Number of points extrapolated
!for a and b
nfn=900, &
spn=2 !1=>up spin;2=>down spin
real*8,protected:: &
emin=-0.9d0, &!emax->emin=energy range
emax=1.00d0, &!
z_a=26.0d0, &!Atomic number of atom A
z_b=24.0d0, &!Atomic number of atom B
c_a=18.0, &!Core electron atom A
c_b=18.0, &!Core electron atom B
x=0.7, &!Conc. of atom type A
ALPF=0.005882d0,&
ALPS=0.34850d0, &!POTPAR for orb. S
ALPP=0.05303d0, &!POTPAR for orb. P
ALPD=0.01071d0, &!POTPAR for orb. D
ruban=0.10d0, &
amix=0.06d0 !Mixing scheme parameter
character(7)::ASMAP='BCC_MAP'
character(7)::CHK_A='CHECK_A',CHK_B='CHECK_B'
character(8)::STRUCTURE ='INFO_BCC'
integer::ntsite,ienump,npn
real::filling,e_a,e_b,y
ntsite=nrsite+3 ! Dimension of AS Map
ienump=ienum+1 !
e_a=z_a-c_a ! Valence electron atom A
e_b=z_b-c_b ! Valence electron atom B
filling=x*e_a+y*e_b !
npn=lorbit*ienump !
y=1.00d0-x ! Conc. of atom type B
end module parameters
In this module,when i am definning like "ntsite=nrsite+3" and so on,
its giving error like
error #6274: This statement must not appear in the specification part
of a module
ntsite=nrsite+3 ! Dimension of AS Map
and so on for all the remainning lines. does it mean i cannot declare
values in module in this way? I checked the J3 manual with no help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MODULE statement has syntax:
MODULE name
[specification-part]
[CONTAINS
module-subprogram
[module-subprogram]...]
END[ MODULE [name]]
Where the specification-part can only have nonexecutable statement that declares the attributes of data objects. ""ntsite=nrsite+3" is a executable assignment statement so it can not be put there. You may move those lines causing error into a module procedue. Details about "MODULE" statement can be found in the compiler documentation -> language reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
integer, parameter :: nrsite = 14
then he could do
integer, parameter :: ntsite = nrsite + 3
without problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you be more specific?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but some of them,like x,y,e_a,c_a etc. varies from 1 run to another(all other are constant between runs). like:
module parameters
! use kinds
! PUBLIC
integer,parameter:: &
fstart=0, &!0=>start from scratch
! &!1=>read restart file
lattice=221, &
ldim=3, &!Lattice dimension
norb=3, &!Number of orbital calc.
nrsite=14, &!Nearest neighbour in real space
nasite=73109, &!Number of site in AS Map
ntype=2, &!Number of atom type
ntsite=nrsite+3,&!Dimension of AS Map
nsite=369902, &!Total number of n.n. in AS Map
maxrec=12, &!Number of recursion step
lorbit=9, &!Number of orbital(s+p+d)
nscf=101, &!SCF loop
imax=172, &
info=172, &
llmax=16, &
jl=7, &
ienum=7, &!Number of seeds for fitting
ienump=ienum+1, &
nkp=17, &!Number of points extrapolated
!for a and b
nfn=900, &
spn=2, &!1=>up spin;2=>down spin
npn=lorbit*ienump
real*8,parameter:: &
emin=-0.9d0, &!emax->emin=energy range
emax=1.00d0, &!
z_a=26.0d0, &!Atomic number of atom A
z_b=24.0d0, &!Atomic number of atom B
c_a=18.0, &!Core electron atom A
c_b=18.0, &!Core electron atom B
e_a=z_a-c_a, &!Valence electron atom A
e_b=z_b-c_b, &!Valence electron atom B
x=0.7, &!Conc. of atom type A
y=1.00d0-x, &!Conc. of atom type B
ALPF=0.005882d0,&
ALPS=0.34850d0, &!POTPAR for orb. S
ALPP=0.05303d0, &!POTPAR for orb. P
ALPD=0.01071d0, &!POTPAR for orb. D
ruban=0.10d0, &
amix=0.06d0, &!Mixing scheme parameter
filling=x*e_a+y*e_b
character(7)::ASMAP='BCC_MAP'
character(7)::CHK_A='CHECK_A',CHK_B='CHECK_B'
character(8)::STRUCTURE ='INFO_BCC'
end module parameters
What i am doing till now is changing them for each run and "make" it eachtime.
Now what i want to do is use x,y e_a etc as command line argument(or read from a namelist or whatever) and do the same thin so that i dont have to remake for each run.
any way of doing that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but some of them,like x,y,e_a,c_a etc. varies from 1 run to another(all other are constant between runs). like:
module parameters
! use kinds
! PUBLIC
integer,parameter:: &
fstart=0, &!0=>start from scratch
! &!1=>read restart file
lattice=221, &
ldim=3, &!Lattice dimension
norb=3, &!Number of orbital calc.
nrsite=14, &!Nearest neighbour in real space
nasite=73109, &!Number of site in AS Map
ntype=2, &!Number of atom type
ntsite=nrsite+3,&!Dimension of AS Map
nsite=369902, &!Total number of n.n. in AS Map
maxrec=12, &!Number of recursion step
lorbit=9, &!Number of orbital(s+p+d)
nscf=101, &!SCF loop
imax=172, &
info=172, &
llmax=16, &
jl=7, &
ienum=7, &!Number of seeds for fitting
ienump=ienum+1, &
nkp=17, &!Number of points extrapolated
!for a and b
nfn=900, &
spn=2, &!1=>up spin;2=>down spin
npn=lorbit*ienump
real*8,parameter:: &
emin=-0.9d0, &!emax->emin=energy range
emax=1.00d0, &!
z_a=26.0d0, &!Atomic number of atom A
z_b=24.0d0, &!Atomic number of atom B
c_a=18.0, &!Core electron atom A
c_b=18.0, &!Core electron atom B
e_a=z_a-c_a, &!Valence electron atom A
e_b=z_b-c_b, &!Valence electron atom B
x=0.7, &!Conc. of atom type A
y=1.00d0-x, &!Conc. of atom type B
ALPF=0.005882d0,&
ALPS=0.34850d0, &!POTPAR for orb. S
ALPP=0.05303d0, &!POTPAR for orb. P
ALPD=0.01071d0, &!POTPAR for orb. D
ruban=0.10d0, &
amix=0.06d0, &!Mixing scheme parameter
filling=x*e_a+y*e_b
character(7)::ASMAP='BCC_MAP'
character(7)::CHK_A='CHECK_A',CHK_B='CHECK_B'
character(8)::STRUCTURE ='INFO_BCC'
end module parameters
What i am doing till now is changing them for each run and "make" it eachtime.
Now what i want to do is use x,y e_a etc as command line argument(or read from a namelist or whatever) and do the same thin so that i dont have to remake for each run.
any way of doing that?
just separate the declarations.
like:
integer, parameter :: param1=x1, param2=x2, etc
integer :: var1,var2,var3
or if you are more of a tidy person use two modules, one for parameters and the other for common variables wich you initialize after reading some file or from keyboard input
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a code snippet:
[cpp]MODULE init_constants IMPLICIT NONE INTEGER, PARAMETER :: iparam1 = 1, iparam2 = 2, max_arg_len = 70 ! charactersNote that command line arguments are read in as character variables and you will have to use read statements to read these character variables (i.e. internal file) into the appropriate real, integer, etc. variables. If you wish you maye do this from within the currect module. Simply change raw_args PROTECTED attribute to PRIVATE, declare REAL or INTEGER variables as PROTECTED, and define another subroutine in the module to read the apropriate raw_arg into the appropriate protected variable. From your main program simply USE init_constants, and then before you start any computations CALL get_cmli_arguments and then if desired CALL the subroutine you wrote to convert/READ the command line arguments into each one's appropriate variable. For a more complicated example see my file IOutils.f90.
REAL, PARAMETER :: rparam1 = 10.0, rparam2 = 20.0
CHARACTER(len=max_arg_len), DIMENSION(:), ALLOCATABLE, PROTECTED :: raw_args
! Define more variables, parameters, derived types, interfaces, etc. CONTAINS SUBROUTINE get_cmdli_arguments(correct_num_args)
INTEGER, INTENT(in), OPTIONAL :: correct_num_args
INTEGER :: i, n_args
n_args = COMMAND_ARGUMENT_COUNT() ! Fortran 2003
IF (PRESENT(correct_num_args)) THEN
IF (n_args /= correct_num_args) THEN
! CALL ERROR()
! RETURN ! With some error code
END IF
END IF
ALLOCATE(raw_args(n_args))
DO i = 1, n_args
CALL get_command_argument(i,raw_args(i))
END DO
END SUBROUTINE get_cmli_arguments
END MODULE init_constants
[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page