Skip to content

Commit

Permalink
add ssdisp_conv wf to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
d-wortmann committed Jul 4, 2024
1 parent 8c4254e commit 03bcc99
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 10 deletions.
48 changes: 48 additions & 0 deletions aiida_fleur/cmdline/launch/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,54 @@ def launch_ssdisp(structure, inpgen, calc_parameters, fleur, wf_parameters, scf_
builder.update(inputs)
utils.launch_process(builder, daemon)

@click.command('ssdisp_conv')
@options.STRUCTURE_OR_FILE(default="inp.xml", show_default=True)
@options.INPGEN()
@options.CALC_PARAMETERS()
@options.FLEUR()
@options.WF_PARAMETERS(required=True)
@options.SCF_PARAMETERS()
@options.DAEMON()
@options.OPTION_NODE()
def launch_ssdisp(structure, inpgen, calc_parameters, fleur, wf_parameters, scf_parameters, daemon, option_node):
"""
Launch a ssdisp_conv workchain
"""
workchain_class = WorkflowFactory('fleur.ssdisp_conv')

fleurinp=None
if (isinstance(structure,FleurinpData)):
fleurinp=structure
structure=None
inpgen=None
calc_parameters=None

inputs = {
'scf': {
'wf_parameters': scf_parameters,
'calc_parameters': calc_parameters,
'options': option_node,
'inpgen': inpgen,
'structure': structure,
'fleurinp': fleurinp,
'fleur': fleur
},
'wf_parameters': wf_parameters,
}
inputs = clean_nones(inputs)
builder = workchain_class.get_builder()
builder.update(inputs)
pk=utils.launch_process(builder, daemon)

if not daemon:
from aiida.orm import load_node
wf=load_node(pk)
ssdisp_output=wf.outputs.output_ssdisp_conv_wc_para.get_dict()
#json with dict
import json
with open("ssdisp_conv.json","w") as file:
json.dump(ssdisp_output,file,indent=2)


@click.command('dmi')
@options.STRUCTURE_OR_FILE(default=defaults.get_fept_film_structure, show_default=True)
Expand Down
11 changes: 9 additions & 2 deletions aiida_fleur/cmdline/util/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@
'"film_distance_relaxation": "False", // if True, sets relaxXYZ="FFT" for all atoms\n'
'"force_criterion": 0.049, // Sets the threshold of the largest force\n'
'"relax_iter": 5 // Maximum number of optimization iterations\n'
'}'

'}',
"ssdisp_conv":'{\n'
'"beta": {"all": 1.57079}, // set the angle of some or all atoms\n'
'"q_vectors": {"label1": [0.0,0.0,0.0], //set the q-vectors. Each has a label attached\n'
' "label2": [0.1,0.0,0.0]\n'
' }\n'
'//"suppress_symmetries": False // Only if you start from a structure: do not use symmetries\n'
'}'

}


Expand Down
13 changes: 5 additions & 8 deletions aiida_fleur/workflows/ssdisp_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,15 @@ def get_inputs_scf(self, qss):
with inpxml_changes(input_scf) as fm:
for key, val in self.ctx.wf_dict['beta'].items():
fm.set_atomgroup_label(key, {'nocoParams': {'beta': val}})
if self.ctx.wf_dict['suppress_symmetries']:
fm.set_inpchanges({'qss': qss})

if 'calc_parameters' in input_scf:
calc_parameters = input_scf.calc_parameters.get_dict()
else:
calc_parameters = {}
if self.ctx.wf_dict['suppress_symmetries']:
calc_parameters['qss'] = {'x': 1.221, 'y': 0.522, 'z': -0.5251}
else:
calc_parameters['qss'] = {'x': qss[0], 'y': qss[1], 'z': qss[2]}
input_scf.calc_parameters = Dict(calc_parameters)
if self.ctx.wf_dict['suppress_symmetries']:
calc_parameters['qss'] = {'x': 1.221, 'y': 0.522, 'z': -0.5251}
else:
calc_parameters['qss'] = {'x': qss[0], 'y': qss[1], 'z': qss[2]}
input_scf.calc_parameters = Dict(calc_parameters)

return input_scf

Expand Down

0 comments on commit 03bcc99

Please sign in to comment.