1
General Questions and Answers / Re: Phonon dispersion is senstitive to "processes_per_displacement" paramter of DM?
« on: April 30, 2024, 07:59 »
With '24' and '4' cores, the results match.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
# -------------------------------------------------------------
# Bulk Configuration
# -------------------------------------------------------------
# Set up lattice
lattice = Hexagonal(2.4612*Angstrom, 30.0*Angstrom)
# Define elements
elements = [Carbon, Carbon]
# Define coordinates
fractional_coordinates = [[ 0.333333333333, 0.6666666666 , 0.5 ],
[ 0.666666666666, 0.3333333333 , 0.5 ]]
# Set up configuration
bulk_configuration = BulkConfiguration(
bravais_lattice=lattice,
elements=elements,
fractional_coordinates=fractional_coordinates
)
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
GGABasis.Carbon_DoubleZetaPolarized,
]
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = SGGA.PBE
k_point_sampling = MonkhorstPackGrid(
na=51,
nb=51,
)
numerical_accuracy_parameters = NumericalAccuracyParameters(
density_mesh_cutoff=110.0*Hartree,
k_point_sampling=k_point_sampling,
occupation_method=FermiDirac(0.05*eV),
)
poisson_solver = FastFourier2DSolver(
boundary_conditions=[[PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
[PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
[DirichletBoundaryCondition(),DirichletBoundaryCondition()]]
)
iteration_control_parameters = IterationControlParameters(
tolerance=1e-08,
max_steps=10000,
)
calculator = LCAOCalculator(
exchange_correlation=exchange_correlation,
numerical_accuracy_parameters=numerical_accuracy_parameters,
poisson_solver=poisson_solver,
iteration_control_parameters=iteration_control_parameters,
)
bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('gr_mp_fhi_dzp.hdf5', bulk_configuration)
## -------------------------------------------------------------
## Optimize Geometry
## -------------------------------------------------------------
bulk_configuration = OptimizeGeometry(
bulk_configuration,
max_forces=0.0001*eV/Ang,
max_stress=1.0e-04*eV/Angstrom**3,
max_steps=20000,
max_step_length=0.4*Ang,
optimize_cell=True,
trajectory_filename=None,
optimizer_method=LBFGS(),
enable_optimization_stop_file=False,
)
bulk_configuration.update()
nlsave('gr_mp_fhi_dzp.hdf5', bulk_configuration)
nlprint(bulk_configuration)
bulk_configuration = nlread('gr_mp_fhi_dzp.hdf5', BulkConfiguration)[1]
# -------------------------------------------------------------
# Dynamical Matrix
# -------------------------------------------------------------
dynamical_matrix = DynamicalMatrix(
bulk_configuration,
filename= 'gr_mp_fhi.hdf5',
object_id='dynamical_matrix',
repetitions=(11, 11, 1),
atomic_displacement=0.01*Angstrom,
acoustic_sum_rule=True,
finite_difference_method=Central,
#max_interaction_range=3.5*Angstrom,
force_tolerance=1e-08*Hartree/Bohr**2,
processes_per_displacement=28,
log_filename_prefix='forces_fhi_mp_',
use_wigner_seitz_scheme=True,
)
dynamical_matrix.update()
# -------------------------------------------------------------
# Phonon Bandstructure
# -------------------------------------------------------------
phonon_bandstructure = PhononBandstructure(
configuration=bulk_configuration,
dynamical_matrix=dynamical_matrix,
route=['G', 'K', 'M', 'G'],
points_per_segment=100,
number_of_bands=All
)
nlsave('gr_mp_fhi_dzp.hdf5', phonon_bandstructure)
filename = 'gr_mp_fhi_ph_band.dat'#.format(band_index)
with open(filename, 'w') as f:
phonon_bandstructure.nlprint(f)
import glob
import os
directory = ''
filenames= glob.glob(os.path.join(directory, 'data_*.hdf5'))
bulk_configurations = []
for filename in filenames:
bulk_configurations.append(nlread(filename, BulkConfiguration)[0])
calculator = bulk_configurations[0].calculator()
training_set= TrainingSet(bulk_configurations, recalculate_training_data=False, calculator = calculator )
scan_over_non_linear_coefficients = scanOverNonLinearCoefficients(
perform_optimization=False
# Moment Tensor Potential Training
moment_tensor_potential_training = MomentTensorPotentialTraining(
filename='MTP.hdf5',
object_id='mtp',
training_sets= training_set,
calculator=calculator,
fitting_parameters_list=scan_over_non_linear_coefficients
)
moment_tensor_potential_training.update()
repetitions = checkNumberOfRepetitions(bulk_configuration),
repetitions = checkNumberOfRepetitions(bulk_configuration, max_interaction_range=5.0*Angstrom).
moment_tensor_potential_training=nlread('MTP_basics_results.hdf5',MomentTensorPotentialTraining)[0]
moment_tensor_potential_training._nlplotscatter(fit_index=1)