Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts to aiida 2.6.2 #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
STRUCTURES_FULL_GROUP_LABEL = f'acwf-verification/{SET_NAME}/structures'

Structure = DataFactory('structure')
group, _ = orm.Group.objects.get_or_create(label=STRUCTURES_FULL_GROUP_LABEL)
group, _ = orm.Group.collection.get_or_create(label=STRUCTURES_FULL_GROUP_LABEL)

query = orm.QueryBuilder()
query.append(Structure, tag='structure', project=['extras', 'id'])
Expand Down
2 changes: 1 addition & 1 deletion 0-preliminary-do-not-run/oxides/upload-test-structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
STRUCTURES_FULL_GROUP_LABEL = f'acwf-verification/{set_name}/structures/{code_name}'

Structure = DataFactory('structure')
group, created = orm.Group.objects.get_or_create(label=STRUCTURES_FULL_GROUP_LABEL)
group, created = orm.Group.collection.get_or_create(label=STRUCTURES_FULL_GROUP_LABEL)

if not created and len(group.nodes) > 0:
print(f"Stopping, non-empty group '{STRUCTURES_FULL_GROUP_LABEL}' already exists")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_aiida_structures(alats):
print(f"# {len(existing)} structures already in the group")
print(f"# {len(missing)} structures that I will add to the group")

group, _ = Group.objects.get_or_create(label=AIIDA_GROUP_LABEL)
group, _ = Group.collection.get_or_create(label=AIIDA_GROUP_LABEL)
structures_to_add = [all_structures[extras] for extras in missing]
# I need to store all these structures first
for structure in structures_to_add:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_aiida_structures(alats):
print(f"# {len(existing)} structures already in the group")
print(f"# {len(missing)} structures that I will add to the group")

group, _ = Group.objects.get_or_create(label=AIIDA_GROUP_LABEL)
group, _ = Group.collection.get_or_create(label=AIIDA_GROUP_LABEL)
structures_to_add = [all_structures[extras] for extras in missing]
# I need to store all these structures first
for structure in structures_to_add:
Expand Down
4 changes: 2 additions & 2 deletions 1-preliminary/create_starting_subgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def get_plugin_name():
STRUCTURES_FULL_GROUP_LABEL = f'acwf-verification/{SET_NAME}/structures'
STRUCTURES_GROUP_LABEL = f'acwf-verification/{SET_NAME}/structures/{PLUGIN_NAME}'

group = orm.Group.objects.get(label=STRUCTURES_FULL_GROUP_LABEL)
subgroup, _ = orm.Group.objects.get_or_create(label=STRUCTURES_GROUP_LABEL)
group = orm.Group.collection.get(label=STRUCTURES_FULL_GROUP_LABEL)
subgroup, _ = orm.Group.collection.get_or_create(label=STRUCTURES_GROUP_LABEL)

#####################################################################################
## PLUGIN-SPECIFIC PART: ADD THE ELIF FOR YOUR CODE
Expand Down
2 changes: 1 addition & 1 deletion 2-submit/launch_calculations_qe.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_inputs_and_processclass_from_extras(self, extras_values):
'sub_process' : { # optional code-dependent overrides
'base': {
'pw': {
'settings' : orm.Dict(dict= {
'settings' : orm.Dict({
'cmdline': ['-nk', '32'],
})
}
Expand Down
28 changes: 19 additions & 9 deletions 3-analyze/get_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def extract_from_failed(node):
streses=[]
num_atoms = None
num_attempt_vols = 0
for i in node.get_outgoing(link_type=LinkType.CALL_WORK).all():
for i in node.base.links.get_outgoing(link_type=LinkType.CALL_WORK).all():
num_attempt_vols = num_attempt_vols + 1
if i.node.is_finished_ok:
if num_atoms is None:
Expand Down Expand Up @@ -109,8 +109,8 @@ def get_plugin_name():
progress_bar = tqdm.tqdm(wf_nodes)
for node in progress_bar:
structure = node.inputs.structure
element = structure.extras['element']
configuration = structure.extras['configuration']
element = structure.base.extras.all['element']
configuration = structure.base.extras.all['configuration']

uuid_mapping[f'{element}-{configuration}'] = {
'structure': structure.uuid,
Expand Down Expand Up @@ -141,7 +141,7 @@ def get_plugin_name():
# For successfully finished workflows, collect the data from outputs
if node.process_state.value == 'finished' and node.exit_status == 0:
# Extract volumes and energies for this system
outputs = node.get_outgoing(link_type=LinkType.RETURN).nested()
outputs = node.base.links.get_outgoing(link_type=LinkType.RETURN).nested()
for index, sub_structure in sorted(outputs['structures'].items()):
if num_atoms is None:
num_atoms = len(sub_structure.sites)
Expand All @@ -152,7 +152,7 @@ def get_plugin_name():
volumes.append(sub_structure.get_cell_volume())
energy_node = outputs['total_energies'][index]
energies.append(energy_node.value)
parent_workflows_links = energy_node.get_incoming(link_type=LinkType.RETURN).all()
parent_workflows_links = energy_node.base.links.get_incoming(link_type=LinkType.RETURN).all()
parent_workflows = [
triple.node for triple in parent_workflows_links
if issubclass(triple.node.process_class, CommonRelaxWorkChain)]
Expand Down Expand Up @@ -214,8 +214,13 @@ def get_plugin_name():
bulk_modulus_GPa = bulk_modulus_internal * echarge * 1.0e21
#1 eV/Angstrom3 = 160.21766208 GPa
bulk_modulus_ev_ang3 = bulk_modulus_GPa / 160.21766208
data_to_print[(structure.extras['element'], structure.extras['configuration'])] = (
min_volume, E0, bulk_modulus_GPa, bulk_deriv)
data_to_print[
(
structure.base.extras.all['element'], structure.base.extras.all['configuration']
)
] = (
min_volume, E0, bulk_modulus_GPa, bulk_deriv
)
BM_fit_data = {
'min_volume': min_volume,
'E0': E0,
Expand All @@ -224,11 +229,16 @@ def get_plugin_name():
'residuals': residuals[0]
}
if residuals[0] > 1.e-3:
warning_lines.append(f"WARNING! High fit residuals: {residuals[0]} for {structure.extras['element']} {structure.extras['configuration']}")
warning_lines.append(
f"WARNING! High fit residuals: {residuals[0]} for {structure.base.extras.all['element']} "
f"{structure.base.extras.all['configuration']}"
)
except ValueError:
# If we cannot find a minimum
# Note that BM_fit_data was already set to None at the top
warning_lines.append(f"WARNING! Unable to fit for {structure.extras['element']} {structure.extras['configuration']}")
warning_lines.append(
f"WARNING! Unable to fit for {structure.base.extras.all['element']} {structure.base.extras.all['configuration']}"
)

all_eos_data[f'{element}-{configuration}'] = eos_data
num_atoms_in_sim_cell[f'{element}-{configuration}'] = num_atoms
Expand Down