<jupyter_start><jupyter_text>Step 1: Select initial structure<jupyter_code># DISPLAY WIDGETS AND DEFINE JOB PARAMETERS

# Structure.
struct_browser = StructureBrowserWidget()
struct_browser.results.observe(on_struct_change, names='value')

# Viewer.
viewer_widget = ViewerDetails()

# Mol info.
mol_ids_info_out = ipw.Output()

display(ipw.VBox([struct_browser, viewer_widget, mol_ids_info_out]))<jupyter_output><empty_output><jupyter_text>Step 2: General parameters of the calculation<jupyter_code># Code.
computer_code_dropdown = CodeDropdown(input_plugin='cp2k', path_to_root="../../")

# Misc details.
style = {'description_width': '120px'}
layout = {'width': '70%'}
num_nodes_selector = ipw.IntText(
    value=1,
    description='# Nodes',
    style=style, layout=layout)
calc_name_selector = ipw.Text(
    description='Calculation Name: ',
    placeholder='A great name.',
    style=style, layout=layout)

# DFT
dft_details_widget = DFTDetails(job_details=job_details)    
dft_details_widget.btn_fixed_atoms.on_click(on_fixed_atoms_btn_click)
dft_details_widget.calc_type.observe(lambda c: guess_calc_params(), names='value')

# Display code dropdown.
display(ipw.VBox([computer_code_dropdown, num_nodes_selector, calc_name_selector, dft_details_widget]))<jupyter_output><empty_output><jupyter_text>Step 3: Define collective variableThe unit of the spring constant is [eV/unit of colvar^2].Three kinds of collective variable are implemented:**DISTANCE**- Distance between two atoms.**ANGLE_PLANE_PLANE**- Rotation of plane defined by (P1 - P2) and (P3 - P2) WRT plane defined by a normal.**BOND_ROTATION**- Clockwise rotation of (P2-P1) WRT (P4-P3).<jupyter_code>cv_widget = CollectiveVariableWidget()

def on_vis_cv_click(c):
    if cv_widget.validation_check() and atoms is not None:
        vis_list = cv_widget.current_cv_instance.visualization_list(atoms)
        viewer_widget.visualize_extra(vis_list)
        
        with mol_ids_info_out:
            cv_widget.current_cv_instance.print_cv(atoms)
        
cv_widget.visualize_colvar_btn.on_click(on_vis_cv_click)

display(cv_widget)<jupyter_output><empty_output><jupyter_text>Optionally, to continue another replica chain calculation, use the exact same calculation name, pick one of its output geometries as input and use the same collective variable definition.  Submit<jupyter_code>def build_inputs():
    builder = ReplicaWorkChain.get_builder()
    builder.cp2k_code = computer_code_dropdown.selected_code
    builder.structure = struct_browser.results.value
    builder.num_machines = Int(num_nodes_selector.value)
    builder.calc_name = Str(calc_name_selector.value)
    #builder.cell
    builder.fixed_atoms = Str(dft_details_widget.fixed_atoms.value)
    builder.colvar_targets = Str(cv_widget.colvar_targets)
    builder.target_unit = Str(cv_widget.target_unit)
    builder.spring = Float(cv_widget.spring_constant)
    builder.spring_unit = Str(cv_widget.spring_unit)
    builder.subsys_colvar = Dict(dict=cv_widget.subsys_colvar)
    builder.calc_type = Str(dft_details_widget.calc_type.value)
    builder.mgrid_cutoff = Int(dft_details_widget.mgrid_cutoff.value)
    builder.max_force = Float(dft_details_widget.max_force.value)
    builder.dftd3_switch = Bool(dft_details_widget.vdw_switch.value)

    builder.metadata = {
        "description": calc_name_selector.value,
        "label": "ReplicaWorkChain",
    }
    return builder
btn_submit = SubmitButtonWidget(ReplicaWorkChain,input_dictionary_function=build_inputs)
submit_out = ipw.Output()
display(btn_submit, submit_out)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09718741297688666, 'fraction_numerical': 0.005847953216374269, 'mean_word_length': 5.854961832061068, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '364750', 'license': 'MIT', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1187, 'n_words': 211, 'path': 'reactions/submit_replicas.ipynb', 'repo_name': 'cpignedoli/aiidalab-empa-surfaces', 'size': '3591'}