Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate phonons from MD #116

Merged
merged 8 commits into from
Dec 10, 2023
Merged

Calculate phonons from MD #116

merged 8 commits into from
Dec 10, 2023

Conversation

jan-janssen
Copy link
Member

from ase.atoms import Atoms
from atomistics.calculators import (
    calc_molecular_dynamics_phonons_with_lammps,
    evaluate_with_lammps, 
    get_potential_by_name,
)
from atomistics.workflows import PhonopyWorkflow
from dynaphopy import Quasiparticle
import pandas
from phonopy.units import VaspToTHz

cell = [[5.4500000000, 0.0, 0.0], [0.0, 5.4500000000, 0.0], [0.0, 0.0, 5.4500000000]]
positions = [
    [4.7687500000, 4.7687500000, 4.7687500000],
    [4.7687500000, 2.0437500000, 2.0437500000],
    [2.0437500000, 4.7687500000, 2.0437500000],
    [2.0437500000, 2.0437500000, 4.7687500000],
    [0.6812500000, 0.6812500000, 0.6812500000],
    [0.6812500000, 3.4062500000, 3.4062500000],
    [3.4062500000, 0.6812500000, 3.4062500000],
    [3.4062500000, 3.4062500000, 0.6812500000],
]
symbols = ["Si"] * len(positions)
structure_ase = Atoms(symbols=symbols, positions=positions, cell=cell, pbc=True)

potential_dataframe = pandas.DataFrame({
    "Config": [[
        "pair_style tersoff",
        "pair_coeff * * SiCGe.tersoff Si(C)"
    ]],
    "Filename": [[]],
    "Model": ["Tersoff"],
    "Name": ["Tersoff"],
    "Species": [["Si"]],
})

workflow = PhonopyWorkflow(
    structure=structure_ase,
    interaction_range=10,
    factor=VaspToTHz,
    displacement=0.01,
    dos_mesh=20,
    primitive_matrix=[[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]],
    number_of_snapshots=None,
)
task_dict = workflow.generate_structures()
result_dict = evaluate_with_lammps(
    task_dict=task_dict,
    potential_dataframe=potential_dataframe,
)
mesh_dict, dos_dict = workflow.analyse_structures(output_dict=result_dict)

trajectory = calc_molecular_dynamics_phonons_with_lammps(
    structure_ase=structure_ase,
    potential_dataframe=potential_dataframe,
    force_constants=workflow.phonopy.get_force_constants(), 
    phonopy_unitcell=workflow.phonopy.get_unitcell(),
    phonopy_primitive_matrix=workflow.phonopy.get_primitive_matrix(),
    phonopy_supercell_matrix=workflow.phonopy.get_supercell_matrix(),
    total_time=20,      # ps
    time_step=0.001,    # ps
    relaxation_time=5,  # ps
    silent=True,
    supercell=[2, 2, 2],
    memmap=False,
    velocity_only=True,
    temperature=300,
)

# set dynaphopy calculation
calculation = Quasiparticle(trajectory)
calculation.select_power_spectra_algorithm(2)  # select FFT algorithm
calculation.get_renormalized_phonon_dispersion_bands()
renormalized_force_constants = calculation.get_renormalized_force_constants()

# Print phonon band structure
calculation.plot_renormalized_phonon_dispersion_bands()

phonons

Waiting for pyiron/pylammpsmpi#166

@jan-janssen jan-janssen marked this pull request as draft December 9, 2023 07:36
@jan-janssen jan-janssen linked an issue Dec 9, 2023 that may be closed by this pull request
@jan-janssen jan-janssen added the format_black Launch the pyiron/actions black formatting routine label Dec 9, 2023
@jan-janssen jan-janssen marked this pull request as ready for review December 10, 2023 07:39
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jan-janssen jan-janssen merged commit 0ecf70d into main Dec 10, 2023
@jan-janssen jan-janssen deleted the dynaphopy branch December 10, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format_black Launch the pyiron/actions black formatting routine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Calculate finite temperature phonons
2 participants