Skip to content

Commit

Permalink
Add restart function and machine keyword option for restart
Browse files Browse the repository at this point in the history
  • Loading branch information
sakim8048 committed Dec 13, 2024
1 parent 568941b commit ac00616
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions pynta/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
from fireworks.core.fworker import FWorker
import fireworks.fw_config
import logging
#restart RHE
import pickle
#restart RHE+KSA
import time
from pynta.polaris import createFWorkers
from pynta.utils import copyDataAndSave
Expand All @@ -43,10 +42,10 @@ def __init__(self,path,rxns_file,surface_type,metal,label,launchpad_path=None,fw
TS_opt_software_kwargs=None,
lattice_opt_software_kwargs={'kpts': (25,25,25), 'ecutwfc': 70, 'degauss':0.02, 'mixing_mode': 'plain'},
reset_launchpad=False,queue_adapter_path=None,num_jobs=25,max_num_hfsp_opts=None,#max_num_hfsp_opts is mostly for fast testing
Eharmtol=3.0,Eharmfiltertol=30.0,Ntsmin=5,frozen_layers=2,fmaxopt=0.05,fmaxirc=0.1,fmaxopthard=0.05,pickled=0):
Eharmtol=3.0,Eharmfiltertol=30.0,Ntsmin=5,frozen_layers=2,fmaxopt=0.05,fmaxirc=0.1,fmaxopthard=0.05):

self.surface_type = surface_type
self.pickled = pickled


if launchpad_path:
launchpad = LaunchPad.from_file(launchpad_path)
Expand Down Expand Up @@ -180,28 +179,6 @@ def analyze_slab(self):
self.double_site_bond_params_lists = double_site_bond_params_lists
self.double_sites_lists = unique_site_pairs_lists

my_dictionary_to_pickled = {'cas' : cas,
'single_site_bond_params_list': single_site_bond_params_lists,
'single_sites_lists': unique_site_lists,
'double_site_bond_params_lists': double_site_bond_params_lists,
'double_sites_lists_full': unique_site_pairs_lists}

print("Save as a pickle")
with open('analize_slab.pickle', 'wb') as myfile:
pickle.dump(my_dictionary_to_pickled, myfile)

else :
with open('analize_slab.pickle', 'rb') as myfile:
my_dict = pickle.load(myfile)

print("Load from a pickle")

self.cas = my_dict['cas']
self.single_site_bond_params_lists = my_dict['single_site_bond_params_list']
self.single_sites_lists = my_dict['unique_site_lists']
self.double_site_bond_params_lists = my_dict['double_site_bond_params_lists']
self.double_sites_lists = my_dict['unique_site_pairs_lists']

def generate_mol_dict(self):
"""
generates all unique Molecule objects based on the reactions and generates a dictionary
Expand Down Expand Up @@ -589,7 +566,7 @@ def execute_from_initial_ad_guesses(self):
self.launch()

#restart option: RHE + KSA
def reset(self,wfid):
def restart(self,wfid):

id_number = int(wfid)
# Get the information of the workflow
Expand Down Expand Up @@ -617,19 +594,6 @@ def reset(self,wfid):
'{{pynta.tasks.MolecularVibrationsTask}}',
'{{pynta.tasks.MolecularIRC}}']

#if nameTask in nameTasks:
# opt_method = newd['_tasks'][0]['opt_method'] if 'opt_method' in newd['_tasks'][0] else None

# if self.software == "Espresso" or self.software == "PWDFT":
# print(" Change: ", newd['_tasks'][0]['software_kwargs']['command'], end='')
# node = MapTaskToNodes()
# newcommand = node.getCommand()
# newd['_tasks'][0]['software_kwargs']['command'] = newcommand
# print(" by: ", newcommand)
# Here we work with reset the optimization task
# We load the trajectory file and save this structure in the
# tree of each uncompleted task

if 'opt' in task_name:
dirs = wf_launchers[task_name]
if dirs != []:
Expand Down

0 comments on commit ac00616

Please sign in to comment.