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

Jupyter notebooks #6

Open
2 tasks
hrushikesh-s opened this issue Mar 1, 2024 · 1 comment
Open
2 tasks

Jupyter notebooks #6

hrushikesh-s opened this issue Mar 1, 2024 · 1 comment

Comments

@hrushikesh-s
Copy link
Owner

  • Job submission
  • Post processing
@hrushikesh-s
Copy link
Owner Author

from atomate2.vasp.flows.hiphive import HiphiveMaker
from atomate2.forcefields.flows.hiphive import HiphiveMaker as HiphiveMakerFF
from atomate2.forcefields.jobs import (
    CHGNetRelaxMaker, CHGNetStaticMaker, M3GNetRelaxMaker, M3GNetStaticMaker, MACERelaxMaker, MACEStaticMaker 
)
from jobflow import run_locally
import numpy as np
from fireworks import LaunchPad
from jobflow.managers.fireworks import flow_to_workflow

from mp_api.client import MPRester
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

with MPRester("...") as mpr:    
    mpids = ["mp-1265"] # MgO
    for i, mpid in enumerate(mpids):    
        fields = ["material_id", "band_gap", "bulk_modulus", "formula_pretty", "nsites", "structure"]
        data = mpr.materials.summary.search(material_ids=[mpid], fields=fields)
        example_doc = data[0]
        struct = example_doc.structure
        struct = SpacegroupAnalyzer(struct).find_primitive()
        mpid_new = example_doc.material_id
        k_vrh = example_doc.bulk_modulus['vrh']
        nsites = example_doc.nsites

        try:
            bulk_mod = k_vrh
            print(f'bulk_mod = {bulk_mod}')
        except:
            pass

        sa = SpacegroupAnalyzer(struct)
        sym_operations: list = sa.get_point_group_operations()
        num_operations = len(sym_operations)
        print(f"number of point group operations: {num_operations}")
        crystal_system = sa.get_crystal_system()
        print(f"crystal system: {crystal_system}")
        if crystal_system == "cubic":
            n_configs_per_std = int(nsites/2)
        else:
            n_configs_per_std = int(nsites/2*np.sqrt(48)/num_operations)
        print(f"n_configs_per_std: {n_configs_per_std}")

        factor = np.around(np.mean(struct.atomic_numbers)/40,1) # displacement scaler factor - TO BE ADJUSTED
        fixed_displs = [0.01,0.03,0.08,0.1] # new displacement values
        perturbed_structure_kwargs={"rattle_stds": fixed_displs,"n_configs_per_std":n_configs_per_std},
        calculate_lattice_thermal_conductivity=True,
        fit_method = ["rfe"]
        disp_cut = 0.05
        min_atoms=150 #150 #4
        max_atoms=60 #600 #10
        min_length=18 #18 #6
        supercell_matrix_kwargs={"min_atoms":min_atoms, "max_atoms":max_atoms, "force_diagonal":True}

        hiphive_flow = HiphiveMakerFF(
                                supercell_matrix_kwargs=supercell_matrix_kwargs,
                                min_length=min_length,
                                THERM_COND_SOLVER="shengbte", # almabte
                                ).make(  
                                                            mpid=mpid,  
                                                            structure=struct,
                                                            bulk_modulus=bulk_mod,
                                                            renormalize=False,
                                                            n_structures=n_configs_per_std,
                                                            fixed_displs=fixed_displs,
                                                            disp_cut=disp_cut)

        # # run the job locally
        # run_locally(hiphive_flow, create_folders=True)

        # convert the flow to a fireworks WorkFlow object and submit the job to the LaunchPad
        wf = flow_to_workflow(hiphive_flow)
        lpad = LaunchPad.from_file('/Users/HPSahasrabuddhe/fw_config_perlmutter/my_launchpad.yaml')
        lpad.add_wf(wf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant