This page was generated from docs/source/user_guide/calc_main_immigrant.ipynb,
with configuration: sphinx_ipypublish_all.ext.noexec
Main Calculation Immigration¶
In order to immigrate existing CRYSTAL17 calculations, the
aiida_crystal17.immigration
module has been created to take a
.d12
and .out
file set and replicate a crystal17.main
calculation:
Note
This approach may be subject to change, if a general approach is developed for immigrant calculations (see this ongoing issue).
In:
from aiida import load_profile
profile = load_profile()
import os
from aiida_crystal17.tests import TEST_FILES
from aiida_crystal17.tests.utils import (
get_or_create_local_computer, get_or_create_code,
get_default_metadata)
from aiida_crystal17.immigration.create_inputs import populate_builder
from aiida_crystal17.immigration.create_calcjob import immigrate_existing
from aiida_crystal17.common import display_json
from aiida.orm import Code, RemoteData
from aiida.common.folders import Folder
from aiida.tools.visualization import Graph
aiida_crystal17.immigration.create_inputs.populate_builder()
will create an input builder for the crystal17.main
calculation,
from a FolderData
node, populated with the files, and a Code
node.
In:
computer = get_or_create_local_computer('work_directory', 'localhost')
code = get_or_create_code('crystal17.main', computer, 'mock_crystal17')
In:
metadata = get_default_metadata()
metadata['options'].update({
"input_file_name": 'INPUT',
"output_main_file_name": "main.out"
})
remote = RemoteData(
remote_path=os.path.join(
TEST_FILES, "crystal", "nio_sto3g_afm_opt"),
computer=computer)
builder = populate_builder(
remote, code=code,
metadata=metadata)
display_json(builder)
{
"metadata": {
"options": {
"resources": {
"num_machines": 1,
"num_mpiprocs_per_machine": 1
},
"max_wallclock_seconds": 1800,
"withmpi": false,
"input_file_name": "INPUT",
"output_main_file_name": "main.out"
},
"dry_run": false
},
"basissets": {
"Ni": [
"uuid: 7f91a637-a366-47f1-9ce3-7e017c82b5a2 (pk: 43)"
],
"O": [
"uuid: c3af1c12-115e-44b2-8106-2f79ba8110a7 (pk: 44)"
]
},
"parameters": [
"uuid: 635dd759-2b98-46cb-8d5d-74749607cba2 (unstored)"
],
"structure": [
"uuid: cca36a57-1dd2-4ca1-97b1-d3660391e9d6 (unstored)"
],
"symmetry": [
"uuid: 63042ccb-0a15-4578-89ee-b30e92c523b6 (unstored)"
],
"kinds": [
"uuid: 9a7317e7-8e35-4bf8-bd59-2e57f8e24acb (unstored)"
],
"code": [
"Remote code 'crystal17.main-mock_crystal17@localhost' on localhost,",
"pk: 23, uuid: 8451bd5e-397a-4014-9982-340b571a48c8"
]
}
aiida_crystal17.immigration.create_calcjob.immigrate_existing()
creates a CalcJobNode
and uses the above function, and the
crystal17.main
parser, to create and attach incoming and outgoing
nodes, replicating a full calculation.
In:
calc_node = immigrate_existing(
builder, remote)
calc_node
Out:
<CalcJobNode: uuid: 8ce940ed-cbfd-48ad-843d-51a99a831d29 (pk: 182) (aiida.calculations:crystal17.main)>
In:
graph = Graph(graph_attr={'size': "6,8!", "rankdir": "LR"})
graph.add_node(calc_node)
graph.add_incoming(calc_node, annotate_links="both")
graph.add_outgoing(calc_node, annotate_links="both")
graph.graphviz
Out:
In:
calc_node.attributes
Out:
{'sealed': True,
'version': {'core': '1.0.0b5', 'plugin': '0.9.0b5'},
'withmpi': False,
'resources': {'num_machines': 1, 'num_mpiprocs_per_machine': 1},
'append_text': '',
'exit_status': 0,
'parser_name': 'crystal17.main',
'prepend_text': '',
'process_label': 'CryMainCalculation',
'process_state': 'finished',
'retrieve_list': ['main.out',
'fort.34',
'HESSOPT.DAT',
'_scheduler-stdout.txt',
'_scheduler-stderr.txt'],
'remote_workdir': '/Users/cjs14/GitHub/aiida-crystal17/aiida_crystal17/tests/raw_files/crystal/nio_sto3g_afm_opt',
'input_file_name': 'INPUT',
'scheduler_stderr': '_scheduler-stderr.txt',
'scheduler_stdout': '_scheduler-stdout.txt',
'mpirun_extra_params': [],
'environment_variables': {},
'max_wallclock_seconds': 1800,
'output_main_file_name': 'main.out',
'import_sys_environment': True,
'retrieve_temporary_list': ['opt[ac][0-9][0-9][0-9]'],
'custom_scheduler_commands': ''}
In:
calc_node.extras
Out:
{'immigrated': True,
'_aiida_hash': '5ad21255cb9b23b804a331c0bddb00110de0fffa09e5c7e7cc5d9ba7de948a70',
'immigration_func': 'aiida_crystal17.immigration.create_calcjob'}
In:
display_json(calc_node.outputs.results.attributes)
{
"units": {
"angle": "degrees",
"energy": "eV",
"length": "angstrom",
"conversion": "CODATA2014"
},
"energy": -85125.876675219,
"errors": [],
"header": {
"crystal_version": 17,
"crystal_subversion": "1.0.1"
},
"volume": 42.49241208568,
"warnings": [
"WARNING **** INT_SCREEN **** CELL PARAMETERS OPTIMIZATION ONLY"
],
"calculation": {
"n_ao": 46,
"spin": true,
"type": "unrestricted open shell",
"n_atoms": 4,
"n_shells": 14,
"n_symops": 16,
"n_core_el": 40,
"n_electrons": 72,
"n_kpoints_ibz": 75,
"n_kpoints_gilat": 75
},
"energy_units": "eV",
"parser_class": "CryMainParser",
"parser_errors": [],
"mulliken_spins": [
3.234,
-3.234,
-0.172,
0.172
],
"opt_iterations": 19,
"parser_version": "0.9.0b5",
"scf_iterations": 16,
"number_of_atoms": 4,
"parser_warnings": [],
"mulliken_charges": [
0.363,
0.363,
-0.363,
-0.363
],
"parser_exceptions": [],
"mulliken_electrons": [
27.637,
27.637,
8.363,
8.363
],
"mulliken_spin_total": 0.0,
"number_of_assymetric": 4,
"execution_time_seconds": 3018
}