From c2d3658e59daf19d8c2e8e14902236f65123bd07 Mon Sep 17 00:00:00 2001 From: Mingqing Liao Date: Sun, 17 Jul 2022 09:14:45 +0800 Subject: [PATCH 1/3] collection.update is removed in PyMongo 4+ collection.update is removed https://pymongo.readthedocs.io/en/stable/migrate-to-pymongo4.html#collection-update-is-removed --- dfttk/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dfttk/utils.py b/dfttk/utils.py index 2fdefd69..12ee3b6e 100644 --- a/dfttk/utils.py +++ b/dfttk/utils.py @@ -518,9 +518,9 @@ def mark_adopted_TF(tag, db_file, adpoted, phonon=False): t_file = loadfn(config_to_dict()["FWORKER_LOC"])["env"]["db_file"] vasp_db = VaspCalcDb.from_db_file(t_file, admin=True) if vasp_db: - vasp_db.collection.update({'metadata.tag': tag}, {'$set': {'adopted': adpoted}}, upsert = True, multi = True) + vasp_db.collection.update_many({'metadata.tag': tag}, {'$set': {'adopted': adpoted}}, upsert = True) if phonon: - vasp_db.db['phonon'].update({'metadata.tag': tag}, {'$set': {'adopted': adpoted}}, upsert = True, multi = True) + vasp_db.db['phonon'].update_many({'metadata.tag': tag}, {'$set': {'adopted': adpoted}}, upsert = True) def mark_adopted(tag, db_file, volumes, phonon=False): @@ -532,11 +532,11 @@ def mark_adopted(tag, db_file, volumes, phonon=False): t_file = loadfn(config_to_dict()["FWORKER_LOC"])["env"]["db_file"] vasp_db = VaspCalcDb.from_db_file(t_file, admin=True) for volume in volumes: - vasp_db.collection.update({'$and':[ {'metadata.tag': tag}, {'output.structure.lattice.volume': volume} ]}, - {'$set': {'adopted': True}}, upsert = True, multi = False) # Mark only one + vasp_db.collection.update_one({'$and':[ {'metadata.tag': tag}, {'output.structure.lattice.volume': volume} ]}, + {'$set': {'adopted': True}}, upsert = True) # Mark only one if phonon: - vasp_db.db['phonon'].update({'$and':[ {'metadata.tag': tag}, {'volume': volume} ]}, - {'$set': {'adopted': True}}, upsert = True, multi = False) + vasp_db.db['phonon'].update_one({'$and':[ {'metadata.tag': tag}, {'volume': volume} ]}, + {'$set': {'adopted': True}}, upsert = True) def consistent_check_db(db_file, tag): From f1e4cd02982a5e25d7fea36a2d8dbb4c78863f23 Mon Sep 17 00:00:00 2001 From: Mingqing Liao Date: Mon, 18 Jul 2022 16:15:33 +0800 Subject: [PATCH 2/3] Update setup.py The files in dfttk/analysis/database is required. It should included into package_data --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6df8657e..c79ed612 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,8 @@ def readme(): version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), - package_data = {'dfttk.structure_builders' : ["prototype_anrl.all", "aflow_prototype_db.json"]}, + package_data = {'dfttk.structure_builders' : ["prototype_anrl.all", "aflow_prototype_db.json"], + 'dfttk.analysis' : ['database/*']}, description='Density functional theory workflows for finite temperature thermodynamics based on atomate workflows. Created by the Phases Research Lab', long_description=readme(), install_requires=['atomate>=0.9.4', 'tinydb', 'phonopy', 'ase', 'pymatgen', 'numpy>=1.20.1'], From b8b9309c1aa6cc02495577106b60cf20239646c6 Mon Sep 17 00:00:00 2001 From: Mingqing Liao Date: Fri, 14 Apr 2023 22:13:21 +0800 Subject: [PATCH 3/3] override_symmetry_tolerance Error on updating the override_symmetry_tolerance from SETTINGS.yaml --- dfttk/fworks.py | 2 +- dfttk/wflows.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dfttk/fworks.py b/dfttk/fworks.py index d77ea9d9..4309d534 100644 --- a/dfttk/fworks.py +++ b/dfttk/fworks.py @@ -169,7 +169,7 @@ def __init__(self, structure, isif=7, name="structure optimization", isif4=False t.append(PassCalcLocs(name=name)) if db_insert: t.append(VaspToDb(db_file=">>db_file<<", additional_fields={"task_label": name, "metadata": metadata}, store_volumetric_data=store_volumetric_data)) - t.append(CheckSymmetryToDb(db_file=">>db_file<<", tag=tag, site_properties=site_properties)) + t.append(CheckSymmetryToDb(db_file=">>db_file<<", tag=tag, site_properties=site_properties, override_symmetry_tolerances=override_symmetry_tolerances)) common_kwargs = {'vasp_cmd': vasp_cmd, 'db_file': ">>db_file<<", "metadata": metadata, "tag": tag, 'override_default_vasp_params': override_default_vasp_params} diff --git a/dfttk/wflows.py b/dfttk/wflows.py index a7089e65..a385655f 100644 --- a/dfttk/wflows.py +++ b/dfttk/wflows.py @@ -64,7 +64,7 @@ def get_wf_EV_bjb(structure, deformation_fraction=(-0.08, 0.12), store_volumetri struct = deepcopy(structure) struct.scale_lattice(defo) full_relax_fw = RobustOptimizeFW(struct, isif=5, vasp_cmd=VASP_CMD, db_file=DB_FILE, - store_volumetric_data=store_volumetric_data) + store_volumetric_data=store_volumetric_data, override_symmetry_tolerances=override_symmetry_tolerances) fws.append(full_relax_fw) if metadata is not None and all(x in metadata for x in ('phase_name', 'sublattice_configuration')): # create a nicer name for the workflow