コード例 #1
0
                         forces_file  = 'tet.force',
                         dipoles_file = 'tet.dip', 
                         stresses_file = 'tet.stress' )

config3 = Configuration( options = options,
                         species = { 'Ba', 'Ti', 'O' },
                         directory = 'configs/rhombo',
                         runtime_file = 'runtime_rhombo.inpt',
                         restart_file = 'restart_rhombo.dat',
                         forces_file  = 'rhombo.force',
                         dipoles_file = 'rhombo.dip', 
                         stresses_file = 'rhombo.stress' )

training_set = Training_Set( [ config1, config2, config3 ] )
fitting_parameters = Fitting_Parameter_Set.from_parameters_file( 'PARAMS' )
potential_file = Potential_File( 'template_BaTiO3', fitting_parameters )

chi_squared_scaling = { 'forces':   options[ 'scaling' ][ 'forces' ],
                        'dipoles':  options[ 'scaling' ][ 'dipoles' ],
                        'stresses': options[ 'scaling' ][ 'stresses' ] }

sum_of_chi = sumOfChi( potential_file, training_set, chi_squared_scaling )

# # evaluate sum_of_chi with our initial potential parameters, and save a .pdf plot
# sum_of_chi.evaluate( fitting_parameters.to_fit.initial_values, plot = True )
# # TODO move plotting capabilities of sum_of_chi to a .plot method, and allow the target directory to be set here
# mkdir_p('./initial-errors-pdfs')
# os.system('mv *.pdf ./initial-errors-pdfs')

optimise( sum_of_chi.evaluate, fitting_parameters, options )
コード例 #2
0
ファイル: fitabinitio.py プロジェクト: CEames/ppfit
                         dipoles_file = 'tet.dip', 
                         stresses_file = 'tet.stress' )

config3 = Configuration( directory = 'configs/rhombo',
                         runtime_file = 'runtime_rhombo.inpt',
                         restart_file = 'restart_rhombo.dat',
                         forces_file  = 'rhombo.force',
                         dipoles_file = 'rhombo.dip', 
                         stresses_file = 'rhombo.stress' )

training_set = Training_Set( [ config1, config2, config3 ] )
fitting_parameters = Fitting_Parameter_Set.from_parameters_file( 'PARAMS' )
potential_file = Potential_File( 'template_BaTiO3', fitting_parameters )
opt_options = read_optimisation_options( 'OPT' )
min_method = opt_options.method_min

chi_squared_scaling = { 'forces':   opt_options.scalingF,
                        'dipoles':  opt_options.scalingD,
                        'stresses': opt_options.scalingS }

sum_of_chi = sumOfChi( potential_file, training_set, chi_squared_scaling, plot = True )

# # evaluate sum_of_chi with our initial potential parameters, and save a .pdf plot
# sum_of_chi.evaluate( fitting_parameters.to_fit.initial_values )
# # TODO move plotting capabilities of sum_of_chi to a .plot method, and allow the target directory to be set here
# mkdir_p('./initial-errors-pdfs')
# os.system('mv *.pdf ./initial-errors-pdfs')

sum_of_chi.plot = False
optimise( sum_of_chi.evaluate, fitting_parameters, method = min_method, opts = opt_options )