<commit_before>"""
Create a workflow and submit it to the 'fireworks' database on hydrogen

Note 1:
      the database for job submission('fireworks') is
      on the mongodb server running on hydrogen.
      use own account to run the script.
      contact me(<EMAIL>) to create a database account
      
Note 2:
        Since hydrogen is part of the hermes subnetwork, direct connection to the database
        is not possible. So tunell port number 27017 from your local machine to port 27017 on hydrogen via ssh:
        ssh -N -f -L 27017:10.1.255.101:27017 <EMAIL>
"""

import numpy as np
from pymatgen import Lattice
from pymatgen.core.structure import Structure
from pymatgen.io.vaspio.vasp_input import Incar, Poscar, Potcar, Kpoints
from fireworks import Firework, Workflow, LaunchPad
from fireworks.core.rocket_launcher import launch_rocket #rapidfire
from mpinterfaces.firetasks import MPINTCalibrateTask, MPINTMeasurementTask

#---------------------------------------------------------
# set up the LaunchPad i.e connect to the database
#--------------------------------------------------------
launchpad = LaunchPad(host='localhost', port=27017, name='fireworks',
                       username="km468", password="<PASSWORD>")

#---------------------------------
# INCAR
#---------------------------------
incarparams = {'System':'test',
                   'ENCUT': 400,
                   'ISMEAR': 1,
                   'SIGMA': 0.1,
                   'EDIFF':1E-6}
incar = Incar(params=incarparams)

#---------------------------------
# POSCAR
#----------------------------------
system = 'Pt bulk'
atoms = ['Pt']
    
a0 = 3.965
lvec = [ [0.5, 0.0, 0.5], [0.5, 0.5, 0.0], [0.0, 0.5, 0.5] ]
lvec = np.array(lvec) * a0
lattice = Lattice(lvec)#.from_parameters(3.866, 3.866, 3.866, 60, 60, 60)
structure = Structure( lattice, atoms, [ [0.0, 0.0, 0.0] ],coords_are_cartesian=False)
poscar = Poscar(structure, comment=system,
        selective_dynamics=None,
        true_names=True, velocities=None, predictor_corrector=None)

#---------------------------------
# KPOINTS
#----------------------------------
kpoints = Kpoints()

#------------------------------------------
# define firetasks
#-----------------------------------------

#-------------------------------------------------
#first firetask
#create a calibrate task: calibrate bulk
#------------------------------------------------

#set the paramters for the calibrate task
calparams1 = {}
#required params: incar, poscar, list of encut and kpoints and the calibrate object
#potcar created from poscar
calparams1['incar'] = incar.as_dict()
calparams1['poscar'] = poscar.as_dict()
calparams1['kpoints'] = kpoints.as_dict()
#submit script settings
calparams1['que'] = {
                     'type':'PBS',
                     'params':
                     {
                     'nnodes': '1',
                     'ppnode': '8',
                     'walltime': '24:00:00',
                     'job_name': 'test_job',
                     'rocket_launch': 'mpirun ~/Software/vasp.5.3.5/vasp'
                     }
                     }
#range specification for encut and kpoints
calparams1['encut_list'] = ['400', '800', '100']
calparams1['kpoint_list'] = ['[7,7,7]', '[11,11,11]' ]
#type of calibration to be done: basically the name of calibrate calss to
#be used. available options: CalibrateMolecule, CalibrateSlab, CalibrateBulk
calparams1['calibrate'] = 'CalibrateBulk'
#optional param: job_dir is the name of the directory within which
#the encut and kpoints jobs will be run
calparams1['cal_construct_params'] = {'job_dir':'Bulk_test'}

caltask1 = MPINTCalibrateTask(calparams1)

#---------------------------------------------------
#second firetask
#create a calibrate task: calibrate bulk calculation
#---------------------------------------------------
calparams2 = {}
calparams2 = {k:calparams1[k] for k in calparams1.keys()}
calparams2['calibrate'] = 'CalibrateSlab'
calparams2['cal_construct_params'] = {'job_dir':'Slab_1'}

#caltask2 = MPINTCalibrateTask(calparams2)

#---------------------------------------------------
#third firetask
#create a Measurement task
#---------------------------------------------------
msrparams1 = {}
msrparams1['cal_objs'] = [calparams1, calparams2]
msrparams1['msr_construct_params'] = {'job_dir':'Measurement_1'}
msrtask1 = MPINTMeasurementTask(msrparams1)

#--------------------------------------------------
#create the fireworks from the firetasks 
#--------------------------------------------------
#fw1 = Firework([caltask1, caltask2], name="calibrate")
fw1 = Firework([msrtask1], name="calibrate")
#fw2 = Firework([msrtask1], name="measurement", parents=[fw1])
#fw3 = Firework(pptask, name="post_process", parents=[fw1, fw2])

#-----------------------------------------------------
#create workflow from the fireworks
#-----------------------------------------------------
wf = Workflow([fw1, fw2], name="mpint workflow")<commit_msg>minor changes in submit script<commit_after>"""
Create a workflow and submit it to the 'fireworks' database on hydrogen

Note 1:
      the database for job submission('fireworks') is
      on the mongodb server running on hydrogen.
      use own account to run the script.
      contact me(<EMAIL>) to create a database account
      
Note 2:
        Since hydrogen is part of the hermes subnetwork, direct connection to the database
        is not possible. So tunell port number 27017 from your local machine to port 27017 on hydrogen via ssh:
        ssh -N -f -L 27017:10.1.255.101:27017 <EMAIL>
"""

import numpy as np
from pymatgen import Lattice
from pymatgen.core.structure import Structure
from pymatgen.io.vaspio.vasp_input import Incar, Poscar, Potcar, Kpoints
from fireworks import Firework, Workflow, LaunchPad
from fireworks.core.rocket_launcher import launch_rocket #rapidfire
from mpinterfaces.firetasks import MPINTCalibrateTask, MPINTMeasurementTask

#---------------------------------------------------------
# set up the LaunchPad i.e connect to the database
#--------------------------------------------------------
launchpad = LaunchPad(host='localhost', port=27017, name='fireworks',
                       username="km468", password="<PASSWORD>")

#---------------------------------
# INCAR
#---------------------------------
incarparams = {'System':'test',
                   'ENCUT': 400,
                   'ISMEAR': 1,
                   'SIGMA': 0.1,
                   'EDIFF':1E-6}
incar = Incar(params=incarparams)

#---------------------------------
# POSCAR
#----------------------------------
system = 'Pt bulk'
atoms = ['Pt']
    
a0 = 3.965
lvec = [ [0.5, 0.0, 0.5], [0.5, 0.5, 0.0], [0.0, 0.5, 0.5] ]
lvec = np.array(lvec) * a0
lattice = Lattice(lvec)#.from_parameters(3.866, 3.866, 3.866, 60, 60, 60)
structure = Structure( lattice, atoms, [ [0.0, 0.0, 0.0] ],coords_are_cartesian=False)
poscar = Poscar(structure, comment=system,
        selective_dynamics=None,
        true_names=True, velocities=None, predictor_corrector=None)

#---------------------------------
# KPOINTS
#----------------------------------
kpoints = Kpoints()

#------------------------------------------
# define firetasks
#-----------------------------------------

#-------------------------------------------------
#first firetask
#create a calibrate task: calibrate bulk
#------------------------------------------------

#set the paramters for the calibrate task
calparams1 = {}
#required params: incar, poscar, list of encut and kpoints and the calibrate object
#potcar created from poscar
calparams1['incar'] = incar.as_dict()
calparams1['poscar'] = poscar.as_dict()
calparams1['kpoints'] = kpoints.as_dict()
#submit script settings
calparams1['que'] = {
                     'type':'PBS',
                     'params':
                     {
                     'nnodes': '1',
                     'ppnode': '8',
                     'walltime': '24:00:00',
                     'job_name': 'test_job',
                     'rocket_launch': 'mpirun ~/Software/vasp.5.3.5/vasp'
                     }
                     }
#range specification for encut and kpoints
calparams1['encut_list'] = ['400', '800', '100']
calparams1['kpoint_list'] = ['[7,7,7]', '[11,11,11]' ]
#type of calibration to be done: basically the name of calibrate calss to
#be used. available options: CalibrateMolecule, CalibrateSlab, CalibrateBulk
calparams1['calibrate'] = 'CalibrateBulk'
#optional param: job_dir is the name of the directory within which
#the encut and kpoints jobs will be run
calparams1['cal_construct_params'] = {'job_dir':'Bulk_test'}

caltask1 = MPINTCalibrateTask(calparams1)

#---------------------------------------------------
#second firetask
#create a calibrate task: calibrate bulk calculation
#---------------------------------------------------
calparams2 = {}
calparams2 = {k:calparams1[k] for k in calparams1.keys()}
calparams2['calibrate'] = 'CalibrateSlab'
calparams2['cal_construct_params'] = {'job_dir':'Slab_1'}

#caltask2 = MPINTCalibrateTask(calparams2)

#---------------------------------------------------
#third firetask
#create a Measurement task
#---------------------------------------------------
msrparams1 = {}
msrparams1['cal_objs'] = [calparams1, calparams2]
msrparams1['msr_construct_params'] = {'job_dir':'Measurement_1'}
msrtask1 = MPINTMeasurementTask(msrparams1)

#--------------------------------------------------
#create the fireworks from the firetasks 
#--------------------------------------------------
#fw1 = Firework([caltask1, caltask2], name="calibrate")
fw1 = Firework([msrtask1], name="calibrate")
#fw2 = Firework([msrtask1], name="measurement", parents=[fw1])
#fw3 = Firework(pptask, name="post_process", parents=[fw1, fw2])

#-----------------------------------------------------
#create workflow from the fireworks
#-----------------------------------------------------
wf = Workflow([fw1], name="mpint workflow")
#wf = Workflow([fw1, fw2], name="mpint workflow")
{'fraction_non_alphanumeric': 0.28203078153108135, 'fraction_numerical': 0.03308015190885469, 'mean_word_length': 1.7720221606648199, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3810357', 'n_tokens_mistral': 3032, 'n_tokens_neox': 2764, 'n_words': 755}