@@ -0,0 +1,2538 @@
+from aiida import load_dbenv%0Aload_dbenv()%0Afrom aiida.orm import Code, DataFactory%0A%0AStructureData = DataFactory('structure')%0AParameterData = DataFactory('parameter')%0A%0Aimport numpy as np%0Aimport os%0Aimport pymatgen%0A%0A##########################%0Astructure_id = 'mp-149'%0A##########################%0A%0Arester =  pymatgen.MPRester(os.environ%5B'PMG_MAPI_KEY'%5D)%0Apmg_structure = rester.get_structure_by_material_id(structure_id)%0Aspa = pymatgen.symmetry.analyzer.SpacegroupAnalyzer(pmg_structure)%0A%0Aconventional = spa.get_conventional_standard_structure()%0Aprimitive = spa.get_primitive_standard_structure()%0A%0Aprimitive_matrix = np.dot(np.linalg.inv(conventional.lattice_vectors()), primitive.lattice_vectors())%0Anp.round(primitive_matrix, decimals=6).tolist()%0A%0Astructure = StructureData(pymatgen=conventional).store()%0A%0Acrystal_system = spa.get_crystal_system()%0Aif crystal_system == 'hexagonal':%0A    supercell = %5B%5B3, 0, 0%5D,%0A                 %5B0, 3, 0%5D,%0A                 %5B0, 0, 3%5D%5D%0Aelse:%0A    supercell = %5B%5B2, 0, 0%5D,%0A                 %5B0, 2, 0%5D,%0A                 %5B0, 0, 2%5D%5D%0A%0Aincar_dict = %7B%0A    'NELMIN' : 5,%0A    'NELM'   : 100,%0A    'ENCUT'  : 400,%0A    'ALGO'   : 38,%0A    'ISMEAR' : 0,%0A    'SIGMA'  : 0.01,%0A    'GGA'    : 'PS'%0A%7D%0A%0Apseudo_dict = %7B'functional': 'PBE',%0A               'symbols': np.unique(conventional.symbol_set).tolist()%7D%0A%0A# Monkhorst-pack%0Akpoints_dict = %7B'points': %5B2, 2, 2%5D,%0A                'shift' : %5B0.0, 0.0, 0.0%5D%7D%0A%0Amachine_dict = %7B%0A    'num_machines': 1,%0A    'parallel_env':'mpi*',%0A    'tot_num_mpiprocs': 16%7D%0A%0A%0Aph_dict = ParameterData(dict=%7B'supercell': supercell,%0A                              'primitive': primitive_matrix,%0A                              'distance': 0.01,%0A                              'mesh': %5B20, 20, 20%5D%7D%0A                       ).store()%0A%0Awf_parameters = %7B%0A     'structure': structure,%0A     'phonopy_input': ph_dict,%0A     'input_force': %7B'code': 'vasp541mpi@stern',%0A                    'parameters': incar_dict,%0A                    'resources': machine_dict,%0A                    'pseudo': pseudo_dict,%0A                    'kpoints': kpoints_dict%7D,%0A     'input_optimize': %7B'code': 'vasp541mpi@stern',%0A                       'parameters': incar_dict,%0A                       'resources': machine_dict,%0A                       'pseudo': pseudo_dict,%0A                       'kpoints': kpoints_dict%7D%0A%7D%0A%0A#Submit workflow%0Afrom aiida.workflows.wf_phonon import WorkflowPhonon%0Awf = WorkflowPhonon(params=wf_parameters, optimize=False)%0A%0Awf.label = 'VASP %7B%7D'.format(structure.get_formula())%0Awf.start()%0Aprint ('pk: %7B%7D'.format(wf.pk))%0A%0A

add launch script to use structure directly from materials project