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

Add further tweaking for more recent AiiDA versions #69

Open
wants to merge 1 commit into
base: master
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
4 changes: 2 additions & 2 deletions aiida_crystal_dft/data/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions aiida_crystal_dft/data/basis_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions aiida_crystal_dft/tests/fixtures/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion aiida_crystal_dft/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion aiida_crystal_dft/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading