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

Cp2k 2.0 #2672

Merged
merged 284 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
284 commits
Select commit Hold shift + click to select a range
01feaa0
Added a property assignment structure for testing. Tests not yet writ…
nwinner Apr 16, 2021
7f36836
Modified test file. Removed NLCC_POTENTIALS.yaml, which has no use at…
nwinner Apr 16, 2021
f75bf69
Commits to this branch will be updates to defects module. Added WIP u…
nwinner Apr 16, 2021
723df3f
Defect module WIP
nwinner Apr 16, 2021
8356993
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Apr 19, 2021
7306414
Try else got tripped unecessarily. Fixed with conditional.
nwinner Apr 19, 2021
7eaf136
Updated import statement.
nwinner Apr 19, 2021
e5a29e1
Updated import statement.
nwinner Apr 19, 2021
b96c63a
Updated import statement.
nwinner Apr 19, 2021
bb5d688
Fixed charge transfer, which was not working.
nwinner Apr 19, 2021
e050487
Slightly better version of last commit
nwinner Apr 20, 2021
425a1b5
Plotting updates.
nwinner Apr 20, 2021
fcf727c
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Apr 20, 2021
00b28e1
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Apr 27, 2021
9bcfeff
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Apr 29, 2021
dea8525
A very subtle error... Everything in the sets/inputs preserves the
nwinner Apr 29, 2021
63141ad
mypy on github (but not on my machine, oddly) didn't like the use of
nwinner Apr 29, 2021
efa414e
Reorder import. Couple of formatting corrections from pylint.
nwinner Apr 30, 2021
d19cb20
Update plotter.
nwinner May 3, 2021
bf4f4df
Created a polaron class as a child of Substitution.
nwinner May 3, 2021
c79eeff
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 3, 2021
c400b46
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 4, 2021
5408469
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 4, 2021
d9c499d
Merge branch 'site-perturb-patch-2' into CP2K
nwinner May 4, 2021
665ecfc
Trying out a "RelaxationTransformation" to help stitch together the
nwinner May 4, 2021
0b6cecb
Merge branch 'defects' into CP2K
nwinner May 4, 2021
fc936bb
Tweak as_dict() summary.
nwinner May 8, 2021
201c856
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 8, 2021
cbe74b5
The GhostVacancy is a special vacancy object for CP2K calculations where
nwinner May 8, 2021
37528ea
added dtype=object to np.array
nwinner May 8, 2021
2cb78aa
Update import statement
nwinner May 8, 2021
8ff6747
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 8, 2021
8e45ba8
Merge branch 'defects' into CP2K
nwinner May 8, 2021
1fac193
Assembled basis sets, pseudopotential, and DFT+U settings into a single
nwinner May 8, 2021
666f084
Updated in accordance with new settings.yaml file.
nwinner May 8, 2021
35747ec
Update in accordance with new settings.yaml file.
nwinner May 8, 2021
98c6053
Update to one of the hubbard values.
nwinner May 21, 2021
1f9f1d5
Fixed the getting of hubbard values.
nwinner May 21, 2021
2061e28
Updated predominance diagrams
nwinner May 22, 2021
c507209
A temporary measure on my dev branch for avoid Potcar hashing with CP…
nwinner May 22, 2021
3a76562
These files are no longer necessary, as settings.yaml will hold all
nwinner May 22, 2021
5b9e105
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 22, 2021
5176a1f
Merge branch 'defects' into CP2K
nwinner May 22, 2021
93ad9d3
Merge branch 'site-perturb-patch-2' into CP2K
nwinner May 22, 2021
0b19e95
Merge branch 'fdos-patch-1' into CP2K
nwinner May 22, 2021
05a659a
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 22, 2021
6d6ec6c
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 24, 2021
291c2b7
Merge branch 'defects' into CP2K
nwinner May 24, 2021
ba4aed7
Update attribute.
nwinner May 24, 2021
02c9b15
Merge branch 'defects' into CP2K
nwinner May 24, 2021
068aa73
Update attribute
nwinner May 24, 2021
2cab015
Merge branch 'defects' into CP2K
nwinner May 24, 2021
b6a1c42
Update the plot with "combine_charges" to make cleaner figures
nwinner May 24, 2021
35b766a
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 24, 2021
2fdf453
Merge branch 'defects' into CP2K
nwinner May 24, 2021
fd1bc91
Keywords must have strings for names. Numbers will cause problems.
nwinner May 27, 2021
e429b6f
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 27, 2021
1d91d0b
Update to the mo_eigenvalues parsing for non-OT compatability. Parsin…
nwinner Jun 4, 2021
858b052
Update to the file reading. Subsections can have "subsection params",
nwinner Jun 4, 2021
b417e43
Change to default diagonalization params.
nwinner Jun 4, 2021
3fb4319
Update dict band gap.
nwinner Jun 4, 2021
6de76c4
Updating mo_eigenvalues parsing, which is getting troublesome mixing
nwinner Jun 4, 2021
082a916
Modifications to the DOS parser so that its more integrated with the
nwinner Jun 11, 2021
8324167
Update for aux_basis set. "match" keyword will now use primary basis,…
nwinner Jun 22, 2021
4663750
Added aux_basis argument
nwinner Jun 22, 2021
c572b09
Don't assume initial structure was parsed.
nwinner Jun 23, 2021
228ec0a
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Jun 23, 2021
22a5a7f
Need hubbard > 0
nwinner Jul 30, 2021
d79ac35
Update to diagonalization settings.
nwinner Jul 30, 2021
d543a03
Section Lists
nwinner Jul 30, 2021
3cf5f51
Reject if sizes don't match
nwinner Jul 30, 2021
b30f5ac
Testing new plot.
nwinner Jul 30, 2021
9cdcdb0
Merge branch 'defects' into CP2K
nwinner Jul 30, 2021
84b1656
Possible hash for defects.
nwinner Aug 5, 2021
d4d191c
Merge branch 'defects' into CP2K
nwinner Aug 5, 2021
a2ea321
Nevermind.
nwinner Aug 6, 2021
2a807c9
Merge branch 'defects' into CP2K
nwinner Aug 6, 2021
d687442
Remove warning.
nwinner Aug 26, 2021
c021691
Update plus_u and xc_functional
nwinner Aug 26, 2021
d448613
fix
nwinner Aug 26, 2021
a2b5d4a
Update for functional processing. Do not like this as it relies on
nwinner Aug 26, 2021
054e5e5
Still need to figure out how to get mos automatically. Upped it for
nwinner Aug 30, 2021
84d39d3
Change how output parser gets the functional.
nwinner Aug 30, 2021
e3c448b
Use the getattr operation to be case insensitive.
nwinner Aug 31, 2021
fd79445
Update section descriptions.
nwinner Aug 31, 2021
ef47785
So bader can use reference charges with cubes. Will submit patch and …
nwinner Aug 31, 2021
349ea32
This function should not default to cm^-3 units. Most/all of pymatgen…
nwinner Aug 31, 2021
4cff1e4
Dos objects
nwinner Oct 10, 2021
36f3c87
Use structure matcher instead of exact equality to deal with empty
nwinner Oct 10, 2021
13c190c
fixing cube
nwinner Oct 11, 2021
52e9146
Fix for getting items. Now there is a seperate get function for keyword
nwinner Oct 17, 2021
8fa2876
Update to docstring and import.
nwinner Oct 20, 2021
8460d06
Adsorbent class.
nwinner Nov 1, 2021
bbc3624
Concentration should be in formula units by default.
nwinner Nov 2, 2021
f103501
(1) prettier plots
nwinner Nov 2, 2021
98a97c3
Docstring.
nwinner Nov 2, 2021
f175f0f
Merge branch 'defects' into CP2K
nwinner Nov 2, 2021
2be9691
Add rotations
nwinner Nov 5, 2021
0f9c77f
forgot to make msonable
nwinner Nov 5, 2021
f024b7e
Kpoints keyword
nwinner Jan 12, 2022
e955e15
Updates for functionals
nwinner Jan 14, 2022
a691ffd
Parse initial structure
nwinner Jan 14, 2022
c0dd907
Parse initial structure
nwinner Jan 14, 2022
8374e2a
Updates.
nwinner Jan 15, 2022
458f7be
optFIT basis
nwinner Jan 21, 2022
7445c12
Convergence criteria
nwinner Jan 24, 2022
b164c27
Add option for strict updates.
nwinner Jan 28, 2022
797d799
Update hybrid
nwinner Jan 28, 2022
8909471
Update test
nwinner Jan 28, 2022
a232496
Update functionals
nwinner Jan 28, 2022
08bd13b
Add cutoff radius
nwinner Feb 1, 2022
916bc5d
Update core defects
nwinner Feb 3, 2022
ccc58a8
Updates
nwinner Feb 4, 2022
7d07a92
Cutoff radius
nwinner Feb 7, 2022
e3735b8
Fix cutoff
nwinner Feb 8, 2022
198f834
Changes and Fixes
nwinner Feb 23, 2022
2bccb58
Update args
nwinner Feb 25, 2022
557c31f
Fix
nwinner Feb 25, 2022
859c574
stress tensor
nwinner Feb 25, 2022
f6b0aed
Allow positive
nwinner Feb 25, 2022
9bcd04f
Updates
nwinner Feb 28, 2022
b4b6ae7
New Thermo
nwinner Feb 28, 2022
1b5d071
Remove temp
nwinner Feb 28, 2022
b4def3a
SectionList
nwinner Mar 2, 2022
dccf2f9
Double loop
nwinner Mar 3, 2022
b7f211c
Drop undeveloped corrections and work on 2d correction
nwinner Mar 7, 2022
6d5266b
Get section explicit
nwinner Mar 7, 2022
9ed0bc8
Dont check if not running freysoldt
nwinner Mar 7, 2022
7b22aa0
Rename
nwinner Mar 7, 2022
f035319
Squashed commit of the following:
nwinner Mar 7, 2022
3839363
Merge branch 'master' into CP2K
nwinner Mar 7, 2022
7a2b4f9
Redundancy
nwinner Mar 7, 2022
7f4399f
No longer needed. Merge into settings.yaml
nwinner Mar 7, 2022
456837d
Remove DFT plus U logic
nwinner Mar 7, 2022
5552637
Formatting updates
nwinner Mar 7, 2022
46340c0
Deprecation upcoming
nwinner Mar 7, 2022
70d6619
Formatting
nwinner Mar 7, 2022
96cf190
Formatting
nwinner Mar 8, 2022
cb0b94b
Formatting
nwinner Mar 17, 2022
18c9331
Defect Complex and Linting
nwinner Mar 28, 2022
31bacef
Typing
nwinner Mar 28, 2022
34da0ad
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Mar 28, 2022
1c7e5b9
Emergency push
nwinner May 4, 2022
278ed1b
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner May 7, 2022
0c015a0
Update to correction
nwinner May 11, 2022
4479140
Bandstructures
nwinner Sep 7, 2022
406e37d
Revisions and Bandstructure support
nwinner Sep 26, 2022
37c55a2
Kpoints
nwinner Sep 27, 2022
38dade5
Format
nwinner Sep 29, 2022
0e6573f
Merge branch 'master' into CP2K
nwinner Sep 29, 2022
7a08346
Merge branch 'CP2K' into cp2k-2.0
nwinner Sep 29, 2022
45fa838
Revert to master
nwinner Sep 29, 2022
eeb838d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2022
2d2694e
Last minute fix. Needs to access num_kpts
nwinner Sep 30, 2022
66a5717
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Sep 30, 2022
77f92fd
Needs to access num_kpts
nwinner Sep 30, 2022
00e2961
Old test and type check
nwinner Oct 3, 2022
7b32b02
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2022
00bd6e9
Some more lint
nwinner Oct 3, 2022
0d8997c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2022
e998f8f
Unused import
nwinner Oct 4, 2022
f25ae99
Lint
nwinner Oct 4, 2022
28aa088
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 4, 2022
34b8158
override_default_params
nwinner Oct 4, 2022
3b02aba
None->{}
nwinner Oct 4, 2022
4845f17
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 4, 2022
8f9b914
Add self
nwinner Oct 4, 2022
e51ad0e
Loops
nwinner Oct 4, 2022
275e35c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 4, 2022
6127ff9
remove sigma
nwinner Oct 4, 2022
a65dcf1
A few changes to tests and test files
nwinner Oct 11, 2022
e785e87
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 11, 2022
60b0085
fix assert
nwinner Oct 11, 2022
875abdf
AssertEqual
nwinner Oct 12, 2022
d7d47ee
Kpoints
nwinner Oct 13, 2022
ba16821
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Oct 19, 2022
41499da
Dict already preserves ordering since py3.7
nwinner Oct 19, 2022
55371b5
use .items()
nwinner Oct 19, 2022
7ed71c8
EPS_PGF_ORB
nwinner Oct 22, 2022
d93e703
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 22, 2022
80eee1e
Gamma kpoint
nwinner Oct 22, 2022
7f19e88
Merge branch 'master' of https://github.com/materialsproject/pymatgen…
nwinner Oct 22, 2022
6254ac6
Basis and Potential
nwinner Oct 25, 2022
62a685e
None
nwinner Oct 25, 2022
d4481d3
Dict
nwinner Oct 25, 2022
3f752d3
startswith
nwinner Oct 25, 2022
6c430d9
get element
nwinner Oct 25, 2022
70f2f83
kpts
nwinner Oct 25, 2022
08d8a71
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Oct 25, 2022
1bf473c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2022
886b4f8
Only use trunc if periodic
nwinner Oct 26, 2022
110da14
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Oct 26, 2022
3197c33
Only use trunc if periodic
nwinner Oct 26, 2022
6c37a1d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 26, 2022
3a056b1
ADMM Keywords
nwinner Oct 26, 2022
5076c2a
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Oct 26, 2022
4f4f659
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 26, 2022
ed057bd
Activate motion
nwinner Oct 31, 2022
fb3d145
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Oct 31, 2022
24fee15
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2022
177d4e3
Delete
nwinner Oct 31, 2022
0a2d33a
runtype check
nwinner Oct 31, 2022
270ea6e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2022
bc67b88
molecules
nwinner Nov 5, 2022
831539f
processor
nwinner Nov 5, 2022
52dad5c
dft set
nwinner Nov 5, 2022
eef6f3b
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Nov 5, 2022
e19e3cb
multiplicity
nwinner Nov 8, 2022
8635d4d
Exchange correction function
nwinner Nov 15, 2022
c04dfdb
pmg config
nwinner Nov 21, 2022
b3fb40b
Test set
nwinner Nov 21, 2022
39c5e3e
Basis and Potentials
nwinner Nov 21, 2022
5f91e7b
pmg config
nwinner Nov 21, 2022
e77296d
Molecule
nwinner Nov 21, 2022
6e4a79d
kpts
nwinner Nov 30, 2022
c25243a
Some tests
nwinner Dec 15, 2022
62aa692
Test sets
nwinner Dec 15, 2022
45201aa
Lintings
nwinner Dec 15, 2022
6e96116
Merge branch 'master' into cp2k-2.0
nwinner Dec 15, 2022
6746859
Test files and tests
nwinner Dec 15, 2022
845f0c0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2022
61f1afd
Lint
nwinner Dec 15, 2022
cc47309
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2022
258187a
Merge branch 'master' into cp2k-2.0
nwinner Dec 15, 2022
715db18
More lint
nwinner Dec 15, 2022
f1eb8c8
Don't use built-in name
nwinner Dec 15, 2022
aa955b1
list->List, dict->Dict
nwinner Dec 15, 2022
b28ee8e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2022
7e74040
Refactor pydantic to msonable
nwinner Dec 16, 2022
b57b948
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2022
fa5fbc3
Delete settings.yaml
nwinner Dec 16, 2022
41297b4
mypy 0.991 upgrade
nwinner Dec 16, 2022
f9b70ee
Util types and lint
nwinner Dec 16, 2022
7dd9c93
Uncomment a line
nwinner Dec 16, 2022
249eda1
Missing arg
nwinner Dec 16, 2022
e57d2bb
type
nwinner Dec 16, 2022
081b66b
arg
nwinner Dec 16, 2022
3cd8fd8
Dftd3
nwinner Dec 16, 2022
9447f76
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2022
9a898d9
Don't use literal
nwinner Dec 16, 2022
067eaa6
Merge branch 'cp2k-2.0' of https://github.com/nwinner/pymatgen into c…
nwinner Dec 16, 2022
fdecbb4
Json
nwinner Dec 17, 2022
cd0fd89
Test for aux
nwinner Dec 17, 2022
e9a90b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 17, 2022
2ff39ee
Tiny fixes
nwinner Dec 20, 2022
c797b31
rename some vars in pymatgen/cli/pmg_config.py to snake case
janosh Jan 3, 2023
0e6e361
breaking: change CP2K _postprocessor parsing error type from OSError …
janosh Jan 3, 2023
377f6f1
Pre/postprocessor
nwinner Jan 3, 2023
3d0f9d0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2023
52a7500
add return types in pymatgen/io/cp2k/sets.py
janosh Jan 3, 2023
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ repos:
- id: codespell
stages: [commit, commit-msg]
exclude_types: [html]
args: [--ignore-words-list, 'titel,titels,reson,rute,pres,kno']
args: [--ignore-words-list, 'titel,titels,reson,rute,pres,kno,coo']

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
Expand Down
10 changes: 10 additions & 0 deletions pymatgen/cli/pmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ def main():
nargs="+",
help="Variables to add in the form of space separated key value pairs. E.g., PMG_VASP_PSP_DIR ~/psps",
)

groups.add_argument(
"--cp2k",
dest="cp2k_data_dirs",
metavar="dir_name",
nargs=2,
help="Initial directory where the CP2K data is located and the output directory where the "
"CP2K yaml data files will be written",
)

parser_config.add_argument(
"-b",
"--backup",
Expand Down
117 changes: 104 additions & 13 deletions pymatgen/cli/pmg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,105 @@
from pymatgen.core import OLD_SETTINGS_FILE, SETTINGS_FILE


def setup_cp2k_data(cp2k_data_dirs: list[str]) -> None:
"""Setup CP2K basis and potential data directory"""
data_dir, target_dir = (os.path.abspath(dir) for dir in cp2k_data_dirs)
try:
os.mkdir(target_dir)
except OSError:
reply = input("Destination directory exists. Continue (y/n)?")
if reply != "y":
print("Exiting ...")
raise SystemExit(0)
print("Generating pymatgen resource directory for CP2K...")

import glob

from monty.json import jsanitize
from ruamel import yaml

from pymatgen.core import Element
from pymatgen.io.cp2k.inputs import GaussianTypeOrbitalBasisSet, GthPotential
from pymatgen.io.cp2k.utils import chunk

basis_files = glob.glob(os.path.join(data_dir, "*BASIS*"))
potential_files = glob.glob(os.path.join(data_dir, "*POTENTIAL*"))

settings: dict[str, dict] = {str(el): {"potentials": {}, "basis_sets": {}} for el in Element}

for potential_file in potential_files:
print(f"Processing... {potential_file}")
with open(potential_file) as file:
try:
chunks = chunk(file.read())
except IndexError:
continue
for chk in chunks:
try:
potential = GthPotential.from_string(chk)
potential.filename = os.path.basename(potential_file)
potential.version = None
settings[potential.element.symbol]["potentials"][potential.get_hash()] = jsanitize(
potential, strict=True
)
except ValueError:
# Chunk was readable, but the element is not pmg recognized
continue
except IndexError:
# Chunk was readable, but invalid. Mostly likely "N/A" for this potential
continue

for basis_file in basis_files:
print(f"Processing... {basis_file}")
with open(basis_file) as file:
try:
chunks = chunk(file.read())
except IndexError:
continue
for chk in chunks:
try:
basis = GaussianTypeOrbitalBasisSet.from_string(chk)
basis.filename = os.path.basename(basis_file)
settings[basis.element.symbol]["basis_sets"][basis.get_hash()] = jsanitize( # type: ignore
basis, strict=True
)
except ValueError:
# Chunk was readable, but the element is not pmg recognized
continue
except IndexError:
# Chunk was readable, but invalid. Mostly likely "N/A" for this potential
continue

print("Done processing cp2k data files")

for el in settings:
print(f"Writing {el} settings file")
with open(os.path.join(target_dir, el), "w") as file:
yaml.dump(settings.get(el), file, default_flow_style=False)

print(
"\n CP2K resource directory generated. It is recommended that you run:"
f"\n 'pmg config --add PMG_CP2K_DATA_DIR {os.path.abspath(target_dir)}' "
)
print(
"\n It is also recommended that you set the following (with example values):"
"\n 'pmg config --add PMG_DEFAULT_CP2K_FUNCTIONAL PBE' "
"\n 'pmg config --add PMG_DEFAULT_CP2K_BASIS_TYPE TZVP-MOLOPT' "
"\n 'pmg config --add PMG_DEFAULT_CP2K_AUX_BASIS_TYPE pFIT' "
)
print("\n Start a new terminal to ensure that your environment variables are properly set.")


def setup_potcars(potcar_dirs: list[str]):
"""Setup POTCAR directories."""
pspdir, targetdir = (os.path.abspath(d) for d in potcar_dirs)
psp_dir, target_dir = (os.path.abspath(d) for d in potcar_dirs)
try:
os.makedirs(targetdir)
os.makedirs(target_dir)
except OSError:
r = input("Destination directory exists. Continue (y/n)? ")
if r != "y":
reply = input("Destination directory exists. Continue (y/n)? ")
if reply != "y":
print("Exiting ...")
sys.exit(0)
raise SystemExit(0)

print("Generating pymatgen resources directory...")

Expand All @@ -51,18 +140,18 @@ def setup_potcars(potcar_dirs: list[str]):
"potUSPP_GGA": "POT_GGA_US_PW91",
}

for parent, subdirs, _files in os.walk(pspdir):
for parent, subdirs, _files in os.walk(psp_dir):
basename = os.path.basename(parent)
basename = name_mappings.get(basename, basename)
for subdir in subdirs:
filenames = glob.glob(os.path.join(parent, subdir, "POTCAR*"))
if len(filenames) > 0:
try:
basedir = os.path.join(targetdir, basename)
if not os.path.exists(basedir):
os.makedirs(basedir)
base_dir = os.path.join(target_dir, basename)
if not os.path.exists(base_dir):
os.makedirs(base_dir)
fname = filenames[0]
dest = os.path.join(basedir, os.path.basename(fname))
dest = os.path.join(base_dir, os.path.basename(fname))
shutil.copy(fname, dest)
ext = fname.split(".")[-1]
if ext.upper() in ["Z", "GZ"]:
Expand All @@ -73,16 +162,16 @@ def setup_potcars(potcar_dirs: list[str]):
p.communicate()
if subdir == "Osmium":
subdir = "Os"
dest = os.path.join(basedir, f"POTCAR.{subdir}")
shutil.move(os.path.join(basedir, "POTCAR"), dest)
dest = os.path.join(base_dir, f"POTCAR.{subdir}")
shutil.move(os.path.join(base_dir, "POTCAR"), dest)
with subprocess.Popen(["gzip", "-f", dest]) as p:
p.communicate()
except Exception as ex:
print(f"An error has occurred. Message is {str(ex)}. Trying to continue... ")

print(
"\nPSP resources directory generated. It is recommended that you "
f"run 'pmg config --add PMG_VASP_PSP_DIR {os.path.abspath(targetdir)}'"
f"run 'pmg config --add PMG_VASP_PSP_DIR {os.path.abspath(target_dir)}'"
)
print("Start a new terminal to ensure that your environment variables are properly set.")

Expand Down Expand Up @@ -209,3 +298,5 @@ def configure_pmg(args: Namespace):
install_software(args.install)
elif args.var_spec:
add_config_var(args.var_spec, args.backup)
elif args.cp2k_data_dirs:
setup_cp2k_data(args.cp2k_data_dirs)
5 changes: 3 additions & 2 deletions pymatgen/entries/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,9 @@ def get_adjustments(self, entry: AnyComputedEntry) -> list[EnergyAdjustment]:

# check the POTCAR symbols
# this should return ufloat(0, 0) or raise a CompatibilityError or ValueError
pc = PotcarCorrection(MPRelaxSet, check_hash=self.check_potcar_hash)
pc.get_correction(entry)
if entry.parameters.get("software", "vasp") == "vasp":
pc = PotcarCorrection(MPRelaxSet, check_hash=self.check_potcar_hash)
pc.get_correction(entry)

# apply energy adjustments
adjustments: list[CompositionEnergyAdjustment] = []
Expand Down
Loading