Data query in MgO band structure tutorial

I had a problem with querying the data in the tutorial that pymongo couldn’t find any firetask with label. Wondering where went wrong?

from atomate.vasp.database import VaspCalcDb
from pymatgen.electronic_structure.plotter import DosPlotter, BSPlotter
PATH_TO_MY_DB_JSON = '/path/to/db.json'
atomate_db = VaspCalcDb.from_db_file(PATH_TO_MY_DB_JSON)

line_bs_entry = atomate_db.collection.find_one({'task_label': 'nscf line', 'formula_pretty': 'MgO'})

Return None, but the workflow is there and calculation has finished. If I try,

line_bs_entry = atomate_db.collection.find_one()

return

{‘_id’: ObjectId(‘5cc022227f39695c8df0e9fc’),
‘links’: {‘18’: [], ‘19’: [], ‘20’: [19, 18], ‘21’: [20]},
‘parent_links’: {‘19’: [20], ‘18’: [20], ‘20’: [21]},
‘nodes’: [18, 19, 20, 21],
‘metadata’: {‘structure’: {‘@module’: ‘pymatgen.core.structure’,
@class’: ‘Structure’,
‘charge’: None,
‘lattice’: {‘matrix’: [[2.606553, 0.0, 1.504894],
[0.868851, 2.457482, 1.504894],
[0.0, 0.0, 3.009788]],
‘a’: 3.0097881143105405,
‘b’: 3.0097883300592754,
‘c’: 3.009788,
‘alpha’: 60.000003627588235,
‘beta’: 60.00000125635496,
‘gamma’: 60.000003208803285,
‘volume’: 19.279368831332597},
‘sites’: [{‘species’: [{‘element’: ‘O’, ‘occu’: 1}],
‘abc’: [0.5, 0.5, 0.5],
‘xyz’: [1.737702, 1.228741, 3.009788],
‘label’: ‘O’,
‘properties’: {}},
{‘species’: [{‘element’: ‘Mg’, ‘occu’: 1}],
‘abc’: [0.0, 0.0, 0.0],
‘xyz’: [0.0, 0.0, 0.0],
‘label’: ‘Mg’,
‘properties’: {}}]},
‘nsites’: 2,
‘elements’: [‘Mg’, ‘O’],
‘nelements’: 2,
‘formula’: ‘Mg1 O1’,
‘formula_pretty’: ‘MgO’,
‘formula_reduced_abc’: ‘Mg1 O1’,
‘formula_anonymous’: ‘AB’,
‘chemsys’: ‘Mg-O’,
‘is_ordered’: True,
‘is_valid’: True},
‘state’: ‘FIZZLED’,
‘name’: ‘MgO’,
‘created_on’: datetime.datetime(2019, 4, 24, 8, 45, 20, 989000),
‘updated_on’: datetime.datetime(2019, 4, 24, 16, 42, 56, 608000),
‘fw_states’: {‘21’: ‘COMPLETED’,
‘20’: ‘COMPLETED’,
‘19’: ‘FIZZLED’,
‘18’: ‘COMPLETED’}}

Hi Zezhong

It looks like you are querying the wrong database. It seems your path/to/db.json right now likely contains credentials to connect to your “FireWorks” database, and the “workflows” collection.

You want to instead connect to the “tasks” collection in whatever database you have set up to store tasks.

···

On Wednesday, May 1, 2019 at 11:45:57 PM UTC-7, Zezhong Zhang wrote:

I had a problem with querying the data in the tutorial that pymongo couldn’t find any firetask with label. Wondering where went wrong?

from atomate.vasp.database import VaspCalcDb
from pymatgen.electronic_structure.plotter import DosPlotter, BSPlotter
PATH_TO_MY_DB_JSON = '/path/to/db.json'
atomate_db = VaspCalcDb.from_db_file(PATH_TO_MY_DB_JSON)

line_bs_entry = atomate_db.collection.find_one({'task_label': 'nscf line', 'formula_pretty': 'MgO'})

Return None, but the workflow is there and calculation has finished. If I try,

line_bs_entry = atomate_db.collection.find_one()

return

{‘_id’: ObjectId(‘5cc022227f39695c8df0e9fc’),
‘links’: {‘18’: [], ‘19’: [], ‘20’: [19, 18], ‘21’: [20]},
‘parent_links’: {‘19’: [20], ‘18’: [20], ‘20’: [21]},
‘nodes’: [18, 19, 20, 21],
‘metadata’: {‘structure’: {‘@module’: ‘pymatgen.core.structure’,
@class’: ‘Structure’,
‘charge’: None,
‘lattice’: {‘matrix’: [[2.606553, 0.0, 1.504894],
[0.868851, 2.457482, 1.504894],
[0.0, 0.0, 3.009788]],
‘a’: 3.0097881143105405,
‘b’: 3.0097883300592754,
‘c’: 3.009788,
‘alpha’: 60.000003627588235,
‘beta’: 60.00000125635496,
‘gamma’: 60.000003208803285,
‘volume’: 19.279368831332597},
‘sites’: [{‘species’: [{‘element’: ‘O’, ‘occu’: 1}],
‘abc’: [0.5, 0.5, 0.5],
‘xyz’: [1.737702, 1.228741, 3.009788],
‘label’: ‘O’,
‘properties’: {}},
{‘species’: [{‘element’: ‘Mg’, ‘occu’: 1}],
‘abc’: [0.0, 0.0, 0.0],
‘xyz’: [0.0, 0.0, 0.0],
‘label’: ‘Mg’,
‘properties’: {}}]},
‘nsites’: 2,
‘elements’: [‘Mg’, ‘O’],
‘nelements’: 2,
‘formula’: ‘Mg1 O1’,
‘formula_pretty’: ‘MgO’,
‘formula_reduced_abc’: ‘Mg1 O1’,
‘formula_anonymous’: ‘AB’,
‘chemsys’: ‘Mg-O’,
‘is_ordered’: True,
‘is_valid’: True},
‘state’: ‘FIZZLED’,
‘name’: ‘MgO’,
‘created_on’: datetime.datetime(2019, 4, 24, 8, 45, 20, 989000),
‘updated_on’: datetime.datetime(2019, 4, 24, 16, 42, 56, 608000),
‘fw_states’: {‘21’: ‘COMPLETED’,
‘20’: ‘COMPLETED’,
‘19’: ‘FIZZLED’,
‘18’: ‘COMPLETED’}}

Dear Anubhav,

You are right! The credentials was indeed directed to the “workflow” collection instead of “tasks” collection. Many thanks for your kind help!

After assigning the right collection, I can finally finish the tutorial.

Looking forward to getting work started!

Cheers,

Zezhong

···

On 10 May 2019, at 19:57, Anubhav Jain <[email protected]> wrote:

Hi Zezhong

It looks like you are querying the wrong database. It seems your path/to/db.json right now likely contains credentials to connect to your "FireWorks" database, and the "workflows" collection.

You want to instead connect to the "tasks" collection in whatever database you have set up to store tasks.

On Wednesday, May 1, 2019 at 11:45:57 PM UTC-7, Zezhong Zhang wrote:
I had a problem with querying the data in the tutorial that pymongo couldn't find any firetask with label. Wondering where went wrong?

from atomate.vasp.database import
VaspCalcDb

from pymatgen.electronic_structure.plotter import
DosPlotter, BSPlotter
PATH_TO_MY_DB_JSON =
'/path/to/db.json'

atomate_db = VaspCalcDb.from_db_file(PATH_
TO_MY_DB_JSON)

line_bs_entry = atomate_db.collection.find_
one({'task_label': 'nscf line', 'formula_pretty': 'MgO'})

Return None, but the workflow is there and calculation has finished. If I try,

line_bs_entry = atomate_db.collection.find_
one()

return

{‘_id’: ObjectId(‘5cc022227f39695c8df0e9fc’),
‘links’: {‘18’: [], ‘19’: [], ‘20’: [19, 18], ‘21’: [20]},
‘parent_links’: {‘19’: [20], ‘18’: [20], ‘20’: [21]},
‘nodes’: [18, 19, 20, 21],
‘metadata’: {‘structure’: {‘@module’: ‘pymatgen.core.structure’,
@class’: ‘Structure’,
‘charge’: None,
‘lattice’: {‘matrix’: [[2.606553, 0.0, 1.504894],
[0.868851, 2.457482, 1.504894],
[0.0, 0.0, 3.009788]],
‘a’: 3.0097881143105405,
‘b’: 3.0097883300592754,
‘c’: 3.009788,
‘alpha’: 60.000003627588235,
‘beta’: 60.00000125635496,
‘gamma’: 60.000003208803285,
‘volume’: 19.279368831332597},
‘sites’: [{‘species’: [{‘element’: ‘O’, ‘occu’: 1}],
‘abc’: [0.5, 0.5, 0.5],
‘xyz’: [1.737702, 1.228741, 3.009788],
‘label’: ‘O’,
‘properties’: {}},
{‘species’: [{‘element’: ‘Mg’, ‘occu’: 1}],
‘abc’: [0.0, 0.0, 0.0],
‘xyz’: [0.0, 0.0, 0.0],
‘label’: ‘Mg’,
‘properties’: {}}]},
‘nsites’: 2,
‘elements’: [‘Mg’, ‘O’],
‘nelements’: 2,
‘formula’: ‘Mg1 O1’,
‘formula_pretty’: ‘MgO’,
‘formula_reduced_abc’: ‘Mg1 O1’,
‘formula_anonymous’: ‘AB’,
‘chemsys’: ‘Mg-O’,
‘is_ordered’: True,
‘is_valid’: True},
‘state’: ‘FIZZLED’,
‘name’: ‘MgO’,
‘created_on’: datetime.datetime(2019, 4, 24, 8, 45, 20, 989000),
‘updated_on’: datetime.datetime(2019, 4, 24, 16, 42, 56, 608000),
‘fw_states’: {‘21’: ‘COMPLETED’,
‘20’: ‘COMPLETED’,
‘19’: ‘FIZZLED’,
‘18’: ‘COMPLETED’}}

--
You received this message because you are subscribed to the Google Groups "atomate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/atomate/53508de6-e4c2-4486-8fea-7a60e2bd7f97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.