new update
This commit is contained in:
parent
2c9c856bb4
commit
56b0b346a8
68
src/error.f
68
src/error.f
|
|
@ -62,74 +62,6 @@
|
|||
|
||||
!--------------------------------------------------------------------------------------
|
||||
|
||||
subroutine nnweight(wterr,pat_out,npat)
|
||||
use nn_params
|
||||
use nncommons
|
||||
use io_parameters
|
||||
implicit none
|
||||
! Evaluate system specific weighting for 1 pattern.
|
||||
|
||||
|
||||
!include 'JTmod.incl'
|
||||
|
||||
double precision wterr(maxpout,npat),pat_out(maxpout,npat)
|
||||
integer npat
|
||||
|
||||
integer i,j, ii,k
|
||||
|
||||
ii =0
|
||||
do k =1,sets
|
||||
do j = 1,ndata(k)
|
||||
ii = ii +1
|
||||
do i =5, inp_out
|
||||
if (wterr (i,ii) .gt. 0.0d0) then
|
||||
wterr( i,ii) = 1.0d-4
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! check whether npat equals the number of point in each set
|
||||
if (npat .ne. ii ) then
|
||||
write(6,*)" Error in the weight. not consistent npat", npat
|
||||
stop
|
||||
endif
|
||||
|
||||
pat_out=pat_out
|
||||
|
||||
contains
|
||||
double precision function wdamp(dE)
|
||||
use nn_params
|
||||
implicit none
|
||||
double precision dE
|
||||
|
||||
! Weight decay rate
|
||||
double precision, parameter :: unit=eV2hart
|
||||
! ln(3)/2 = artanh(1/2)
|
||||
! double precision, parameter :: alpha=0.5d0*log(3.d0)/unit
|
||||
! (1+tanh(-x))/2 ~ exp(-2x)
|
||||
! double precision, parameter :: alpha=0.5d0*log(2.d0)/unit
|
||||
!
|
||||
double precision, parameter :: alpha=log(10.d0)/unit
|
||||
|
||||
! cutoff
|
||||
double precision, parameter :: minweight=1.d-4
|
||||
|
||||
! asymptotically,
|
||||
! wdamp=(1.d0+tanh(-alpha*dE))*0.5d0 + minweight
|
||||
wdamp=1.0d0
|
||||
|
||||
if (dE.lt.0) then
|
||||
wdamp=1.d0
|
||||
else if (dE.lt.(4*eV2hart)) then
|
||||
wdamp=exp(-alpha*dE)+minweight
|
||||
else
|
||||
wdamp=0
|
||||
endif
|
||||
|
||||
end function wdamp
|
||||
end subroutine
|
||||
|
||||
!--------------------------------------------------------------------------------------
|
||||
|
||||
subroutine nnoutgrad(ad_grads,pat_in,nn_out)
|
||||
|
|
|
|||
|
|
@ -1,162 +0,0 @@
|
|||
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
|
||||
|
|
@ -11,7 +11,7 @@ module nndbg_mod
|
|||
!logical,parameter:: (dbg=.false.,vbs=.false.,rats=.true.)
|
||||
!logical,parameter:: (dbg=.false.,vbs=.true.,rats=.false.)
|
||||
!logical,parameter:: (dbg=.true.,vbs=.false.,rats=.false.)
|
||||
!logical,parameter:: (dbg=.true.,vbs=.true.,rats=.false.)
|
||||
!logical,parameter:: dbg=.true.,vbs=.true.,rats=.false.
|
||||
!logical,parameter:: (dbg=.true.,vbs=.false.,rats=.true.)
|
||||
logical,parameter:: dbg=.false.,vbs=.true.,rats=.true.
|
||||
logical,parameter:: conlog=.true.
|
||||
|
|
@ -27,4 +27,4 @@ module nndbg_mod
|
|||
|
||||
|
||||
|
||||
END MODULE
|
||||
END MODULE
|
||||
|
|
|
|||
Loading…
Reference in New Issue