ANN-my-version/src/nn_params.f90

163 lines
7.3 KiB
Fortran

module nn_params
use accuracy_constants, only: idp,dp
implicit none
! module to hold the parameters
! to replace nnparams.incl
! define all the parameter
!**********************************************************
!**** Parameters
!*** maxneu: max. number of neurons per hidden layer
!*** maxnin: max. number of neurons in input layer
!*** maxnout: max. number of neurons in output layer
!*** maxset: max. number of neural networks to fit
!*** maxpout: max. number of values in output pattern
!*** maxlay: max. number of layers (always >2)
!*** maxtypes: max. number of neuron types
!*** maxtpar: max. number of parameters for each neuron type
!*** maxpats: max. number of learning patterns
!*** maxxrmeta: max. number of metadata-blocks in xranges
!**********************************************************
!**** Inferred Parameters
!*** maxwei: max. total number of weight matrix elements
!*** neucap: max. total number of neurons
!*** wbcap: max. total number of weights and biases
!*** xrcap: max. total number of used dimensions in xranges
!*** WARNING: maxwei may fail for 2-layered networks
!*** if maxnin*maxnout is sufficiently large!
!**********************************************************
!**** Numerical Parameters
!*** infty: largest possible double precision real value.
!*** iinfty: largest possible integer value.
!*** zero: sets what is considered an irrelevant difference
!*** in size. use for comarison of reals, to determine
!*** 'dangerously small' values, etc
!*** scan_res: maximum precision for geometric boundary algorithm
integer(idp),parameter:: maxneu=150,maxlay=3,maxtypes=2,maxtpar=1
integer(idp),parameter:: maxpats=10000
integer(idp),parameter:: maxnin=15,maxnout=25,maxpout=15
integer(idp),parameter:: maxwei=(maxlay-3)*maxneu**2+maxneu*(maxnin+maxnout)
integer(idp),parameter:: neucap=(maxlay-2)*maxneu+maxnin+maxnout
integer(idp),parameter:: wbcap=maxwei+neucap
integer(idp),parameter:: maxset=1000, maxnnkeys=4*maxlay
integer(idp),parameter:: maxxrmeta=3,xrcap=2+maxxrmeta
! NUMERICAL PARAMETER
real(dp),parameter:: pi = acos(-1.0_dp)
real(dp),parameter:: infty=huge(1.0_dp)
integer(idp),parameter:: iinfty=huge(1)
real(dp),parameter:: zero =1.0d-8, scan_res=1.0d-8
! unit conversion parameter
real(dp),parameter:: hart2eV=27.211385d0
real(dp),parameter:: eV2hart=1.0d0/hart2eV
real(dp),parameter:: hart2icm=219474.69d0
real(dp),parameter:: icm2hart=1.0_dp/hart2icm
real(dp),parameter:: eV2icm=hart2icm/hart2eV
real(dp),parameter:: icm2eV=1.0_dp/eV2icm
real(dp),parameter:: deg2rad=pi/180.0_dp, rad2deg=1.0_dp/deg2rad
!**********************************************************
!**** I/O Parameters
!*** iout: standard output for vranf error messages
!*** nnunit: temporary UNIT for misc. output files
!*** nnuit + [0..99] are reserved for futher
!*** unspecific misc. files.
!*** perfunit: UNIT for performance logfile
!*** fitunit: UNIT added to random positive integer
!*** identifying a single core fit UNIQUELY
!***
!*** lrfmt: format for long real output
!*** lifmt: format for long integer output
!***
!*** nndatfile: filename for DATA-files
!*** (without file extension)
!*** nnreffile: filename for reference DATA-blocks
!*** (without file extension)
!*** nnparfile: filename for best fitted parameters to be
!*** written on (without file extension)
!*** nnp10file: filename for the 10th percentile parameters to
!*** be written on (without file extension)
!*** nnexpfile: filename for modified neural network parameters
!*** (without file extension)
!*** sampfile: filename for displaying sampled points in
!*** configuration space
!*** nndmpfile: filename for dumping data point pairs
!*** nnrecfile: filename for writing parameter records.
!*** perfile: filename for logged fitting performances.
!*** nntag: infix for various filenames to mark their origin
!*** program should end with a trailing '_' if nonempty.
!*** prim_tag: tag added to the '***' line of primitive par-files
!*** nnfdir: directory for dumping fit files
!*** nnsdir: directory for dumping scans.
!*** nnldir: directory for dumping logfiles for each fit
character(len=32),parameter:: nndatfile='DATA_ANN'
character(len=32),parameter:: nnreffile='REF_ANN'
character(len=32),parameter:: nnparfile='../nnfits/fit_pars'
character(len=32),parameter:: nnp10file='../nnfits/fit_10p'
character(len=32),parameter:: nnexpfile='../nnfits/exp_pars'
character(len=32),parameter:: nndmpfile='../nnfits/fit_dump.dat'
character(len=32),parameter:: sampfile='../scans/samples.dat'
character(len=32),parameter:: perfile='../logs/performance.log'
character(len=32),parameter:: nnrecfile='../nnfits/record'
character(len=16),parameter:: nnfdir='../nnfits/',nnsdir='../scans/'
character(len=8), parameter:: nnldir='../logs/'
character(len=8), parameter:: nntag=''
character(len=16),parameter:: prim_tag=' Time-stamp: " "'
character(len=16),parameter:: lrfmt='(ES20.12)',lifmt='(I12)'
integer(idp),parameter :: iout=6,perfunit=700,nnunit=800,fitunit=8000
!**********************************************************
!**** Debugging Parameters
!*** sline: separation line
!*** asline: alternative sep. line
!*** hline: simple horizontal line
!*** newline: a single blank line
!*** mform: standard form for matrix output
!*** miform: standard form for integer matrix output
!*** smform: shortened form for matrix output
!*** stdfmt: standard format for strings
character(len=16),parameter:: sline='(75("*"))',asline='(75("#"))'
character(len=16),parameter:: hline='(75("-"))'
character(len=2) ,parameter:: newline='()'
character(len=16),parameter:: mform='(5ES12.4)',smform='(5ES10.2)'
character(len=16),parameter:: miform='(5I12)'
character(len=8) ,parameter:: stdfmt='(A)'
!**********************************************************
!**** Continuation Parameters
!*** record_*: Various possible values for the common block variable
!*** record_state. See the parser for more.
integer(idp),parameter :: record_read=0,record_write=1,record_overwrite=-1
integer(idp),parameter :: record_update=-2
!**********************************************************
!**** Error Codes
!*** Codes should be powers of 2. Binary representation of return value
!*** should correspond to all exceptions invoked. ec_error should never
!*** be invoked with any other.
!***
!*** ec_error: generic error (catch-all, avoid!)
!*** ec_read: parsing error during les()
!*** ec_dim: dimensioning error
!*** ec_log: logic error
!***
!**** Inferred error codes
!*** ec_dimrd: ec_dim+ec_read
integer(idp),parameter:: ec_error=1,ec_read=2,ec_dim=4,ec_log=8
integer(idp),parameter:: ec_dimrd=ec_dim+ec_read
END module nn_params