# Create a bandstructure from the workflow from the atomate presets
import numpy as np
from pymatgen.core import Structure
from fireworks import LaunchPad
from atomate.vasp.workflows.presets.core import wf_bandstructure
from atomate.vasp.powerups import add_modify_incar
# load structure from file
struct = Structure.from_file('POSCAR') # note: many file formats supported, see function docs
# create the Workflow
wf = wf_bandstructure(struct)
# finally, instatiate the LaunchPad and add the workflow to it
lpad = LaunchPad.auto_load() # loads this based on the FireWorks configuration
lpad.add_wf(wf)
(3.12) [xys@master test]$ python test.py
Traceback (most recent call last):
File "/home/xys/test/test.py", line 15, in
lpad.add_wf(wf)
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/fireworks/core/launchpad.py", line 399, in add_wf
self.workflows.insert_one(wf.to_db_dict())
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/collection.py", line 658, in insert_one
self._insert_one(
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/collection.py", line 598, in _insert_one
self.__database.client._retryable_write(
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1575, in _retryable_write
return self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1461, in _retry_with_session
return self._retry_internal(
^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/_csot.py", line 108, in csot_wrapper
return func(self, *args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1507, in _retry_internal
).run()
^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 2353, in run
return self._read() if self._is_read else self._write()
^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 2470, in _write
return self._func(self._session, conn, self._retryable) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/collection.py", line 586, in _insert_command
result = conn.command(
^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/helpers.py", line 342, in inner
return func(args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/pool.py", line 1017, in command
self._raise_connection_failure(error)
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/pool.py", line 989, in command
return command(
^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/network.py", line 152, in command
request_id, msg, size, max_doc_size = message._op_msg(
^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/message.py", line 758, in _op_msg
return _op_msguncompressed(flags, command, identifier, docs, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bson.errors.InvalidDocument: cannot encode object: True, of type: <class 'numpy.bool'>
(3.12) [xys@master test]$ python test.py Traceback (most recent call last): File "/home/xys/test/test.py", line 15, in
lpad.add_wf(wf)
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/fireworks/core/launchpad.py", line 399, in add_wf
self.workflows.insert_one(wf.to_db_dict())
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/collection.py", line 658, in insert_one
self._insert_one(
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/collection.py", line 598, in _insert_one
self.__database.client._retryable_write(
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1575, in _retryable_write
return self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1461, in _retry_with_session
return self._retry_internal(
^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/_csot.py", line 108, in csot_wrapper
return func(self, *args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1507, in _retry_internal
).run()
^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 2353, in run
return self._read() if self._is_read else self._write()
^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/mongo_client.py", line 2470, in _write
return self._func(self._session, conn, self._retryable) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/collection.py", line 586, in _insert_command
result = conn.command(
^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/helpers.py", line 342, in inner
return func(args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/pool.py", line 1017, in command
self._raise_connection_failure(error)
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/pool.py", line 989, in command
return command(
^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/network.py", line 152, in command
request_id, msg, size, max_doc_size = message._op_msg(
^^^^^^^^^^^^^^^^
File "/home/xys/miniconda3/envs/3.12/lib/python3.12/site-packages/pymongo/message.py", line 758, in _op_msg
return _op_msguncompressed(flags, command, identifier, docs, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bson.errors.InvalidDocument: cannot encode object: True, of type: <class 'numpy.bool'>