diff --git a/aiida_crystal_dft/data/basis.py b/aiida_crystal_dft/data/basis.py index a4ea43a..6342166 100644 --- a/aiida_crystal_dft/data/basis.py +++ b/aiida_crystal_dft/data/basis.py @@ -33,7 +33,7 @@ class CrystalBasisData(Dict): @property def md5(self): """ md5 hash of the basis set """ - return self.get_attribute('md5', default=None) + return self.base.attributes.get('md5', default=None) @property def element(self): @@ -124,7 +124,7 @@ def store(self): md5_hash = md5(self.get_dict()) if self.from_md5(md5_hash): raise UniquenessError("Basis with MD5 hash {} has already found in the database!".format(md5_hash)) - self.set_attribute("md5", md5_hash) + self.base.attributes.set("md5", md5_hash) return super(CrystalBasisData, self).store() def _get_occupations(self): diff --git a/aiida_crystal_dft/data/basis_family.py b/aiida_crystal_dft/data/basis_family.py index 9fb480f..ded9218 100644 --- a/aiida_crystal_dft/data/basis_family.py +++ b/aiida_crystal_dft/data/basis_family.py @@ -72,7 +72,7 @@ def get_or_create(cls, name, basis_sets=None): def add(self, basis_sets): """Adds basis sets to family""" - group, group_created = Group.objects.get_or_create(label=self.name, + group, group_created = Group.collection.get_or_create(label=self.name, type_string=BASIS_FAMILY_TYPE, user=get_automatic_user()) # validate basis sets @@ -104,18 +104,18 @@ def get_basis(self, element): @property def group(self): - _group, _ = Group.objects.get_or_create(label=self.name, + _group, _ = Group.collection.get_or_create(label=self.name, type_string=BASIS_FAMILY_TYPE, user=get_automatic_user()) return _group @property def name(self): - return self.get_attribute("name", default=None) + return self.base.attributes.get("name", default=None) @name.setter def name(self, value): - self.set_attribute("name", value) + self.base.attributes.set("name", value) def set_name(self, name): # check name for this instance @@ -238,7 +238,7 @@ def get_families(cls, filter_elements=None, user=None): group_query_params = {"type_string": BASIS_FAMILY_TYPE} if user is not None: group_query_params['user'] = user - basis_groups = Group.objects.find(filters=group_query_params) + basis_groups = Group.collection.find(filters=group_query_params) predefined_bases = [b for b in cls._get() if b.predefined] if isinstance(filter_elements, str): filter_elements = [filter_elements] diff --git a/aiida_crystal_dft/tests/fixtures/calculations.py b/aiida_crystal_dft/tests/fixtures/calculations.py index 6158b82..61c4d65 100644 --- a/aiida_crystal_dft/tests/fixtures/calculations.py +++ b/aiida_crystal_dft/tests/fixtures/calculations.py @@ -74,8 +74,8 @@ def get_calcnode(files=None, prefix="mgo_sto3g"): process_type = 'aiida.calculations:{}'.format('crystal_dft.serial') node = CalcJobNode(computer=aiida_localhost, process_type=process_type) node.set_process_label('CrystalSerialCalculation') - node.set_attribute('input_filename', 'INPUT') - node.set_attribute('output_filename', 'crystal.out') + node.base.attributes.set('input_filename', 'INPUT') + node.base.attributes.set('output_filename', 'crystal.out') node.set_option('resources', {'num_machines': 1, 'num_mpiprocs_per_machine': 1}) node.add_incoming(crystal_calc_inputs.code, link_type=LinkType.INPUT_CALC, link_label='code') # store inputs @@ -120,9 +120,9 @@ def get_calcnode(files=None): node = CalcJobNode(computer=aiida_localhost, process_type=process_type) node.set_process_label('PropertiesCalculation') node.set_option('resources', {'num_machines': 1, 'num_mpiprocs_per_machine': 1}) - node.set_attribute('input_filename', 'INPUT') - node.set_attribute('output_filename', '_scheduler-stderr.txt') - node.set_attribute('error_filename', '_scheduler-stderr.txt') + node.base.attributes.set('input_filename', 'INPUT') + node.base.attributes.set('output_filename', '_scheduler-stderr.txt') + node.base.attributes.set('error_filename', '_scheduler-stderr.txt') # store inputs for calc_input in ("parameters", "wavefunction"): properties_calc_inputs[calc_input].store() diff --git a/aiida_crystal_dft/tests/utils.py b/aiida_crystal_dft/tests/utils.py index de7fbbc..89fe454 100644 --- a/aiida_crystal_dft/tests/utils.py +++ b/aiida_crystal_dft/tests/utils.py @@ -6,7 +6,7 @@ def get_current_user(): """Returns the current AiiDA user""" - return User.objects.get_default() + return User.collection.get_default() def get_authinfo(computer): diff --git a/aiida_crystal_dft/utils/__init__.py b/aiida_crystal_dft/utils/__init__.py index b6e9f7f..1fcd3ff 100644 --- a/aiida_crystal_dft/utils/__init__.py +++ b/aiida_crystal_dft/utils/__init__.py @@ -44,7 +44,7 @@ def get_data_class(data_type): def get_automatic_user(): from aiida.orm import User - return User.objects.get_default() + return User.collection.get_default() def recursive_update(d, u): diff --git a/pyproject.toml b/pyproject.toml index 8bd944c..c1acc36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,8 @@ requires-python = ">=3.8" dependencies = [ "numpy >= 1.17.5", "scipy >= 1.2.1", - "aiida-core >= 2.0.2", - "pycrystal >= 1.0.10", + "aiida-core >= 2.5.1", + "pycrystal >= 1.0.16", "mpds_client >= 0.24", "pyparsing > 2.3.1", "ase >= 3.19",