url
stringlengths 63
66
| repository_url
stringclasses 1
value | labels_url
stringlengths 77
80
| comments_url
stringlengths 72
75
| events_url
stringlengths 70
73
| html_url
stringlengths 52
56
| id
int64 3.39M
3.04B
| node_id
stringlengths 18
32
| number
int64 1
4.39k
| title
stringlengths 3
367
| user
dict | labels
listlengths 0
5
| state
stringclasses 2
values | locked
bool 2
classes | assignee
dict | assignees
listlengths 0
2
| milestone
null | comments
listlengths 0
30
| created_at
timestamp[s]date 2012-02-26 12:10:46
2025-05-02 18:11:41
| updated_at
timestamp[s]date 2012-02-26 14:52:41
2025-05-02 18:16:27
| closed_at
stringlengths 0
20
| author_association
stringclasses 3
values | type
stringclasses 1
value | active_lock_reason
stringclasses 2
values | sub_issues_summary
dict | body
stringlengths 0
119k
| closed_by
dict | reactions
dict | timeline_url
stringlengths 72
75
| performed_via_github_app
null | state_reason
stringclasses 4
values | is_pull_request
bool 2
classes | draft
bool 2
classes | pull_request
dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
https://api.github.com/repos/materialsproject/pymatgen/issues/3670
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3670/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3670/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3670/events
|
https://github.com/materialsproject/pymatgen/pull/3670
| 2,167,476,811
|
PR_kwDOACgets5on73O
| 3,670
|
Ensure `MSONAtoms` is indeed `MSONable` when `Atoms.info` is loaded with goodies
|
{
"login": "Andrew-S-Rosen",
"id": 8674072,
"node_id": "MDQ6VXNlcjg2NzQwNzI=",
"avatar_url": "https://avatars.githubusercontent.com/u/8674072?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Andrew-S-Rosen",
"html_url": "https://github.com/Andrew-S-Rosen",
"followers_url": "https://api.github.com/users/Andrew-S-Rosen/followers",
"following_url": "https://api.github.com/users/Andrew-S-Rosen/following{/other_user}",
"gists_url": "https://api.github.com/users/Andrew-S-Rosen/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Andrew-S-Rosen/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Andrew-S-Rosen/subscriptions",
"organizations_url": "https://api.github.com/users/Andrew-S-Rosen/orgs",
"repos_url": "https://api.github.com/users/Andrew-S-Rosen/repos",
"events_url": "https://api.github.com/users/Andrew-S-Rosen/events{/privacy}",
"received_events_url": "https://api.github.com/users/Andrew-S-Rosen/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
},
{
"id": 5585129979,
"node_id": "LA_kwDOACgets8AAAABTOZR-w",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ase",
"name": "ase",
"color": "B8E879",
"default": false,
"description": "Atomic simulation environment"
},
{
"id": 6591917865,
"node_id": "LA_kwDOACgets8AAAABiOivKQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/serialization",
"name": "serialization",
"color": "5BCA72",
"default": false,
"description": "Data/object serialization"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"All ready to go!\r\n",
"Thanks!"
] | 2024-03-04T18:31:04
| 2024-03-05T12:14:34
|
2024-03-04T21:31:42Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Closes https://github.com/materialsproject/pymatgen/issues/3668.
The `Atoms.info` dictionary can be populated with all kinds of goodies that are challenging to deal with from a (de)serialization perspective. Oftentimes, this is from users hacking things into `Atoms.info`. For instance, in #3668, I put a `Structure` object in the `Atoms.info` dictionary, which then broke things during serialization. In order to ensure `MSONAtoms` plays nice with the (de)serialization routines in `monty`, it is better to split off the `Atoms.info` metadata into its own entry in the `.as_dict()` dictionary that we can sanitize ourselves. That's what I've done in this PR.
The following toy example now works in a round-trip fashion:
```python
from pymatgen.core import Structure
from monty.serialization import dumpfn, loadfn
structure = Structure(
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
species=["Mg", "O"],
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
)
mson_atoms = structure.to_ase_atoms()
mson_atoms.info = {"test": "hi", "s": structure}
dumpfn(mson_atoms, "test.json")
loadfn("test.json")
|
{
"login": "shyuep",
"id": 577107,
"node_id": "MDQ6VXNlcjU3NzEwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/577107?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/shyuep",
"html_url": "https://github.com/shyuep",
"followers_url": "https://api.github.com/users/shyuep/followers",
"following_url": "https://api.github.com/users/shyuep/following{/other_user}",
"gists_url": "https://api.github.com/users/shyuep/gists{/gist_id}",
"starred_url": "https://api.github.com/users/shyuep/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/shyuep/subscriptions",
"organizations_url": "https://api.github.com/users/shyuep/orgs",
"repos_url": "https://api.github.com/users/shyuep/repos",
"events_url": "https://api.github.com/users/shyuep/events{/privacy}",
"received_events_url": "https://api.github.com/users/shyuep/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3670/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3670/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3670",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3670",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3670.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3670.patch",
"merged_at": "2024-03-04T21:31:42Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3671
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3671/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3671/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3671/events
|
https://github.com/materialsproject/pymatgen/pull/3671
| 2,169,287,080
|
PR_kwDOACgets5ouIdG
| 3,671
|
Fix blank line bug in `io.res.ResWriter`
|
{
"login": "stefsmeets",
"id": 873520,
"node_id": "MDQ6VXNlcjg3MzUyMA==",
"avatar_url": "https://avatars.githubusercontent.com/u/873520?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stefsmeets",
"html_url": "https://github.com/stefsmeets",
"followers_url": "https://api.github.com/users/stefsmeets/followers",
"following_url": "https://api.github.com/users/stefsmeets/following{/other_user}",
"gists_url": "https://api.github.com/users/stefsmeets/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stefsmeets/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stefsmeets/subscriptions",
"organizations_url": "https://api.github.com/users/stefsmeets/orgs",
"repos_url": "https://api.github.com/users/stefsmeets/repos",
"events_url": "https://api.github.com/users/stefsmeets/events{/privacy}",
"received_events_url": "https://api.github.com/users/stefsmeets/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-05T13:50:19
| 2024-04-12T05:43:37
|
2024-03-05T14:07:28Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
This PR fixes two bugs in the res writer:
- Fix 1: Add a blank line at the end of the file
- Fix 2: Do not write a blank line if REMS is empty
Closes #3636
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3671/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3671/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3671",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3671",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3671.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3671.patch",
"merged_at": "2024-03-05T14:07:28Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3672
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3672/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3672/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3672/events
|
https://github.com/materialsproject/pymatgen/pull/3672
| 2,169,483,931
|
PR_kwDOACgets5ou0Lr
| 3,672
|
Reset label for sites changed by `Structure.replace_species()`
|
{
"login": "stefsmeets",
"id": 873520,
"node_id": "MDQ6VXNlcjg3MzUyMA==",
"avatar_url": "https://avatars.githubusercontent.com/u/873520?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stefsmeets",
"html_url": "https://github.com/stefsmeets",
"followers_url": "https://api.github.com/users/stefsmeets/followers",
"following_url": "https://api.github.com/users/stefsmeets/following{/other_user}",
"gists_url": "https://api.github.com/users/stefsmeets/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stefsmeets/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stefsmeets/subscriptions",
"organizations_url": "https://api.github.com/users/stefsmeets/orgs",
"repos_url": "https://api.github.com/users/stefsmeets/repos",
"events_url": "https://api.github.com/users/stefsmeets/events{/privacy}",
"received_events_url": "https://api.github.com/users/stefsmeets/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
},
{
"id": 5648629103,
"node_id": "LA_kwDOACgets8AAAABUK89bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/core",
"name": "core",
"color": "299448",
"default": false,
"description": "Pymatgen core"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-05T15:10:21
| 2024-04-12T05:44:20
|
2024-03-05T19:12:23Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
This PR resets the label on any site changed by `Structure.replace_species()`. `Site.label` will fall back to use the default label instead (the species string).
Closes #3658
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3672/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3672/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3672",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3672",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3672.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3672.patch",
"merged_at": "2024-03-05T19:12:23Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3674
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3674/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3674/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3674/events
|
https://github.com/materialsproject/pymatgen/pull/3674
| 2,173,231,169
|
PR_kwDOACgets5o7prt
| 3,674
|
Clean up test files: VASP inputs
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5698361208,
"node_id": "LA_kwDOACgets8AAAABU6YXeA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/dx",
"name": "dx",
"color": "73339B",
"default": false,
"description": "Developer experience"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Meanwhile I noticed some input files are compressed for example: https://github.com/materialsproject/pymatgen/blob/8c5829ba0cc713ae1ead3d80e66a15b76ccf95da/tests/io/lobster/test_inputs.py#L1653-L1661\r\n\r\nI didn't see much point in compressing these small and \"human-oriented\" inputs files (`INCAR/POSCAR/KPOINTS`) so I might save them decompressed.",
"Also noticed some inputs from `POSCAR` file seem to be dependent on the file naming. Renaming `POSCAR.Li2O` to `POSCAR_Li2O` breaks quite a few tests unexpectedly, even when the corresponding file names are correct, see [this workflow run](https://github.com/materialsproject/pymatgen/actions/runs/8198548630/job/22422248832).\r\n\r\nAlso need to look closer into this.\r\n\r\n",
"Should be good for review now @janosh. Thanks a ton for your time and let me know if you want any more changes. ",
"Thanks for reviewing @janosh . Meanwhile I might need some of your advice on the third episode, where I plan to collect all those randomly scattered VASP directories in test files together. As such it seems we would have two options: \r\n\r\n1. Lay all directories side by side with `inputs` and `outputs`:\r\n```bash\r\nvasp\r\n├── inputs\r\n├── outputs\r\n├── vasp_dir_0\r\n└── vasp_dir_1\r\n```\r\nThis could prevent the test directory being too deeply nested, but would potentially bury the important `inputs` and `outputs` if there are too many.\r\n\r\n2. Otherwise we could have another directory (I would need a better name than `vasp_project`):\r\n```bash\r\nvasp\r\n├── inputs\r\n├── outputs\r\n└── vasp_project\r\n ├── vasp_dir_0\r\n └── vasp_dir_1\r\n```\r\n\r\nI would personally prefer the 2nd. What do you think?\r\n",
"i think both options are fine. if we go with option 2, `fixtures` is one possible name for `vasp_project` as it's commonly used for directories with reference files so will be easily understood by many people. it's a slight misuse though as basically then the whole `tests/files` dir could be called `tests/fixtures` instead"
] | 2024-03-07T08:04:27
| 2024-03-08T12:49:38
|
2024-03-08T12:31:20Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Clean up test files: VASP inputs
The second episode of cleaning up test files: VASP inputs, relocate VASP input files to a dedicated dir (`vasp/inputs`), following #3653.
## TODOs
- [x] Relocate `INCAR`: 2ebe5927e1e4ebd6752b34e8f17076f9c8986066
- [x] Relocate `KPOINTS`: c11758a333642f13beee17255e51a5a8594dcbe0
- [x] Relocate `POSCAR`: 00f1beb74bd30170109a6c68b2efb42a54e9dc5e
- [x] Relocate `POTCAR`: 090f8473c5bbe4b2ce6f1b05ede99a05273daeab
- [x] Relocate some `feff` test files: 831c64366954bfe9abe963454d827b6cec109fef
- [x] Final clean up
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3674/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3674/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3674",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3674",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3674.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3674.patch",
"merged_at": "2024-03-08T12:31:20Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3675
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3675/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3675/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3675/events
|
https://github.com/materialsproject/pymatgen/pull/3675
| 2,173,262,645
|
PR_kwDOACgets5o7wmF
| 3,675
|
Migrate CI dependency installation from `pip` to `uv`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4705022165,
"node_id": "LA_kwDOACgets8AAAABGHDw1Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/performance",
"name": "performance",
"color": "458C0D",
"default": false,
"description": "Some functionality is too slow or regressed"
},
{
"id": 5578251138,
"node_id": "LA_kwDOACgets8AAAABTH1bgg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ci",
"name": "ci",
"color": "4E135C",
"default": false,
"description": "Continuous integration"
},
{
"id": 5585018768,
"node_id": "LA_kwDOACgets8AAAABTOSfkA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/pkg",
"name": "pkg",
"color": "EFE8DB",
"default": false,
"description": "Package health and distribution related stuff"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"good news: looks like linux CI dependency install time went from 2.5 to 1 min (2.5x speed up) and windows install time went from 9-14 min to 3-5 min (~3x speed up)!\r\n\r\nalso, `matgl` import error was indeed automatically fixed by `uv` and remaining failing tests due to `pydantic` import error are skipped until https://github.com/materialsvirtuallab/matgl/issues/238 is resolved.\r\n\r\npinging a few people in case they want to migrate their repos to `uv` as well for (hopefully) similar speedups.\r\n- @utf for `atomate2`\r\n- @Andrew-S-Rosen for `quacc`\r\n- @shyuep / @esoteric-ephemera for `custodian`\r\n- @DanielYang59 for `pymatviz`\r\n- @mkhorton for CTK",
"Amazing! I have a few upstream issues in uv I need fixed before I can switch. Already tried. But I am hopeful it will be soon! ",
"Glad to help you with `pymatviz`. Would get my hands on that soon (well... another promise 😄 ).\r\n\r\nDespite of the dramatic speed up, I'm quite curious why the original `import` issue in the first place because these two should function the same?",
"> I'm quite curious why the original import issue in the first place because these two should function the same?\r\n\r\n`uv` is meant as a drop-in replacement for `pip`, yes, but their module resolution works differently. i assume `pip` failed to install `matgl` due conflicting version reqs where `uv` succeeded. but just guessing, didn't look into it",
"> i assume `pip` failed to install `matgl` due conflicting version reqs where `uv` succeeded. but just guessing, didn't look into it\r\n\r\nWell...At lease from this [run](https://github.com/materialsproject/pymatgen/actions/runs/8184520269/job/22379106771), `matgl` is successfully installed but still the weird `importError`. Not idea why.\r\n```\r\nSuccessfully installed ..... matgl-1.0.0 ....\r\n```\r\n\r\n",
"A quick update @janosh , it seems `uv` timed out for some reason [here](https://github.com/materialsproject/pymatgen/actions/runs/8188398603/job/22390876432?pr=3674).\r\n```bash\r\nRun uv pip install numpy cython --system\r\nResolved 2 packages in 98ms\r\nDownloaded 2 packages in 419ms\r\nInstalled 2 packages in 17ms\r\n + cython==3.0.9\r\n + numpy==1.26.4\r\nBuilt 1 editable in 28.18s\r\nResolved 194 packages in 2.55s\r\nerror: Failed to download distributions\r\n Caused by: Failed to fetch wheel: torch==2.2.1\r\n Caused by: Failed to extract source distribution\r\n Caused by: Failed to download distribution due to network timeout. Try increasing UV_HTTP_TIMEOUT (current value: 300s).\r\n```",
"good to know, i'll keep an eye on it"
] | 2024-03-07T08:21:29
| 2024-04-10T09:50:36
|
2024-03-07T09:16:12Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
hoping the migration to `uv`, besides being faster than `pip`, can also fix the CI import errors for `matgl` and `pydantic` that started 2 days ago. not optimistic about `pydantic` which shouldn't be imported by pymatgen or any of its deps anyway but maybe `matgl`.
related PR: https://github.com/CederGroupHub/chgnet/pull/133
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3675/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3675/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3675",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3675",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3675.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3675.patch",
"merged_at": "2024-03-07T09:16:12Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3676
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3676/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3676/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3676/events
|
https://github.com/materialsproject/pymatgen/pull/3676
| 2,173,840,327
|
PR_kwDOACgets5o9v-w
| 3,676
|
Dynamic `__hash__` for `BalancedReaction`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4705022165,
"node_id": "LA_kwDOACgets8AAAABGHDw1Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/performance",
"name": "performance",
"color": "458C0D",
"default": false,
"description": "Some functionality is too slow or regressed"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5525608888,
"node_id": "LA_kwDOACgets8AAAABSVoZuA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/analysis",
"name": "analysis",
"color": "7E50AA",
"default": false,
"description": "Concerning pymatgen.analysis"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"> i added a test\r\n\r\nThanks a lot. You did much more than you said 😄 \r\n"
] | 2024-03-07T13:15:15
| 2024-04-12T05:45:51
|
2024-03-07T19:27:18Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Replace a hard coded hash `7` with proper hash method, see #3673.
The necessity of such method is unclear meanwhile.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3676/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3676/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3676",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3676",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3676.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3676.patch",
"merged_at": "2024-03-07T19:27:18Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3677
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3677/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3677/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3677/events
|
https://github.com/materialsproject/pymatgen/issues/3677
| 2,174,204,792
|
I_kwDOACgets6Bl7t4
| 3,677
|
Bug in `ResWriter._ions_from_sites` in `pymatgen.io.res`
|
{
"login": "SehunJoo",
"id": 82074302,
"node_id": "MDQ6VXNlcjgyMDc0MzAy",
"avatar_url": "https://avatars.githubusercontent.com/u/82074302?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/SehunJoo",
"html_url": "https://github.com/SehunJoo",
"followers_url": "https://api.github.com/users/SehunJoo/followers",
"following_url": "https://api.github.com/users/SehunJoo/following{/other_user}",
"gists_url": "https://api.github.com/users/SehunJoo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/SehunJoo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/SehunJoo/subscriptions",
"organizations_url": "https://api.github.com/users/SehunJoo/orgs",
"repos_url": "https://api.github.com/users/SehunJoo/repos",
"events_url": "https://api.github.com/users/SehunJoo/events{/privacy}",
"received_events_url": "https://api.github.com/users/SehunJoo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
},
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"I never use `AIRSS`, so just provide some info here, waiting a true master being called :).\r\n\r\nI assume update: https://github.com/materialsproject/pymatgen/blob/668fa574ab1e3e102065c5a9d7a785213dc5ac2f/pymatgen/io/res.py#L257-L269\r\n\r\nwith this might work:\r\n```diff\r\n @classmethod\r\n def _ions_from_sites(cls, sites: list[PeriodicSite]) -> list[Ion]:\r\n \"\"\"Produce a list of entries for a SFAC block from a list of pymatgen PeriodicSite.\"\"\"\r\n ions: list[Ion] = []\r\n i = 0\r\n for site in sites:\r\n+ prev_specie = None\r\n for specie, occ in site.species.items():\r\n- i += 1\r\n+ if specie != prev_specie:\r\n+ i += 1\r\n+ prev_specie = specie\r\n x, y, z = map(float, site.frac_coords)\r\n spin = site.properties.get(\"magmom\")\r\n spin = spin and float(spin)\r\n ions.append(Ion(specie, i, (x, y, z), occ, spin))\r\n return ions\r\n```\r\n\r\nBut I'm afraid I'm not the right person to make this change as I cannot write a proper unit test for this.\r\n\r\n<details>\r\n <summary> Supporting Info </summary>\r\n\r\n From the official documentation [here](https://airss-docs.github.io/tutorials/examples/), there is:\r\n ```\r\n $ cat Al-72120-6057-19.res\r\n \r\n TITL Al-72120-6057-19 0.0000000000 8000.0000000000 -44.3248941562 0 0 13 (Ih) n - 1\r\n REM\r\n REM in /Users/user/examples/1.2\r\n REM\r\n REM\r\n REM\r\n REM\r\n REM\r\n REM buildcell < ./Al.cell (8f0fc5c9d882ed20c27978dd052da9d4)\r\n REM AIRSS Version 0.9.1 July 2018 build 92bfd83db9d4+ Sat, 30 Jun 2018 13:13:37 +0100\r\n REM compiler GCC version 5.5.0\r\n REM options -fPIC -feliminate-unused-debug-symbols -mmacosx-version-min=10.13.6 -mtune=core2 -g -O0\r\n REM seed -1471360510 667860809 1027640838 1038292373 -213802532 -1539206485 -1872642957 -340800072 -697171857 -761177086 -1542735574 -885338462\r\n REM\r\n CELL 1.54180 20.00000 20.00000 20.00000 90.00000 90.00000 90.00000\r\n LATT -1\r\n SFAC Al\r\n Al 1 0.6038930453823 0.4836194826238 0.5253309492534 1.0\r\n Al 1 0.5723861716435 0.5636803790552 0.4509205384933 1.0\r\n Al 1 0.4999999997846 0.5000000000790 0.5000000075654 1.0\r\n Al 1 0.4276138527499 0.4363195677348 0.5490794435604 1.0\r\n Al 1 0.4701141676138 0.6024370215993 0.4821888755138 1.0\r\n Al 1 0.5298858276893 0.3975629918030 0.5178112246213 1.0\r\n Al 1 0.4526399878259 0.4244380397184 0.4387532754310 1.0\r\n Al 1 0.5473600525560 0.5755619778738 0.5612466872006 1.0\r\n Al 1 0.4789066108987 0.5271042987692 0.3974126364780 1.0\r\n Al 1 0.3961069520357 0.5163804721092 0.4746690478913 1.0\r\n Al 1 0.5210933793772 0.4728958126855 0.6025874103552 1.0\r\n Al 1 0.4384134677060 0.5463289943787 0.5759240890051 1.0\r\n Al 1 0.5615864847371 0.4536709615702 0.4240759146313 1.0\r\n END\r\n ```\r\n\r\n And the source code `cabal.f90`:\r\n ```f90\r\n subroutine write_res()\r\n \r\n integer :: n\r\n \r\n character(len=40) :: fmt,ctemp,ctemp2\r\n \r\n if((buff_words(1,1).eq.'TITL').and.(buff_words(10,1).eq.'n')) then\r\n write(stdout,'(a)') trim(adjustl(buff(1)))\r\n else\r\n write(ctemp,'(f15.6)') lattice_volume\r\n write(ctemp2,*) num_ions\r\n write (stdout,'(a,a,a,a,f4.1,a,f4.1,2i2,1x,a,a)') 'TITL cabal-',trim(inext),'2',&\r\n trim(outext),0.0_dp,' '//trim(adjustl(ctemp)),0.0_dp,0,0,trim(adjustl(ctemp2)),' (n/a) n - 1'\r\n end if\r\n !!$ write (stdout,'(a)') 'REM'\r\n !!$ write (stdout,'(a,a)') 'REM Converted by cabal ',date()\r\n !!$ write (stdout,'(a)') 'REM'\r\n write (stdout,'(a,6f11.5)') 'CELL 1.54180',lattice_abc\r\n write (stdout,'(a)') 'LATT -1'\r\n write (ctemp,*) num_species\r\n write (fmt,*) \"(a,\"//trim(adjustl(ctemp))//\"a3)\"\r\n write (stdout,trim(adjustl(fmt))) 'SFAC ',species_names(1:num_species)\r\n if(any(ion_spin.ne.0.0_dp)) then\r\n do n=1,num_ions\r\n write (stdout,'(a4,i4,3f17.13,f4.1,f7.2)') &\r\n species_names(ion_index(n)),ion_index(n),ion_fractional(:,n),ion_occ(n),ion_spin(n)\r\n end do\r\n else\r\n do n=1,num_ions\r\n write (stdout,'(a4,i4,3f17.13,f4.1)') &\r\n species_names(ion_index(n)),ion_index(n),ion_fractional(:,n),ion_occ(n)\r\n end do\r\n end if\r\n write (stdout,'(a)') 'END'\r\n \r\n end subroutine write_res\r\n ```\r\n \r\n There seems to be indeed a bug as the `ion_index(n)` should be written not the `num_ions`.\r\n\r\n</details>",
"@DanielYang59 Can we expect an update on this in the public version?",
"Hi thanks for pinging me. But I'm not a maintainer, nor a `AIRSS` user. Maybe you should ping @janosh (he is recently very busy)?\r\n\r\nMeanwhile fixing the issue itself seems easy, we need to update the unit test on which unfortunately I cannot help much...",
"thanks for bringing this up @SehunJoo and for suggesting a fix @DanielYang59! 👍 \r\n\r\ni'm not familiar with the RES spec either but based on [the example @DanielYang59 shared](https://airss-docs.github.io/tutorials/examples/#example-102), looks like this is indeed an issue.\r\n\r\n@stefsmeets if you have time, could you take a look and comment whether this needs fixing?",
"This is indeed a bug, see shelx documentation here: https://shelx.uni-goettingen.de/shelxl_html.php\r\n\r\nSeems easy enough to fix, I'll have a look."
] | 2024-03-07T16:02:09
| 2024-04-22T16:10:55
|
2024-04-22T16:10:55Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.10.8
### Pymatgen version
The latest
### Operating system version
_No response_
### Current behavior
The index of the SFAC block (second column) is not compatible with ARISS.
Currently, ResWriter gives a file as follows:
```
TITL mp-841-R2SCAN 0.00 63.1079 -46.08987 0.000000 0.000000 (P6_3/mmc) n - 1
CELL 1.00000 3.10263 3.10263 7.56993 90.00000 90.00000 119.99999
LATT -1
SFAC O Li
Li 1 0.00000000 -0.00000000 -0.00000000 1.000000 -0.00
Li 2 0.00000000 -0.00000000 0.50000000 1.000000 -0.00
Li 3 0.33333300 0.66666700 0.25000000 1.000000 0.00
Li 4 0.66666700 0.33333300 0.75000000 1.000000 0.00
O 5 0.33333300 0.66666700 0.64856887 1.000000 0.00
O 6 0.66666700 0.33333300 0.14856887 1.000000 0.00
O 7 0.66666700 0.33333300 0.35143113 1.000000 0.00
O 8 0.33333300 0.66666700 0.85143113 1.000000 0.00
END
```
### Expected Behavior
The index must match the index/order of the elements in the SFAC line, not the atomic index, as shown below.
```
TITL cabal-in-out 0.000000000000 95.523851950751 0.000000000000 0.00 0.00 15 (n/a) n - 1
CELL 1.54180 4.48006 4.48006 5.49558 90.00000 90.00000 120.00000
LATT -1
SFAC Li Ni O
Li 1 -0.1813932000000 -0.4270413000000 0.4149065000000 1.0
Li 1 0.4270413000000 0.2456481000000 0.4149065000000 1.0
Li 1 -0.2456481000000 0.1813932000000 0.4149065000000 1.0
Li 1 -0.3333333000000 0.3333333000000 -0.4486238000000 1.0
Li 1 0.0000000000000 0.0000000000000 0.3052228000000 1.0
Ni 2 0.3294838000000 -0.1925651000000 0.2087146000000 1.0
Ni 2 0.1925651000000 -0.4779511000000 0.2087146000000 1.0
Ni 2 0.4779511000000 -0.3294838000000 0.2087146000000 1.0
Ni 2 -0.3333333000000 0.3333333000000 0.0703588000000 1.0
Ni 2 -0.0000000000000 -0.0000000000000 -0.1219930000000 1.0
O 3 -0.3333334000000 -0.0977824000000 -0.4510226000000 1.0
O 3 0.0977824000000 -0.2355510000000 -0.4510226000000 1.0
O 3 0.2355510000000 0.3333334000000 -0.4510226000000 1.0
O 3 0.3333333000000 -0.3333333000000 -0.1021862000000 1.0
O 3 -0.3333333000000 0.3333333000000 -0.2065545000000 1.0
END
```
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3677/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3677/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3678
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3678/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3678/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3678/events
|
https://github.com/materialsproject/pymatgen/issues/3678
| 2,175,006,926
|
I_kwDOACgets6Bo_jO
| 3,678
|
get_pmg_structure returns magnetic moments under site_properties key "magnetic_moments" instead of "magmom"
|
{
"login": "JonathanSchmidt1",
"id": 54937397,
"node_id": "MDQ6VXNlcjU0OTM3Mzk3",
"avatar_url": "https://avatars.githubusercontent.com/u/54937397?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JonathanSchmidt1",
"html_url": "https://github.com/JonathanSchmidt1",
"followers_url": "https://api.github.com/users/JonathanSchmidt1/followers",
"following_url": "https://api.github.com/users/JonathanSchmidt1/following{/other_user}",
"gists_url": "https://api.github.com/users/JonathanSchmidt1/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JonathanSchmidt1/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JonathanSchmidt1/subscriptions",
"organizations_url": "https://api.github.com/users/JonathanSchmidt1/orgs",
"repos_url": "https://api.github.com/users/JonathanSchmidt1/repos",
"events_url": "https://api.github.com/users/JonathanSchmidt1/events{/privacy}",
"received_events_url": "https://api.github.com/users/JonathanSchmidt1/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
},
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5733199609,
"node_id": "LA_kwDOACgets8AAAABVbmu-Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/magmoms",
"name": "magmoms",
"color": "3B4F19",
"default": false,
"description": "Magnetism related"
},
{
"id": 6225613014,
"node_id": "LA_kwDOACgets8AAAABcxNQ1g",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/phonon",
"name": "phonon",
"color": "0ED699",
"default": false,
"description": "Lattice vibrations"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Thanks for the report, @JonathanSchmidt1. You are absolutely right that this is a bug that should be fixed. Are you interested in submitting a PR for this patch? \r\n\r\nCCing @tomdemeyere to let him know about the bug in case it is relevant to his work.",
"@JonathanSchmidt1 yes, please go ahead and submit a bug fix if you like to.\r\nAs previously mentioned, we have never used pymatgen or atomate2 for phonon runs of magnetic materials."
] | 2024-03-07T23:30:19
| 2024-03-08T09:34:14
|
2024-03-08T09:31:18Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
3.9.13
### Pymatgen version
2024.2.23
### Operating system version
_No response_
### Current behavior
Recently the get_pmg_structure and the get_phonopy_structure methods in pymatgen/io/phonopy.py were updated to include magnetic moments. ( https://github.com/materialsproject/pymatgen/pull/3555 )
the get_pmg_structure method should have the magnetic moment under the magmom key instead it is magnetic moments. I also overlooked this in the pull request ...
```
return Structure(
lattice,
symbols,
frac_coords,
site_properties={"phonopy_masses": masses, "magnetic_moments": magmoms},
)
```
This leads to problems e.g. when automatically creating incars in atomate2 etc. (working on adding magmoms to the phonon workflow @JaGeo )
### Expected Behavior
It should be under magmom:
```
return Structure(
lattice,
symbols,
frac_coords,
site_properties={"phonopy_masses": masses, "magmom": magmoms},
)
```
than it also corresponds to the other method that converts from pymatgen to phonopy:
```
return PhonopyAtoms(
symbols=symbols,
cell=pmg_structure.lattice.matrix,
scaled_positions=pmg_structure.frac_coords,
magnetic_moments=pmg_structure.site_properties.get("magmom"),
)
```
The unit test would also need to be changed to confirm that the site_properties are the same. Right now it only tests the following for magmom:
` assert list(struct_ph.magnetic_moments) == magmoms`
maybe it would be possible to add:
assert struct_pmg_round_trip.site_properties['magmom']==struct_pmg.site_properties['magmom']
### Minimal example
```Python
from pymatgen.io.phonopy import get_pmg_structure, get_phonopy_structure
from pymatgen.core import Structure, Lattice
lattice_vectors = [
[2.8126969436818903, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 2.8126969436818903, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 2.8126969436818903],
]
lattice = Lattice(lattice_vectors)
species = ["Cr", "Cr"]
positions = [
[0.0000000000000000, 0.0000000000000000, 0.0000000000000000], # First Cr atom
[0.5000000000000000, 0.5000000000000000, 0.5000000000000000], # Second Cr atom
]
cr_structure = Structure(lattice, species, positions, coords_are_cartesian=False, site_properties={"magmom": [5, -5]})
print(get_pmg_structure(get_phonopy_structure(cr_structure)).site_properties)
```
### Relevant files to reproduce this bug
_No response_
|
{
"login": "JonathanSchmidt1",
"id": 54937397,
"node_id": "MDQ6VXNlcjU0OTM3Mzk3",
"avatar_url": "https://avatars.githubusercontent.com/u/54937397?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JonathanSchmidt1",
"html_url": "https://github.com/JonathanSchmidt1",
"followers_url": "https://api.github.com/users/JonathanSchmidt1/followers",
"following_url": "https://api.github.com/users/JonathanSchmidt1/following{/other_user}",
"gists_url": "https://api.github.com/users/JonathanSchmidt1/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JonathanSchmidt1/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JonathanSchmidt1/subscriptions",
"organizations_url": "https://api.github.com/users/JonathanSchmidt1/orgs",
"repos_url": "https://api.github.com/users/JonathanSchmidt1/repos",
"events_url": "https://api.github.com/users/JonathanSchmidt1/events{/privacy}",
"received_events_url": "https://api.github.com/users/JonathanSchmidt1/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3678/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3678/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3679
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3679/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3679/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3679/events
|
https://github.com/materialsproject/pymatgen/pull/3679
| 2,175,609,910
|
PR_kwDOACgets5pDyvp
| 3,679
|
Fix `phonopy.get_pmg_structure` `site_properties` key for magmoms
|
{
"login": "JonathanSchmidt1",
"id": 54937397,
"node_id": "MDQ6VXNlcjU0OTM3Mzk3",
"avatar_url": "https://avatars.githubusercontent.com/u/54937397?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JonathanSchmidt1",
"html_url": "https://github.com/JonathanSchmidt1",
"followers_url": "https://api.github.com/users/JonathanSchmidt1/followers",
"following_url": "https://api.github.com/users/JonathanSchmidt1/following{/other_user}",
"gists_url": "https://api.github.com/users/JonathanSchmidt1/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JonathanSchmidt1/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JonathanSchmidt1/subscriptions",
"organizations_url": "https://api.github.com/users/JonathanSchmidt1/orgs",
"repos_url": "https://api.github.com/users/JonathanSchmidt1/repos",
"events_url": "https://api.github.com/users/JonathanSchmidt1/events{/privacy}",
"received_events_url": "https://api.github.com/users/JonathanSchmidt1/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5733199609,
"node_id": "LA_kwDOACgets8AAAABVbmu-Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/magmoms",
"name": "magmoms",
"color": "3B4F19",
"default": false,
"description": "Magnetism related"
},
{
"id": 6225613014,
"node_id": "LA_kwDOACgets8AAAABcxNQ1g",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/phonon",
"name": "phonon",
"color": "0ED699",
"default": false,
"description": "Lattice vibrations"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-08T09:13:06
| 2024-03-08T09:35:17
|
2024-03-08T09:29:56Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
closes #3678.
- fix: Change key in `get_pmg_structure` from `magnetic_moments` to `magmom`
- test: add `assert struct_pmg_round_trip.site_properties["magmom"] == struct_pmg.site_properties["magmom"]`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3679/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3679/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3679",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3679",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3679.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3679.patch",
"merged_at": "2024-03-08T09:29:56Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3680
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3680/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3680/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3680/events
|
https://github.com/materialsproject/pymatgen/pull/3680
| 2,176,942,329
|
PR_kwDOACgets5pIXh4
| 3,680
|
Add support for vaspout.h5, improvements to potcar handling
|
{
"login": "esoteric-ephemera",
"id": 33381112,
"node_id": "MDQ6VXNlcjMzMzgxMTEy",
"avatar_url": "https://avatars.githubusercontent.com/u/33381112?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/esoteric-ephemera",
"html_url": "https://github.com/esoteric-ephemera",
"followers_url": "https://api.github.com/users/esoteric-ephemera/followers",
"following_url": "https://api.github.com/users/esoteric-ephemera/following{/other_user}",
"gists_url": "https://api.github.com/users/esoteric-ephemera/gists{/gist_id}",
"starred_url": "https://api.github.com/users/esoteric-ephemera/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/esoteric-ephemera/subscriptions",
"organizations_url": "https://api.github.com/users/esoteric-ephemera/orgs",
"repos_url": "https://api.github.com/users/esoteric-ephemera/repos",
"events_url": "https://api.github.com/users/esoteric-ephemera/events{/privacy}",
"received_events_url": "https://api.github.com/users/esoteric-ephemera/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5952080879,
"node_id": "LA_kwDOACgets8AAAABYsWL7w",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/feature",
"name": "feature",
"color": "241DAB",
"default": false,
"description": "PRs with new features, not enhancements to existing features"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"there's going to be a new `pmg` release soon to close #3744. do we want to get this in before that? let us know if others can help with this PR",
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Auto Review Skipped\n> \n> Draft detected.\n> \n> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository.\n> \n> To trigger a single review, invoke the `@coderabbitai review` command.\n> \n\n<!-- end of auto-generated comment: skip review by coderabbit.ai --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"This isn't super urgent for release. What I'd like to do is ensure that this works across a wider variety of vaspout's, and make sure that all fields currently included in the vaspout are being mapped correctly to the PMG object\r\n\r\nRn, it doesn't seems like vaspout.h5 has the same level of detail as vasprun.xml so figuring out a way to handle that would also be good",
"Thanks for this PR @esoteric-ephemera. Do you happen to know if magnetic moments are now stored in the vaspout.h5? \r\n\r\nPreviously these were not available in the vasprun.xml, although perhaps they have since been added and we haven't noticed. I do see a `MAGDIPOLOUT` key.",
"Hi @mkhorton, yes both the magnetic moments *and* charges are stored in vaspout.h5, and thankfully to normal floating point precision\r\n\r\nI need to revisit this PR soon - will try to this week or next",
"Saw this is stale, that's no problem but wondered if you were expecting any updates to this. I saw VASP 6.5 is out with some further hdf5 support.\r\n\r\nMore generally, given there is now first-party support for parsing from the VASP developers in `py4vasp`, do you have any new thoughts on how this should fit in with pymatgen? Should development of parsing continue to be done in parallel, or are there scenarios where having a dep on `py4vasp` might make sense?",
"Sorry @mkhorton, I'll try to get this synced up tomorrow to merge. The only thing I wanted to add was KPOINTS_OPT parsing, which I think I have enough test files for\r\n\r\nIn general, I don't think we can nor want to chase VASP's support for their own schemas but that's a discussion worth having with the p4vasp team",
"Hey @mkhorton @shyuep - I think this is ready for review. Some features are missing to bring `Vaspout` to full parity with `Vasprun`. That might be due to the schema of `Vaspout` being not fixed yet (there are already code blocks that support older / newer versions of `Vaspout` schemas) or something I missed\r\n\r\nEither way, I think it's best we have a template to add to / modify as `Vaspout` is developed",
"Thanks. I will merge and release. I think we can do the usual approach of release first then iterate as necessary. It is a format still in flux but no reason why we cannot support it now first."
] | 2024-03-09T00:06:36
| 2025-03-13T15:47:04
|
2025-03-10T17:09:12Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
The vaspout.h5 file appears to be a replacement for / supplement to the vasprun.xml file, and has been available in certain VASP versions >= 6. This PR aims to add support for parsing this file.
However the vaspout.h5 file appears to be still in development. For example, no electronic self-consistency info is included in it as of 11 April, 2024, but there is a [PR on VASP's py4vasp GH](https://github.com/vasp-dev/py4vasp/commit/8ebe3b6c94c6f654de4c5af20bbbb8a82bbfb33a) to add OSZICAR info to vaspout.h5
Major changes:
- Add support for parsing vaspout.h5 through `pymatgen.io.vasp.outputs.Vaspout`. This subclasses `Vasprun` in the spirit that the two should contain roughly the same information now.
- Add `.from_str` method to `pymatgen.io.vasp.inputs.Potcar` (needed because vaspout.h5 stores the complete potcar as a str)
- To avoid issues of copyright, there's a kwarg, `store_potcar`, to enable/disable storing the full POTCAR or its just spec
- The structure at each `ionic_step` now has `site_properties` with the _s_, _p_, _d_,...-resolved and `tot` charge / magnetization, if applicable. This is the same format as `Outcar.charge` and `Outcar.magnetization`, but added as a site property at each ionic step instead of a top-level attr for only the final structure
## Some related changes for VASP I/O
- Add `spec` attr to `PotcarSingle` and `Potcar`. This standardizes the POTCAR spec attr added to vasprun.xml and vaspout.h5 objects
- Add `from_spec` method to `Potcar`, which attempts to generate a POTCAR with a consistent functional just from the spec. Note that multiple matches are possible, this only takes the first consistent match.
## Todos
- Some information currently contained in vasprun.xml appears not to be available in vaspout.h5. That might change in the near future, or I may be mistaken
- Support for selective dynamics (if applicable)
- Various TODO's sprinkled through current code
- Tests
|
{
"login": "shyuep",
"id": 577107,
"node_id": "MDQ6VXNlcjU3NzEwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/577107?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/shyuep",
"html_url": "https://github.com/shyuep",
"followers_url": "https://api.github.com/users/shyuep/followers",
"following_url": "https://api.github.com/users/shyuep/following{/other_user}",
"gists_url": "https://api.github.com/users/shyuep/gists{/gist_id}",
"starred_url": "https://api.github.com/users/shyuep/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/shyuep/subscriptions",
"organizations_url": "https://api.github.com/users/shyuep/orgs",
"repos_url": "https://api.github.com/users/shyuep/repos",
"events_url": "https://api.github.com/users/shyuep/events{/privacy}",
"received_events_url": "https://api.github.com/users/shyuep/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3680/reactions",
"total_count": 4,
"+1": 2,
"-1": 0,
"laugh": 0,
"hooray": 1,
"confused": 0,
"heart": 1,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3680/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3680",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3680",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3680.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3680.patch",
"merged_at": "2025-03-10T17:09:12Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3681
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3681/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3681/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3681/events
|
https://github.com/materialsproject/pymatgen/pull/3681
| 2,177,029,089
|
PR_kwDOACgets5pIp8c
| 3,681
|
Clean up test files: dedicated VASP directories, `xyz`, `mcif`, `cssr`, `exciting`, `wannier90`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5698361208,
"node_id": "LA_kwDOACgets8AAAABU6YXeA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/dx",
"name": "dx",
"color": "73339B",
"default": false,
"description": "Developer experience"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"`borg` is a mystery for me partly because I never use it before, which looks like a parallelized VASP results collection tool. But in the unit tests, what files are being collected are not explicitly declared, nor commented. And the test data length is hard-coded:\r\nhttps://github.com/materialsproject/pymatgen/blob/daa0bb01477321828aa324c9ce9d07383db778e1/tests/apps/borg/test_queen.py#L16-L21\r\n\r\n\r\nI would need to add some comments after I find out what files are being collected.",
"There is a test skipped in #1766 because `free_sph.cif` is absent:\r\nhttps://github.com/materialsproject/pymatgen/blob/daa0bb01477321828aa324c9ce9d07383db778e1/tests/io/test_zeopp.py#L173-L192\r\n\r\nMaybe we should somehow recover the test file or remove this test altogether?\r\n\r\nUpdate: tried to dig into Git Blame but didn't have much luck.\r\n",
"> Maybe we should somehow recover the test file or remove this test altogether?\r\n\r\nlooks like the file never existed which is odd. however, even if we had the file, the test would fail with\r\n\r\n> RuntimeError: get_voronoi_nodes requires Zeo++ cython extension to be installed. Please contact developers of Zeo++ to obtain it.\r\n\r\ni would keep the test for now even if it's not running.",
"I might need your advice on fixing tests for `borg` @janosh, thanks\r\n\r\nCurrent the `drone` is being deployed to `TEST_FILES_DIR`. And as the test files are dynamic under `TEST_FILES_DIR` while the number of `valid_paths` is hard-coded to be `16`: \r\nhttps://github.com/materialsproject/pymatgen/blob/910e5719770647e6ed7fa41cb2358d5f8f42161f/tests/apps/borg/test_queen.py#L16-L21\r\nAny time a vasp test directory is added or removed, the test is very likely to fail.\r\n\r\nSo I guess we should either:\r\n- Use a more \"general\" condition like `assert len(data)` over `assert len(data) == 16`\r\n\r\nor \r\n\r\n- Create a dedicated test directories for `borg` with static test files (symlinks maybe).\r\n\r\n**UPDATE**: already created a dedicated dir for `borg`.\r\n",
"> UPDATE: already created a dedicated dir for borg.\r\n\r\ngreat! i would also have gone with this approach 👍 ",
"> really nice to bring the repo size down by compressing more test files!\r\n\r\nThanks for reviewing. Didn't compress much files 😃 just grouped different types to tidy up the test files.\r\n\r\n",
"quarter million lines gone. i call that a win 😄 ",
"> quarter million lines gone. \r\n\r\nYes I indeed removed some unused test directories. Tried my best to search globally for their names and at least confirmed they're not explicitly called. Also committed all removals individually in case any need to be recovered.\r\n\r\nWith this said, I'm not sure what is the best practice, but I think it's better to explicitly declare file name in unit tests wherever possible? Or if this is not possible, at least put a comment about the target directory/file.\r\n\r\nFor example this gave me quite a painful time:\r\nhttps://github.com/materialsproject/pymatgen/blob/d07164fd27b955010ad411033d262ef3d935d09c/tests/apps/borg/test_hive.py#L27-L33\r\n\r\nBecause:\r\n- No comment nor explicit declaration of test file name.\r\n- A ton of possible target `vasprun.xml` files exist in directory and don't know which is the target file.\r\n- Result hard coded.\r\n\r\nCan you please encourage developers to add a comment or declare explicitly in the future if anyone is adding test files? Thanks a ton 😃 .\r\n\r\n\r\n",
"> Can you please encourage developers to add a comment or declare explicitly in the future if anyone is adding test files? Thanks a ton 😃 .\r\n\r\nof course! this test predates my becoming a `pymatgen` co-maintainer but i'm glad you refactored to clarify the test ↔ test-file association here\r\n"
] | 2024-03-09T03:21:57
| 2024-03-12T01:53:44
|
2024-03-11T07:06:21Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Clean up test files: dedicated VASP directories
The third (hopefully the last) episode of cleaning up VASP test files: relocate dedicated VASP directories to `vasp/fixtures`, following #3653 and #3674.
## Tasks
- [x] Relocate dedicated VASP directories
- [x] Compress some hidden VASP outputs
- [x] Group some files: xyz, mcif, cssr, exciting, wannier90
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3681/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3681/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3681",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3681",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3681.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3681.patch",
"merged_at": "2024-03-11T07:06:21Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3682
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3682/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3682/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3682/events
|
https://github.com/materialsproject/pymatgen/issues/3682
| 2,177,206,575
|
I_kwDOACgets6BxYkv
| 3,682
|
Create monolayer MoS2 from the bulk.
|
{
"login": "hongyi-zhao",
"id": 11155854,
"node_id": "MDQ6VXNlcjExMTU1ODU0",
"avatar_url": "https://avatars.githubusercontent.com/u/11155854?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hongyi-zhao",
"html_url": "https://github.com/hongyi-zhao",
"followers_url": "https://api.github.com/users/hongyi-zhao/followers",
"following_url": "https://api.github.com/users/hongyi-zhao/following{/other_user}",
"gists_url": "https://api.github.com/users/hongyi-zhao/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hongyi-zhao/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hongyi-zhao/subscriptions",
"organizations_url": "https://api.github.com/users/hongyi-zhao/orgs",
"repos_url": "https://api.github.com/users/hongyi-zhao/repos",
"events_url": "https://api.github.com/users/hongyi-zhao/events{/privacy}",
"received_events_url": "https://api.github.com/users/hongyi-zhao/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-09T12:23:49
| 2024-03-09T12:23:49
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
I try to generate the monolayer MoS2 from the bulk as follows:
```python
from pymatgen.core.structure import Structure
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.vasp import Poscar
# Load the MoS2 structure (assuming you have the CIF file)
MoS2 = Structure.from_file("MoS2_mp-1434.cif")
# Add oxidation states
MoS2.add_oxidation_state_by_element({"Mo": 4, "S": -2})
# Initialize SlabGenerator for a single layer
slabgen = SlabGenerator(MoS2,
miller_index=(0, 0, 1),
min_slab_size=MoS2.lattice.c/3, # Approximate single layer thickness in Å
in_unit_planes=False,
min_vacuum_size=10)
# Generate slabs
slabs = slabgen.get_slabs()
# Assuming the first slab is the desired single layer, this may need verification
single_layer_slab = slabs[0]
# Write the single layer structure to a POSCAR file
poscar = Poscar(single_layer_slab)
poscar.write_file("MoS2_single_layer_POSCAR")
```
But the result is as follows:

As you can see, obviously it includes multiple layers alongside the (001) plane. Attached are all the files mentioned above:
[MoS2_ML.zip](https://github.com/materialsproject/pymatgen/files/14546257/MoS2_ML.zip)
Any tips for achieving this goal will be helpful.
Regards,
Zhao
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3682/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3682/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3683
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3683/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3683/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3683/events
|
https://github.com/materialsproject/pymatgen/issues/3683
| 2,177,248,644
|
I_kwDOACgets6Bxi2E
| 3,683
|
Has the `CoherentInterfaceBuilder` class considered the issue of deduplication for equivalent structures?
|
{
"login": "hongyi-zhao",
"id": 11155854,
"node_id": "MDQ6VXNlcjExMTU1ODU0",
"avatar_url": "https://avatars.githubusercontent.com/u/11155854?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hongyi-zhao",
"html_url": "https://github.com/hongyi-zhao",
"followers_url": "https://api.github.com/users/hongyi-zhao/followers",
"following_url": "https://api.github.com/users/hongyi-zhao/following{/other_user}",
"gists_url": "https://api.github.com/users/hongyi-zhao/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hongyi-zhao/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hongyi-zhao/subscriptions",
"organizations_url": "https://api.github.com/users/hongyi-zhao/orgs",
"repos_url": "https://api.github.com/users/hongyi-zhao/repos",
"events_url": "https://api.github.com/users/hongyi-zhao/events{/privacy}",
"received_events_url": "https://api.github.com/users/hongyi-zhao/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-09T14:36:06
| 2024-03-09T14:36:06
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
I am not sure if the current implementation of the [`CoherentInterfaceBuilder`](https://github.com/materialsproject/pymatgen/blob/daa0bb01477321828aa324c9ce9d07383db778e1/pymatgen/analysis/interfaces/coherent_interfaces.py#L23) class takes into account the deduplication problem of equivalent structures.
See [here](https://github.com/materialsproject/pymatgen/issues/3612) for the related discussion.
Regards,
Zhao
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3683/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3683/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3684
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3684/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3684/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3684/events
|
https://github.com/materialsproject/pymatgen/issues/3684
| 2,177,520,842
|
I_kwDOACgets6BylTK
| 3,684
|
[Dev] Multiple dependencies for CI missing
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1532985663,
"node_id": "MDU6TGFiZWwxNTMyOTg1NjYz",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/dependencies",
"name": "dependencies",
"color": "0366d6",
"default": false,
"description": "Dependency issues and PRs"
},
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5414010766,
"node_id": "LA_kwDOACgets8AAAABQrM_jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/needs%20discussion",
"name": "needs discussion",
"color": "D96543",
"default": false,
"description": "Needs discussion to agree on actionable next steps"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"i believe missing `icet` was deliberate as @esoteric-ephemera [added it only to `requirements-optional.txt`](https://github.com/materialsproject/pymatgen/pull/3593/files#diff-d52eaab4a615f02e5a1b6e6dd9e17be0c5f0519bcdb433cd28c45705b569da45R14) which is not used in CI.\r\n\r\nthough i could see how that is confusing which is why i've advocated for removing the requirements files in the past. @shyuep prefers to keep. i fwiw, i think the `atomate2` approach is better of having a [`strict` optional deps section in pyproject.toml](https://github.com/materialsproject/atomate2/blob/9f6438150d63706d6f9bf9b63f143932be27b82b/pyproject.toml#L72)",
"`emmet` is purposefully not installed as it comes with a host of transitive deps.\r\n\r\nas for the others, i think it would be good to install and test their respective `pymatgen` integrations in CI",
"> i believe missing icet was deliberate as @esoteric-ephemera [added it only to requirements-optional.txt](https://github.com/materialsproject/pymatgen/pull/3593/files#diff-d52eaab4a615f02e5a1b6e6dd9e17be0c5f0519bcdb433cd28c45705b569da45R14) which is not used in CI.\r\n\r\nThat was deliberate. The same logic applies to `mcsqs` and a few other packages here. Tho that tends to mean that tests for these aren't actively maintained since CI never runs them (could suddenly have broken tests / interfaces if breaking changes are made in a dependency)",
"> Tho that tends to mean that tests for these aren't actively maintained since CI never runs them (could suddenly have broken tests / interfaces if breaking changes are made in a dependency)\r\n\r\nBut I assume it's still beneficial to keep the tests alive for robustness? (Issues are more likely to slip in if tests are skipped)\r\n\r\nAnyway, I would try to install some of these dependencies locally and see if any broken tests show up, and I would keep you updated.\r\n\r\n",
"@DanielYang59 feel free to install some of the missing packages in CI as well to activate those tests. ideally, we don't want to be blocked by upstream packages in our development ([see e.g. tblite](https://github.com/tblite/tblite/pull/122#issuecomment-1990610135)) but if a package is actively maintained and easy to install, it makes sense to add it in CI",
"A very late update, I ran tests for `mcsqs` locally and looks like it's not aging too badly and [only one timeout exception test is failing](https://github.com/materialsproject/pymatgen/pull/4209#discussion_r1864154532)\r\n\r\nI haven't investigated on the design of `mcsqs_caller` but it seems to raise three different timeout errors. I would just replace the error message in #4209 as both points to `mcsqs` timeout, let me know if I'm misunderstanding anything\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/31f1e1fb8cc1bb517d59ea8e484965bb641c42a0/src/pymatgen/command_line/mcsqs_caller.py#L136-L169\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/31f1e1fb8cc1bb517d59ea8e484965bb641c42a0/src/pymatgen/command_line/mcsqs_caller.py#L147\r\nhttps://github.com/materialsproject/pymatgen/blob/31f1e1fb8cc1bb517d59ea8e484965bb641c42a0/src/pymatgen/command_line/mcsqs_caller.py#L157-L159\r\nhttps://github.com/materialsproject/pymatgen/blob/31f1e1fb8cc1bb517d59ea8e484965bb641c42a0/src/pymatgen/command_line/mcsqs_caller.py#L169\r\n\r\nUpdate: also tested installing it in CI 3f63f4b341674e31d597506de4e6a64de4ed5ea3 but it's not worth it (way too slow at ~90 s)"
] | 2024-03-10T04:32:28
| 2024-12-01T06:25:47
|
2024-08-06T14:57:49Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Multiple external dependencies are missing from test setup, including:
- [ ] `graphviz`
- [ ] `critic2`: https://aoterodelaroza.github.io/critic2/installation/
- [ ] `zeo`
### Added
- [x] `Open Babel`: added in #3729
- [x] `enum_lib`: Added for Ubuntu only in #3729
- [x] `boltztrap2`: Fixed
- [x] `x_trans`: Added in #3985
- [x] `OBAlign`: Added in #3985
- [x] `vampire`: Added in #3985
### Not planned
- [x] `mcsqs`: not planned, tested in #4210 but the installation is too slow (~90 s)
- [x] `icet`: not planned (https://github.com/materialsproject/pymatgen/issues/3684#issuecomment-1987687507)
- [x] `emmet`: not planned (https://github.com/materialsproject/pymatgen/issues/3684#issuecomment-1987690470)
- [x] `gulp`: not planned (libgfortran3 not supported by Ubuntu20 afterwards)
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3684/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3684/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3685
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3685/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3685/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3685/events
|
https://github.com/materialsproject/pymatgen/pull/3685
| 2,179,275,089
|
PR_kwDOACgets5pQEgu
| 3,685
|
Officially support Python 3.12 and test in CI
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4735709485,
"node_id": "LA_kwDOACgets8AAAABGkUxLQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/compatability",
"name": "compatability",
"color": "E25438",
"default": false,
"description": "Concerning pymatgen compatibility with different OS, Python versions, numpy versions, etc."
},
{
"id": 5578251138,
"node_id": "LA_kwDOACgets8AAAABTH1bgg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ci",
"name": "ci",
"color": "4E135C",
"default": false,
"description": "Continuous integration"
},
{
"id": 5585018768,
"node_id": "LA_kwDOACgets8AAAABTOSfkA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/pkg",
"name": "pkg",
"color": "EFE8DB",
"default": false,
"description": "Package health and distribution related stuff"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"`chgnet` cythonized graph converter doesn't compile on 3.12:\r\n\r\n```py\r\nchgnet/graph/cygraph.c:1208:10: fatal error: fast_converter_libraries/create_graph.c: No such file or directory\r\n 1208 | #include \"fast_converter_libraries/create_graph.c\"\r\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\ncompilation terminated.\r\nerror: command '/usr/bin/gcc' failed with exit code 1\r\n```",
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThis update involves refinements across various modules in the `pymatgen` library, focusing on enhancing code clarity, type safety, and updating dependencies. Changes include variable renaming for better readability, type annotations for improved type checking, and adjustments in Python version compatibility in CI configurations and setup files.\n\n## Changes\n\n| Files | Change Summary |\n|-------|----------------|\n| `alchemy/transmuters.py`, `analysis/structure_prediction/substitutor.py` | Replaced `extend` with `+=` for list concatenation, updated return variable names, and renamed variables for clarity. |\n| `io/lobster/inputs.py` | Refactored keyword handling in `from_file`, optimized processing, and enhanced error handling. |\n| `io/vasp/outputs.py` | Modified `_parse_dos` method, added type annotations, and improved data processing. |\n| `.github/workflows/test.yml`, `setup.py` | Updated Python versions in CI configurations and dependencies. |\n| `tests/io/lobster/test_inputs.py` | Renamed instance variables within test classes for consistency. |\n\n## Possibly related issues\n- **Issue #3775**: Discusses potential problems with Python 3.12, relevant to updates in `.github/workflows/test.yml` and `setup.py` for Python 3.12 support, indicating preparation for compatibility and addressing concerns raised in the issue.\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n```plaintext\npymatgen/alchemy/transmuters.py: ## Short Summary\n\nThe changes in `transmuters.py` involve replacing the use of `extend` with `+=` for list concatenation in several methods like `append_transformation` and `append_transformed_structures`. Additionally, there is a change in the return variable name from `o` to `out` in the `_apply_transformation` function.\n\n## Alterations to the Declarations of Exported or Public Entities\n- `def apply_filter(self, structure_filter)` => `def apply_filter(self, structure_filter: AbstractStructureFilter)`\n\n---\n\npymatgen/analysis/structure_prediction/substitutor.py: ## Short Summary\n\nThe modifications in the `pred_from_structures` function in `substitutor.py` involve renaming variables from `s` to `dct` and updating variable references accordingly. The instantiation of `TransformedStructure` now uses `dct[\"structure\"]` and `dct[\"id\"]` instead of `s[\"structure\"]` and `s[\"id`].\n\n## Alterations to the declarations of exported or public entities\n- `for dct in structures_list:`\n- `els = dct[\"structure\"].elements`\n- `dct[\"structure\"]`\n- `dct[\"id\"]`\n- `t_struct = TransformedStructure(`\n- `dct[\"structure\"],`\n- `history=[{\"source\": dct[\"id\"]}],`\n- `result.append(t_struct)`\n- `transmuter.append_transformed_structures([t_struct])`\n\n---\n\npymatgen/io/lobster/inputs.py: ## Short Summary\n\nThe update involves refactoring the keyword handling in a lobsterin file within the `from_file` method of the `inputs.py` module. Changes include using `key` instead of `key_word[0].lower()` for key extraction, optimizing keyword processing, enhancing error handling for duplicate keywords, and revising float value processing and storage in `lobsterin_dict`.\n\n## Alterations to the declarations of exported or public entities\n\n- No alterations to the declarations of exported or public entities.\n\n---\n\npymatgen/io/vasp/outputs.py: ## Update existing summary\n\n## Short Summary\n\nThe change in functionality involves modifying the `_parse_dos` method in the `Outputs` class within `pymatgen/io/vasp/outputs.py`. The method now returns a tuple containing instances of `Dos`, a list of `pdos`, and a list of dictionaries, with adjustments to data processing and type annotations.\n\n## Alterations to the declarations of exported or public entities\n\n- `def _parse_dos(elem) -> tuple[Dos, Dos, list[dict]]` in class `Outputs` in `pymatgen/io/vasp/outputs.py`\n- `pdos: dict[Orbital | OrbitalType, dict[Spin, np.ndarray]] = defaultdict(dict)`\n- `_n_row, n_col = data.shape`\n- `for col_idx in range(1, n_col):`\n- `orb = Orbital(col_idx - 1) if lm else OrbitalType(col_idx - 1)`\n- `pdos[orb][spin] = data[:, col_idx] # type: ignore[index]`\n- `return Dos(efermi, energies, tdensities), Dos(efermi, energies, idensities), pdoss`\n\n---\n\n.github/workflows/test.yml: ## Short Summary\n\nThe change in the `.github/workflows/test.yml` file involves updating the Python versions used in the CI matrix configuration. Specifically, the Python versions have been changed from \"3.11\" to \"3.12\" for both Ubuntu and Windows environments.\n\n## Alterations to the declarations of exported or public entities\n\n- `python-version: [\"3.9\", \"3.12\"]` in job matrix configuration\n- `python-version: \"3.12\"` in exclude configuration for Windows environment\n\n---\n\nsetup.py: ## Short Summary\n\nIn the `setup.py` file, the changes involve updating the dependencies for the `\"relaxation\"` and `\"dev\"` sections by specifying version requirements for the packages `chgnet` and `chgnet`, respectively. Additionally, a new Python version (`3.12`) has been added to the classifiers. The dependencies for `tblite` have been adjusted to not depend on versions above 3.11 due to compatibility issues.\n\n---\n\ntests/io/lobster/test_inputs.py: ## Short Summary\nThe modifications in `tests/io/lobster/test_inputs.py` involve renaming instance variables within the `TestLobsterin` class related to `Lobsterin` objects for consistency and clarity, impacting the setup and test methods.\n\n## Alterations to the declarations of exported or public entities\n- `self.Lobsterinfromfile` => `self.Lobsterin`\n- `self.Lobsterinfromfile2` => `self.Lobsterin2`\n- `self.Lobsterinfromfile3` => `self.Lobsterin3`\n- `self.Lobsterinfromfile4` => `self.Lobsterin4`\n```\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request aims to add Python 3.12 to the officially supported versions and integrate it into the continuous integration (CI) testing framework. The description highlights potential compatibility issues with upstream packages, specifically `pytorch` and `spglib`, as noted in a related issue comment. The PR addresses the need to ensure that all components of the project, including dependencies and internal modules, function correctly under Python 3.12.\n\n### Comments Summary\n\nSeveral issues and discussions emerged during the testing of the project with Python 3.12:\n\n1. **Compilation Error in `chgnet`**: Janosh reported a compilation failure for the `chgnet` module due to a missing file in the Cythonized graph converter. This issue is critical as it prevents the module from compiling successfully on Python 3.12.\n\n2. **Failing Tests in `lobster`**: Janosh also noted that some tests in the `lobster` module began to fail under Python 3.12. Although most were fixed, two persistent issues related to dictionary functionality and file read-write operations were highlighted. JaGeo suggested potential solutions related to Python's `UserDict` and linked to ongoing discussions and fixes in other issues.\n\n3. **Platform-Specific Behavior**: Janosh mentioned an inability to reproduce some issues locally on macOS, suggesting that some bugs might be specific to the Linux environment used in CI. This complicates debugging and requires further investigation to isolate the environment-specific factors.\n\n4. **Discussion on `UserDict` Usage**: There was a significant discussion about the use of `UserDict` in the `Lobsterin` class. Janosh proposed removing `UserDict` to simplify the implementation, but JaGeo referenced past issues where `UserDict` provided necessary functionality. The exact benefits and alternatives to `UserDict` remain a point of contention and require a clear resolution.\n\n### AI-Generated Summary of Generated Summaries\n\nThe proposed changes across various modules aim to enhance compatibility with Python 3.12 and improve code quality:\n\n- **General Refactoring**: In `transmuters.py`, list operations were optimized by replacing `extend` with `+=`. Similarly, variable names and structures were clarified in `substitutor.py` and `inputs.py` to improve readability and maintainability.\n\n- **Error Handling and Data Processing**: The `inputs.py` module saw improvements in keyword handling and error management in the lobsterin file processing, ensuring more robust data handling.\n\n- **Type Annotations and Data Structures**: The `outputs.py` module updated the `_parse_dos` method to include detailed type annotations and adjusted data structures for better clarity and performance.\n\n- **CI Configuration**: The CI testing configuration was updated to include Python 3.12, reflecting the PR's goal to support the new Python version.\n\n- **Dependency Management**: Adjustments were made in `setup.py` to specify version requirements for dependencies, ensuring compatibility with the new Python version.\n\n### Alterations to the Declarations of Exported or Public Entities\n\n**pymatgen/alchemy/transmuters.py**:\n- `def apply_filter(self, structure_filter)` => `def apply_filter(self, structure_filter: AbstractStructureFilter)`\n\n**pymatgen/io/vasp/outputs.py**:\n- `def _parse_dos(elem)` => `def _parse_dos(elem) -> tuple[Dos, Dos, list[dict]]`\n- `pdos = defaultdict(dict)` => `pdos: dict[Orbital | OrbitalType, dict[Spin, np.ndarray]] = defaultdict(dict)`\n\n**.github/workflows/test.yml**:\n- `python-version: [\"3.9\", \"3.11\"]` => `python-version: [\"3.9\", \"3.12\"]`\n- `python-version: \"3.11\"` => `python-version: \"3.12\"`\n\n**tests/io/lobster/test_inputs.py**:\n- `self.Lobsterinfromfile` => `self.Lobsterin`\n- `self.Lobsterinfromfile2` => `self.Lobsterin2`\n- `self.Lobsterinfromfile3` => `self.Lobsterin3`\n- `self.Lobsterinfromfile4` => `self.Lobsterin4`\n\nThese changes collectively aim to enhance the project's compatibility with Python 3.12, improve code clarity, and ensure robustness in data handling and testing configurations.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: .coderabbit.yaml**\n**Review profile: CHILL**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 2e051577c9c53ff896e49952d0d0a144e145ee3d and 7779aeb4958d4c8c0a6871eadeac6a99c0464999.\n</details>\n\n\n<details>\n<summary>Files selected for processing (3)</summary>\n\n* pymatgen/alchemy/transmuters.py (10 hunks)\n* pymatgen/io/lobster/inputs.py (3 hunks)\n* tests/io/lobster/test_inputs.py (5 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (3)</summary>\n\n* pymatgen/alchemy/transmuters.py\n* pymatgen/io/lobster/inputs.py\n* tests/io/lobster/test_inputs.py\n\n</details>\n\n\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 9445716a4a31c211e6441375cbb37b5783a8e290 -->\n<!-- 27a031f8cf9b5d3a186b61f9da1f89b94ffad2b7 -->\n<!-- 75202b7771d9f810a1f2cd99f15bd0336a76c1e2 -->\n<!-- 440492d7fec43d103e0d4afb28e3c6454277bef6 -->\n<!-- 77a436ad03a5d60c0aa119639a86f6dd5d6b42f4 -->\n<!-- 56c2e9562fad93e0101ec39a3955e2e75f93fdc4 -->\n<!-- 0990f1f05167811ca5fd900086bd8ebf43635749 -->\n<!-- bc5323a63b513689618b5da1a96626e4b5bfa676 -->\n<!-- 2e051577c9c53ff896e49952d0d0a144e145ee3d -->\n<!-- fb7f63c5ef9daace6b54ac4b204a84e04d05281c -->\n<!-- e95352bba26be87ab44fcce954ba78e2b9e52c28 -->\n<!-- 32b0efdc408b32a5f392eb475c3c2a60117c4e08 -->\n<!-- 26bc81b3306009bd2cf97c14a286f6c873be0ed9 -->\n<!-- 7779aeb4958d4c8c0a6871eadeac6a99c0464999 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@JaGeo some of the lobster tests started failing under Python 3.12. i fixed all but two. maybe you know what needs to change here?\r\n\r\n```py\r\n____________________ TestLobsterin.test_dict_functionality _____________________\r\n\r\nself = <lobster.test_inputs.TestLobsterin testMethod=test_dict_functionality>\r\n\r\n def test_dict_functionality(self):\r\n for key in (\"COHPstartEnergy\", \"COHPstartEnergy\", \"COhPstartenergy\"):\r\n start_energy = self.Lobsterin.get(key)\r\n> assert start_energy == -15.0, f\"{start_energy=}\"\r\nE AssertionError: start_energy=None\r\n\r\ntests/io/lobster/test_inputs.py:1773: AssertionError\r\n___________________ TestLobsterin.test_read_write_lobsterin ____________________\r\n\r\nself = <lobster.test_inputs.TestLobsterin testMethod=test_read_write_lobsterin>\r\n\r\n def test_read_write_lobsterin(self):\r\n outfile_path = tempfile.mkstemp()[1]\r\n lobsterin1 = Lobsterin.from_file(f\"{TEST_DIR}/lobsterin.1\")\r\n lobsterin1.write_lobsterin(outfile_path)\r\n lobsterin2 = Lobsterin.from_file(outfile_path)\r\n> assert lobsterin1.diff(lobsterin2)[\"Different\"] == {}\r\nE AssertionError\r\n\r\ntests/io/lobster/test_inputs.py:1793: AssertionError\r\n```",
"@janosh : see https://github.com/materialsproject/pymatgen/issues/3775 ",
"@janosh could you try this solution for now? \r\nhttps://github.com/python/cpython/issues/105524#issuecomment-1610750842",
"@JaGeo oh right, i forgot about our `UserDict` discussion in #3757.\r\n\r\nif possible, i'd prefer to drop `UserDict` altogether and make `Lobsterin` inherit directly from `dict`. do you remember [what exactly the issues it solves are](https://github.com/materialsproject/pymatgen/pull/3757#issuecomment-2057411158)?",
"@janosh We had issues in #3439 that the Userdict solved. ",
"@JaGeo the suggested fix [you linked](https://github.com/materialsproject/pymatgen/pull/3685#issuecomment-2081967584) doesn't work (see [da1f7c5](https://github.com/materialsproject/pymatgen/pull/3685/commits/da1f7c59a96203073918df245b62a222482c06a1)). i'm still unclear what benefits `UserDict` offers after having looked at https://github.com/materialsproject/pymatgen/pull/3439",
"I can try again in the next days. Need to fix other stuff as well. Sorry that this functionality here is such a pain.",
"the thing making this hard to debug is that i can't repro the issue locally. even on 3.12, everything works for me on macOS. don't understand why this would be linux-specific (if it is)",
"> the thing making this hard to debug is that i can't repro the issue locally. even on 3.12, everything works for me on macOS. don't understand why this would be linux-specific (if it is)\r\n\r\nFixes everything except for a temp_path problem. Not sure where this is coming from. will check and see if I can fix it as well. Overwrote the `__contains__` with a similar method as `__get_item__` before",
"@janosh tests are passing locally now for py 3.12. You might want to check the tmp_dir change. The rest should hopefully be fine now. ",
"3.9 and 3.12 tests are passing. 3.11 does not run.",
"> 3.9 and 3.12 tests are passing\r\n\r\nperfect! thanks! 👍 \r\n\r\n> 3.11 does not run.\r\n\r\nthat's intentional. no point in wasting Ci budget. usually enough to test the oldest and newest boundaries of supported versions. i'll update the required status checks before merging here to make 3.12 tests instead of 3.11 required\r\n\r\n> You might want to check the tmp_dir change\r\n\r\ndone. i refactored the test slightly and deleted the new test files. i assume they were added by accident?"
] | 2024-03-11T14:27:08
| 2024-05-01T00:27:53
|
2024-05-01T00:27:52Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
unknown if all upstream packages have 3.12 support by now. potential issues expected for `pytorch` and `spglib` https://github.com/materialsproject/atomate2/pull/768#issuecomment-1988198169.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3685/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3685/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3685",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3685",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3685.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3685.patch",
"merged_at": "2024-05-01T00:27:52Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3686
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3686/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3686/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3686/events
|
https://github.com/materialsproject/pymatgen/issues/3686
| 2,184,227,651
|
I_kwDOACgets6CMKtD
| 3,686
|
Fatband plot with lobster: not only vasp should be supported
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
}
] |
closed
| false
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
] | null |
[] | 2024-03-13T14:58:18
| 2024-03-14T17:08:52
|
2024-03-14T17:08:52Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Feature Requested
Not only fatband plots with lobster and VASP should be covered.
### Proposed Solution
Use POSCAR.lobster instead of vasprun.xml, POSCAR.lobster will be used. Efermi can be read from vasprun.xml
### Relevant Information
_No response_
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3686/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3686/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3687
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3687/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3687/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3687/events
|
https://github.com/materialsproject/pymatgen/issues/3687
| 2,184,334,609
|
I_kwDOACgets6CMk0R
| 3,687
|
Ion.oxi_state_guesses fails for 'Br' or 'Br(aq)'
|
{
"login": "rkingsbury",
"id": 1908695,
"node_id": "MDQ6VXNlcjE5MDg2OTU=",
"avatar_url": "https://avatars.githubusercontent.com/u/1908695?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/rkingsbury",
"html_url": "https://github.com/rkingsbury",
"followers_url": "https://api.github.com/users/rkingsbury/followers",
"following_url": "https://api.github.com/users/rkingsbury/following{/other_user}",
"gists_url": "https://api.github.com/users/rkingsbury/gists{/gist_id}",
"starred_url": "https://api.github.com/users/rkingsbury/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/rkingsbury/subscriptions",
"organizations_url": "https://api.github.com/users/rkingsbury/orgs",
"repos_url": "https://api.github.com/users/rkingsbury/repos",
"events_url": "https://api.github.com/users/rkingsbury/events{/privacy}",
"received_events_url": "https://api.github.com/users/rkingsbury/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-13T15:44:27
| 2024-03-13T15:44:49
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.10.6
### Pymatgen version
Version: 2024.2.8
### Operating system version
Ubuntu (Windows WSL2)
### Current behavior
`Ion.oxi_state_guesses` fails for `Br`, and for `Br2` unless `all_oxi_state_guesses` is set. This is a problem because 1) `Composition.oxi_state_guesses` works in this case and 2) `Br` is the standard state of bromine
```
>>> from pymatgen.core.ion import Ion
>>> Ion.from_formula('Br').oxi_state_guesses()
()
>>> Ion.from_formula('Br').oxi_state_guesses(all_oxi_states=True)
()
>>> Ion.from_formula('Br2').oxi_state_guesses()
()
>>> Ion.from_formula('Br2').oxi_state_guesses(all_oxi_states=True)
({'Br': 0.0},)
>>> from pymatgen.core import Composition
>>> Composition('Br').oxi_state_guesses()
({'Br': 0.0},)
```
### Expected Behavior
```
>>> Ion.from_formula('Br').oxi_state_guesses()
({'Br': 0.0},)
>>> Ion.from_formula('Br(aq)').oxi_state_guesses()
({'Br': 0.0},)
```
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3687/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3687/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3688
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3688/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3688/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3688/events
|
https://github.com/materialsproject/pymatgen/pull/3688
| 2,184,402,694
|
PR_kwDOACgets5phwGV
| 3,688
|
Generalize fatband plots from Lobster
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 5322856717,
"node_id": "LA_kwDOACgets8AAAABPURZDQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/data%20viz",
"name": "data viz",
"color": "3C19AC",
"default": false,
"description": "PRs and issues about pymatgen plotting functionality"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"@janosh I had to fight with mypy for the Structure. I did not see why it complained. Maybe, you see something... I added ignores for now.",
"Looks like the same download timeout error as #3675 from `uv` for large dependencies, see discussion [here](https://github.com/astral-sh/uv/issues/1921), maybe we should increase the `UV_HTTP_TIMEOUT`?\r\n```\r\nCaused by: Failed to download distribution due to network timeout. Try increasing UV_HTTP_TIMEOUT\r\n```\r\n",
"@janosh weird failures during the dependency installations",
"no point in increasing `UV_HTTP_TIMEOUT` since it's already very high (300s). hopefully, `uv` comes up with a fix soon-ish else we might have to pre-install `pytorch` with `pip` before calling `uv`",
"> we might have to pre-install `pytorch` with `pip` before calling `uv`\r\n\r\nThis sounds like a good temporary fix 😃 \r\n",
"@janosh are the changes fine? Tests have run through after I triggered them again ",
"> Todo:\r\n> More tests\r\n\r\nis the todo resolved?",
"> > Todo:\r\n> > More tests\r\n> \r\n> is the todo resolved?\r\n\r\nYes, i added several new tests.\r\n"
] | 2024-03-13T16:15:21
| 2024-03-14T17:08:51
|
2024-03-14T17:08:51Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Closes #3686
Todo:
- [x] More tests
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3688/reactions",
"total_count": 3,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 2,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3688/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3688",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3688",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3688.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3688.patch",
"merged_at": "2024-03-14T17:08:51Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3689
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3689/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3689/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3689/events
|
https://github.com/materialsproject/pymatgen/pull/3689
| 2,186,592,233
|
PR_kwDOACgets5ppLVz
| 3,689
|
Improve Bandoverlaps parser
|
{
"login": "naik-aakash",
"id": 91958822,
"node_id": "U_kgDOBXsuJg",
"avatar_url": "https://avatars.githubusercontent.com/u/91958822?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/naik-aakash",
"html_url": "https://github.com/naik-aakash",
"followers_url": "https://api.github.com/users/naik-aakash/followers",
"following_url": "https://api.github.com/users/naik-aakash/following{/other_user}",
"gists_url": "https://api.github.com/users/naik-aakash/gists{/gist_id}",
"starred_url": "https://api.github.com/users/naik-aakash/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/naik-aakash/subscriptions",
"organizations_url": "https://api.github.com/users/naik-aakash/orgs",
"repos_url": "https://api.github.com/users/naik-aakash/repos",
"events_url": "https://api.github.com/users/naik-aakash/events{/privacy}",
"received_events_url": "https://api.github.com/users/naik-aakash/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 6043913731,
"node_id": "LA_kwDOACgets8AAAABaD7OAw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/lobster",
"name": "lobster",
"color": "F51A76",
"default": false,
"description": "Lobster package (Local Orbital Basis Suite Towards Electronic-Structure Reconstruction)"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-14T14:56:56
| 2024-03-15T10:49:56
|
2024-03-15T10:49:56Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
# Issue
Current implementation of `Bandoverlaps` parser adds keys with '.' in `band_overlaps_dict` attribute leading to failure of pydantic checks in atomate2 lobster workflow https://github.com/materialsproject/atomate2/issues/769
# Changes
1. Rewrite output format of `band_overlaps_dict` attribute of `Bandoverlaps` class
2. Update and add associated tests
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3689/reactions",
"total_count": 1,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 1,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3689/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3689",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3689",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3689.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3689.patch",
"merged_at": "2024-03-15T10:49:55Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3690
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3690/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3690/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3690/events
|
https://github.com/materialsproject/pymatgen/pull/3690
| 2,188,244,290
|
PR_kwDOACgets5pu1SW
| 3,690
|
`os.path.(exists->isfile)`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-15T10:56:11
| 2024-04-12T05:46:34
|
2024-03-15T11:20:20Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
more accurate and more semantic
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3690/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3690/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3690",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3690",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3690.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3690.patch",
"merged_at": "2024-03-15T11:20:20Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3691
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3691/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3691/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3691/events
|
https://github.com/materialsproject/pymatgen/pull/3691
| 2,190,439,517
|
PR_kwDOACgets5p2Xxf
| 3,691
|
Clean up `core.surface` comments and docstrings
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5648629103,
"node_id": "LA_kwDOACgets8AAAABUK89bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/core",
"name": "core",
"color": "299448",
"default": false,
"description": "Pymatgen core"
},
{
"id": 5692928617,
"node_id": "LA_kwDOACgets8AAAABU1MyaQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/surfaces",
"name": "surfaces",
"color": "521BBE",
"default": false,
"description": "Surface analysis"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Notice multiple funcs with unused `include_index` and `include_image` args across `core.structure`, for example: https://github.com/materialsproject/pymatgen/blob/884946d0d3c022ae197e4188364db2b7ad9cde9a/pymatgen/core/structure.py#L1825-L1911\r\n\r\nThese args were marked \"Deprecated\" **five years ago** in #1610 so I assume it should be safe to remove them?\r\n\r\nOr perhaps even the function altogether? https://github.com/materialsproject/pymatgen/blob/884946d0d3c022ae197e4188364db2b7ad9cde9a/pymatgen/core/structure.py#L1990-L2007\r\n\r\nCan you please advice on this? @janosh",
"I must have opened the Pandora's box of `mypy` errors... Still quite some errors to fix 😭 ",
"Can you pls assign me to the above mentions issues so others would know someone is working on those to avoid overlapping? @janosh, thanks.",
"i can only assign members of MP to issues or people who've commented on issues. so if you leave a comment i could assign you. but given the 1st issue has been open since Oct 23, i don't see a high risk of other people working on it",
"> but given the 1st issue has been open since Oct 23, i don't see a high risk of other people working on it\r\n\r\nI think it should be fine. People should see this PR being linked to those issues. Thanks for the help. \r\n\r\nBut I'm afraid this would take some time as it seems I would need to clean up the entire `surface` module \r\n\r\n",
"> But I'm afraid this would take some time as it seems I would need to clean up the entire surface module\r\n\r\nthat would be great. i can definitely help out here and there :)",
"> Notice multiple funcs with unused `include_index` and `include_image` args across `core.structure`, for example:\r\n> \r\n> https://github.com/materialsproject/pymatgen/blob/884946d0d3c022ae197e4188364db2b7ad9cde9a/pymatgen/core/structure.py#L1825-L1911\r\n> \r\n> These args were marked \"Deprecated\" **five years ago** in #1610 so I assume it should be safe to remove them?\r\n> \r\n> Or perhaps even the function altogether?\r\n> \r\n> https://github.com/materialsproject/pymatgen/blob/884946d0d3c022ae197e4188364db2b7ad9cde9a/pymatgen/core/structure.py#L1990-L2007\r\n\r\nIn case you missed this @janosh. Thanks!\r\n\r\n",
"sorry, i did miss this. \r\n\r\n`get_all_neighbors_old` needs to stay. it's only there for testing purposes (slow but easy to implement and therefore less error prone).\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/48af0386a80b5a6e59d97b42f62529358c43cbb3/tests/core/test_structure.py#L815\r\n\r\nthe unused keywords `include_(index|image)` are to unsure compatible function signatures though i never checked if anything would actually break by removing them. you're welcome to try :)",
"> sorry, i did miss this.\r\n> \r\n> `get_all_neighbors_old` needs to stay. it's only there for testing purposes (slow but easy to implement and therefore less error prone).\r\n> \r\n> https://github.com/materialsproject/pymatgen/blob/48af0386a80b5a6e59d97b42f62529358c43cbb3/tests/core/test_structure.py#L815\r\n\r\nSure let's keep it for testing\r\n\r\n> the unused keywords `include_(index|image)` are to unsure compatible function signatures though i never checked if anything would actually break by removing them. you're welcome to try :)\r\n\r\nThanks. I might go ahead and give it a try. But I'm not sure if any downstream packages call these two args, if they do, this might break them.\r\n\r\nFor example if any downstream code goes like:\r\n ```python\r\nget_all_neighbors( \r\ninclude_index = False, \r\ninclude_image = False\r\n)\r\n```\r\n\r\nThese two args would be just ignored, but if we remove them the code might break (`include_index is an invalid keyword argument for get_all_neighbors`).\r\n\r\n I guess it's better to add some deprecation tag for some time just in case?",
"given those keywords have no effect, downstream code is unlikely to use them but of course a deprecation period doesn't hurt",
"Dependency installation with `uv` is [failing again](https://github.com/materialsproject/pymatgen/actions/runs/8320310950/job/22764834050?pr=3691). \r\n\r\nMaybe we should consider reverting `torch` installation with `pip` for the time being? @janosh",
"> Maybe we should consider reverting torch installation with pip for the time being? @janosh\r\n\r\nthe thing we need to find out first is how to make `uv` ignore packages that are already installed. i think by default it will try to overwrite existing `pytorch`",
"\r\n> the thing we need to find out first is how to make `uv` ignore packages that are already installed. i think by default it will try to overwrite existing `pytorch`\r\n\r\nIt seems to me `uv` would ignore already installed package? Maybe I'm wrong\r\n```bash\r\n(venv) yang@Yang-MacStudio pymatgen % pip show torch\r\nName: torch\r\nVersion: 2.2.1\r\nSummary: Tensors and Dynamic neural networks in Python with strong GPU acceleration\r\nHome-page: https://pytorch.org/\r\nAuthor: PyTorch Team\r\nAuthor-email: packages@pytorch.org\r\nLicense: BSD-3\r\nLocation: /Users/yang/developer/pymatgen/venv/lib/python3.9/site-packages\r\nRequires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions\r\nRequired-by: matgl, pytorch-lightning, torchdata, torchmetrics\r\n\r\n(venv) yang@Yang-MacStudio pymatgen % uv pip install torch\r\nAudited 1 package in 2ms\r\n```\r\n\r\n",
"you need to test `uv pip install .`. i think in that case it will overwrite but maybe they changed that in a recent release",
"This is what I got running locally on my MacOS machine:\r\n```bash\r\n(venv) yang@Yang-MacStudio pymatgen % uv pip install -e .\r\n Built file:///Users/yang/developer/pymatgen Built 1 editable in 31.62s\r\nResolved 40 packages in 2.03s\r\nInstalled 1 package in 1ms\r\n - pymatgen==2024.3.1 (from file:///Users/yang/developer/pymatgen)\r\n + pymatgen==2024.3.1 (from file:///Users/yang/developer/pymatgen)\r\n```\r\n\r\nHope this would be helpful 😄 ",
"> Maybe we should consider reverting `torch` installation with `pip` for the time being? @janosh\r\n\r\nthat was added in #3697 and is now on `master`",
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates across pymatgen's codebase focus on refining code efficiency and clarity. Enhancements include streamlined methods, improved error handling with modern Python syntax, and more precise type declarations. Additionally, test scripts now employ more accurate assertions for floating-point comparisons, ensuring robustness in numerical tests.\n\n## Changes\n\n| File Path | Change Summary |\n|-----------|----------------|\n| `pymatgen/core/.../sites.py`<br>`pymatgen/core/.../structure.py` | Refactored methods, enhanced error handling, improved type hints, and conditions. |\n| `tests/apps/borg/.../test_queen.py`<br>`tests/core/.../test_surface.py` | Enhanced test scripts with improved floating-point comparisons and simplified test method parameters. |\n\n> 🐰✨\n> In the land of code, where logic gates play,\n> A rabbit hopped through, refining away.\n> With a tweak and a type, and a loop now concise,\n> Our code runs smoother than ever, oh so nice!\n> Cheers to clean code, on this bright, sunny day! 🌟\n> 🐰✨\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/core/sites.py: ## Short summary\n\nIn the `species_string` method of `pymatgen/core/sites.py`, the comment regarding the `specie` property has been modified to remove a redundant space before \"Robust.\"\n\n---\n\npymatgen/core/structure.py: ## Short summary\n\n- The `site_properties` method now directly returns a dictionary comprehension instead of building it iteratively.\n- The `labels` method's docstring has been updated for clarity.\n- The `add_oxidation_state_by_element` method now uses a walrus operator for error handling.\n- The `calc_params` assignment in the `_relax` method has been modified based on the `is_molecule` condition.\n- The `from_sites` method now uses a more concise condition for input validation.\n- The fractional coordinates calculation in the `from_spacegroup` and `from_magnetic_spacegroup` methods has been adjusted based on the `coords_are_cartesian` condition.\n- The `copy` method in the `Structure` class now explicitly types its parameters and return type.\n- The `interpolate` method now sets the `images` variable based on the type of `nimages`.\n- The `to` method now uses a set for the format comparison.\n- The `from_file` method now uses the walrus operator for the `match` variable assignment.\n- The `Structure` class now uses `float` instead of `int` for the `charge` parameter in the constructor.\n- The `substitute` method now handles the assignment of `fgroup` based on the type of `func_group`.\n- The `apply_strain` and `make_supercell` methods in the `Structure` class now explicitly type their return types.\n- The `from_prototype` method in the `Structure` class now uses equality comparisons for prototype checks.\n\n---\n\ntests/apps/borg/test_queen.py: ## Short summary\n\n- Added an import statement for `approx` from `pytest`.\n- Modified an assertion in the `test_get_data` function to use `approx` for comparing floating-point values.\n\n---\n\ntests/core/test_surface.py: ## Short summary\n\nIn the `test_as_dict` function of `test_surface.py`, the `scale_factor` attribute of `self.zno55` is modified to be passed without converting it to a list. The test method `test_nonstoichiometric_symmetrized_slab` is renamed to `test_non_stoichiometric_symmetrized_slab`. Variable names like `mg_lattice` and `trig_bi` are updated for clarity.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe PR titled \"Clean up `core.surface`\" (PR #3691) aims to enhance the `core.surface` module in pymatgen by improving comments, docstrings, and code organization. This PR focuses on non-breaking changes, including a thorough cleanup of comments and docstrings for clarity and completeness, as well as sorting method order in `Slab` and `SlabGenerator` classes. The PR also addresses various TODOs like adding type annotations, clarifying terminology, and fixing legacy issues in unit tests. \n\nLooking ahead, the PR outlines potential breaking changes that require discussion, such as adopting tolerance-based position overlap checks and revising the default behavior of the `shift` parameter in `SlabGenerator`. Additionally, it points to existing issues related to the `Slab` module that need attention, indicating a broader effort to improve this part of the library.\n\n### Comments Summary\n\nKey discussions in the PR comments include:\n1. **Deprecated Arguments**: DanielYang59 highlights deprecated arguments in `core.structure` functions and suggests removing them. Janosh mentions the need to keep one function for testing purposes but is open to removing the deprecated arguments if they don't impact functionality.\n \n2. **Assignment and Issue Tracking**: DanielYang59 requests assignment to related issues to avoid overlap, and Janosh clarifies the assignment policy and suggests claiming issues by commenting on them.\n\n3. **Dependency Management**: Discussions revolve around dependency installation issues with `uv` and `torch`. DanielYang59 suggests reverting to `pip` for installing `torch`, and Janosh advises investigating how `uv` handles already installed packages.\n\n### AI-Generated Summary of Generated Summaries\n\nThis PR streamlines the `core.surface` module in pymatgen by:\n- Refining comments and docstrings for clarity and completeness.\n- Rearranging method order in `Slab` and `SlabGenerator` classes.\n- Addressing TODOs like adding type annotations and fixing legacy issues in unit tests.\n- Outlining potential breaking changes for discussion, such as adopting tolerance-based position overlap checks and revising default behaviors.\n- Pointing to existing issues related to the `Slab` module for further attention, indicating a comprehensive effort to enhance this part of the library.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 45a3da9a3648691eb4158c7f9835df707bf62727 and 1b80a2b73b26258626c7a716c1ec2381552241fd.\n</details>\n\n\n<details>\n<summary>Files selected for processing (3)</summary>\n\n* tests/apps/borg/test_queen.py (2 hunks)\n* tests/core/test_surface.py (5 hunks)\n* tests/files/.pytest-split-durations (1 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (2)</summary>\n\n* tests/apps/borg/test_queen.py\n* tests/core/test_surface.py\n\n</details>\n\n\n<details><summary>Additional comments not posted (1)</summary><blockquote>\n<details><summary>tests/files/.pytest-split-durations (1)</summary><blockquote>\n\n`1107-1107`: Renaming the test method improves readability and consistency in naming conventions.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 45a3da9a3648691eb4158c7f9835df707bf62727 -->\n<!-- 1b80a2b73b26258626c7a716c1ec2381552241fd -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Can you please review this? @janosh. Sorry I'm making this PR overly large, but I don't expect functional changes within this PR (mostly cleaning up of comment/docstring/namings). \r\n\r\nAnd I would also expect (multiple) follow up PRs, as I did find some issues (all tagged, you could search `@DanielYang59` to find tags). And I think it would be easier to view the difference if I separate them with this PR.",
"> > And I would also expect (multiple) follow up PRs, as I did find some issues (all tagged, you could search `@DanielYang59` to find tags). And I think it would be easier to view the difference if I separate them with this PR.\r\n> \r\n> thanks a lot for polishing this module! doc string improvements are great for helping usability\r\n\r\nThanks a lot for reviewing and capture those issues. This really took me a lot of energy but I'm now much much familiar with the module, which should hugely facilitate future functional tweaks.",
"@janosh @DanielYang59 I think this PR may have removed the definition of `_calculate_possible_shifts` or was it renamed?",
"Hi @ftherrien thanks for asking. It's now renamed to `gen_possible_terminations` as a private function of `get_slabs` method under `SlabGenerator` class for two reasons:\r\n- It was a private method and depended on by `get_slabs` alone.\r\n- The original name is a bit misleading, because it doesn't really generate the shift but the termination (negative of shift).\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/b28c9371d684b8a605830cd13060bef9accf68cf/src/pymatgen/core/surface.py#L1226-L1232",
"Ah! Thanks so much that makes a lot of sense",
"All good! Thanks for asking and happy coding!"
] | 2024-03-17T02:04:10
| 2024-08-14T05:06:55
|
2024-04-10T05:31:47Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Major clean up of `core.surface`, I decide to split this task into two for readability: this PR to revise comments/docstrings with some relocation of code. Another follow up PR for functional changes/fixes.
### Non-breaking changes
- Major clean up of comments/docstrings (made more concise and add missing)
- Sort ordering of methods in `Slab` and `SlabGenerator`
### TODOs:
- [x] Add type annotations and format clean up in `core.surface` and `core.structure`
- [x] Clarify wording of `site` and `point` in `surface.Slab`, currently a mixture of both is used and might be confusing
- [x] Legacy fix in `queen` unit test from #3681
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3691/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3691/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3691",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3691",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3691.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3691.patch",
"merged_at": "2024-04-10T05:31:47Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3692
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3692/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3692/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3692/events
|
https://github.com/materialsproject/pymatgen/issues/3692
| 2,191,492,838
|
I_kwDOACgets6Cn4bm
| 3,692
|
[Dev] Unify all docstrings to Google-Styled
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5456916296,
"node_id": "LA_kwDOACgets8AAAABRUHvSA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/docs",
"name": "docs",
"color": "35B067",
"default": false,
"description": "Documentation, examples, user guides"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"help with getting consistent Google-style doc strings everywhere would be much appreciated!",
"Fixed in #3694"
] | 2024-03-18T08:06:46
| 2024-03-22T11:07:33
|
2024-03-22T11:07:33Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Noticed some docstrings are still formatted in `Sphinx` style here and there.

Also it seems @janosh is working on reformat them to to Google style for example #3320.
Do we have any plan to use Google style? Should I go ahead and try to reformat more? Thanks.
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3692/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3692/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3693
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3693/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3693/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3693/events
|
https://github.com/materialsproject/pymatgen/pull/3693
| 2,191,692,095
|
PR_kwDOACgets5p6gHp
| 3,693
|
Standardize test names: e.g. `LatticeTestCase` -> `TestLattice`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Thanks for pinging me here 😄 .\r\n\r\nBut for me personally I think initialize a `Species` or `Composition` with an atomic number feels a bit weird/unexpected...Because I think people are expecting chemical Species/Composition to look \"chemical\" like `Composition(\"LiFePO4\")`\r\n\r\nAlso init a Species/Composition might be limited to single-atom Species/Composition, and this might be a very limited use case.(How to init a Species/Composition like \"H2O\" from `int` for example?)\r\n\r\nI assume a helper func to convert `int` to element name would be more straightforward, and could be reused universally instead of modifying all these classes to accept `int`?\r\n\r\n\r\n",
"I vote no on this change. I don't even understand why this is needed. ",
"> I don't even understand why this is needed.\r\n\r\nit's easy to imagine use cases where people have integers and want to create `Species` from them without interconverting to symbols.\r\nalso, [did you read my comment](https://github.com/materialsproject/pymatgen/pull/3693#discussion_r1528394173)?\r\n\r\n> \r\n> the initial motivation for this change came from me noticing (and being surprised) that Structure already handles int\r\n> \r\n> at that point it seems natural to expect as a user that other core classes like Composition should do the same\r\n\r\n@shyuep given your question i have a counter question: why do we need atomic number support in `Structure`?",
"@janosh Given that no one has ever complained about Composition supporting int/float to my knowledge, I would imagine the use case is theoretical and not practical. Composition(1) is ambiguous and for sure, this will not be something I agree to. Species(1) is slightly more justifiable but given that the pseudo-parent class Element does not support Element(1), this is again extremely bad behavior. \r\n\r\nStructure supporting int has good reasons. There are some electronic structure codes where the sites are specified in terms of atomic numbers. Also, for ordered structures, the int specification has a 1:1 link with an atom, this is not ambiguous. \r\n\r\nI would ask that we solve actual problems that people faced, not imagine problems and add complexity to the code to handle a theoretical use case that no one has ever raised.",
"@shyuep please stop closing this PR. it contains other changes that should be merged regardless of whether we go ahead with the `Composition`/`Species` change. depending on the outcome here, i'll revert `Compositon` changes and merge the rest.\r\n\r\n> add complexity to the code to handle a theoretical use case that no one has ever raised.\r\n\r\nthe grand total of added complexity are 2 lines. [this is all it takes to support](https://github.com/materialsproject/pymatgen/pull/3693/files#diff-f2446c679cf9733f360423556f24905c2951b1e0986ff8f8d1c90525ffb26687R121-R123) `int/float` in `Composition`\r\n\r\n```py\r\nif len(args) == 1 and isinstance(args[0], (int, float)):\r\n # treat single integer/float as atomic number\r\n elem_map = {get_el_sp(args[0]): 1}\r\n```\r\n\r\nand then 2 more lines to test it, i.e. negligible\r\n\r\n> Species(1) is slightly more justifiable but given that the pseudo-parent class Element does not support Element(1), this is again extremely bad behavior.\r\n\r\nthat is a shortcoming of `Element` and should be changed. it's not a reason to not support `int` in `Species`",
"There is a good reason why Element does from_Z and not Element(1). It is an Enum and was done for backward compatibility. \r\n\r\nA PR should contain the changes that it is supposed to have - no more, no less. If you want to keep the PR open, by all means but the title should be changed to reflect the actual changes that this PR is supposed to do. But supporting int in Species and Composition is not necessary and adds ambiguity. Like I said - find me someone who has ever complained about the lack of this \"feature\" and we can discuss it. ",
"> It is an Enum and was done for backward compatibility.\r\n\r\nyeah i saw the comment. though i don't understand what would break by supporting `Element(1)`. do you remember the details? if not, could be worth another try.\r\n\r\n> the title should be changed to reflect the actual changes\r\n\r\nwill do\r\n\r\n> find me someone who has ever complained about the lack of this \"feature\" and we can discuss it\r\n\r\nmyself actually. i'm not making this up. the first time i used `Element` years ago I tried `Element(8)` to get oxygen which of course didn't work so i had to search the code to find `Element.from_Z`",
"It has always been that an Element is initialized by Element(\"H\"). While you can obviously use an \"isinstance\" to support int, it is not really necessary."
] | 2024-03-18T09:39:00
| 2024-03-22T13:22:00
|
2024-03-22T13:21:59Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
PR was completely changed after discussion below. now just minor stuff like formatting and better variable names
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3693/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3693/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3693",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3693",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3693.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3693.patch",
"merged_at": "2024-03-22T13:21:59Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3694
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3694/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3694/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3694/events
|
https://github.com/materialsproject/pymatgen/pull/3694
| 2,191,707,851
|
PR_kwDOACgets5p6i-n
| 3,694
|
Reformat docstrings to Google style and add type annotations
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5456916296,
"node_id": "LA_kwDOACgets8AAAABRUHvSA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/docs",
"name": "docs",
"color": "35B067",
"default": false,
"description": "Documentation, examples, user guides"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Opened another Pandora's box of `mypy` errors. ",
"I guess it's not a good idea to reformat docstring and add type annotations (for modules I'm not quite familiar with especially) at the same time. I should focus on reformatting docstring for this PR and stop adding type annotations.\r\n\r\nI tried my best to fix most `mypy` error but still get quite some left (some even seems like programming bugs).\r\n\r\nI pinged a few I'm having trouble with. Could you please give me a hand when you have time? @janosh. Thanks a ton in advance. 😄 ",
"thanks so much @DanielYang59! this looks like a lot of work! `mypy` is happy now 26a2c8c :)",
"> thanks a lot @DanielYang59! 👍\r\n\r\nThanks for reviewing! Glad I can help.",
"Ahh. I forgot to mention this but it seems we need to rebuild the `docs` after so many changes? @janosh "
] | 2024-03-18T09:44:06
| 2024-03-23T01:55:46
|
2024-03-22T10:40:37Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Reformat docstrings to Google style and add type annotations
There should be no functional changes. Any change made to the code is to resolve `mypy` type errors.
Tasks:
- Corrected some already Google styled docstrings. Replaced keywords `Arg/Return/Raise` with its plural form `Args/Returns/Raises` even when there is only one `Arg/Return/Raise`. [Reference](https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings).
- Replaced `reStructuredText` format by searching for keywords: `:param`, `:type`, `:returns`, `:rtype`, `::`.
- Did not find `Scipy/Numpy/Epytext` styled docstrings.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3694/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3694/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3694",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3694",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3694.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3694.patch",
"merged_at": "2024-03-22T10:40:37Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3695
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3695/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3695/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3695/events
|
https://github.com/materialsproject/pymatgen/issues/3695
| 2,192,342,015
|
I_kwDOACgets6CrHv_
| 3,695
|
All the Potentials are not written properly
|
{
"login": "aakhiltayal",
"id": 121573628,
"node_id": "U_kgDOBz8Q_A",
"avatar_url": "https://avatars.githubusercontent.com/u/121573628?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/aakhiltayal",
"html_url": "https://github.com/aakhiltayal",
"followers_url": "https://api.github.com/users/aakhiltayal/followers",
"following_url": "https://api.github.com/users/aakhiltayal/following{/other_user}",
"gists_url": "https://api.github.com/users/aakhiltayal/gists{/gist_id}",
"starred_url": "https://api.github.com/users/aakhiltayal/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/aakhiltayal/subscriptions",
"organizations_url": "https://api.github.com/users/aakhiltayal/orgs",
"repos_url": "https://api.github.com/users/aakhiltayal/repos",
"events_url": "https://api.github.com/users/aakhiltayal/events{/privacy}",
"received_events_url": "https://api.github.com/users/aakhiltayal/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"@aakhiltayal to be clear, this only occurs when there's a single absorbing atom in the unit cell, correct?",
"@matthewcarbone No it occurs even for two atom system as I shown for FeN. When I pull all the structure for FeN, for some of structures all the potentials are written. I think it is because they have composition like Fe2N2 and have four atom in the structure but for cases where composition is like Fe1N1 and only two atom in structure it did not write all the potentials.",
"No I mean a single _absorbing atom_ in the unit cell. Based on the structure, it looks like there's a single Fe/unit cell. I don't think this problem occurs when there are multiple, even symmetrically equivalent, atoms in the unit cell.\r\n\r\nAnd just to be clear, what I mean by this is that this occurs in the case when you have some absorbing atom type and there is exactly one of those atoms in the unit cell.",
"@matthewcarbone That is true"
] | 2024-03-18T14:13:39
| 2024-03-18T17:34:00
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
https://github.com/materialsproject/pymatgen/blob/ac8a7e9cd93ba9f7afeaced45dc28af6d4e151d4/pymatgen/io/feff/inputs.py#L927
@matthewcarbone
While using the Potentials card to write potential it was found that it did not write all the potentials in the feff.inp file which makes the feff.inp file not usable for the further calculations. The exclusion of L927-L928 fix the issue but needs to be checked if it didn't create other issues as it was put deliberately.
for e.g the structure is pull from the materials project and passes to the Potential card the output doesnot have all the potentials but if L927 and L928 is excluded the output is correct.
```
potential_pymatgen = Potential(struct=structures['mp-1009019'], absorbing_atom='Fe')
In [37]: print(str(potential_pymatgen))
POTENTIALS
*ipot Z tag lmax1 lmax2 xnatph(stoichometry) spinph
******- **- ****- ******- ******- ********************** ********
0 26 Fe -1 -1 0.0001 0
1 7 N -1 -1 1 0
```
```
In [38]: potential_modified = Potential_rewrite(structure=structures['mp-1009019'], absorbing_atom='Fe')
In [39]: print(str(potential_modified))
POTENTIALS
*ipot Z tag lmax1 lmax2 xnatph(stoichometry) spinph
******- **- ****- ******- ******- ********************** ********
0 26 Fe -1 -1 0.0001 0
1 26 Fe -1 -1 1 0
2 7 N -1 -1 1 0
```
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3695/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3695/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3696
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3696/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3696/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3696/events
|
https://github.com/materialsproject/pymatgen/pull/3696
| 2,193,879,505
|
PR_kwDOACgets5qCCwc
| 3,696
|
Remove exception printing when importing phonopy
|
{
"login": "lan496",
"id": 7272505,
"node_id": "MDQ6VXNlcjcyNzI1MDU=",
"avatar_url": "https://avatars.githubusercontent.com/u/7272505?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/lan496",
"html_url": "https://github.com/lan496",
"followers_url": "https://api.github.com/users/lan496/followers",
"following_url": "https://api.github.com/users/lan496/following{/other_user}",
"gists_url": "https://api.github.com/users/lan496/gists{/gist_id}",
"starred_url": "https://api.github.com/users/lan496/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/lan496/subscriptions",
"organizations_url": "https://api.github.com/users/lan496/orgs",
"repos_url": "https://api.github.com/users/lan496/repos",
"events_url": "https://api.github.com/users/lan496/events{/privacy}",
"received_events_url": "https://api.github.com/users/lan496/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
},
{
"id": 6225613014,
"node_id": "LA_kwDOACgets8AAAABcxNQ1g",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/phonon",
"name": "phonon",
"color": "0ED699",
"default": false,
"description": "Lattice vibrations"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"The CI jobs seem to be failed due to network timeouts. \r\n- https://github.com/materialsproject/pymatgen/actions/runs/8336717393/job/22814307503?pr=3696\r\n- https://github.com/materialsproject/pymatgen/actions/runs/8336717393/job/22814308207?pr=3696"
] | 2024-03-19T02:36:20
| 2024-03-20T10:12:35
|
2024-03-20T10:12:35Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Removes stdout printing when trying to import phonopy for tidiness. These printing appeared in some downstream packages. For example
```shell
pip install mp_api
python -c "from mp_api.client import MPRester"
```
resulted in
```
No module named 'phonopy'
No module named 'phonopy'
```
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [ ] Tests added for new features/fixes.
- [ ] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3696/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3696/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3696",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3696",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3696.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3696.patch",
"merged_at": "2024-03-20T10:12:34Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3697
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3697/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3697/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3697/events
|
https://github.com/materialsproject/pymatgen/pull/3697
| 2,196,396,519
|
PR_kwDOACgets5qKlqP
| 3,697
|
Prevent GitHub Actions from running docs-related CI on forks
|
{
"login": "lan496",
"id": 7272505,
"node_id": "MDQ6VXNlcjcyNzI1MDU=",
"avatar_url": "https://avatars.githubusercontent.com/u/7272505?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/lan496",
"html_url": "https://github.com/lan496",
"followers_url": "https://api.github.com/users/lan496/followers",
"following_url": "https://api.github.com/users/lan496/following{/other_user}",
"gists_url": "https://api.github.com/users/lan496/gists{/gist_id}",
"starred_url": "https://api.github.com/users/lan496/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/lan496/subscriptions",
"organizations_url": "https://api.github.com/users/lan496/orgs",
"repos_url": "https://api.github.com/users/lan496/repos",
"events_url": "https://api.github.com/users/lan496/events{/privacy}",
"received_events_url": "https://api.github.com/users/lan496/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4826367266,
"node_id": "LA_kwDOACgets8AAAABH6yFIg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/contributing",
"name": "contributing",
"color": "A54D9F",
"default": false,
"description": "Issues about how to contribute, report errors, submit features"
},
{
"id": 5578251138,
"node_id": "LA_kwDOACgets8AAAABTH1bgg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ci",
"name": "ci",
"color": "4E135C",
"default": false,
"description": "Continuous integration"
},
{
"id": 5698361208,
"node_id": "LA_kwDOACgets8AAAABU6YXeA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/dx",
"name": "dx",
"color": "73339B",
"default": false,
"description": "Developer experience"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-20T00:59:13
| 2024-04-12T05:47:36
|
2024-03-20T10:20:07Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
`.github/workflows/jekyll-gh-pages.yml` run on forked repository, and caused CI fails if the forked repository is not set up for GitHub Pages (e.g. https://github.com/lan496/pymatgen/actions/runs/8325702971).
As the CI for testing is already disabled on forked (https://github.com/materialsproject/pymatgen/commit/531561d8d1dd55b3104d923c585861340c2223f0), I think it will be reasonable to disable CI for Github Pages as well.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3697/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3697/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3697",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3697",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3697.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3697.patch",
"merged_at": "2024-03-20T10:20:06Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3698
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3698/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3698/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3698/events
|
https://github.com/materialsproject/pymatgen/issues/3698
| 2,197,809,053
|
I_kwDOACgets6C_-ed
| 3,698
|
adding structure's MP ID to web site structure export files
|
{
"login": "bernstei",
"id": 1202357,
"node_id": "MDQ6VXNlcjEyMDIzNTc=",
"avatar_url": "https://avatars.githubusercontent.com/u/1202357?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bernstei",
"html_url": "https://github.com/bernstei",
"followers_url": "https://api.github.com/users/bernstei/followers",
"following_url": "https://api.github.com/users/bernstei/following{/other_user}",
"gists_url": "https://api.github.com/users/bernstei/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bernstei/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bernstei/subscriptions",
"organizations_url": "https://api.github.com/users/bernstei/orgs",
"repos_url": "https://api.github.com/users/bernstei/repos",
"events_url": "https://api.github.com/users/bernstei/events{/privacy}",
"received_events_url": "https://api.github.com/users/bernstei/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"`pymatgen` isn't quite the right place for this feature request. [`crystaltoolkit`](https://github.com/materialsproject/crystaltoolkit) contains part of the relevant code. i added the behavior that MP ID will be included in the filename if it's found in `Structure.properties` in https://github.com/materialsproject/crystaltoolkit/pull/378.\r\n\r\nall the frontend would have to do is store the MP ID as `\"material_id\"` or `\"id\"` in `Structure.properties` to enable this behavior.\r\npinging @yang-ruoxi in case you want to create an `mp-web` issue from this.",
"Thanks - sorry about the somewhat misdirected post."
] | 2024-03-20T15:19:31
| 2024-03-22T12:29:01
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Feature Requested
It would be great if files exported from the web site visualizer export button would indicate what MP ID the structure corresponds to. Right now they seem to only indicate the chemical formula.
### Proposed Solution
Add the MP ID as part of the filename (e.g. `Al2O3_mp_1143.poscar`) and/or add the MP ID to the POSCAR comment (1st) line. I don't know as much about the other formats, so I don't know if they could accommodate arbitrary strings within the file as well.
### Relevant Information
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3698/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3698/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3699
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3699/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3699/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3699/events
|
https://github.com/materialsproject/pymatgen/issues/3699
| 2,198,318,295
|
I_kwDOACgets6DB6zX
| 3,699
|
Incorrect Parsing of OSZICAR with VASP 6.3.2
|
{
"login": "YunyeongChoi",
"id": 48029616,
"node_id": "MDQ6VXNlcjQ4MDI5NjE2",
"avatar_url": "https://avatars.githubusercontent.com/u/48029616?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/YunyeongChoi",
"html_url": "https://github.com/YunyeongChoi",
"followers_url": "https://api.github.com/users/YunyeongChoi/followers",
"following_url": "https://api.github.com/users/YunyeongChoi/following{/other_user}",
"gists_url": "https://api.github.com/users/YunyeongChoi/gists{/gist_id}",
"starred_url": "https://api.github.com/users/YunyeongChoi/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/YunyeongChoi/subscriptions",
"organizations_url": "https://api.github.com/users/YunyeongChoi/orgs",
"repos_url": "https://api.github.com/users/YunyeongChoi/repos",
"events_url": "https://api.github.com/users/YunyeongChoi/events{/privacy}",
"received_events_url": "https://api.github.com/users/YunyeongChoi/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-20T18:56:25
| 2024-03-20T18:56:25
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
python 3.9.12
### Pymatgen version
2024.3.1
### Operating system version
Rocky Linux release 8.9
### Current behavior
I know this is related to the VASP error, but thought worth reporting the issue.
In some static calculations using VASP version 6.3.2, when the energy difference (dE) is extremely small, OSZICAR writes the dE value incorrectly. This issue arises in cases where dE is not represented in scientific notation with a very small exponent. For instance:
`1 F= -.16497036E+04 E0= -.16497036E+04 d E =-.302333-128 mag= 13.9998`
Here, the correct representation of dE should be d E =-.302333E-128, but it is mistakenly written as -302333-128, which leads to parsing errors when attempting to read the outputs using Oszicar in pymatgen.
For instance, Error when I use Oszicar to read outputs:
```
from pymatgen.io.vasp.outputs import Oszicar
Oszicar('/home/yychoi/ts_static/0.0833_0.5833/4/2/OSZICAR')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[2], line 1
----> 1 Oszicar('/home/yychoi/ts_static/0.0833_0.5833/4/2/OSZICAR')
File ~/miniconda3/envs/mace/lib/python3.9/site-packages/pymatgen/io/vasp/outputs.py:3934, in Oszicar.__init__(self, filename)
3931 elif line.strip() != "":
3932 # remove space first and apply field agnostic extraction
3933 matches = re.findall(ionic_general_pattern, re.sub(r"d E ", "dE", line))
-> 3934 ionic_steps.append({key: float(value) for key, value in matches})
3936 self.electronic_steps = electronic_steps
3937 self.ionic_steps = ionic_steps
File ~/miniconda3/envs/mace/lib/python3.9/site-packages/pymatgen/io/vasp/outputs.py:3934, in <dictcomp>(.0)
3931 elif line.strip() != "":
3932 # remove space first and apply field agnostic extraction
3933 matches = re.findall(ionic_general_pattern, re.sub(r"d E ", "dE", line))
-> 3934 ionic_steps.append({key: float(value) for key, value in matches})
3936 self.electronic_steps = electronic_steps
3937 self.ionic_steps = ionic_steps
ValueError: could not convert string to float: '-.302333-128'
```
### Expected Behavior
The OSZICAR file should correctly represent the energy difference in scientific notation, allowing for accurate parsing using Oszicar in pymatgen.
Or it will be great if pymatgen support exception-handling for these cases.
### Minimal example
_No response_
### Relevant files to reproduce this bug
N E dE d eps ncg rms rms(c)
DAV: 1 0.198644808263E+05 0.19864E+05 -0.76814E+05 7928 0.168E+03
DAV: 2 0.177691351143E+04 -0.18088E+05 -0.17054E+05 8024 0.484E+02
DAV: 3 -0.158070428665E+04 -0.33576E+04 -0.31537E+04 8544 0.214E+02
DAV: 4 -0.185134065799E+04 -0.27064E+03 -0.26453E+03 9944 0.651E+01
DAV: 5 -0.186458040528E+04 -0.13240E+02 -0.12993E+02 11408 0.140E+01 0.199E+02
RMM: 6 -0.171792907794E+04 0.14665E+03 -0.41106E+02 10187 0.207E+01 0.156E+02
RMM: 7 -0.186567247463E+04 -0.14774E+03 -0.57820E+02 11347 0.221E+01 0.179E+02
RMM: 8 -0.200888091592E+04 -0.14321E+03 -0.41272E+02 12538 0.179E+01 0.186E+02
RMM: 9 -0.172173427404E+04 0.28715E+03 -0.15493E+02 11854 0.119E+01 0.111E+02
RMM: 10 -0.172721147766E+04 -0.54772E+01 -0.12930E+02 11881 0.113E+01 0.120E+02
RMM: 11 -0.166575073031E+04 0.61461E+02 -0.65747E+01 11794 0.827E+00 0.977E+01
RMM: 12 -0.164740753637E+04 0.18343E+02 -0.32006E+01 12129 0.547E+00 0.902E+01
RMM: 13 -0.165350176003E+04 -0.60942E+01 -0.23500E+01 11251 0.461E+00 0.772E+01
RMM: 14 -0.163630171606E+04 0.17200E+02 -0.11769E+01 11244 0.367E+00 0.634E+01
RMM: 15 -0.163637944591E+04 -0.77730E-01 -0.79722E+00 11729 0.284E+00 0.666E+01
RMM: 16 -0.164663534176E+04 -0.10256E+02 -0.92111E+00 12202 0.295E+00 0.595E+01
RMM: 17 -0.164339719732E+04 0.32381E+01 -0.10554E+01 13078 0.333E+00 0.528E+01
RMM: 18 -0.163817383042E+04 0.52234E+01 -0.66205E+00 12744 0.277E+00 0.547E+01
RMM: 19 -0.163712705594E+04 0.10468E+01 -0.17954E+00 11950 0.205E+00 0.545E+01
RMM: 20 -0.163489256685E+04 0.22345E+01 -0.23296E+00 12214 0.173E+00 0.453E+01
RMM: 21 -0.163365787593E+04 0.12347E+01 -0.18720E+00 11993 0.143E+00 0.467E+01
RMM: 22 -0.163141557443E+04 0.22423E+01 -0.90062E-01 11655 0.111E+00 0.385E+01
RMM: 23 -0.163006244580E+04 0.13531E+01 -0.78896E-01 11753 0.103E+00 0.356E+01
RMM: 24 -0.163062486964E+04 -0.56242E+00 -0.27859E-01 12192 0.635E-01 0.358E+01
RMM: 25 -0.163063925046E+04 -0.14381E-01 -0.86328E-02 13600 0.381E-01 0.353E+01
RMM: 26 -0.163179352136E+04 -0.11543E+01 -0.37317E-01 13143 0.578E-01 0.344E+01
RMM: 27 -0.163191489821E+04 -0.12138E+00 -0.17332E-01 12543 0.523E-01 0.333E+01
RMM: 28 -0.163267026577E+04 -0.75537E+00 -0.18145E-01 12901 0.561E-01 0.323E+01
RMM: 29 -0.163262153019E+04 0.48736E-01 -0.29732E-02 11393 0.279E-01 0.323E+01
RMM: 30 -0.163257433804E+04 0.47192E-01 -0.80352E-03 13906 0.116E-01 0.323E+01
RMM: 31 -0.163278255682E+04 -0.20822E+00 -0.32646E-02 13066 0.173E-01 0.323E+01
RMM: 32 -0.163275490340E+04 0.27653E-01 -0.11181E-02 11316 0.168E-01 0.325E+01
RMM: 33 -0.163286732541E+04 -0.11242E+00 -0.28791E-02 13384 0.182E-01 0.319E+01
RMM: 34 -0.163283337826E+04 0.33947E-01 -0.21117E-02 12740 0.254E-01 0.321E+01
RMM: 35 -0.163320443626E+04 -0.37106E+00 -0.40264E-02 13666 0.215E-01 0.324E+01
RMM: 36 -0.163407413708E+04 -0.86970E+00 -0.39321E-01 15282 0.701E-01 0.414E+01
RMM: 37 -0.163382760380E+04 0.24653E+00 -0.12642E-01 13926 0.625E-01 0.363E+01
RMM: 38 -0.163390006478E+04 -0.72461E-01 -0.22931E-02 13255 0.259E-01 0.364E+01
RMM: 39 -0.163412675124E+04 -0.22669E+00 0.95263E-01 12973 0.332E-01 0.368E+01
RMM: 40 -0.163420021903E+04 -0.73468E-01 -0.11880E-01 12487 0.207E-01 0.368E+01
RMM: 41 -0.163419244801E+04 0.77710E-02 -0.87626E-03 11435 0.122E-01 0.368E+01
RMM: 42 -0.163422979439E+04 -0.37346E-01 -0.12047E-02 12961 0.121E-01 0.369E+01
RMM: 43 -0.163420973389E+04 0.20061E-01 -0.13444E-02 12503 0.200E-01 0.369E+01
RMM: 44 -0.163414792913E+04 0.61805E-01 0.16536E+00 10096 0.423E-01 0.369E+01
RMM: 45 -0.163431092130E+04 -0.16299E+00 -0.14911E-01 14545 0.210E-01 0.369E+01
RMM: 46 -0.163476010333E+04 -0.44918E+00 -0.48589E-02 15049 0.234E-01 0.367E+01
RMM: 47 -0.163553328218E+04 -0.77318E+00 -0.14279E-01 15271 0.389E-01 0.357E+01
RMM: 48 -0.163563315848E+04 -0.99876E-01 -0.59802E-02 14187 0.427E-01 0.357E+01
RMM: 49 -0.163680681603E+04 -0.11737E+01 -0.32732E-01 15673 0.653E-01 0.344E+01
RMM: 50 -0.163677475285E+04 0.32063E-01 -0.87467E-02 14518 0.508E-01 0.343E+01
RMM: 51 -0.164663442650E+04 -0.98597E+01 -0.34895E+00 15808 0.168E+00 0.505E+01
RMM: 52 -0.164373490958E+04 0.28995E+01 -0.75860E-01 15808 0.113E+00 0.413E+01
RMM: 53 -0.164374563210E+04 -0.10723E-01 -0.18761E-01 15598 0.580E-01 0.409E+01
RMM: 54 -0.164362725418E+04 0.11838E+00 0.51312E-01 15482 0.609E-01 0.405E+01
RMM: 55 -0.164192656489E+04 0.17007E+01 -0.28825E+00 15808 0.179E+00 0.398E+01
RMM: 56 -0.164037512926E+04 0.15514E+01 -0.15923E+00 15808 0.140E+00 0.349E+01
RMM: 57 -0.164064904725E+04 -0.27392E+00 -0.63695E-01 15775 0.819E-01 0.317E+01
RMM: 58 -0.164181445552E+04 -0.11654E+01 -0.29807E-01 15643 0.585E-01 0.304E+01
RMM: 59 -0.164243590281E+04 -0.62145E+00 -0.19136E-01 15629 0.461E-01 0.301E+01
RMM: 60 -0.164455757073E+04 -0.21217E+01 -0.13330E+00 15799 0.111E+00 0.353E+01
RMM: 61 -0.164747535058E+04 -0.29178E+01 -0.16120E+00 15808 0.140E+00 0.400E+01
RMM: 62 -0.164640894414E+04 0.10664E+01 -0.80572E-01 15804 0.109E+00 0.350E+01
RMM: 63 -0.164636500890E+04 0.43935E-01 -0.39001E-01 15497 0.679E-01 0.346E+01
RMM: 64 -0.164177603260E+04 0.45890E+01 -0.30958E+00 15751 0.137E+00 0.352E+01
RMM: 65 -0.164139491880E+04 0.38111E+00 -0.15321E-01 14624 0.416E-01 0.353E+01
RMM: 66 -0.162891181069E+04 0.12483E+02 -0.43915E+00 15799 0.182E+00 0.354E+01
RMM: 67 -0.162211815256E+04 0.67937E+01 -0.68494E-01 15553 0.804E-01 0.358E+01
RMM: 68 -0.161038008612E+04 0.11738E+02 -0.76532E-01 15598 0.765E-01 0.367E+01
RMM: 69 -0.161167553239E+04 -0.12954E+01 -0.48895E-02 13654 0.204E-01 0.366E+01
RMM: 70 -0.160826123439E+04 0.34143E+01 0.69323E-01 14348 0.510E-01 0.368E+01
RMM: 71 -0.160315436220E+04 0.51069E+01 -0.79457E-01 15773 0.960E-01 0.360E+01
RMM: 72 -0.160780389698E+04 -0.46495E+01 -0.29678E-01 15638 0.660E-01 0.350E+01
RMM: 73 -0.161087399804E+04 -0.30701E+01 -0.19747E+00 15808 0.148E+00 0.344E+01
RMM: 74 -0.161335160945E+04 -0.24776E+01 -0.37405E-01 15407 0.581E-01 0.360E+01
RMM: 75 -0.161429987608E+04 -0.94827E+00 -0.14368E-01 15253 0.386E-01 0.352E+01
RMM: 76 -0.162719321380E+04 -0.12893E+02 -0.23547E+00 15784 0.146E+00 0.332E+01
RMM: 77 -0.162651459802E+04 0.67862E+00 -0.72626E-01 15685 0.792E-01 0.312E+01
RMM: 78 -0.161661577101E+04 0.98988E+01 -0.17480E+00 15804 0.136E+00 0.286E+01
RMM: 79 -0.161617174415E+04 0.44403E+00 -0.38132E-01 15640 0.617E-01 0.278E+01
RMM: 80 -0.161847125020E+04 -0.22995E+01 -0.17959E-01 15119 0.414E-01 0.272E+01
RMM: 81 -0.163769475276E+04 -0.19224E+02 -0.11793E+01 15808 0.282E+00 0.207E+01
RMM: 82 -0.163808508584E+04 -0.39033E+00 -0.14110E+00 15767 0.115E+00 0.193E+01
RMM: 83 -0.163869413723E+04 -0.60905E+00 -0.15923E+00 15798 0.112E+00 0.186E+01
RMM: 84 -0.163867223477E+04 0.21902E-01 -0.41028E-01 15645 0.642E-01 0.190E+01
RMM: 85 -0.163628001934E+04 0.23922E+01 -0.70656E-01 15525 0.691E-01 0.195E+01
RMM: 86 -0.164384211906E+04 -0.75621E+01 -0.35842E+00 15725 0.142E+00 0.174E+01
RMM: 87 -0.164461357137E+04 -0.77145E+00 -0.52838E-01 15509 0.641E-01 0.179E+01
RMM: 88 -0.164508951612E+04 -0.47594E+00 -0.32836E-01 15543 0.619E-01 0.167E+01
RMM: 89 -0.164482299107E+04 0.26653E+00 -0.27492E-01 15552 0.446E-01 0.157E+01
RMM: 90 -0.164557977706E+04 -0.75679E+00 -0.11055E+00 15751 0.934E-01 0.166E+01
RMM: 91 -0.164662397320E+04 -0.10442E+01 -0.93234E-01 15802 0.102E+00 0.124E+01
RMM: 92 -0.164707700994E+04 -0.45304E+00 -0.31632E-01 15695 0.560E-01 0.118E+01
RMM: 93 -0.164786025912E+04 -0.78325E+00 -0.33197E-01 15743 0.544E-01 0.139E+01
RMM: 94 -0.164776008156E+04 0.10018E+00 -0.67764E-02 14862 0.322E-01 0.127E+01
RMM: 95 -0.164771121456E+04 0.48867E-01 -0.90430E-02 15371 0.305E-01 0.154E+01
RMM: 96 -0.164717268247E+04 0.53853E+00 -0.66085E-01 15788 0.772E-01 0.107E+01
RMM: 97 -0.164780314441E+04 -0.63046E+00 0.61314E-01 15768 0.118E+00 0.957E+00
RMM: 98 -0.164849902279E+04 -0.69588E+00 -0.56142E-01 15721 0.731E-01 0.789E+00
RMM: 99 -0.164885610645E+04 -0.35708E+00 -0.19920E-01 15577 0.454E-01 0.676E+00
RMM: 100 -0.164900111963E+04 -0.14501E+00 -0.32632E-01 15748 0.619E-01 0.598E+00
RMM: 101 -0.164904270183E+04 -0.41582E-01 -0.24735E-01 15667 0.465E-01 0.588E+00
RMM: 102 -0.164914185453E+04 -0.99153E-01 -0.96764E-02 15391 0.266E-01 0.588E+00
RMM: 103 -0.164926857571E+04 -0.12672E+00 -0.13624E-01 15665 0.357E-01 0.599E+00
RMM: 104 -0.164948846432E+04 -0.21989E+00 -0.13529E-01 15555 0.337E-01 0.620E+00
RMM: 105 -0.164961448544E+04 -0.12602E+00 -0.40922E-02 14662 0.181E-01 0.615E+00
RMM: 106 -0.164966536267E+04 -0.50877E-01 -0.68155E-02 15269 0.266E-01 0.632E+00
RMM: 107 -0.164963085216E+04 0.34511E-01 -0.37160E-02 14819 0.223E-01 0.591E+00
RMM: 108 -0.164964484846E+04 -0.13996E-01 -0.32480E-02 14598 0.177E-01 0.576E+00
RMM: 109 -0.164963730638E+04 0.75421E-02 -0.22548E-02 14309 0.137E-01 0.562E+00
RMM: 110 -0.164956162428E+04 0.75682E-01 -0.90666E-02 15298 0.317E-01 0.521E+00
RMM: 111 -0.164957619375E+04 -0.14569E-01 -0.96677E-02 15332 0.307E-01 0.497E+00
RMM: 112 -0.164951639304E+04 0.59801E-01 -0.70438E-02 15139 0.258E-01 0.453E+00
RMM: 113 -0.164953123883E+04 -0.14846E-01 0.56095E-01 14700 0.410E-01 0.431E+00
RMM: 114 -0.164950881622E+04 0.22423E-01 -0.80654E-02 14361 0.216E-01 0.421E+00
RMM: 115 -0.164951009060E+04 -0.12744E-02 -0.58988E-03 13210 0.707E-02 0.420E+00
RMM: 116 -0.164953181144E+04 -0.21721E-01 -0.11229E-01 15228 0.411E-01 0.449E+00
RMM: 117 -0.164954797556E+04 -0.16164E-01 -0.23704E-02 14123 0.146E-01 0.438E+00
RMM: 118 -0.164950748133E+04 0.40494E-01 -0.19638E-02 14639 0.148E-01 0.404E+00
RMM: 119 -0.164947843591E+04 0.29045E-01 -0.14496E-02 14059 0.104E-01 0.380E+00
RMM: 120 -0.164944866460E+04 0.29771E-01 0.13877E-01 14449 0.215E-01 0.348E+00
RMM: 121 -0.164941830903E+04 0.30356E-01 -0.12918E-01 15619 0.358E-01 0.262E+00
RMM: 122 -0.164942381233E+04 -0.55033E-02 -0.12248E-01 15485 0.325E-01 0.199E+00
RMM: 123 -0.164944182374E+04 -0.18011E-01 -0.43971E-02 14977 0.182E-01 0.174E+00
RMM: 124 -0.164944624200E+04 -0.44183E-02 0.20644E-02 14882 0.232E-01 0.157E+00
RMM: 125 -0.164945611208E+04 -0.98701E-02 0.51711E-02 14323 0.218E-01 0.145E+00
RMM: 126 -0.164947951843E+04 -0.23406E-01 -0.40665E-02 14748 0.189E-01 0.132E+00
RMM: 127 -0.164949597337E+04 -0.16455E-01 -0.10958E-02 13978 0.107E-01 0.124E+00
RMM: 128 -0.164951648727E+04 -0.20514E-01 -0.11687E-02 14174 0.133E-01 0.106E+00
RMM: 129 -0.164952430584E+04 -0.78186E-02 -0.48139E-03 13401 0.720E-02 0.983E-01
RMM: 130 -0.164946890420E+04 0.55402E-01 0.18535E+00 14308 0.509E-01 0.910E-01
RMM: 131 -0.164956807462E+04 -0.99170E-01 -0.18192E-01 14784 0.333E-01 0.774E-01
RMM: 132 -0.164959091547E+04 -0.22841E-01 -0.23069E-02 14142 0.163E-01 0.713E-01
RMM: 133 -0.164961216925E+04 -0.21254E-01 -0.49191E-02 14889 0.272E-01 0.689E-01
RMM: 134 -0.164962308082E+04 -0.10912E-01 -0.76141E-03 13632 0.120E-01 0.609E-01
RMM: 135 -0.164963584602E+04 -0.12765E-01 -0.27528E-02 14350 0.210E-01 0.579E-01
RMM: 136 -0.164964378533E+04 -0.79393E-02 -0.52900E-02 14911 0.281E-01 0.616E-01
RMM: 137 -0.164965540757E+04 -0.11622E-01 -0.11630E-02 13882 0.172E-01 0.445E-01
RMM: 138 -0.164965885436E+04 -0.34468E-02 -0.24515E-03 12768 0.579E-02 0.437E-01
RMM: 139 -0.164966555807E+04 -0.67037E-02 -0.68158E-03 13439 0.107E-01 0.416E-01
RMM: 140 -0.164967230790E+04 -0.67498E-02 -0.85762E-03 13579 0.114E-01 0.400E-01
RMM: 141 -0.164967740655E+04 -0.50986E-02 -0.99055E-03 13760 0.121E-01 0.415E-01
RMM: 142 -0.164968617990E+04 -0.87734E-02 -0.82142E-03 13417 0.111E-01 0.325E-01
RMM: 143 -0.164969197857E+04 -0.57987E-02 -0.28990E-03 12884 0.648E-02 0.292E-01
RMM: 144 -0.164969591097E+04 -0.39324E-02 -0.19865E-03 12613 0.541E-02 0.286E-01
RMM: 145 -0.164969933345E+04 -0.34225E-02 -0.15448E-03 12115 0.455E-02 0.282E-01
RMM: 146 -0.164970213421E+04 -0.28008E-02 -0.10671E-03 11601 0.372E-02 0.279E-01
RMM: 147 -0.164970418696E+04 -0.20527E-02 -0.62262E-04 10701 0.282E-02 0.277E-01
RMM: 148 -0.164970446503E+04 -0.27807E-03 -0.12564E-04 7700 0.149E-02 0.278E-01
RMM: 149 -0.164970218098E+04 0.22840E-02 -0.35097E-04 8782 0.268E-02 0.277E-01
RMM: 150 -0.164970040620E+04 0.17748E-02 -0.48094E-04 9010 0.249E-02 0.274E-01
RMM: 151 -0.164969589843E+04 0.45078E-02 -0.19693E-03 11457 0.505E-02 0.277E-01
RMM: 152 -0.164969558382E+04 0.31460E-03 -0.92287E-04 10227 0.323E-02 0.269E-01
RMM: 153 -0.164969264490E+04 0.29389E-02 -0.29034E-03 12156 0.596E-02 0.265E-01
RMM: 154 -0.164968762446E+04 0.50204E-02 -0.12807E-02 13511 0.134E-01 0.265E-01
RMM: 155 -0.164969011294E+04 -0.24885E-02 -0.33286E-03 12120 0.595E-02 0.250E-01
RMM: 156 -0.164969205718E+04 -0.19442E-02 -0.48110E-04 9667 0.296E-02 0.239E-01
RMM: 157 -0.164968526971E+04 0.67875E-02 -0.62699E-03 13038 0.971E-02 0.305E-01
RMM: 158 -0.164969110467E+04 -0.58350E-02 -0.41038E-03 13116 0.998E-02 0.272E-01
RMM: 159 -0.164969122978E+04 -0.12511E-03 -0.25363E-04 8403 0.273E-02 0.266E-01
RMM: 160 -0.164969169942E+04 -0.46964E-03 -0.89352E-04 9986 0.368E-02 0.271E-01
RMM: 161 -0.164970070169E+04 -0.90023E-02 -0.27334E+00 8284 0.350E-01 0.272E-01
RMM: 162 -0.164965725965E+04 0.43442E-01 -0.51098E-01 6501 0.337E-01 0.270E-01
RMM: 163 -0.164968279540E+04 -0.25536E-01 0.27475E-01 6024 0.220E-01 0.270E-01
RMM: 164 -0.164969210222E+04 -0.93068E-02 -0.38612E-02 5555 0.672E-02 0.270E-01
RMM: 165 -0.164969225928E+04 -0.15706E-03 -0.17735E-03 5772 0.154E-02 0.267E-01
RMM: 166 -0.164968982985E+04 0.24294E-02 -0.50845E-03 12789 0.848E-02 0.258E-01
RMM: 167 -0.164969665747E+04 -0.68276E-02 -0.33414E-03 12851 0.253E-01 0.237E-01
RMM: 168 -0.164969429717E+04 0.23603E-02 -0.41499E-02 12856 0.122E-01 0.208E-01
RMM: 169 -0.164969592957E+04 -0.16324E-02 -0.47651E-03 13156 0.843E-02 0.246E-01
RMM: 170 -0.164969778961E+04 -0.18600E-02 -0.17596E-03 11937 0.489E-02 0.211E-01
RMM: 171 -0.164969894664E+04 -0.11570E-02 -0.24051E-03 12547 0.660E-02 0.185E-01
RMM: 172 -0.164970020729E+04 -0.12606E-02 -0.13874E-03 11788 0.436E-02 0.197E-01
RMM: 173 -0.164970129533E+04 -0.10880E-02 -0.11345E-03 11742 0.389E-02 0.211E-01
RMM: 174 -0.164970249576E+04 -0.12004E-02 -0.86698E-04 11372 0.356E-02 0.231E-01
RMM: 175 -0.164970364254E+04 -0.11468E-02 -0.96788E-04 11562 0.372E-02 0.254E-01
RMM: 176 -0.164970494329E+04 -0.13008E-02 -0.14164E-03 12087 0.458E-02 0.288E-01
RMM: 177 -0.164970565705E+04 -0.71376E-03 -0.70490E-04 10788 0.326E-02 0.331E-01
RMM: 178 -0.164970667371E+04 -0.10167E-02 -0.70325E-04 10982 0.328E-02 0.371E-01
RMM: 179 -0.164970717333E+04 -0.49962E-03 -0.32052E-04 9384 0.211E-02 0.413E-01
RMM: 180 -0.164970635379E+04 0.81955E-03 -0.67425E-02 8621 0.133E-01 0.364E-01
RMM: 181 -0.164970589711E+04 0.45668E-03 -0.80177E-03 8416 0.414E-02 0.322E-01
RMM: 182 -0.164970410313E+04 0.17940E-02 -0.15442E-03 12121 0.472E-02 0.232E-01
RMM: 183 -0.164970343838E+04 0.66475E-03 -0.10305E-03 11682 0.364E-02 0.177E-01
RMM: 184 -0.164970303660E+04 0.40179E-03 -0.10226E-03 11911 0.370E-02 0.153E-01
RMM: 185 -0.164970329865E+04 -0.26206E-03 -0.56135E-04 11109 0.291E-02 0.181E-01
RMM: 186 -0.164970355960E+04 -0.26095E-03 -0.83171E-05 7166 0.144E-02 0.184E-01
RMM: 187 -0.164970355552E+04 0.40788E-05 -0.14567E-05 5785 0.648E-03
1 F= -.16497036E+04 E0= -.16497036E+04 d E =-.302333-128 mag= 13.9998
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3699/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3699/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3700
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3700/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3700/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3700/events
|
https://github.com/materialsproject/pymatgen/pull/3700
| 2,202,211,443
|
PR_kwDOACgets5qeSlO
| 3,700
|
Add more flexibility to `PhononDOSPlotter` and `PhononBSPlotter`
|
{
"login": "ab5424",
"id": 57258530,
"node_id": "MDQ6VXNlcjU3MjU4NTMw",
"avatar_url": "https://avatars.githubusercontent.com/u/57258530?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ab5424",
"html_url": "https://github.com/ab5424",
"followers_url": "https://api.github.com/users/ab5424/followers",
"following_url": "https://api.github.com/users/ab5424/following{/other_user}",
"gists_url": "https://api.github.com/users/ab5424/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ab5424/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ab5424/subscriptions",
"organizations_url": "https://api.github.com/users/ab5424/orgs",
"repos_url": "https://api.github.com/users/ab5424/repos",
"events_url": "https://api.github.com/users/ab5424/events{/privacy}",
"received_events_url": "https://api.github.com/users/ab5424/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 5322856717,
"node_id": "LA_kwDOACgets8AAAABPURZDQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/data%20viz",
"name": "data viz",
"color": "3C19AC",
"default": false,
"description": "PRs and issues about pymatgen plotting functionality"
},
{
"id": 6225613014,
"node_id": "LA_kwDOACgets8AAAABcxNQ1g",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/phonon",
"name": "phonon",
"color": "0ED699",
"default": false,
"description": "Lattice vibrations"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent update introduces an `invert_axes` parameter to various plotter methods within pymatgen's phonon module, enhancing flexibility in data visualization by allowing axis inversion. Additionally, it refines the plotter's functionality with clearer variable naming, dimension adjustments based on axis orientation, and improved color customization for comparative plots. The accompanying tests have been revised to reflect these changes, utilizing `matplotlib.pyplot` for a more streamlined approach to plotting.\n\n## Changes\n\n| Files | Changes |\n|-------------------------------|---------------------------------------------------------------------------------------------------|\n| `.../phonon/plotter.py` | Added `invert_axes`, renamed `y` to `ys`, adjusted dimensions and logic for axis inversion, enhanced color handling. |\n| `.../phonon/test_plotter.py` | Updated to use `matplotlib.pyplot`, modified plotter methods and configurations, added new instances for testing. |\n\n> 🐰✨🎨 \n> In the realm of plots and lines, a change unfolds, \n> Axes invert, colors bold, a story told. \n> With `invert_axes` we twist and turn, \n> Through tests and tales, we live and learn. \n> Here's to the plots, now more versatile, \n> Crafted by code, with a rabbit's smile. \n> 🌟📊🐇\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/phonon/plotter.py: ## Short summary\n\n- Added `invert_axes` parameter to `get_plot`, `save_plot`, and `show` methods for axis inversion.\n- Renamed `y` to `ys` for clarity in `get_plot`.\n- Adjusted plot dimensions based on `invert_axes` in `get_plot`.\n- Modified data processing and plotting logic to support axis inversion.\n- Enhanced color handling and customization for multiple plots in `plot_compare`.\n\ntests/phonon/test_plotter.py: ## Short summary\n\nThe functionality in `test_plotter.py` has been updated to use `matplotlib.pyplot` instead of `matplotlib.axes` for plotting. Adjustments have been made to the plotter methods and configurations, including the addition of new plotter instances with different settings for testing various scenarios.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPull Request #3700 enhances the `PhononDOSPlotter` and `PhononBSPlotter` classes in pymatgen to offer more flexibility and functionality to users. The key objectives are:\n\n1. **Invert Axes for PhononDOSPlotter**: Introduces the `invert_axes` feature to `PhononDOSPlotter`, enabling users to invert plot axes for better control over visualization, aligning with existing functionality in `DOSPlotter`.\n\n2. **Enhanced Comparison in PhononBSPlotter**: Upgrades `PhononBSPlotter` to compare phonon band structures of multiple materials simultaneously, improving analysis capabilities for researchers studying phonon behaviors and material properties.\n\nThe PR also includes standard software development practices like docstrings, type annotations, and tests for new features, with a mention of potential `duecredit` decorators for referencing relevant papers.\n\n### Comments Summary\n\nKey points from PR comments for code review:\n\n- **PhononDOSPlotter Testing**: Suggestions to verify correct axis limits inversion along with label swapping for `invert_axes` feature testing.\n \n- **PhononBSPlotter Testing**: Recommendation to test handling of incompatible band structures in addition to existing thorough legend label and color testing for `plot_compare` method.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR #3700 enhances pymatgen's `PhononDOSPlotter` and `PhononBSPlotter` classes with significant improvements:\n\n- **PhononDOSPlotter Enhancements**: Adds `invert_axes` feature for axis inversion in plotting methods, ensuring consistency and control in visualization. Refactors plot dimensions, data processing, and logic to support axis inversion effectively.\n\n- **PhononBSPlotter Enhancements**: Enables comparison of phonon band structures across multiple materials, enhancing color handling and customization for comprehensive analyses. Extends the analytical capabilities of `PhononBSPlotter` for advanced research needs.\n\nTesting updates in `tests/phonon/test_plotter.py` leverage `matplotlib.pyplot` for plotting, ensuring thorough validation of new features with diverse settings. The PR emphasizes robustness and reliability in pymatgen's functionality.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 4ae33eb487af908c5d32d43442d48415f60cbb02 -->\n<!-- 966eefd5c12b53d9a97e8878ee84ba25abbcdf31 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"@ab5424 actually, maybe these two CodeRabbit comments are worth addressing. would you be able to add these checks to `tests/phonon/test_plotter.py`\r\n\r\n> 46-49: Testing the invert_axes feature by asserting the swapped labels is a good approach. Additionally, consider verifying that the axes' limits are correctly inverted to ensure the feature works as expected.\r\n\r\n> 89-101: Testing the plot_compare method with different scenarios and asserting the legend labels and colors is thorough. It ensures that the comparison feature works correctly for multiple cases. Consider adding a test to verify the handling of incompatible band structures if not already covered.\r\n",
"@janosh I changed the code according to the suggestions. Interestingly, I found that I was able to get the NaCl/STO comparison though the checking block because the distances lists had the same length (but not the same shape so there was an `IndexError` on line 691). I changed it so that the shape must be the same."
] | 2024-03-22T10:44:35
| 2024-03-26T11:30:36
|
2024-03-26T11:08:56Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Major changes:
- feature 1: Add `invert_axes` to `PhononDOSPlotter` (similar to `DOSPlotter`)
- feature 2: Compare to more than one other `PhononBSPlotter`
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
- [ ] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Added an `invert_axes` parameter to various plotting methods for axis inversion, enhancing plot customization.
- Enhanced color handling and customization options for comparing multiple plots.
- **Refactor**
- Renamed a parameter for clarity and adjusted plot dimensions based on new axis inversion feature.
- **Tests**
- Updated plotting tests to reflect changes in plotting methods and configurations, including the use of `matplotlib.pyplot`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3700/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3700/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3700",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3700",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3700.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3700.patch",
"merged_at": "2024-03-26T11:08:56Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3701
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3701/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3701/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3701/events
|
https://github.com/materialsproject/pymatgen/issues/3701
| 2,202,388,078
|
I_kwDOACgets6DRcZu
| 3,701
|
printing labels from PeriodicSite in cif file
|
{
"login": "AndresOrtegaGuerrero",
"id": 34098967,
"node_id": "MDQ6VXNlcjM0MDk4OTY3",
"avatar_url": "https://avatars.githubusercontent.com/u/34098967?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/AndresOrtegaGuerrero",
"html_url": "https://github.com/AndresOrtegaGuerrero",
"followers_url": "https://api.github.com/users/AndresOrtegaGuerrero/followers",
"following_url": "https://api.github.com/users/AndresOrtegaGuerrero/following{/other_user}",
"gists_url": "https://api.github.com/users/AndresOrtegaGuerrero/gists{/gist_id}",
"starred_url": "https://api.github.com/users/AndresOrtegaGuerrero/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/AndresOrtegaGuerrero/subscriptions",
"organizations_url": "https://api.github.com/users/AndresOrtegaGuerrero/orgs",
"repos_url": "https://api.github.com/users/AndresOrtegaGuerrero/repos",
"events_url": "https://api.github.com/users/AndresOrtegaGuerrero/events{/privacy}",
"received_events_url": "https://api.github.com/users/AndresOrtegaGuerrero/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-22T12:29:20
| 2024-03-22T12:29:20
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
3.12.1
### Pymatgen version
2024.3.1
### Operating system version
_No response_
### Current behavior
Hello Developers, When defying a Structure where the periodicSites have an specific label , the cif file that is print by CifWriter doesnt use the labels when one is None,
from pymatgen.core import Lattice, Structure, Molecule
from pymatgen.io.cif import CifWriter
coords = [[0, 0, 0], [0.75,0.5,0.75]]
lattice = Lattice.from_parameters(a=3.84, b=3.84, c=3.84, alpha=120,
beta=90, gamma=60)
struct = Structure(lattice, ["Si", "Si"], coords)
struct.sites[0].label = "Si1"
cif_writer = CifWriter(struct)
cif_writer.write_file("output.cif")
I obtained,
_cell_angle_beta 90.00000000
_cell_angle_gamma 60.00000000
_symmetry_Int_Tables_number 1
_chemical_formula_structural Si
_chemical_formula_sum Si2
_cell_volume 40.03858081
_cell_formula_units_Z 2
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Si Si1 1 0.00000000 0.00000000 0.00000000 1
Si Si1 1 0.75000000 0.50000000 0.75000000 1
### Expected Behavior
I should expect
_cell_angle_beta 90.00000000
_cell_angle_gamma 60.00000000
_symmetry_Int_Tables_number 1
_chemical_formula_structural Si
_chemical_formula_sum Si2
_cell_volume 40.03858081
_cell_formula_units_Z 2
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Si Si1 1 0.00000000 0.00000000 0.00000000 1
Si Si 1 0.75000000 0.50000000 0.75000000 1
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3701/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3701/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3702
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3702/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3702/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3702/events
|
https://github.com/materialsproject/pymatgen/pull/3702
| 2,203,071,283
|
PR_kwDOACgets5qhO6K
| 3,702
|
`Self` return type on `from_dict` methods
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Great work 😄 ! I can take care of the rest if you don't mind.\r\n\r\nMeanwhile I noticed at least two modules are using naming conventions as `with_something` instead of `from_something`, do we have any plan to unify their namings as well?\r\n\r\n<img width=\"358\" alt=\"image\" src=\"https://github.com/materialsproject/pymatgen/assets/80093591/ea822bde-f0c1-4f12-ab2d-19bb9f20a2d7\">\r\n",
"good catch. i think we can rename those to `from_...` with a year-long deprecation period.",
"Sure. I would do that (I saw your follow up in `monty` but that `deprecation` decorator change is still not merged.). With that `deprecation` would much cleaner and easier.",
"while we're at it, these classes should be renamed to `PascalCase` (e.g. `BrunnerNNReciprocal`) and also be deprecated. you can find them with this regex: `class [^(= ]+_[^(]+\\(`\r\n\r\n\r\n",
"Sure would do. \r\n\r\nCan you please rebuild the `docs` (should be quite outdated) as we changed quite a lot in #3694? 🌹 ",
"`invoke make-doc` doesn't do a whole lot. not sure how doc updating is supposed to work atm. @shyuep?\r\n\r\n\r\n",
"Did you install `sphinx` dependencies (check warnings for `invoke make-doc`)? Like `sphinx_markdown_builder` and `sphinx_rtd_theme`? I got quite a lot of changes.\r\n\r\n\r\n",
"i did have those installed. i just updated `sphinx_markdown_builder` and `sphinx_rtd_theme` to v2 and ran again. that seems to have helped. still not many meaningful changes though. a few changed line ranges mostly https://github.com/materialsproject/pymatgen/commit/af0425827650c05692882bacc0fff6646115f859",
"Great to know. Meanwhile I noticed this warning from 3 years ago #2149:\r\nhttps://github.com/materialsproject/pymatgen/blob/af0425827650c05692882bacc0fff6646115f859/pymatgen/analysis/interface.py#L18-L23\r\n\r\nI assume it might be old enough to be removed?"
] | 2024-03-22T18:26:23
| 2024-03-23T06:10:44
|
2024-03-22T18:47:05Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
follow up to @DanielYang59's start in #3694 of adding `Self` return types on `from_dict` methods. far from complete. should be set on `from_str` and other `from_...` methods as well
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3702/reactions",
"total_count": 1,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 1,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3702/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3702",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3702",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3702.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3702.patch",
"merged_at": "2024-03-22T18:47:05Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3703
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3703/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3703/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3703/events
|
https://github.com/materialsproject/pymatgen/pull/3703
| 2,203,787,991
|
PR_kwDOACgets5qjqnG
| 3,703
|
Define `needs_u_correction(comp: CompositionLike) -> set[str]` utility function
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5680875673,
"node_id": "LA_kwDOACgets8AAAABUptImQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/mixing-schemes",
"name": "mixing-schemes",
"color": "44BAE9",
"default": false,
"description": "About mixing energies from different DFT functionals"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe update brings a mix of enhancements across different components: the pre-commit configuration, pymatgen library updates, and test suite improvements. It introduces a new argument for the `ruff` hook, expands pymatgen's functionality with additional imports and compatibility checks, and enriches the test suite with new checks and constants. These changes collectively enhance code quality, compatibility handling, and testing robustness, reflecting a commitment to maintaining high standards in software development.\n\n## Changes\n\n| Files | Summary |\n|--------------------------------------------|-------------------------------------------------------------------------------------------|\n| `.pre-commit-config.yaml` | Updated `ruff-pre-commit` revision to `v0.3.4` and added `--unsafe-fixes` argument. |\n| `pymatgen/entries/compatibility.py` | Enhanced compatibility checks, added imports, and introduced `needs_u_correction` function. |\n| `tests/entries/.../test_compatibility.py` | Expanded tests with new imports, constants, and a method to check `u_correction`. |\n\n> 🐰✨\n> In the realm of code, where changes abound, \n> A rabbit hopped in, improvements it found. \n> With a tweak and a fix, in files it did roam, \n> Enhancing the code, in its digital home. \n> So here's to the changes, both big and small, \n> May they make our code stronger, bugs to appall. \n> 🌟📜🐇\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n.pre-commit-config.yaml: ## Short summary\n\nThe change in functionality involves updating the revision of the `ruff-pre-commit` repository from `v0.3.3` to `v0.3.4`, affecting the `ruff` hook by adding the `--unsafe-fixes` argument.\n\n---\n\npymatgen/entries/compatibility.py: ## Short summary\n\nThe changes in `compatibility.py` involve importing `Composition` in addition to `Element`, adding a new import for `CompositionLike`, loading and using different compatibility configuration files, adjusting file path handling, and modifying the initialization and configuration settings related to compatibility checks. Additionally, a new function `needs_u_correction` is introduced to check Hubbard U corrections for compositions in the Materials Project 2020 scheme.\n\n---\n\ntests/entries/test_compatibility.py: ## Short summary\n\n- Added imports for `TYPE_CHECKING` and `CompositionLike`.\n- Added constants `MP2020_COMPAT_CONFIG` and `MP_COMPAT_CONFIG`.\n- Added a new test method `test_needs_u_correction` to check for `u_correction`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPull Request #3703 introduces a new utility function, `needs_u_correction(comp: CompositionLike) -> set[str]`, aimed at enhancing the functionality within the context of the Materials Project 2020 GGA/GGA+U mixing scheme. This function is designed to check if a given `CompositionLike` object is subject to Hubbard U corrections, a critical aspect in accurately modeling electronic structures within certain materials. The PR not only adds this utility function but also involves updates and modifications across several files to support this new feature.\n\nThe description of the PR highlights the core objective of implementing the `needs_u_correction` function and seeks feedback from other contributors, specifically tagging @rkingsbury, @JaGeo, and @Andrew-S-Rosen for their opinions. This indicates a collaborative effort to refine and ensure the utility function aligns with the project's standards and requirements.\n\nIn addition to the new utility function, the PR includes updates to the `.pre-commit-config.yaml` file, specifically upgrading the `ruff-pre-commit` repository revision and modifying the `ruff` hook configuration. Changes in `pymatgen/entries/compatibility.py` are substantial, involving imports adjustments, handling of compatibility configuration files, and path management enhancements. These changes are foundational for the introduction of the `needs_u_correction` function and its integration into the project's compatibility checking framework.\n\nFurthermore, the PR extends its modifications to the test suite, particularly in `tests/entries/test_compatibility.py`, where new imports, constants, and a test method `test_needs_u_correction` are added to validate the functionality of the newly introduced utility function.\n\n### AI-generated Summary of Generated Summaries\n\nPull Request #3703 focuses on the introduction of a new utility function, `needs_u_correction`, designed to assess Hubbard U corrections for `CompositionLike` objects within the Materials Project 2020 GGA/GGA+U mixing scheme. This addition is part of a broader effort to enhance the project's electronic structure modeling capabilities. To support this new functionality, the PR implements several key changes across the codebase:\n\n- The `.pre-commit-config.yaml` file is updated to revise the `ruff-pre-commit` repository version and modify the `ruff` hook by incorporating the `--unsafe-fixes` argument, indicating an enhancement in the pre-commit checks.\n- Significant modifications are made in `pymatgen/entries/compatibility.py`, including the importation of `Composition` and `CompositionLike`, adjustments in compatibility configuration file handling, and the introduction of the `needs_u_correction` function itself. These changes are crucial for integrating the new utility function into the existing compatibility checking framework.\n- The test suite is expanded with the addition of new imports, constants, and a dedicated test method `test_needs_u_correction` in `tests/entries/test_compatibility.py`. This ensures that the functionality of the `needs_u_correction` utility function is thoroughly validated.\n\nOverall, PR #3703 represents a comprehensive effort to bolster the Materials Project's modeling accuracy by facilitating the identification of compositions requiring Hubbard U corrections, supported by updates to configuration management, pre-commit checks, and testing protocols.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 20e60b2d08b335cdd7809aa8e408f61e146c4b55 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"Sorry to be late to the party here @janosh . This looks useful to me. It's easy to forget that we only correct certain TMs _when they occur as oxides or fluorides_ so it'll be nice to have a check like this. Thanks for contributing!"
] | 2024-03-23T09:19:15
| 2024-03-28T14:06:13
|
2024-03-26T06:44:56Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Checks if a `CompositionLike` is Hubbard U-corrected in the Materials Project 2020 GGA/GGA+U mixing scheme.
would be great to get other's opinions on this @rkingsbury @JaGeo @Andrew-S-Rosen
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3703/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3703/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3703",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3703",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3703.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3703.patch",
"merged_at": "2024-03-26T06:44:56Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3704
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3704/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3704/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3704/events
|
https://github.com/materialsproject/pymatgen/pull/3704
| 2,204,110,599
|
PR_kwDOACgets5qkp76
| 3,704
|
Support appending vectors to positions in XSF format
|
{
"login": "mturiansky",
"id": 8866816,
"node_id": "MDQ6VXNlcjg4NjY4MTY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8866816?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mturiansky",
"html_url": "https://github.com/mturiansky",
"followers_url": "https://api.github.com/users/mturiansky/followers",
"following_url": "https://api.github.com/users/mturiansky/following{/other_user}",
"gists_url": "https://api.github.com/users/mturiansky/gists{/gist_id}",
"starred_url": "https://api.github.com/users/mturiansky/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/mturiansky/subscriptions",
"organizations_url": "https://api.github.com/users/mturiansky/orgs",
"repos_url": "https://api.github.com/users/mturiansky/repos",
"events_url": "https://api.github.com/users/mturiansky/events{/privacy}",
"received_events_url": "https://api.github.com/users/mturiansky/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 6225613014,
"node_id": "LA_kwDOACgets8AAAABcxNQ1g",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/phonon",
"name": "phonon",
"color": "0ED699",
"default": false,
"description": "Lattice vibrations"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-24T00:25:43
| 2024-03-24T21:43:12
|
2024-03-24T06:51:56Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
XSF allows you to append a vector after the positions (usually forces). This makes it easier to visualize phonons with VESTA.
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3704/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3704/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3704",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3704",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3704.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3704.patch",
"merged_at": "2024-03-24T06:51:56Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3705
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3705/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3705/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3705/events
|
https://github.com/materialsproject/pymatgen/pull/3705
| 2,204,152,561
|
PR_kwDOACgets5qkydq
| 3,705
|
Use `Self` type in Method Signatures
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"[i added `Self` return type to `__new__` and `__enter__` methods](https://github.com/materialsproject/pymatgen/pull/3705/commits/2adde295d16126b84e4f346ff3294420003c9069). created 66 `mypy` errors unfortunately so feel free to revert if we don't want to deal with this now",
"> [i added `Self` return type to `__new__` and `__enter__` methods](https://github.com/materialsproject/pymatgen/pull/3705/commits/2adde295d16126b84e4f346ff3294420003c9069). created 66 `mypy` errors unfortunately so feel free to revert if we don't want to deal with this now\r\n\r\nThanks for your help! And don't worry about the `mypy` errors (I already opened some magic boxes 😄 , don't mind adding a few more). I would try to fix as many as I can later.\r\n",
"Naming of these two properties is a bit funny: https://github.com/materialsproject/pymatgen/blob/b1e50237cfd90a68440fb82806b58e59db2a4d5e/pymatgen/analysis/reaction_calculator.py#L455-L482\r\n\r\nDeprecate them and use `reaction_energy(_uncertainty)` instead (in the future `deprecation` PR for `with_something`)?",
"> Deprecate them and use `reaction_energy(_uncertainty)` instead (in the future `deprecation` PR for `with_something`)?\r\n\r\ni agree the naming is verbose but i would probably keep them as is to minimize breaking changes",
"> i would probably keep them as is to minimize breaking changes\r\n\r\nSure thing! Thanks for helping me catch more docstrings format issues.",
"Naming aside, need a closer look at the `std_dev` in: https://github.com/materialsproject/pymatgen/blob/b1e50237cfd90a68440fb82806b58e59db2a4d5e/pymatgen/analysis/reaction_calculator.py#L469-L482\r\n\r\n`self.calculate_energy(calc_energies)` should be a `float`, why `self.calculate_energy(calc_energies).std_dev` would even work (0aba332b272cc7d122c54b822c534fcce0f7032e)...\r\n\r\nAlso the `mypy` error: \r\n```\r\npymatgen/analysis/reaction_calculator.py:484: error: \"float\" has no attribute \"std_dev\" [attr-defined]\r\n```",
"> `self.calculate_energy(calc_energies)` should be a `float`, why `self.calculate_energy(calc_energies).std_dev` would even work ([0aba332](https://github.com/materialsproject/pymatgen/commit/0aba332b272cc7d122c54b822c534fcce0f7032e))...\r\n\r\nit's not a regular float but a `ufloat` from the [`uncertainties` package](https://pythonhosted.org/uncertainties/user_guide.html)",
"> > `self.calculate_energy(calc_energies)` should be a `float`, why `self.calculate_energy(calc_energies).std_dev` would even work ([0aba332](https://github.com/materialsproject/pymatgen/commit/0aba332b272cc7d122c54b822c534fcce0f7032e))...\r\n> \r\n> it's not a regular float but a `ufloat` from the [`uncertainties` package](https://pythonhosted.org/uncertainties/user_guide.html)\r\n\r\nAhh, thanks a lot for the quick response. Thought I would investigate tomorrow (22:21 in my time zone). Maybe I was adding the wrong type as `float` instead of `ufloat`. Would fix them tomorrow. Thanks! \r\n\r\nI added such comment here and there as a remainder for myself, but your input would always be hugely appreciated (and always very helpful) 😃 .",
"i think i would be good to open a `monty` PR that adds `Self` return type to `MSONable.from_dict` as well",
"> i think i would be good to open a `monty` PR that adds `Self` return type to `MSONable.from_dict` as well\r\n\r\nI just had a quick look and realized `monty` is missing quite some type annotations. I think it might be good to add type annotations for the entire code base (Given `monty` is not nearly as large in size as PMG)? I can do this after I finished this PR, or do you want to do that yourself? 😄 ",
"> I can do this after I finished this PR, or do you want to do that yourself? 😄\r\n\r\nthat would be nice. you could probably save some time by having an LLM like ChatGPT or Claude do the first pass and then fix the mistakes manually",
"> you could probably save some time by having an LLM like ChatGPT or Claude do the first pass and then fix the mistakes manually\r\n\r\nThanks for the suggestion. I usually use LLM for docstring or descriptive stuff. Currently I'm still not confident about their capability to infer var types. But currently, you know, I need to train myself to consume code 😄 . (With this said, the NVIDIA GTC 2024 keynote is gorgeous)\r\n",
"@coderabbitai review (summon the AI reviewer)",
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->\n\n> [!WARNING]\n> ## Rate Limit Exceeded\n> \n> @janosh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **3 minutes and 27 seconds** before requesting another review.\n> \n> <details>\n> \n> <summary>How to resolve this issue?</summary>\n> \n> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.\n> \n> We recommend that you space out your commits to avoid hitting the rate limit.\n> \n> </details>\n> \n> <details>\n> \n> <summary>How do rate limits work?</summary>\n> \n> CodeRabbit enforces hourly rate limits for each developer per organization.\n> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.\n> Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.\n> \n> </details>\n> \n> <details>\n> <summary>Commits</summary>\n> Files that changed from the base of the PR and between 6d06bef4eb10a9c1e3062c94fa8001757b686d39 and 2fe3b934a98f2cd5475c7e1d3dea7c4c252fa165.\n> </details>\n\n<!-- end of auto-generated comment: rate limited by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\n\nThe overarching theme of these updates revolves around enhancing type annotations and return types across various files, particularly with the addition of `Self` from `typing_extensions` for improved type hinting. Several files also see updates in variable naming, method signatures, and docstring clarifications for better clarity and maintainability. Notably, there's a consistent effort to refine and make explicit the type information across the board, aiming for clearer, more maintainable, and self-documenting code.\n\n## Changes\n\n| Files | Summary |\n|-------|---------|\n| `.../pre-commit-config.yaml` | Updated `ruff-pre-commit` revision and added `--unsafe-fixes` to `ruff` hook. |\n| `dev_scripts/...`, `pymatgen/analysis/...`, `pymatgen/core/...`, `pymatgen/electronic_structure/...`, `pymatgen/entries/...`, `pymatgen/ext/...`, `pymatgen/io/abinit/inputs.py` | Added `Self` from `typing_extensions`, updated method signatures and return types, clarified docstrings, and modified variable names. |\n| `pymatgen/alchemy/...`, `pymatgen/analysis/elasticity/...`, `pymatgen/analysis/ewald.py`, `pymatgen/analysis/ferroelectricity/...`, `pymatgen/analysis/gb/...`, `pymatgen/analysis/interfaces/...`, `pymatgen/analysis/local_env.py`, `pymatgen/analysis/magnetism/...`, `pymatgen/analysis/nmr.py`, `pymatgen/analysis/phase_diagram.py`, `pymatgen/analysis/piezo.py`, `pymatgen/analysis/pourbaix_diagram.py`, `pymatgen/analysis/prototypes.py`, `pymatgen/analysis/quasirrho.py`, `pymatgen/analysis/reaction_calculator.py`, `pymatgen/analysis/surface_analysis.py`, `pymatgen/analysis/transition_state.py`, `pymatgen/analysis/xps.py`, `pymatgen/apps/battery/...`, `pymatgen/command_line/...`, `pymatgen/core/...`, `pymatgen/electronic_structure/...` | Enhanced type hinting and typing clarity with `Self` and `TYPE_CHECKING`, updated return types and method signatures. |\n\n> 🐰✨\n> \n> In the realm of code, where the rabbits hop, \n> We've tweaked and tuned, not a single flop. \n> With `Self` in hand, and types so clear, \n> Our code now sings, to the compiler's ear. \n> So here's to changes, both big and small, \n> In this digital burrow, we've touched them all. \n> 🌟🐾\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n```plaintext\n.pre-commit-config.yaml: ## Short summary\n\nThe change in functionality involves updating the revision of the `ruff-pre-commit` repository from `v0.3.3` to `v0.3.4`, affecting the `ruff` hook configuration by adding `--unsafe-fixes`. Additionally, the `mypy` hook now includes `additional_dependencies: [types-python-dateutil]`.\n\n---\n\npymatgen/alchemy/transmuters.py: ## Short summary\n\n- Added import for `Self` from `typing_extensions`.\n- Modified the `__init__` method signature by adding a return type hint.\n- Added `__len__` and `__str__` methods.\n- Modified `undo_last_change` and `redo_next_change` methods by adding return type hints.\n- Modified `from_structures`, `from_filenames`, and `from_filenames` methods by adding return type hints.\n\n---\n\npymatgen/analysis/adsorption.py: ## Short summary\n\n- Added imports for `matplotlib.pyplot` and `Slab` from `pymatgen.core.surface`.\n- Modified the `AdsorbateSiteFinder` class to accept `Slab` as a parameter.\n- Updated the `from_bulk_and_miller` method to return `Self`.\n- Renamed variables `undercoords` to `under_coords` and `sop` to `symm_op`.\n- Changed method signatures in `find_surface_sites_by_height`, `assign_site_properties`, `get_rot`, and `plot_slab` to accept `Slab` parameters.\n- Adjusted variable names in `find_surface_sites_by_height`, `generate_substitution_structures`, `get_rot`, and `plot_slab`.\n- Updated `find_adsorption_sites` to use `symm_op` instead of `sop`.\n- Replaced `sop` with `symm_op` in `add_adsorbate` and `reorient_z`.\n- Modified `substitute` function to use `idx` instead of `i`.\n\n---\n\npymatgen/analysis/chemenv/coordination_environments/structure_environments.py: ## Short summary\n\nIn the `structure_environments.py` file of `pymatgen`, the changes involve updating the return type annotations in the `from_dict` and `from_structure_environments` methods for the `StructureEnvironments`, `LightStructureEnvironments`, and `ChemicalEnvironments` classes to use `Self` as the return type instead of explicitly specifying the class name.\n\n---\n\npymatgen/analysis/chemenv/coordination_environments/voronoi.py: ## Short Summary\n\nThe function `from_bson_voronoi_list2` in `voronoi.py` now specifies the types of its parameters as `list[PeriodicSite]` and `Structure`.\n\n---\n\npymatgen/analysis/graphs.py: ## Short summary\n\nIn the `__mul__` method of the `StructureGraph` class in `pymatgen/analysis/graphs.py`, the changes primarily involve renaming variables for clarity and improving comments for better understanding. The modifications focus on refining the logic for handling nodes and edges within a supercell, particularly in terms of Cartesian and fractional coordinates calculations.\n\n---\n\npymatgen/analysis/interface_reactions.py: ## Short Summary\nThe `interface_reactions.py` file in `pymatgen` has a semantic change in the `_get_elem_amt_in_rxn` method's return type from `int` to `float`.\n\n---\n\npymatgen/analysis/magnetism/heisenberg.py: ## Short summary\n\nThe change in functionality involves converting parameters to attributes in the `__init__` method of a class, affecting the way certain properties are initialized and accessed within the class.\n\n---\n\npymatgen/analysis/nmr.py: ## Short summary\n\n- Added `from typing import TYPE_CHECKING`.\n- Added `from typing_extensions import Self`.\n- Added return type hints `-> Self | None` to `__new__` methods in `ChemicalShielding` and `ElectricFieldGradient` classes.\n- Added return type hint `-> Self` to `from_maryland_notation` method in `ChemicalShielding` class.\n\n---\n\npymatgen/analysis/reaction_calculator.py: ## Short summary\n\nIn the `reaction_calculator.py` file of `pymatgen/analysis`, the changes include:\n- Addition of `overload` import.\n- Type annotations added/modified in `__init__`, `calculate_energy`, `normalize_to`, `normalize_to_element`, `get_el_amount` methods.\n- Type annotations added/modified in `elements`, `coeffs`, `all_comp`, `reactants`, `products`, `get_coeff`, `normalized_repr_and_factor` methods.\n- Type annotations added/modified in `as_entry`, `as_dict`, `from_str` methods.\n- Type annotations added/modified in `Reaction` class and `copy` method.\n- Type annotations added/modified in `ReactionError` class.\n- Type annotations added/modified in `calculated_reaction_energy`, `calculated_reaction_energy_uncertainty` methods in `ComputedReaction` class.\n\n---\n\npymatgen/apps/battery/conversion_battery.py: ## Short summary\n\n- Added import for `Self` from `typing_extensions`.\n- Added return type annotations `-> Self` to the methods `from_composition_and_pd` and `from_composition_and_entries`.\n- Added return type annotations `-> Self` to the method `from_steps`.\n\n---\n\npymatgen/cli/pmg_config.py: ## Short summary\n\nThe changes in `pymatgen/cli/pmg_config.py` involve modifications to exception handling and file operations within the `setup_cp2k_data` and `setup_potcars` functions. Specifically, the code now raises `SystemExit` with a message instead of printing it before exiting, and file operations include specifying the encoding as `utf-8` for reading files. Additionally, there are conditional checks before updating settings based on potential elements. These adjustments enhance error handling and file processing in the script.\n\n---\n\npymatgen/core/lattice.py: ## Short summary\n\nIn the `pymatgen/core/lattice.py` file, the `parameters` property's docstring has been updated to clarify that it returns a 6-tuple of floats representing (a, b, c, alpha, beta, gamma).\n\n---\n\npymatgen/core/operations.py: ## Short summary\n\nIn `pymatgen/core/operations.py`, the changes involve updating the return types in method declarations to use the `Self` type from `typing_extensions` instead of explicitly specifying the class name. This change affects methods related to creating symmetry operations and magnetic symmetry operations.\n\n---\n\npymatgen/core/periodic_table.py: ## Short summary\n\n- Added encoding parameter to the `open` function call for `periodic_table.json`.\n- Modified the `FloatWithUnit` instantiation to convert tokens to float where necessary.\n- Changed the return type of the `from_str` method in the `Species` class to `Self`.\n- Updated the `__str__` method in the `Species` class to include additional logic.\n- Enhanced error handling and logic in the `get_crystal_field_spin` method.\n- Adjusted the return values and added error handling in the `get_crystal_field_spin` method.\n- Modified the argument type of the `from_dict` method in the `Species` and `DummySpecies` classes to `dict`.\n\n---\n\npymatgen/core/units.py: ## Short summary\n\n- Added `TYPE_CHECKING` import from `typing`.\n- Removed `Error` attribute from classes `Unit`, `FloatWithUnit`, and `ArrayWithUnit`.\n- Modified the constructor in class `FloatWithUnit` to include type annotations for parameters.\n- Updated the `unit_type` property in class `FloatWithUnit` to return `str | None`.\n- Added a new class method `from_str` in class `FloatWithUnit` with type annotations.\n- Updated the return type of the class method `from_str` in class `FloatWithUnit` to `Self`.\n- Added type annotations to the constructor in class `ArrayWithUnit`.\n- Updated the `obj_with_unit` function to handle type annotations and added type hints for the return type.\n\n---\n\npymatgen/core/xcfunc.py: ## Short summary\n\nThe changes in `pymatgen/core/xcfunc.py` involve the addition of a new `__init__` method with parameter type annotations, adjustments to method signatures with added return type annotations, and modifications to the logic in methods like `type` and `name` to handle different cases based on the presence of certain attributes.\n\n---\n\npymatgen/electronic_structure/bandstructure.py: ## Short summary\n\nThe changes in `bandstructure.py` involve modifying the return types of `from_dict` and `from_old_dict` methods in various classes to return `Self` instead of specific class names, enhancing flexibility and maintainability.\n\n---\n\npymatgen/electronic_structure/boltztrap.py: ## Short summary\n\nIn the `BoltztrapAnalyzer` class in `boltztrap.py`, the `from_files` method signature has been updated to specify type hints for the `path_dir` parameter as `str` and for the `dos_spin` parameter as `Literal[-1, 1]`, and the return type hint has been changed to `Self`.\n\n---\n\npymatgen/electronic_structure/boltztrap2.py: ## Short summary\n\n- Added `from typing import TYPE_CHECKING`.\n- Added `from pathlib import Path`.\n- Added `from typing_extensions import Self`.\n- Changed `def from_file(cls, vasprun_file)` to `def from_file(cls, vasprun_file: str | Path) -> Self` for both `VasprunBSLoader` and `VasprunLoader`.\n\n---\n\npymatgen/electronic_structure/cohp.py: ## Short summary\n\n- The `from_dict` method in the `Cohp` class now returns `cls` instead of `Cohp`.\n- The `from_dict` method in the `CompleteCohp` class now returns `cls` instead of `CompleteCohp`.\n- The `from_file` method in the `CompleteCohp` class now specifies the return type as `Self`.\n\n---\n\npymatgen/ext/matproj.py: ## Short summary\n\nThe `matproj.py` file in `pymatgen/ext` underwent changes that introduced new imports, added type hints, and modified the `__new__` method in the `MPRester` class to include type annotations for return values.\n\n---\n\npymatgen/io/abinit/inputs.py: ## Short summary\n\n- Added type hints to the `from_object` method in the `ShiftMode` class.\n- Replaced `app` with `lines.append` in the `to_str` method for clarity.\n- Added type hints to the `from_inputs` method in the `BasicMultiDataset` class.\n\n---\n\npymatgen/io/abinit/pseudos.py: ## Short summary\n\n- Refactored the `to_str` method to use list comprehension for appending lines and adjusted the handling of hints and non-linear core correction radius.\n- Added a return type hint for the `from_dir` method.\n\n---\n\npymatgen/io/ase.py: ## Short summary\n\n- Added import statement for `Self` from `typing_extensions`.\n- Changed the return type of the `from_dict` function from `MSONAtoms` to `Self`.\n\n---\n\npymatgen/io/cif.py: ## Short summary\n\n- Added `from_str` method type annotations in `CifBlock` and `CifFile` classes.\n- Updated method return types to use `Self` in `CifBlock` and `CifFile` classes.\n- Modified method parameter types in `from_file` method of `CifFile` class.\n- Added type hinting for `Self` in `TYPE_CHECKING` block.\n\n---\n\npymatgen/io/core.py: ## Short summary\n\nIn the `pymatgen/io/core.py` file:\n- The `from_str` method in the `InputFile` class now returns `None` instead of `InputFile`.\n- The `from_file` method in the `InputFile` class now returns `None` instead of `InputFile`.\n- An `NotImplementedError` is raised in the `from_str` method to indicate it has not been implemented.\n- The `from_directory` method in the `InputSet` class now returns `None` instead of not specifying a return type.\n\n---\n\npymatgen/io/cp2k/inputs.py: ## Short summary\n\n- Added type annotations to method parameters and return types for improved type safety and clarity.\n- Updated method signatures to include type hints for parameters.\n- Enhanced method signatures with type annotations for better code readability and maintainability.\n\n---\n\npymatgen/io/cp2k/outputs.py: ## Short summary\n\n- The `completed` property now uses the walrus operator for assignment.\n- Simplified logic in `is_molecule`, `is_metal`, and `parse_structures` methods.\n- Refactored conditions in `is_hubbard` and `parse_structures`.\n- Utilized assignment expressions in `parse_dft_params`.\n- Improved handling of `dos_file` in `parse_dos`.\n- Encoding specified in `open` call in `parse_bandstructure`.\n\n---\n\npymatgen/io/cp2k/sets.py: ## Short summary\n\n- Changed the assignment of `self.basis_and_potential` to use `or` instead of `if else` for default value assignment.\n- Updated file reading in `get_basis_and_potential` to include `encoding=\"utf-8\"`.\n- Modified the assignment of `names` in `get_xc_functionals` to use `or` instead of `if else`.\n- Adjusted the assignment of `potential_type` in `activate_hybrid` to use `or` instead of `if else`.\n\n---\n\npymatgen/io/cp2k/utils.py: ## Short summary\n\nIn the `postprocessor` function of `pymatgen/io/cp2k/utils.py`, the change involves switching from using parentheses to curly braces in the `in` checks for specific strings like \"false\", \"no\", \"f\", \"true\", \"yes\", \"t\". This modification alters the way these values are checked for truthiness or falsiness within the function.\n\n---\n\npymatgen/io/cssr.py: ## Short summary\n\n- Added `TYPE_CHECKING` import for type hinting.\n- Added type hints for `string` parameter in `from_str` method.\n- Added type hints for `filename` parameter in `from_file` method.\n\n---\n\npymatgen/io/exciting/inputs.py: ## Short summary\n\n- Added `TYPE_CHECKING` import for typing.\n- Added type hints for `from_str` method parameters.\n- Improved error handling for missing structure in the input file.\n- Refactored attribute retrieval for structure elements.\n- Enhanced type annotations for the `from_file` method.\n\n---\n\npymatgen/io/feff/inputs.py: ## Short summary\n\nIn `pymatgen/io/feff/inputs.py`, the changes involve adding type annotations to method parameters and return types, specifically in the `from_file` and `header_string_from_file` methods within the `Header` class. The method signatures now include type hints for parameters and return values.\n\n---\n\npymatgen/io/feff/outputs.py: ## Short summary\n\n- Added `from typing import TYPE_CHECKING`\n- Added `from typing_extensions import Self` under `if TYPE_CHECKING`\n- Modified method signatures in `LDos`, `Xmu`, and `EelsSpectrum` classes to include type hints and return annotations\n\n---\n\npymatgen/io/feff/sets.py: ## Short summary\n\nAdded type hints for the `from_directory` method in the `FeffInputSet` class to specify the input parameter and return type.\n\n---\n\npymatgen/io/gaussian.py: ## Short summary\n\nIn the `pymatgen/io/gaussian.py` file:\n- Added type hints for `contents` parameter in `from_str` method.\n- Added type hints for `filename` parameter in `from_file` method.\n- Changed the return type hint in `from_dict` method from `GaussianInput` to `Self`.\n- Imported `TYPE_CHECKING`, `Path`, and `Self` from `typing` modules.\n\n---\n\npymatgen/io/lammps/data.py: ## Short summary\n\n- Added import for `Self` from `typing_extensions`.\n- Updated return type annotations in `from_file`, `from_ff_and_topologies`, `from_structure`, `from_bonding`, `to_file`, `from_file`, `from_dict`, `from_ff_and_topologies`, `from_structure`, `parse_xyz`, `from_files`, and `from_lammpsdata` methods to use `Self` instead of specific class names.\n- Added return type annotations for `from_ff_and_topologies` and `from_structure` methods.\n- Added a note about methods overriding the parent class.\n\n---\n\npymatgen/io/lammps/generators.py: ## Short summary\n\nIn the `BaseLammpsGenerator` class in `pymatgen/io/lammps/generators.py`, the change involves renaming the `Parameters` section to `Attributes` for clarity without altering the content. This modification aims to better describe the purpose of the section within the class. The `get_input_set` method now enforces the `structure` parameter to be of type `Structure`, `LammpsData`, or `CombinedData`, ensuring stricter type checking.\n\n---\n\npymatgen/io/lammps/inputs.py: ## Short summary\n\nAdded an import statement for `Self` from `typing_extensions`. Updated the return type annotations of the `from_str` and `from_file` class methods in `LammpsInputFile` to use `Self` instead of `LammpsInputFile`.\n\n---\n\npymatgen/io/lammps/sets.py: ## Short summary\n\n- Added an import statement for `Self` from `typing_extensions`.\n- Changed the return type of the `from_directory` method in `LammpsInputSet` class from `LammpsInputSet` to `Self`.\n- Updated the return statement in the `from_directory` method to use `cls` instead of `LammpsInputSet`.\n\n---\n\npymatgen/io/lmto.py: ## Short summary\n\n- Added import statement for `Path`.\n- Modified the `from_file` method in the `LMTOCtrl` class to accept a `filename` of type `str` or `Path` and return `Self` instead of `LMTOCtrl`.\n- Modified the `from_str` method in the `LMTOCtrl` class to return `Self` instead of `LMTOCtrl`.\n\n---\n\npymatgen/io/lobster/lobsterenv.py: ## Short summary\n\n- Added import for `Self` from `typing_extensions`.\n- Modified the return type annotation of the `from_Lobster` method to use `Self`.\n\n---\n\npymatgen/io/lobster/outputs.py: ## Short summary\n\nIn `pymatgen/io/lobster/outputs.py`, the changes involve adjusting the calculation of `num_bonds` based on the condition `self.are_multi_center_cobis`, and correcting an error in raising a `ValueError` when a condition is not met.\n\n---\n\npymatgen/io/nwchem.py: ## Short summary\n\n-\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request focuses on incorporating `Self` return types in method signatures, adding related type annotations, and making minor docstring tweaks for code clarity and maintainability.\n\n### Comments Summary\n\n1. **Type Updates**: `__new__` and `__enter__` methods were updated with `Self` return types, causing `mypy` errors that are being addressed.\n\n2. **Property Naming**: Discussion on deprecating verbose property names to minimize breaking changes.\n\n3. **Type Clarification**: Clarification on using `ufloat` from the `uncertainties` package instead of a regular `float`.\n\n4. **Future Work Suggestions**: Proposals to extend `Self` return types to `monty` and enhance type annotations across the codebase.\n\n5. **Collaborative Spirit**: Positive interactions and gratitude for feedback and assistance during the review process.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR introduces `Self` return types and type annotations across various modules, enhancing code readability and type safety. Key changes include:\n- Adoption of `Self` return types for method signatures.\n- Addition of type annotations for improved type checking.\n- Minor docstring adjustments for better documentation alignment.\nThe comments reflect collaborative efforts to address `mypy` errors, discussions on property naming, clarification on type usage, and suggestions for future work. Contributors engage positively, aiming to refine and improve the proposed changes effectively.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- b8f1a3246b13970e4149c0aa3ab4bf6a4dceea72 -->\n<!-- cfd77ab29300c313846eb93ed0517e676700bcae -->\n<!-- 8137931539024f1b5a43002da124d18389be6d1e -->\n<!-- 4bbee19049febd45292e7a1b61820d319c33bef0 -->\n<!-- 6d06bef4eb10a9c1e3062c94fa8001757b686d39 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"<!-- This is an auto-generated reply by CodeRabbit -->\n\n\n@DanielYang59, I've noted your request for a review. Given the detailed discussions in this PR, I'll focus on the key areas mentioned, including the addition of `Self` return types, the use of `ufloat` from the `uncertainties` package, and the broader topic of adding type annotations to the `monty` codebase. While I can't directly access the code changes, I'll provide guidance based on the discussions you've had. If there are specific code snippets or files you'd like me to look at more closely, please let me know!\n\n\n\n<details>\n<summary>Actions performed</summary>\n\nReview triggered.\n\n> Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.\n\n</details>",
"@janosh Could you please give me a hand? 2 left",
"The unit test of `Kpoints` is inconsistent with type annotation (therefore the unit test failure), mostly `tuple` and `list` cannot be used interchangeably after adding type annotations. Need discussion on this as I'm not sure if any internal mechanism has any requirement.",
"Everything looks good! Only two minor comments [here](https://github.com/materialsproject/pymatgen/pull/3705#discussion_r1542264987) and [here](https://github.com/materialsproject/pymatgen/pull/3705#discussion_r1541061338).\r\n\r\nThanks a lot for helping me @janosh \r\n\r\nSorry I'm making this PR overly large. I would try to chop up future PRs into smaller chunks.",
"> thank you so much @DanielYang59! \r\n\r\nGlad I could help (as always)... Can never be done without your help. ❤️ \r\n\r\nAlso I begin to notice [this](https://github.com/materialsproject/pymatgen/actions/runs/8479010046/job/23232289989?pr=3705) `pytest` error very recently (in some previous recent PRs too):\r\n```\r\nRun pytest --splits 10 --group 8 --durations-path tests/files/.pytest-split-durations tests\r\npytest: D:\\a\\_temp\\7e802d0c-9ab9-42f4-9fa8-e2b5bcdba88b.ps1:2\r\nLine |\r\n 2 | pytest --splits 10 --group 8 --durations-path tests/files/.pytest-spl …\r\n | ~~~~~~\r\n | The term 'pytest' is not recognized as a name of a cmdlet, function, script file, or executable program. Check\r\n | the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nError: Process completed with exit code 1.\r\n```\r\nLooks like some internal error for the Windows runner.\r\n",
"> Looks like some internal error for the Windows runner.\r\n\r\nvery strange. did not notice this before in other PRs. if i see it a 2nd time I'll do some digging",
"Cheers!",
"with all the type fixes in this PR, we can probably consider unskipping `mypy` in CI. i.e. remove this line\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/3a49dd918db2b64c48493ac6e1eb837d65930d86/.pre-commit-config.yaml#L5",
"> we can probably consider unskipping `mypy` in CI\r\n\r\nAhh... Frankly I don't know how would this potentially alter (impact) CI. I thought `mypy` has always been running in CI?\r\n\r\n",
"> I thought `mypy` has always been running in CI?\r\n\r\nit has but not in `pre-commit.ci`, only in GitHub actions. for some reason ([maybe different set of CLI args](https://github.com/pre-commit/mirrors-mypy/blob/9db9854e3041219b1eb619872a2dfaf58adfb20b/.pre-commit-hooks.yaml#L7)), the former reported more errors in the past which is why i skipped it. but i think we can try again now to see how many errors remain",
"Speaking of this. I might continue to add type annotations across the code base in the near future. But I guess it's better to start from the most used parts (`core` and `vasp` I guess?) instead of alphabetically, do you have any suggestions? ",
"> it has but not in `pre-commit.ci`, only in GitHub actions. for some reason ([maybe different set of CLI args](https://github.com/pre-commit/mirrors-mypy/blob/9db9854e3041219b1eb619872a2dfaf58adfb20b/.pre-commit-hooks.yaml#L7)), the former reported more errors in the past which is why i skipped it. but i think we can try again now to see how many errors remain\r\n\r\nThanks for clarifying. This makes sense to me, but I guess it's better to run locally with the same args, instead of risk breaking everyone's PR workflow? I'm having a try now.\r\n\r\n",
"instead of risk breaking everyone's CI workflow?\r\n\r\noh don't worry, `skip` applies only to `ci`. `mypy` was [only skipped in `pre-commit.ci`\r\n](https://results.pre-commit.ci/run/github/2629302/1711248642.AYsq7ELtT76saw_UfnYvrQ)\r\n\r\n\r\n> Speaking of this. I might continue to add type annotations across the code base in the near future. But I guess it's better to start from the most used parts (core and vasp I guess?) instead of alphabetically, do you have any suggestions?\r\n\r\nthat would be very welcome! `core` is definitely most important. `vasp`, `electronic_structure`, `phonons` are also important",
"I think I don't understand the difference between CI and `pre-commit` properly (currently doing some research on this). From my current understanding, `pre-commit` seems to check modified file for a PR only, right?\r\n\r\nOn the other hand, running `mypy pymatgen` gives:\r\n```\r\nFound 732 errors in 96 files (checked 278 source files)\r\n```\r\n\r\n................................ OMG",
"> From my current understanding, pre-commit seems to check modified file for a PR only, right?\r\n\r\nthat's correct. you can still run it on all files with `pre-commit run --all-files`\r\n\r\n> On the other hand, running `mypy pymatgen` gives:\r\n> \r\n> ```\r\n> Found 732 errors in 96 files (checked 278 source files)\r\n> ```\r\n> \r\n> ................................ OMG\r\n\r\n😆 yep, lots of legacy issues to clean up. can't be done all at once. but some type errors could also go away with a smarter type checker in the future. hoping `ruff` becomes a type checker! 🤞 ",
"I'm hoping the same, but there are actually quite some issues can be discovered by type checking (mostly `None` as default type).\r\n\r\nOn the other hand, `mypy --check-untyped-defs pymatgen` gives:\r\n```\r\nFound 2080 errors in 159 files (checked 278 source files)\r\n```\r\n\r\nI wouldn't worry about this too much, we fixed like 120? in 5 days, I just want to duplicate myself...\r\n\r\n"
] | 2024-03-24T02:50:41
| 2024-04-13T18:05:56
|
2024-03-29T09:38:53Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Use `Self` for return type in Method Signatures, see reference [here](https://typing.readthedocs.io/en/latest/spec/generics.html#self).
### Major changes:
- Use `Self` type in Method Signatures
- Add related type annotations
- Some `sourcery` fixes
### Minor changes:
- Docstring tweaks
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
## Summary by CodeRabbit
- **New Features**
- Enhanced search functionality with more intuitive variable names and clearer method signatures.
- Improved clarity and consistency in documentation across various modules.
- **Refactor**
- Updated method return types to leverage `Self` for better type hinting and future maintainability.
- Modified method signatures for clarity and consistency.
- **Chores**
- Updated pre-commit hook configurations for improved code quality checks.
- **Style**
- Clarified and condensed docstrings for better readability.
- **Bug Fixes**
- Fixed potential issues with handling `None` values in data processing methods.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3705/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3705/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3705",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3705",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3705.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3705.patch",
"merged_at": "2024-03-29T09:38:53Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3706
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3706/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3706/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3706/events
|
https://github.com/materialsproject/pymatgen/pull/3706
| 2,205,050,494
|
PR_kwDOACgets5qns8r
| 3,706
|
Return `self` from `Structure` methods `replace`, `substitute`, `remove_species`, `remove_sites`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
},
{
"id": 5529392097,
"node_id": "LA_kwDOACgets8AAAABSZPT4Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/api",
"name": "api",
"color": "D21149",
"default": false,
"description": "Application programming interface"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
},
{
"id": 5648629103,
"node_id": "LA_kwDOACgets8AAAABUK89bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/core",
"name": "core",
"color": "299448",
"default": false,
"description": "Pymatgen core"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-25T07:07:40
| 2024-04-12T05:47:54
|
2024-03-25T07:18:49Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
allows chaining these methods which returned `None` before. updated tests to `assert returned is self` and added a new test for `Structure.replace()` which was missing coverage
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3706/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3706/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3706",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3706",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3706.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3706.patch",
"merged_at": "2024-03-25T07:18:49Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3707
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3707/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3707/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3707/events
|
https://github.com/materialsproject/pymatgen/pull/3707
| 2,205,378,669
|
PR_kwDOACgets5qo0tw
| 3,707
|
`Self` return type on `Lattice` methods
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-25T10:16:31
| 2024-03-25T11:09:06
|
2024-03-25T10:59:03Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
define new type `PbcLike = tuple[bool, bool, bool]`. improve tests for `typing` module
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3707/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3707/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3707",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3707",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3707.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3707.patch",
"merged_at": "2024-03-25T10:59:03Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3708
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3708/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3708/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3708/events
|
https://github.com/materialsproject/pymatgen/issues/3708
| 2,205,481,510
|
I_kwDOACgets6DdPom
| 3,708
|
[Dev] Some methods do not have proper types or names
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Sorry @janosh I still remember there is a comment from you about some classes that don't follow PascalCase naming (and you provided the `re` pattern). \r\n\r\nUPDATE: I found it [here](https://github.com/materialsproject/pymatgen/pull/3702#issuecomment-2016363666)",
"Fixed in #3725."
] | 2024-03-25T11:05:20
| 2024-03-29T11:25:10
|
2024-03-29T11:25:10Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
- Some methods should not be `staticmethods` (there should certainly be other wrong types I didn't notice).
- Some methods in `analysis.graphs` should be renamed from `with_*` to `from_*` for consistency.
For example (not exhaustive):
https://github.com/materialsproject/pymatgen/blob/05d3f9f5643c9585e15b297a58697432c9de4dcf/pymatgen/alchemy/transmuters.py#L297-L313
https://github.com/materialsproject/pymatgen/blob/05d3f9f5643c9585e15b297a58697432c9de4dcf/pymatgen/analysis/graphs.py#L199-L290
https://github.com/materialsproject/pymatgen/blob/05d3f9f5643c9585e15b297a58697432c9de4dcf/pymatgen/analysis/graphs.py#L1630-L1737
- Some classes don't follow PascalCase pattern found by @janosh, [here](https://github.com/materialsproject/pymatgen/pull/3702#issuecomment-2016363666)
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3708/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3708/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3710
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3710/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3710/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3710/events
|
https://github.com/materialsproject/pymatgen/pull/3710
| 2,207,078,472
|
PR_kwDOACgets5quoGF
| 3,710
|
Convert some `staticmethod` to `classmethod`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates in the pymatgen library focus on transitioning static methods to class methods, incorporating type hinting with `Self` for return types. These changes aim to improve class inheritance, flexibility, and code uniformity, enhancing the library's extensibility and adaptability for future enhancements.\n\n## Changes\n\n| Files | Change Summary |\n|-------|----------------|\n| `.../alchemy/transmuters.py`<br>`.../analysis/graphs.py`<br>`.../core/operations.py`<br>`.../io/abinit/pseudos.py`<br>`.../io/babel.py`<br>`.../io/cp2k/inputs.py`<br>`.../io/feff/inputs.py`<br>`.../io/pwmat/inputs.py`<br>`.../io/vasp/inputs.py`<br>`.../phonon/thermal_displacements.py`<br>`.../transformations/standard_transformations.py`<br>`.../util/provenance.py` | Shifted from `@staticmethod` to `@classmethod`, updated type hinting with `Self`, and adjusted method signatures to use `cls` for improved inheritance and flexibility. |\n| `.../transformations/advanced_transformations.py` | Made minor import adjustments with no significant changes to logic or control flow. |\n\n> \"In the realm of code where the bits entwine, \n> 🐇 A rabbit hopped through, making pymatgen shine. \n> From static to class, with a magical twist, \n> Methods now flexible, in an extensive list. \n> 🌟 With every hop, a better design, \n> For a library more robust, and oh so fine. \n> Celebrate we shall, with carrots so sweet, \n> For changes so grand, they deserve a tweet!\" 🥕🎉\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/cp2k/inputs.py: \n- In the `pymatgen/io/cp2k/inputs.py` file, the `from_kpoints` method in the `Band_Structure` class has been changed from a static method to a class method. The method signature now includes type hints and returns `Self` instead of `Band_Structure`.\n\npymatgen/transformations/standard_transformations.py: \n- The changes in `standard_transformations.py` involve switching from `@staticmethod` to `@classmethod` for the `from_boundary_distance` method, updating the return type annotation to use `Self` from `typing_extensions`, and adjusting the method calls accordingly.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe Pull Request (PR) #3710 aims to convert specific methods within the pymatgen library from `staticmethod` to `classmethod`. This conversion is intended to address issue #3708, focusing on methods that create instances of their respective classes. By switching to `classmethod`, the PR seeks to enhance flexibility and extensibility in the codebase by enabling better utilization of class inheritance. The modification allows these methods to access the class object through the `cls` parameter, facilitating dynamic instance creation respecting inheritance hierarchies. The changes span various files in the pymatgen library, including `transmuters.py`, `graphs.py`, `operations.py`, and input/output files related to computational tools.\n\n### Comments Summary\n\nThe comments on PR #3710 request a review from the AI, seeking validation of the changes made. No specific technical concerns or objections are raised, indicating a straightforward intent behind the modifications. Contributors seem interested in confirming the correctness and appropriateness of the transition from static to class methods in different parts of the pymatgen library.\n\n### AI-generated Summary of Generated Summaries\n\nPR #3710 involves a significant refactor in the pymatgen library, converting `staticmethod` to `classmethod` in various classes to align methods responsible for creating instances with class inheritance principles. Key changes include:\n\n- Conversion of instance creation methods across multiple pymatgen modules like `alchemy/transmuters.py`, `analysis/graphs.py`, `core/operations.py`, `io/abinit/pseudos.py`, `io/babel.py`, `io/cp2k/inputs.py`, `io/feff/inputs.py`, `io/pwmat/inputs.py`, `io/vasp/inputs.py`, `phonon/thermal_displacements.py`, and `transformations/standard_transformations.py`. These methods now use `cls` as the first argument, enhancing inheritance capabilities.\n- Updated return type annotations to use `Self` where applicable, indicating methods return instances of their classes, enhancing flexibility and extensibility.\n- Minor adjustments and import statement updates accompany the changes to maintain code consistency and adhere to Python development best practices.\n\nOverall, PR #3710 systematically improves the design and structure of the pymatgen library, making classes more adaptable and methods more aligned with object-oriented programming principles.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 0baee35206afa879c10d403b9c32abcfa9103383 -->\n<!-- 8067df104d6b747e11a2beffdc283a16739c3865 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"@coderabbitai review",
"@coderabbitai Can you find if there is any other methods decorated as `staticmethod` (returns an instance of the Class itself), but should be a `classmethod` instead, across the entire code base?",
"<!-- This is an auto-generated reply by CodeRabbit -->\n> [!TIP]\n> For best results, initiate chat on the files or code changes.\n\n@DanielYang59, I've identified numerous files across the pymatgen codebase that contain methods decorated with `@staticmethod`. Given the extensive list, it would be beneficial to manually review these methods to determine if any should be converted to `@classmethod` based on whether they return an instance of the class itself. Here are some of the files where `@staticmethod` methods were found:\n\n- `pymatgen/io/vasp/inputs.py`\n- `pymatgen/core/operations.py`\n- `pymatgen/analysis/structure_analyzer.py`\n- `pymatgen/symmetry/analyzer.py`\n- `pymatgen/transformations/advanced_transformations.py`\n\nThis list is not exhaustive but provides a starting point for further investigation.\n\n<details>\n<summary>Analysis chain</summary>\n\n\n\n---\n\n\n\n</details>\n\n<details>\n<summary>Scripts executed</summary>\n\nThe following scripts were executed for the analysis:\n\n\n\n---\n\nScript:\n```shell\n#!/bin/bash\n# Search the entire codebase for methods decorated with `staticmethod`.\n# This script uses ripgrep (rg) to find occurrences of `@staticmethod` and prints the file names and method signatures.\nrg --multiline '@staticmethod\\ndef ' --glob '*.py'\n\n```\n\nLength of output: 52\n\n---\n\n\n\n---\n\nScript:\n```shell\n#!/bin/bash\n# Adjusting the search to find occurrences of `@staticmethod` more reliably.\n# This script uses ripgrep (rg) to find occurrences of `@staticmethod` and prints the file names where they are found.\nrg '@staticmethod' --glob '*.py' --files-with-matches\n\n```\n\nLength of output: 2855\n\n</details>",
"@janosh, please review. Thanks a lot.",
"Glad I could help. Thanks for reviewing @janosh "
] | 2024-03-26T01:59:30
| 2024-03-26T07:37:56
|
2024-03-26T06:15:45Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Major changes:
- Converted some `staticmethod` to `classmethod`, partially address #3708
Rationale:
These methods create an instance of the Class itself, and should be a `classmethod`, not `staticmethod`.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Enhanced class method flexibility across various modules by converting static methods to class methods and updating method signatures for improved inheritance and extensibility.
- Introduced type hints for return types to ensure type safety and clarity in method definitions.
- Streamlined code by leveraging class inheritance, making the codebase more extensible and maintainable.
- **Documentation**
- Updated method signatures in documentation to reflect changes from static to class methods and the introduction of type hints.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3710/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3710/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3710",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3710",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3710.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3710.patch",
"merged_at": "2024-03-26T06:15:45Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3711
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3711/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3711/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3711/events
|
https://github.com/materialsproject/pymatgen/pull/3711
| 2,207,535,595
|
PR_kwDOACgets5qwL9l
| 3,711
|
Fix import order for `if TYPE_CHECKING:` block
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5509832055,
"node_id": "LA_kwDOACgets8AAAABSGlddw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/imports",
"name": "imports",
"color": "B52839",
"default": false,
"description": "Import changes and formatting"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe changes across various files in the pymatgen library mainly focus on import statement adjustments, including the reordering and removal of `TYPE_CHECKING` blocks, as well as minor formatting tweaks. These modifications enhance code readability and maintainability without altering the core functionality or logic of the library. The emphasis on cleaner import statements and slight adjustments in formatting indicates a drive towards more streamlined and efficient code.\n\n## Changes\n\n| File(s) | Summary |\n|---------|---------|\n| `.../voronoi.py`, `.../molecule_matcher.py`, `.../ase.py`, `.../lammps/utils.py`, `.../vasp/outputs.py`, `.../util/provenance.py`, `.../vis/structure_vtk.py` | Adjustments to `TYPE_CHECKING` and type hint imports, including reordering and removal. |\n| `.../boltztrap2.py`, `.../phonon/thermal_displacements.py` | Minor formatting changes: addition/removal of newline. |\n| `.../symmetry/analyzer.py` | New import line for `CrystalSystem`. |\n| `tests/core/test_settings.py` | Added an import statement for `_load_pmg_settings`. |\n\n> 🐰✨ \n> In pymatgen's land, amidst code and clay, \n> Imports shuffled, neat and spry, a dance in the fray. \n> `TYPE_CHECKING` waltzed away, new lines in their stead, \n> A rabbit hopped through, with a poem to spread. \n> \"To cleaner code,\" it whispered, under moon's gentle gaze, \n> 🌙💻 A tale of tweaks and types, through the digital maze. \n> 🎉🐾\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/chemenv/coordination_environments/voronoi.py: ## Short summary\n\nThe diff in `voronoi.py` removes the `TYPE_CHECKING` import and related usage, specifically the `Self` import, making adjustments to the module's imports.\n\n---\n\npymatgen/analysis/molecule_matcher.py: ## Short summary\n\nIn the `molecule_matcher.py` file in `pymatgen/analysis`, the changes involve reordering the import statements related to `TYPE_CHECKING` and `openbabel`. The `TYPE_CHECKING` import is now placed after the `openbabel` import. This modification does not impact the logic or functionality of the code.\n\n---\n\npymatgen/electronic_structure/boltztrap2.py: ## Short summary\n\nAdded an extra newline before the `__author__` declaration in `boltztrap2.py`.\n\n---\n\npymatgen/io/ase.py: ## Short summary\n\nThe code in `pymatgen/io/ase.py` underwent changes related to type hint imports, specifically the removal and re-addition of type hint imports for `Any`, `ArrayLike`, and `SiteCollection`. These changes were made within the context of `TYPE_CHECKING` blocks.\n\n---\n\npymatgen/io/lammps/utils.py: ## Short summary\n\nThe change in `pymatgen/io/lammps/utils.py` involves reordering the import statements for `pybel` from `openbabel` and adding a check for `TYPE_CHECKING`. The `pybel` import is now attempted before the `TYPE_CHECKING` block. This modification may affect the availability of `pybel` in the module.\n\n---\n\npymatgen/io/vasp/outputs.py: ## Short summary\n\nThe change involves reordering the logger declaration and adding an import statement for `logging`. The logger declaration is now placed after the `TYPE_CHECKING` block.\n\n---\n\npymatgen/phonon/thermal_displacements.py: ## Short summary\n\nThe change in `thermal_displacements.py` involves the removal of an empty line, affecting the file's formatting.\n\n---\n\npymatgen/symmetry/analyzer.py: ## Short Summary\n\nAdded a new line for importing `CrystalSystem` from `pymatgen.symmetry.groups`. No other significant changes in functionality observed.\n\n---\n\npymatgen/util/provenance.py: ## Short summary\n\nIn the `pymatgen/util/provenance.py` file, the main change involves the reorganization of the import statements related to type hints (`TYPE_CHECKING`) and the addition of blank lines. The declarations of exported entities remain unchanged.\n\n---\n\npymatgen/vis/structure_vtk.py: ### Short Summary\n\nRemoved the `TYPE_CHECKING` import block and re-imported `Sequence` from `collections.abc` later in the file.\n\n---\n\ntests/core/test_settings.py: ## Short summary\n\nAdded an import statement for `_load_pmg_settings` from `pymatgen.core`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3711, aims to address and rectify the organization of import statements within a specific context, namely the `if TYPE_CHECKING:` block, across various files in the project. The primary focus is on adjusting the order of imports and, in some instances, adding or removing imports related to type checking and other functionalities. These changes span across multiple modules within the project, including but not limited to analysis tools, input/output utilities, electronic structure analysis, and visualization components. The modifications are intended to enhance code readability, maintainability, and possibly the efficiency of type checking processes without altering the core logic or functionality of the codebase.\n\n### AI-generated Summary of Generated Summaries\n\nThe pull request introduces a series of modifications primarily centered around the organization and management of import statements within the `if TYPE_CHECKING:` block across various files in the project. Key changes include:\n\n- **Removal and Reordering of Imports**: Several files, such as `voronoi.py` and `structure_vtk.py`, saw the removal of the `TYPE_CHECKING` import and related usage, including specific imports like `Self` and `Sequence`. Conversely, files like `molecule_matcher.py`, `io/lammps/utils.py`, and `io/vasp/outputs.py` experienced reordering of import statements to place `TYPE_CHECKING` and related imports in a more logical or efficient order. This reordering also includes adjustments for imports not directly related to type checking, such as `openbabel` and `logging`.\n\n- **Addition of New Lines and Minor Formatting Adjustments**: Minor formatting changes were made in several files, including the addition of extra newlines (e.g., in `boltztrap2.py` before the `__author__` declaration) and the removal of empty lines (e.g., in `thermal_displacements.py`). These changes, while not affecting functionality, contribute to the overall cleanliness and readability of the code.\n\n- **Type Hint Import Adjustments**: Files like `io/ase.py` and `util/provenance.py` underwent modifications in the handling of type hint imports within the `TYPE_CHECKING` block, including the removal and subsequent re-addition of certain type hint imports. This indicates a refinement in how type hints are managed and utilized within the project.\n\n- **Specific Import Additions**: In a few instances, specific imports were added outside the general theme of reordering or removing. For example, `symmetry/analyzer.py` added a new line for importing `CrystalSystem`, and `tests/core/test_settings.py` included an import statement for `_load_pmg_settings`.\n\nOverall, these changes collectively aim to streamline the import order and handling within the `if TYPE_CHECKING:` block and related areas, improving the project's code structure without impacting its operational capabilities.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 176056b5af7ce44b964d9b723fda013ff0ae1cf1 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"Meanwhile I noticed our linter `ruff` seems unable to detect such format issue?\r\n\r\nThere is another issue: the import block seems to have inconsistent format across files, some have two blank lines between the code body, while some have only one?",
"Can you please review this as well? @janosh Thanks a lot!"
] | 2024-03-26T08:10:38
| 2024-03-26T13:43:54
|
2024-03-26T13:03:51Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Major changes:
- Fix import order for `if TYPE_CHECKING:` block: put this type checking import block at the end
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Adjusted import statements and order related to `TYPE_CHECKING` across multiple modules for better code organization.
- Removed unnecessary lines and added new lines for clarity in file formatting.
- **Chores**
- Updated import statements for type hints and external libraries in several modules.
- **Style**
- Improved code style by reorganizing import statements and modifying whitespace.
- **Tests**
- Enhanced testing capabilities by adding an import statement for settings loading in the test suite.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3711/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3711/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3711",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3711",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3711.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3711.patch",
"merged_at": "2024-03-26T13:03:51Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3712
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3712/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3712/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3712/events
|
https://github.com/materialsproject/pymatgen/issues/3712
| 2,207,597,238
|
I_kwDOACgets6DlUK2
| 3,712
|
ChemEnv unable to identify the neighboring environments
|
{
"login": "Atefeh-Yadegarifard",
"id": 141133743,
"node_id": "U_kgDOCGmHrw",
"avatar_url": "https://avatars.githubusercontent.com/u/141133743?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Atefeh-Yadegarifard",
"html_url": "https://github.com/Atefeh-Yadegarifard",
"followers_url": "https://api.github.com/users/Atefeh-Yadegarifard/followers",
"following_url": "https://api.github.com/users/Atefeh-Yadegarifard/following{/other_user}",
"gists_url": "https://api.github.com/users/Atefeh-Yadegarifard/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Atefeh-Yadegarifard/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Atefeh-Yadegarifard/subscriptions",
"organizations_url": "https://api.github.com/users/Atefeh-Yadegarifard/orgs",
"repos_url": "https://api.github.com/users/Atefeh-Yadegarifard/repos",
"events_url": "https://api.github.com/users/Atefeh-Yadegarifard/events{/privacy}",
"received_events_url": "https://api.github.com/users/Atefeh-Yadegarifard/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Thanks for raising the issue.\r\n\r\nCould you be a bit more specific on the output that you get? For example, if you are using the cation-anion modus in the analysis, I would expect the anion neighbor lists to be empty.",
"Hello. I am using all the default settings of the ChemEnv module. This error also occurs for cations. For example in the code below, ChemEnv shows an empty list for the site 2, which is Na atom:\r\n\r\n\r\n```\r\nfrom pymatgen.core.structure import Structure\r\nfrom pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import LocalGeometryFinder\r\nfrom pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import SimplestChemenvStrategy, MultiWeightsChemenvStrategy\r\nfrom pymatgen.analysis.chemenv.coordination_environments.structure_environments import LightStructureEnvironments\r\n\r\ncif_file='030a7f2455.CIF'\r\nstructure = Structure.from_file (cif_file)\r\nlgf = LocalGeometryFinder()\r\nlgf.setup_parameters(centering_type=\"centroid\", include_central_site_in_centroid=True)\r\nlgf.setup_structure(structure=structure)\r\nse = lgf.compute_structure_environments(maximum_distance_factor=1.41)\r\nstrategy = MultiWeightsChemenvStrategy.stats_article_weights_parameters()\r\nlse = LightStructureEnvironments.from_structure_environments(strategy=strategy, structure_environments=se)\r\n \r\nspecies = {}\r\nfor i in range(len(lse.as_dict()['structure']['sites'])): \r\n species[i] = (lse.as_dict()['structure']['sites'][i]['label'])\r\n \r\nprint (species) \r\nprint (lse.coordination_environments[2]) \r\n```\r\n\r\n\r\n[cif file in the code .zip](https://github.com/materialsproject/pymatgen/files/14757822/cif.file.in.the.code.zip)\r\n",
"Will need to check in more detail.\r\n\r\nMy ideas:\r\n- remove \"maximum_distance_factor\" to see what happens\r\n- check what happens if you look at all bonds instead of cation-anion ones.",
"If you provide the valences with the bond valence analyser, everything works as expected:\r\n```py\r\nfrom pymatgen.core.structure import Structure\r\nfrom pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import LocalGeometryFinder\r\nfrom pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import SimplestChemenvStrategy, \\\r\n MultiWeightsChemenvStrategy\r\nfrom pymatgen.analysis.chemenv.coordination_environments.structure_environments import LightStructureEnvironments\r\nfrom pymatgen.analysis.bond_valence import BVAnalyzer\r\n\r\ncif_file = '030a7f2455.CIF'\r\nstructure = Structure.from_file(cif_file)\r\nbva = BVAnalyzer()\r\nvalences = bva.get_valences(structure)\r\nlgf = LocalGeometryFinder()\r\nlgf.setup_structure(structure=structure)\r\nse = lgf.compute_structure_environments(valences=valences)\r\nstrategy = MultiWeightsChemenvStrategy.stats_article_weights_parameters()\r\nlse = LightStructureEnvironments.from_structure_environments(strategy=strategy, structure_environments=se)\r\n\r\nfor isite, (site,ce) in enumerate(zip(structure, lse.coordination_environments)):\r\n if ce is not None:\r\n print(site.species_string+str(isite)+': '+str(ce[0][\"ce_symbol\"]))\r\n\r\n```\r\n\r\nChemEnv cannot deal with coordination numbers larger 13. The coordination numbers get larger 13 if you consider all bonds.\r\n\r\nOutput from the code above is:\r\n\r\n```\r\nNa0: DDPN:8\r\nNa1: DDPN:8\r\nNa2: BO_2:8\r\nNa3: T:6\r\nNa4: BO_2:8\r\nNa5: DDPN:8\r\nNa6: T:6\r\nNa7: DDPN:8\r\nNa8: T:6\r\nNa9: BO_2:8\r\nNa10: BO_2:8\r\nNa11: T:6\r\nEu12: SBT:8\r\nEu13: SBT:8\r\nEu14: SBT:8\r\nEu15: SBT:8\r\nB16: TL:3\r\nB17: TL:3\r\nB18: TL:3\r\nB19: TL:3\r\nB20: TL:3\r\nB21: TL:3\r\nB22: TL:3\r\nB23: TL:3\r\n```",
"I think it is resolved. I am therefore closing the issue. Let me know if there are further issues. "
] | 2024-03-26T08:44:31
| 2024-03-27T18:41:03
|
2024-03-27T18:31:06Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.11.5
### Pymatgen version
2024.3.1
### Operating system version
(wsl) Ubuntu 22.04
### Current behavior
I have been using pymatgen.analysis.chemenv.coordination_environments to analyze atomic environments. In some cases, the code is unable to identify the neighboring atoms or environments and lse.coordination_environments returns None or an empty list.
this code also shows this warning after running :
`/home/xxx/miniconda3/lib/python3.11/site-packages/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py:2642: RuntimeWarning: invalid value encountered in scalar divide
nb_sets_fractions = {cn_map: w_nb_set / w_nb_sets_total for cn_map, w_nb_set in w_nb_sets.items()}`
### Expected Behavior
Expected the code to identify the environment for all sites.
### Minimal example
```Python
#material = Structure.from_file ('01eeb23f6f.CIF')
material = Structure.from_file('Na3Zr2Si2PO12.cif')
lgf = LocalGeometryFinder()
lgf.setup_parameters(centering_type="centroid", include_central_site_in_centroid=True)
lgf.setup_structure(structure=material)
strategy = MultiWeightsChemenvStrategy.stats_article_weights_parameters()
lse = LightStructureEnvironments.from_structure_environments(strategy=strategy, structure_environments=se)
```
### Relevant files to reproduce this bug
[cif files .zip](https://github.com/materialsproject/pymatgen/files/14755304/cif.files.zip)
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3712/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3712/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3713
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3713/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3713/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3713/events
|
https://github.com/materialsproject/pymatgen/pull/3713
| 2,207,969,571
|
PR_kwDOACgets5qxr9z
| 3,713
|
Clean up tests
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates focus on enhancing code readability and efficiency in a scientific computing library. Changes include variable renaming for clarity, matrix manipulation optimization, and test case refinement for improved precision. These updates aim to boost maintainability and performance, making the codebase more developer-friendly.\n\n## Changes\n\n| Files | Change Summary |\n|------------------------------------------|----------------------------------------------------------------------------------------------------|\n| `pymatgen/io/lmto.py` | Renamed variables for clarity in loops within `from_str` method. |\n| `pymatgen/io/nwchem.py` | Optimized `hessian` and `projected_hessian` matrix handling. |\n| `tests/analysis/.../test_elastic.py`, `tests/analysis/test_graphs.py`, `tests/analysis/test_local_env.py`, `tests/core/test_interface.py`, `tests/core/test_lattice.py`, `tests/core/test_surface.py`, `tests/core/test_trajectory.py` | Renamed loop variables to `idx`, updated variable names and assertions for clarity. |\n| `tests/core/test_units.py`, `tests/electronic_structure/test_boltztrap.py`, `tests/ext/test_matproj.py`, `tests/io/lobster/test_inputs.py`, `tests/io/vasp/test_outputs.py`, `tests/symmetry/test_analyzer.py`, `tests/transformations/test_standard_transformations.py` | Enhanced test clarity with variable renaming, direct assertions, and refactored loops. |\n\n> \"In the realm of code where logic threads weave, \n> 🐇 A rabbit hopped, with changes up its sleeve. \n> Variables renamed, for clarity's embrace, \n> And loops refined, in the digital space. \n> With every hop, efficiency achieved, \n> In a codebase garden, freshly conceived.\" \n> 🌟🌱\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n```\npymatgen/io/lmto.py:\n- Renaming variables related to indexing within loops and adjusting variable names for clarity in the `from_str` method of the `LMTOCtrl` class.\n\npymatgen/io/nwchem.py:\n- Updating logic for handling `hessian` and `projected_hessian` matrices to improve efficiency by using new variable names and adjusting loop indices for matrix manipulation.\n\ntests/analysis/elasticity/test_elastic.py:\n- Renamed variable `i` to `idx` in the `test_get_strain_state_dict` function.\n\ntests/analysis/test_graphs.py:\n- Renamed variable `i` to `idx` in the `test_split` function.\n\ntests/analysis/test_local_env.py:\n- Updated loop variable to `idx`, assertion messages for clarity, initialization of `op_params` using list comprehension, and modified assignment of values to `op_params` for indices 1, 2, and 33.\n\ntests/core/test_interface.py:\n- Updated variable names within a loop from `i` to `idx` for better clarity and consistency.\n\ntests/core/test_lattice.py:\n- Modified how `lengths` and `lattice` are generated in the `test_get_distance_and_image_strict` method.\n\ntests/core/test_surface.py:\n- Renamed loop variable `i` to `idx` in the `test_get_symmetrically_distinct_miller_indices` function.\n\ntests/core/test_trajectory.py:\n- Updated variable names from `i` to `idx` in various loops for clarity and consistency.\n\ntests/core/test_units.py:\n- Renamed functions within the `test_unitized` method for better clarity.\n\ntests/electronic_structure/test_boltztrap.py:\n- Modified test cases to replace loops with direct assertions and adjusted tolerance values.\n\ntests/electronic_structure/test_plotter.py:\n- Refactored nested loops within the `test_methods` function to use different loop variables (`ii`, `jj`, `kk`, `ll`) instead of (`i`, `j`, `k`, `m`).\n\ntests/ext/test_matproj.py:\n- Changed variable names in set comprehensions from `i` to `ent` for clarity and consistency.\n\ntests/io/abinit/test_inputs.py:\n- In the `test_api` function, replaced the variable `i` with `idx` in the assertion statement for dataset comparison based on index.\n\ntests/io/lobster/test_inputs.py:\n- Swapped the order of `Orbital` instances in the `orbitals` list comprehension.\n\ntests/io/vasp/test_outputs.py:\n- Various modifications in test methods for improved comparisons and refactored loops using list comprehension.\n\ntests/io/test_pwscf.py:\n- Renamed variables related to `PWInput` and `PWOutput` instances from `pwin` to `pw_in` and `pwout` to `pw_out`, respectively. Updates to references to attributes and sections within these instances.\n\ntests/symmetry/test_analyzer.py:\n- Renamed variables in functions for clarity.\n\ntests/transformations/test_standard_transformations.py:\n- Replaced the usage of `random` with `np.random` for generating random integers.\n\ntests/analysis/ferroelectricity/test_polarization.py:\n- Modified the generation of folder names within a list comprehension by adjusting the range and index values used for interpolation folder names.\n```\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of this pull request, titled \"Clean up tests,\" is to enhance the clarity, efficiency, and maintainability of the codebase, specifically focusing on test files and certain I/O related files. The description provided with the PR indicates a specific example of the cleanup efforts, such as removing unnecessary for loops when using `pytest.approx()`, suggesting a broader initiative to streamline and refine the testing practices within the project. Although the PR description is concise, the changes span across various modules, including adjustments to variable naming for better clarity, optimization of logic in handling matrices, and the refactoring of test cases to improve readability and efficiency. This PR aims to make the code more understandable and efficient by addressing naming conventions, loop optimizations, and direct assertions in tests, thereby contributing to the overall quality and robustness of the project's codebase.\n\n### AI-generated Summary of Generated Summaries\n\nThis pull request involves a comprehensive cleanup and optimization effort across the codebase, primarily targeting test files and I/O related modules. Key changes include:\n\n- **Variable Naming and Loop Optimization**: Renaming loop variables for clarity and consistency, seen in various test files like `test_elastic.py`, `test_graphs.py`, and `test_local_env.py`. Loop indices have been optimized, and list comprehensions are used for efficiency improvements.\n\n- **Refactoring for Clarity and Efficiency**: Refactoring tests for direct assertions, tolerance adjustments, and reordering instances for clearer comparisons. Notable in `test_boltztrap.py` and `test_inputs.py` within the `lobster` module.\n\n- **Adjustments in Variable and Function Names**: Changes in function names for clarity, as observed in the `test_units.py` file, ensuring descriptive and consistent naming conventions.\n\n- **Optimization of Logic for Handling Matrices**: Updates in the `nwchem.py` file to enhance efficiency in handling matrices by introducing new variable names and adjusting loop indices.\n\n- **Miscellaneous Enhancements**: Utilizing `np.random` over `random` for generating random integers in `test_standard_transformations.py`, showcasing a preference for NumPy's random module.\n\nThese changes collectively enhance readability, efficiency, and maintainability by refining variable names, optimizing loops and logic, and improving test structures for clarity and directness. The PR aligns with best coding and testing practices, contributing to the project's overall code quality and reliability.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 1e79a0690f21fc3e484904006174f40b6ab1e8c8 -->\n<!-- b994f49d59f428940db15a2bfc71a4c43655ee85 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-03-26T11:22:19
| 2024-03-26T11:48:25
|
2024-03-26T11:48:24Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
e.g. remove unnecessary for loops when using pytest.approx()
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Enhanced variable naming for better clarity in code and tests.
- Improved efficiency in matrix manipulation for chemical analysis tools.
- Streamlined test cases for readability and consistency.
- **Tests**
- Updated and refactored multiple test cases for clarity and reliability across various modules.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3713/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3713/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3713",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3713",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3713.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3713.patch",
"merged_at": "2024-03-26T11:48:24Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3714
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3714/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3714/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3714/events
|
https://github.com/materialsproject/pymatgen/pull/3714
| 2,208,770,883
|
PR_kwDOACgets5q0dUG
| 3,714
|
Correct units of Element.atomic_orbitals
|
{
"login": "esoteric-ephemera",
"id": 33381112,
"node_id": "MDQ6VXNlcjMzMzgxMTEy",
"avatar_url": "https://avatars.githubusercontent.com/u/33381112?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/esoteric-ephemera",
"html_url": "https://github.com/esoteric-ephemera",
"followers_url": "https://api.github.com/users/esoteric-ephemera/followers",
"following_url": "https://api.github.com/users/esoteric-ephemera/following{/other_user}",
"gists_url": "https://api.github.com/users/esoteric-ephemera/gists{/gist_id}",
"starred_url": "https://api.github.com/users/esoteric-ephemera/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/esoteric-ephemera/subscriptions",
"organizations_url": "https://api.github.com/users/esoteric-ephemera/orgs",
"repos_url": "https://api.github.com/users/esoteric-ephemera/repos",
"events_url": "https://api.github.com/users/esoteric-ephemera/events{/privacy}",
"received_events_url": "https://api.github.com/users/esoteric-ephemera/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5648629103,
"node_id": "LA_kwDOACgets8AAAABUK89bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/core",
"name": "core",
"color": "299448",
"default": false,
"description": "Pymatgen core"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates to the pymatgen library introduce a significant enhancement in representing atomic orbital energies. A new `atomic_orbitals_eV` property now provides these energies in electronvolts, complementing the existing `atomic_orbitals` in Hartree units. This addition ensures users have clear and consistent options for energy units across the library.\n\n## Changes\n\n| File Path | Change Summary |\n|----------------------------------------------------------|--------------------------------------------------------------------------------------------------|\n| `pymatgen/core/periodic_table.py` | Added `atomic_orbitals_eV` property for atomic orbital energies in eV; enhances energy unit options. |\n| `tests/core/test_periodic_table.py`, `tests/core/test_units.py` | Updated tests to include `Ha_to_eV` conversion, ensure consistency in element attribute testing, and added new unit conversion constants and tests. |\n\n> 🐇✨ \n> In pymatgen's land, amidst the code and bytes, \n> A new change gleams, in the computational nights. \n> Atomic orbitals in eV, alongside Hartree's grace, \n> For clarity and choice, in the elemental space. \n> So hop along, dear scientists, with glee, \n> For in pymatgen's realm, more discoveries to be! \n> 🌌🔬🐰\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/core/periodic_table.py: The `pymatgen.core.periodic_table` module underwent changes where a new property `atomic_orbitals_eV` was added to provide atomic orbital energies in electronvolts (eV) alongside the existing `atomic_orbitals` property that provides energies in Hartree units. This addition ensures consistency and clarity in the representation of atomic orbital energies. The `atomic_orbitals_eV` property was enhanced to include a calculation based on `Ha_to_eV` conversion.\n\ntests/core/test_periodic_table.py: \n- Added import for `Ha_to_eV` from `pymatgen.core.units`.\n- Modified the `keys` tuple in `test_attributes` method, updating the attributes being tested for elements.\n- Added a check for `atomic_orbitals_eV` calculation based on `Ha_to_eV` conversion.\n- Adjusted the comparison for element symbols in a set instead of a list.\n\ntests/core/test_units.py: \nAdded new unit conversion constants and tests for unit conversions in the `test_units.py` file. New constants include `Ha_to_eV`, `Ry_to_eV`, `bohr_to_angstrom`, and `amu_to_kg`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPull Request (PR) #3714 addresses the discrepancy in atomic orbital energy units in `pymatgen`. The `Element.atomic_orbitals` property incorrectly stated energies in eV instead of Hartree due to missing conversion, causing confusion as noted in a matsci post. To resolve this, PR #3714 introduces `Element.atomic_orbitals_eV` for accurate eV representation without disrupting existing code.\n\n### AI-generated Summary of Generated Summaries\n\nPR #3714 enhances `pymatgen/core/periodic_table.py` by adding `atomic_orbitals_eV` to `Element`, providing atomic orbital energies in eV alongside the existing Hartree-based `atomic_orbitals`. This addition aligns energy representation with expectations, addressing a long-standing discrepancy and improving clarity. The implementation of `atomic_orbitals_eV` responds to user feedback, maintaining compatibility and enhancing accuracy in energy units. Changes in `test_periodic_table.py` and `test_units.py` support unit conversions and comprehensive testing within the library.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 0d36dc6cc22ed54749111aebae08ceae9c37f9ab -->\n<!-- aaff77602b89a56e3c4e3ba1d80adb33c7bb51d4 -->\n<!-- 92d1a804c4f8eafbb8e12b330e74ba2a2fefeff3 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-03-26T16:43:25
| 2024-04-12T05:48:22
|
2024-03-26T18:43:21Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
The docstr for `pymatgen.core.Element.atomic_orbitals` indicates that the units of the LDA energies is eV. However the data in `periodic_table.json` was never converted to eV from Hartree, so `element.atomic_orbitals` prints energies in Hartree. (This is also true for pymatgen versions before the periodic table data was updated in [#3542](https://github.com/materialsproject/pymatgen/pull/3542).)
This was brought up in a [matsci post](https://matsci.org/t/unit-of-atomic-orbitals-energy/54325).
This PR just adds an `Element.atomic_orbitals_eV` property which converts the atomic orbitals energies to eV, and ensures no breaking changes.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Added a new property to display atomic orbital energies in electronvolts (eV) for clarity and consistency.
- Enhanced `atomic_orbitals_eV` property to include a calculation based on `Ha_to_eV` conversion.
- Added new unit conversion constants (`Ha_to_eV`, `Ry_to_eV`, `bohr_to_angstrom`, `amu_to_kg`) and tests for unit conversions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3714/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3714/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3714",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3714",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3714.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3714.patch",
"merged_at": "2024-03-26T18:43:21Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3715
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3715/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3715/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3715/events
|
https://github.com/materialsproject/pymatgen/issues/3715
| 2,209,491,205
|
I_kwDOACgets6DsikF
| 3,715
|
Default settings of `Structure.relax()` fails to synchronize tensor locations (CPU/GPU) on GPU-enabled environments
|
{
"login": "jsukpark",
"id": 12984115,
"node_id": "MDQ6VXNlcjEyOTg0MTE1",
"avatar_url": "https://avatars.githubusercontent.com/u/12984115?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/jsukpark",
"html_url": "https://github.com/jsukpark",
"followers_url": "https://api.github.com/users/jsukpark/followers",
"following_url": "https://api.github.com/users/jsukpark/following{/other_user}",
"gists_url": "https://api.github.com/users/jsukpark/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jsukpark/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jsukpark/subscriptions",
"organizations_url": "https://api.github.com/users/jsukpark/orgs",
"repos_url": "https://api.github.com/users/jsukpark/repos",
"events_url": "https://api.github.com/users/jsukpark/events{/privacy}",
"received_events_url": "https://api.github.com/users/jsukpark/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"ADD: The `matgl` package installed is of version `1.0.0`."
] | 2024-03-26T23:00:06
| 2024-03-26T23:02:10
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.9.18
### Pymatgen version
2023.12.18
### Operating system version
Ubuntu 22.04.4 LTS
### Current behavior
Running the `relax()` method of `pymatgen.core.Structure` object with default settings on a GPU-enabled environment raises `RuntimeError`, saying the tensors involved in computation are not on the same device.
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/pymatgen/core/structure.py", line 4323, in relax
return self._relax(
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/pymatgen/core/structure.py", line 776, in _relax
dyn = opt_class(ecf, **opt_kwargs)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/optimize/fire.py", line 54, in __init__
Optimizer.__init__(self, atoms, restart, logfile, trajectory,
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/optimize/optimize.py", line 234, in __init__
self.set_force_consistent()
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/optimize/optimize.py", line 325, in set_force_consistent
self.atoms.get_potential_energy(force_consistent=True)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/constraints.py", line 2420, in get_potential_energy
atoms_energy = self.atoms.get_potential_energy(
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/atoms.py", line 728, in get_potential_energy
energy = self._calc.get_potential_energy(
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/calculators/calculator.py", line 709, in get_potential_energy
energy = self.get_property('energy', atoms)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/ase/calculators/calculator.py", line 737, in get_property
self.calculate(atoms, [name], system_changes)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/matgl/ext/ase.py", line 177, in calculate
energies, forces, stresses, hessians = self.potential(graph, lattice, state_attr_default)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/matgl/apps/pes.py", line 120, in forward
property_offset = torch.squeeze(self.element_refs(g))
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/miniconda3/envs/myenv/lib/python3.9/site-packages/matgl/layers/_atom_ref.py", line 78, in forward
offset = property_offset_batched * one_hot
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
```
### Expected Behavior
The structural relaxation would run without error, with all intermediate tensors copied to/from GPU as needed to ensure all operations occur within the same device.
### Minimal example
```Python
import numpy as np
from pymatgen.core import Structure
struct = Structure( # diamond
np.array([[0, 1, 1], [1, 0, 1], [1, 1, 0]]) * 1.786855,
['C'] * 2,
np.array([[.25, .25, .25], [0.0, 0.0, 0.0]]),
)
struct.relax() # uses default calculator 'm3gnet'
```
```
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3715/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3715/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3716
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3716/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3716/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3716/events
|
https://github.com/materialsproject/pymatgen/pull/3716
| 2,209,980,039
|
PR_kwDOACgets5q4nMN
| 3,716
|
Clean up tests 2
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates focused on enhancing the clarity and consistency of variable names across various test cases. This comprehensive effort involved renaming variables to more descriptive terms, improving readability and understanding. Changes were made in tests for elasticity, magnetism, structure prediction, adsorption, energy models, phase diagrams, and more, reflecting a systematic refinement of the codebase.\n\n## Changes\n\n| Files | Change Summary |\n|-------|----------------|\n| `tests/analysis/elasticity/test_stress.py`<br>`tests/analysis/elasticity/test_elastic.py` | Replaced variable names for clarity in calls to `piola_kirchoff_1` and `piola_kirchoff_2`. |\n| `tests/analysis/magnetism/test_jahnteller.py` | Renamed variable for effect magnitudes assertions. |\n| `tests/analysis/structure_prediction/test_volume_predictor.py`<br>`tests/analysis/structure_prediction/test_substitutor.py` | Renamed variable for `RLSVolumePredictor` instances. |\n| `tests/analysis/test_adsorption.py`<br>`tests/analysis/test_dimensionality.py` | Changed variable names for clarity in test cases. |\n| `tests/analysis/test_energy_models.py` | Renamed variable for `EwaldElectrostaticModel` instances. |\n| `tests/analysis/test_phase_diagram.py`<br>`tests/analysis/test_ewald.py` | Updated variable names for clarity. |\n| `tests/analysis/test_piezo_sensitivity.py` | Improved variable naming for clarity and consistency. |\n| `tests/analysis/test_quasirrho.py` | Renamed variable for `QuasiRRHO` instantiation. |\n| `tests/analysis/test_surface_analysis.py`<br>`tests/analysis/test_structure_analyzer.py`<br>`tests/analysis/test_structure_matcher.py` | Refactored variable names and updated entity names for consistency. |\n| `tests/apps/battery/test_conversion_battery.py` | Clarified variable names for better readability. |\n| `tests/core/test_ion.py`<br>`tests/command_line/test_enumlib_caller.py` | Renamed variables for improved clarity. |\n| `tests/core/test_lattice.py` | Updated variable names for `Lattice` instances. |\n| `tests/core/test_operations.py` | Improved variable naming for `SymmOp` instances. |\n| `tests/core/test_periodic_table.py`<br>`tests/core/test_units.py` | Enhanced variable naming for better understanding. |\n| `tests/core/test_structure.py`<br>`tests/io/lammps/test_data.py`<br>`tests/io/test_adf.py`<br>`tests/io/vasp/test_inputs.py`<br>`tests/io/vasp/test_outputs.py`<br>`tests/io/vasp/test_sets.py` | Updated variable names and paths for clarity. |\n| `tests/core/test_surface.py` | Renamed variables and updated file paths for clarity. |\n| `tests/core/test_tensors.py` | Changed variable names for improved clarity. |\n| `tests/core/test_trajectory.py` | Modified variable assignments for `setUp` method. |\n| `tests/electronic_structure/test_boltztrap.py` | Clarified variable names for `eig_vals`. |\n| `tests/entries/test_mixing_scheme.py` | Improved variable naming for `entry`. |\n| `tests/ext/test_matproj.py` | Renamed variable for clarity. |\n| `tests/files/.pytest-split-durations` | Updated entity names for consistency. |\n| `tests/io/cp2k/test_inputs.py` | Renamed variables for `potential_info`. |\n| `tests/io/feff/test_inputs.py` | Corrected comparison logic for `Header` object. |\n| `tests/io/lammps/test_data.py` | Passed `Molecule` object directly for clarity. |\n| `tests/io/test_cif.py` | Updated variable names related to chemical elements. |\n| `tests/symmetry/test_groups.py` | Renamed variable for `rand_percent`. |\n| `tests/transformations/test_standard_transformations.py` | Improved variable naming for structures and directories. |\n| `tests/util/test_coord.py` | Renamed variable for clarity in methods.\n\n> \"In the garden of code, where the variables play,<br>\n> 🐇 A rabbit hopped through, making changes today.<br>\n> From `f` to `deform`, `m` to `model`, so bright,<br>\n> Each name now clear, in the moon's gentle light.<br>\n> So here's to the code, may it run swift and true,<br>\n> With names like a map, guiding me and you.\"\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\ntests/analysis/elasticity/test_stress.py:\n- Replaced variable `f` with `deform` in calls to `piola_kirchoff_1` and `piola_kirchoff_2` within `test_properties` method.\n\n---\n\ntests/analysis/magnetism/test_jahnteller.py:\n- Renamed variable `m` to `magnitude` throughout test cases affecting assertions on effect magnitudes.\n\n---\n\ntests/analysis/structure_prediction/test_volume_predictor.py:\n- Renamed variable `p` to `predictor` for `RLSVolumePredictor` instances in `test_predict`.\n\n---\n\ntests/analysis/test_adsorption.py:\n- Changed variable `o` to `oxi` for clarity in `test_adsorb_both_surfaces`.\n\n---\n\ntests/analysis/test_energy_models.py:\n- Renamed variable `m` to `model` for `EwaldElectrostaticModel` instances in `test_get_energy`.\n\n---\n\ntests/analysis/test_phase_diagram.py:\n- Changed variable `e` to `e_above_hull` in `test_1d_pd` for clarity.\n\n---\n\ntests/analysis/test_piezo_sensitivity.py:\n- Renamed variables and iterators for clarity and consistency.\n\n---\n\ntests/analysis/test_quasirrho.py:\n- Renamed variable `e` to `e_final` for `QuasiRRHO` instantiation.\n\n---\n\ntests/analysis/test_surface_analysis.py:\n- Renamed `TEST_DIR` to `\"surfaces\"` and `TestWorkfunctionAnalyzer` to `TestWorkFunctionAnalyzer`.\n\n---\n\ntests/apps/battery/test_conversion_battery.py:\n- Renamed variables `p` to `props` and `k, v` to `k, v` for clarity in loops.\n\n---\n\ntests/core/test_ion.py:\n- Renamed variable `i` to `ion` in `test_oxi_state_guesses`.\n\n---\n\ntests/core/test_lattice.py:\n- Renamed variables `m` to `cubic`, `hexagonal` to `Lattice`, `cubic_from_flat` to `cubic_from_flat`.\n\n---\n\ntests/core/test_operations.py:\n- Changed variable `o` to `symm_op` for `SymmOp` instances in `test_xyz`.\n\n---\n\ntests/core/test_periodic_table.py:\n- Changed variable `o` to `pickled` in `test_pickle`.\n\n---\n\ntests/core/test_structure.py:\n- Passed `Molecule` object directly to `self.mol.substitute`.\n\n---\n\ntests/core/test_surface.py:\n- Renamed variables like `agfcc` to `ag_fcc`, `libcc` to `li_bcc`, `h` to `hydrogen`.\n- Updated file paths, refactored variable names for clarity.\n\n---\n\ntests/core/test_tensors.py:\n- Changed variable names `u` and `p` to `u_mat` and `p_mat` in `test_polar_decomposition`.\n\n---\n\ntests/core/test_trajectory.py:\n- Modified addition of molecules in `setUp` method, updated `coords` definition.\n\n---\n\ntests/core/test_units.py:\n- Renamed variables related to energy calculations, gravitational acceleration, potential energy.\n\n---\n\ntests/electronic_structure/test_boltztrap.py:\n- Renamed `eigs` to `eig_vals`, `ref_eigs` to `ref_eig_vals` in `test_get_zt`.\n\n---\n\ntests/entries/test_mixing_scheme.py:\n- Changed variable `e` to `entry` in `test_state_energy_modified`.\n\n---\n\ntests/ext/test_matproj.py:\n- Changed variable `m` to `match` in `test_include_user_agent`.\n\n---\n\ntests/files/.pytest-split-durations:\n- Renamed entities from `TestWorkfunctionAnalyzer` to `TestWorkFunctionAnalyzer`.\n\n---\n\ntests/io/cp2k/test_inputs.py:\n- Renamed variables within `test_potential_info` to `pot_info`.\n\n---\n\ntests/io/feff/test_inputs.py:\n- Renamed variables, corrected comparison logic for `Header` object.\n\n---\n\ntests/io/lammps/test_data.py:\n- Renamed variables for clarity and consistency.\n\n---\n\ntests/io/test_adf.py:\n- Renamed variables `o` to `mol`, `task` to `adf_task`, `o` to `adf_out`.\n\n---\n\ntests/io/test_cif.py:\n- Renamed variables related to chemical elements and species.\n\n---\n\ntests/io/vasp/test_inputs.py:\n- Renamed variables for `Incar` and `PotcarSingle` instances.\n\n---\n\ntests/io/vasp/test_outputs.py:\n- Renamed variables to `vasp_run` and `outcar` for clarity.\n\n---\n\ntests/io/vasp/test_sets.py:\n- Renamed variables in functions for clarity.\n\n---\n\ntests/symmetry/test_groups.py:\n- Renamed variable `p` to `rand_percent` in multiple test functions.\n\n---\n\ntests/transformations/test_standard_transformations.py:\n- Renamed variables related to structures and directories.\n\n---\n\ntests/analysis/elasticity/test_elastic.py:\n- Replaced variable `f` with `deform` in calls to `piola_kirchoff_1` and `piola_kirchoff_2` within `test_properties` method.\n\n---\n\ntests/analysis/structure_prediction/test_substitutor.py:\n- Renamed variable `p` to `predictor` for `RLSVolumePredictor` instances in `test_predict`.\n\n---\n\ntests/analysis/test_dimensionality.py:\n- Changed variable `o` to `oxi` for clarity in `test_adsorb_both_surfaces`.\n\n---\n\ntests/analysis/test_ewald.py:\n- Renamed variable `e` to `e_above_hull` in `test_1d_pd` for clarity.\n\n---\n\ntests/analysis/test_structure_analyzer.py:\n- Renamed `TEST_DIR` to `\"surfaces\"` and `TestWorkfunctionAnalyzer` to `TestWorkFunctionAnalyzer`.\n\n---\n\ntests/analysis/test_structure_matcher.py:\n- Renamed variables like `agfcc` to `ag_fcc`, `libcc` to `li_bcc`, `h` to `hydrogen`.\n- Updated file paths, refactored variable names for clarity.\n\n---\n\ntests/command_line/test_enumlib_caller.py:\n- Renamed variable `i` to `ion` in `test_oxi_state_guesses`.\n\n---\n\ntests/core/test_periodic_table.py:\n- Renamed variables `m` to `cubic`, `hexagonal` to `Lattice`, `cubic_from_flat` to `cubic_from_flat`.\n\n---\n\ntests/core/test_units.py:\n- Renamed variables related to energy calculations, gravitational acceleration, potential energy.\n\n---\n\ntests/io/cp2k/test_inputs.py:\n- Changed variable `o` to `symm_op` for `SymmOp` instances in `test_xyz`.\n\n---\n\ntests/io/feff/test_inputs.py:\n- Changed variable `o` to `pickled` in `test_pickle`.\n\n---\n\ntests/io/lammps/test_data.py:\n- Passed `Molecule` object directly to `self.mol.substitute`.\n\n---\n\ntests/io/test_adf.py:\n- Renamed variables like `agfcc` to `ag_fcc`, `libcc` to `li_bcc`, `h` to `hydrogen`.\n- Updated file paths, refactored variable names for clarity.\n\n---\n\ntests/io/vasp/test_inputs.py:\n- Changed variable names `u` and `p` to `u_mat` and `p_mat` in `test_polar_decomposition`.\n\n---\n\ntests/io/vasp/test_outputs.py:\n- Modified addition of molecules in `setUp` method, updated `coords` definition.\n\n---\n\ntests/io/vasp/test_sets.py:\n- Renamed variables related to energy calculations, gravitational acceleration, potential energy.\n\n---\n\ntests/symmetry/test_groups.py:\n- Renamed `TEST_DIR` to `\"surfaces\"` and `TestWorkfunctionAnalyzer` to `TestWorkFunctionAnalyzer`.\n\n---\n\ntests/transformations/test_standard_transformations.py:\n- Renamed variables `s` to `struct_trafo` in multiple places.\n- Renamed variable `disord` to `disordered`.\n- Updated variable names in assertions and method calls.\n- Refactored variable assignments within loops.\n- Improved variable naming consistency.\n\n---\n\ntests/util/test_coord.py:\n- Renamed the variable `s` to `simplex` within the `test_bary_coords`, `test_intersection`, and `test_str` methods.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis Pull Request (PR) titled \"Clean up tests 2\" with the number 3716 is a follow-up to PR #3713. The primary objective of this PR is to enhance code readability and maintainability by systematically renaming variables across various test files in the codebase. These changes aim to improve clarity and consistency in the test suite, covering a wide range of modules and functionalities.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR involves a comprehensive cleanup of variable names in test files to improve code clarity and consistency. Key changes include:\n\n- **General Renaming Strategy**: Variables are renamed to more descriptive names like `deform`, `magnitude`, `predictor`, `oxi`, `e_above_hull`, `u_mat`, etc., enhancing readability and understanding across different modules.\n\n- **Specific Renaming Examples**:\n - In elasticity tests, `f` is changed to `deform` for piola_kirchoff function calls.\n - Magnetism tests update `m` to `magnitude` for clarity.\n - Structure prediction uses `predictor` instead of `p` for better variable naming.\n - Adsorption and energy model tests clarify variables as `oxi` and `model`.\n - Surface analysis renames `TEST_DIR` to `\"surfaces\"` and `TestWorkfunctionAnalyzer` to `TestWorkFunctionAnalyzer`.\n\n- **File and Object Naming Improvements**: Updates to file paths and object names enhance readability, e.g., `agfcc` to `ag_fcc` in surface tests.\n\n- **Consistency and Clarity**: The changes focus on ensuring consistent and clear variable naming conventions, making the codebase more accessible and understandable for developers.\n\nThis PR aims to standardize naming conventions in the test suite, promoting readability, maintainability, and overall code quality.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 1bf618d1129b2b96361e0bd0539546d2ac352e4d -->\n<!-- b1e616031d511cd83c2e44f74d746b2138ce429f -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-03-27T06:26:30
| 2024-03-27T06:57:52
|
2024-03-27T06:57:51Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
follow-up to #3713
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Improved variable naming for clarity across various test modules.
- Updated file paths and refactored variable names for better readability.
- Modified test setup procedures and assertions for consistency.
- **Tests**
- Enhanced test cases by renaming variables for better understanding of test purposes.
- Adjusted comparison logic and test configurations for accuracy.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3716/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3716/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3716",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3716",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3716.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3716.patch",
"merged_at": "2024-03-27T06:57:51Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3718
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3718/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3718/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3718/events
|
https://github.com/materialsproject/pymatgen/pull/3718
| 2,211,517,651
|
PR_kwDOACgets5q9y44
| 3,718
|
Remove unnecessary `unittest.TestCase` subclassing
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates focus on enhancing code maintainability and preparing for future modifications. A significant change is the deprecation of `QuasiharmonicDebyeApprox` in favor of a correctly capitalized class name, `QuasiHarmonicDebyeApprox`, signaling a move towards consistent naming conventions. Additionally, there's a shift in the testing framework, moving from a direct `unittest.TestCase` import to a more streamlined approach by importing `TestCase` directly, affecting numerous test files. This change simplifies the import statements and class inheritance, aligning with best practices for readability and maintainability.\n\n## Changes\n\n| Files | Change Summary |\n|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| pymatgen/analysis/quasiharmonic.py | Introduced deprecation warning for `QuasiharmonicDebyeApprox` in favor of `QuasiHarmonicDebyeApprox`. |\n| pymatgen/util/testing/__init__.py | Replaced `unittest` import with `TestCase` from `unittest`; Updated base class of `PymatgenTest` to `TestCase`. |\n| tests/command_line/test_critic2_caller.py, files/.pytest-split-durations | - Removed `unittest` import and adjusted test class declarations. - Refactored import statements for cleanliness. - Renamed test methods for clarity and consistency. |\n\n> 🐰✨ \n> In the realm of code where the bytes roam free, \n> A change was made, as you can see. \n> From `unittest`'s embrace, we did depart, \n> With `TestCase` now, we make our art. \n> Deprecation warnings, a gentle nudge, \n> Towards cleaner code, we won't begrudge. \n> 🌟📝🐇\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\ntests/command_line/test_critic2_caller.py: The diff in `test_critic2_caller.py` removes the `unittest` import, updates the test class declarations to remove inheritance from `unittest.TestCase`, and adjusts the test methods accordingly. Additionally, it refactors the import statements by removing unused imports and reordering the imports. These changes do not affect the core logic of the tests but improve code cleanliness and adherence to best practices.\n\ntests/files/.pytest-split-durations: In the given diff, there are changes in the test method names related to the `quasi_harmonic_debye_approx` module. The test methods have been renamed from `TestAnharmonicQuasiharmociDebyeApprox` to `TestQuasiHarmonicDebyeApprox` with corrected spelling and updated method names. This change likely reflects a correction in the naming convention for consistency and clarity in the test suite.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of this pull request (PR #3718) is to optimize the testing framework by removing unnecessary subclassing from `unittest.TestCase` in various test classes. This change aims to simplify the test code by eliminating unused inheritance, specifically targeting classes without `setUp` or `tearDown` methods. Additionally, the PR involves renaming the `Quasi(h->H)armonicDebyeApprox` class and deprecating the old name to improve code clarity and maintainability.\n\n### AI-generated Summary of Generated Summaries\n\nThis pull request streamlines the testing framework by removing unnecessary subclassing from `unittest.TestCase` across multiple test files. It updates import statements to import `TestCase` directly from `unittest` and adjusts class declarations accordingly. This change spans various modules like analysis, core, electronic structure, entries, io, symmetry, transformations, and utilities, enhancing code readability and maintainability.\n\nMoreover, the PR introduces a deprecation warning for the `QuasiharmonicDebyeApprox` class in `pymatgen/analysis/quasiharmonic.py`, advising the use of the renamed `QuasiHarmonicDebyeApprox` class. It provides clear deprecation messages with future removal dates to guide users towards the updated class name, ensuring a smooth transition.\n\nAdditionally, in `pymatgen/util/testing/__init__.py`, the base class of `PymatgenTest` is changed from `unittest.TestCase` to `TestCase`, aligning with the PR's goal of refining the testing framework by simplifying the code structure and removing unnecessary subclassing.\n\nOverall, this PR enhances the testing framework efficiency, manages code deprecation effectively, and prepares the codebase for future developments, contributing to a clean, readable, and maintainable project codebase.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- f1917df205e7dd49e73f479257f75c944a015a6e -->\n<!-- 516a98be8dd69529dcc76d13bcdf6ca4902e0228 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-03-27T18:19:49
| 2024-03-27T18:59:23
|
2024-03-27T18:59:22Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
many test classes don't have `setUp` or `tearDown` methods and so don't need to inherit from `unittest.TestCase`
also rename `Quasi(h->H)armonicDebyeApprox` and deprecate old name
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Deprecated `QuasiharmonicDebyeApprox` in favor of `QuasiHarmonicDebyeApprox`, with a clear deprecation and removal timeline.
- Updated test framework by replacing `unittest.TestCase` with `TestCase` for improved readability and maintainability across numerous test files.
- Refactored import statements in test files for better organization and cleanliness.
- Renamed test methods in `quasi_harmonic_debye_approx` module for consistency and clarity in the test suite.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3718/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3718/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3718",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3718",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3718.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3718.patch",
"merged_at": "2024-03-27T18:59:22Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3719
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3719/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3719/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3719/events
|
https://github.com/materialsproject/pymatgen/issues/3719
| 2,212,017,157
|
I_kwDOACgets6D2LQF
| 3,719
|
Unexpected Tokenizing error when using `parse_lammps_dumps`
|
{
"login": "kimiaGF",
"id": 89272851,
"node_id": "MDQ6VXNlcjg5MjcyODUx",
"avatar_url": "https://avatars.githubusercontent.com/u/89272851?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/kimiaGF",
"html_url": "https://github.com/kimiaGF",
"followers_url": "https://api.github.com/users/kimiaGF/followers",
"following_url": "https://api.github.com/users/kimiaGF/following{/other_user}",
"gists_url": "https://api.github.com/users/kimiaGF/gists{/gist_id}",
"starred_url": "https://api.github.com/users/kimiaGF/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/kimiaGF/subscriptions",
"organizations_url": "https://api.github.com/users/kimiaGF/orgs",
"repos_url": "https://api.github.com/users/kimiaGF/repos",
"events_url": "https://api.github.com/users/kimiaGF/events{/privacy}",
"received_events_url": "https://api.github.com/users/kimiaGF/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-27T22:38:45
| 2024-03-27T22:38:45
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.9.17
### Pymatgen version
Pymatgen 2024.3.1
### Operating system version
Linux HPC
### Current behavior
When using `pymatgen.io.lammps.outputs.parse_lammps_dumps` function to read a dump output, it incorrectly puts out an error on some dump files:
`ParserError: Error tokenizing data. C error: Expected 20 fields in line 62686, saw 21`
### Expected Behavior
Correct behavior of this function returns a list of LammpsDump objects corresponding to each snapshot in Lammps simulation.
### Minimal example
```Python
snapshots = [d for d in parse_lammps_dumps(path_to_dump_file)]
```
### Relevant files to reproduce this bug
files are too large to upload to github, so they are uploaded to [google drive](https://drive.google.com/file/d/1yvQ5kp4KDlWkHpeJXFa82_Y6FLElTc-I/view?usp=sharing).
To replicate the error, use `dump.data_shock_chunk_-30.0`.
To replicate a successful run, use `dump.data_shock_chunk_-5.0`.
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3719/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3719/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3720
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3720/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3720/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3720/events
|
https://github.com/materialsproject/pymatgen/issues/3720
| 2,213,270,699
|
I_kwDOACgets6D69Sr
| 3,720
|
The inconsistent results when finding the transformatoin matrix between two space groups using StructureMatcher and Bilbao Crystallographic Server IDENTIFY GROUP.
|
{
"login": "hongyi-zhao",
"id": 11155854,
"node_id": "MDQ6VXNlcjExMTU1ODU0",
"avatar_url": "https://avatars.githubusercontent.com/u/11155854?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hongyi-zhao",
"html_url": "https://github.com/hongyi-zhao",
"followers_url": "https://api.github.com/users/hongyi-zhao/followers",
"following_url": "https://api.github.com/users/hongyi-zhao/following{/other_user}",
"gists_url": "https://api.github.com/users/hongyi-zhao/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hongyi-zhao/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hongyi-zhao/subscriptions",
"organizations_url": "https://api.github.com/users/hongyi-zhao/orgs",
"repos_url": "https://api.github.com/users/hongyi-zhao/repos",
"events_url": "https://api.github.com/users/hongyi-zhao/events{/privacy}",
"received_events_url": "https://api.github.com/users/hongyi-zhao/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"I'm quite confused about what you're trying to achieve here. \r\n\r\nYour original structure certainly is not a conventional cell and its supercell as you mentioned in #3717:\r\n```\r\nwerner@X10DAi:~$ cat POSCAR_ms\r\nSi2-primitive cell from MS software\r\n1.0\r\n3.8670001030 0.0000000000 0.0000000000\r\n1.9335000515 3.3489203256 0.0000000000\r\n1.9335000515 1.1163067752 3.1573923625\r\nSi\r\n2\r\nDirect\r\n0.000000000 0.000000000 0.000000000\r\n0.250000002 0.250000005 0.249999992\r\n\r\nwerner@X10DAi:~$ cat POSCAR_vaspkit\r\nSi2-primitive cell from VASPKIT software\r\n 1.000000\r\n0.00000000000000 2.73436403275000 2.73436403275000\r\n2.73436403275000 0.00000000000000 2.73436403275000\r\n2.73436403275000 2.73436403275000 0.00000000000000\r\nSi\r\n2\r\nDIRECT\r\n0.0000000000000000 0.0000000000000000 0.0000000000000000 Si1\r\n0.2500000000000000 0.2500000000000000 0.2500000000000000 Si2\r\n```\r\nas such you might be using the wrong method (`get_transformation` finds supercell transformation): https://github.com/materialsproject/pymatgen/blob/25006642a53bab0ac78c5415d21ec881e767dec2/pymatgen/analysis/structure_matcher.py#L1090-L1107\r\n\r\nAnd it seems you might be looking for the [change-of-basis matrix](https://en.wikipedia.org/wiki/Change_of_basis).\r\n\r\nAlso the [IDENTIFY GROUP](https://www.cryst.ehu.es/cgi-bin/cryst/programs/checkgr.pl) tool you mentioned is a **Magnetic** Space Group finder.\r\n",
"> I'm quite confused about what you're trying to achieve here.\r\n\r\nSorry for my not-so-clear description. Let me clarify further as follows.\r\n \r\n> Your original structure certainly is not a conventional cell and its supercell as you mentioned in https://github.com/materialsproject/pymatgen/discussions/3717:\r\n\r\nAlthough these two questions are related in some way, they are not exactly the same questions and the purpose of linking them to one another is to facilitate a related discussion.\r\n\r\n> And it seems you might be looking for the [change-of-basis matrix](https://en.wikipedia.org/wiki/Change_of_basis).\r\n\r\nI think that a complete transformation should include a change-of-basis and an origin shift. The original intent of initiating this issue was to understand how to correlate the results of the elasticity tensor obtained, if we calculate it using different representations of the same structure's POSCAR. As described [here](https://mp.weixin.qq.com/s?__biz=MzI2OTQ4OTExOA==&mid=2247485044&idx=2&sn=80178d0bda6de43e3a5e4a47a72aa158&chksm=eadec0c5dda949d31853dafa37ae593b96f872990bf7b7ada0cbb89bf5e64bbc66903d8794e4&scene=21#wechat_redirect):\r\n\r\n\r\n\r\n\r\n> Also the [IDENTIFY GROUP](https://www.cryst.ehu.es/cgi-bin/cryst/programs/checkgr.pl) tool you mentioned is a **Magnetic** Space Group finder.\r\n\r\nIt might have been that I copied the wrong website link at the time; I have corrected it now.",
"> The original intent of initiating this issue was to understand how to correlate the results of the elasticity tensor obtained, if we calculate it using different representations of the same structure's POSCAR.\r\n\r\nCan you please elaborate on how this is a `pymatgen` issue (this sounds like a general question)?",
"> Can you please elaborate on how this is a `pymatgen` issue (this sounds like a general question)?\r\n\r\nI agree, not that this is a problem against `pymatgen`, but want to solve it based on the power of `pymatgen`.",
"Let me answer my issue and close it: There is no problem with BCS identify group and pymatgen StructureMatcher, more specifically, they all give correct results in this case. \r\n\r\nThe reason I see different conjugators is rooted in that there are infinite conjugators connecting two isomorphism space groups. This can be verified as follows:\r\n\r\n```python\r\nIn [2]: from pymatgen.core import Structure\r\n ...: from pymatgen.analysis.structure_matcher import StructureMatcher\r\n ...: \r\n ...: poscar1 = 'POSCAR_ms'\r\n ...: poscar2 = 'POSCAR_vaspkit'\r\n ...: \r\n ...: structure1 = Structure.from_file(poscar1)\r\n ...: structure2 = Structure.from_file(poscar2)\r\n ...: \r\n ...: matcher = StructureMatcher(primitive_cell=False)\r\n ...: matches = matcher.fit(structure1, structure2)\r\n ...: \r\n ...: if matches:\r\n ...: try:\r\n ...: transformation = matcher.get_transformation(structure1, structur\r\n ...: e2)\r\n ...: print(transformation)\r\n ...: except ValueError as e:\r\n ...: print(f\"error:{str(e)}\")\r\n ...: else:\r\n ...: print(\"Failed to match.\")\r\n ...: \r\n(array([[ 0, 0, -1],\r\n [ 0, -1, 0],\r\n [-1, 0, 0]]), array([0.25, 0.25, 0.25]), [1, 0])\r\n\r\nIn [4]: from pymatgen.core import Structure\r\n ...: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer\r\n ...: import numpy as np\r\n ...: from fractions import Fraction\r\n ...: \r\n ...: def to_fraction_matrix(matrix):\r\n ...: # Function to convert a matrix into its fractional form\r\n ...: fraction_matrix = np.vectorize(lambda x: str(Fraction(x).limit_denominator()))(matrix)\r\n ...: return fraction_matrix\r\n ...: \r\n ...: # Create a Structure instance using the provided POSCAR data\r\n ...: structure = Structure.from_file(\"./POSCAR_ms\")\r\n ...: \r\n ...: # Analyze the structure using SpacegroupAnalyzer\r\n ...: analyzer = SpacegroupAnalyzer(structure)\r\n ...: \r\n ...: # Get the symmetry operations (rotation and translation operations) of the space group\r\n ...: symmetry_operations = analyzer.get_symmetry_operations()\r\n ...: \r\n ...: affine_matrices_in_fractions = [] # List to store all affine matrices in fractional form\r\n ...: \r\n ...: for op in symmetry_operations:\r\n ...: rot = op.rotation_matrix # Rotation matrix\r\n ...: trans = op.translation_vector # Translation vector\r\n ...: \r\n ...: # Create a 4x4 identity matrix to construct the affine matrix\r\n ...: affine_matrix = np.eye(4)\r\n ...: affine_matrix[:3, :3] = rot # Fill the top-left 3x3 part with the rotation matrix\r\n ...: affine_matrix[:3, 3] = trans # Fill the top three rows of the rightmost column with the translation vector\r\n ...: \r\n ...: # Convert the affine matrix to fractional form and add it to the list\r\n ...: affine_matrices_in_fractions.append(to_fraction_matrix(affine_matrix))\r\n ...: \r\n ...: # Convert each affine matrix in the list to the desired format\r\n ...: formatted_affine_matrices = []\r\n ...: for matrix in affine_matrices_in_fractions:\r\n ...: formatted_matrix = [list(row) for row in matrix]\r\n ...: formatted_affine_matrices.append(formatted_matrix)\r\n ...: \r\n ...: # Print or return the list of all affine matrices in fractional form\r\n ...: print(formatted_affine_matrices)\r\n[[['1', '0', '0', '0'], ['0', '1', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['1', '0', '0', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['0', '0', '1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['0', '1', '0', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['0', '0', '1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['1', '0', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']]]\r\n\r\n\r\nIn [3]: from pymatgen.core import Structure\r\n ...: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer\r\n ...: import numpy as np\r\n ...: from fractions import Fraction\r\n ...: \r\n ...: def to_fraction_matrix(matrix):\r\n ...: # Function to convert a matrix into its fractional form\r\n ...: fraction_matrix = np.vectorize(lambda x: str(Fraction(x).limit_denominator()))(matrix)\r\n ...: return fraction_matrix\r\n ...: \r\n ...: # Create a Structure instance using the provided POSCAR data\r\n ...: structure = Structure.from_file(\"./POSCAR_vaspkit\")\r\n ...: \r\n ...: # Analyze the structure using SpacegroupAnalyzer\r\n ...: analyzer = SpacegroupAnalyzer(structure)\r\n ...: \r\n ...: # Get the symmetry operations (rotation and translation operations) of the space group\r\n ...: symmetry_operations = analyzer.get_symmetry_operations()\r\n ...: \r\n ...: affine_matrices_in_fractions = [] # List to store all affine matrices in fractional form\r\n ...: \r\n ...: for op in symmetry_operations:\r\n ...: rot = op.rotation_matrix # Rotation matrix\r\n ...: trans = op.translation_vector # Translation vector\r\n ...: \r\n ...: # Create a 4x4 identity matrix to construct the affine matrix\r\n ...: affine_matrix = np.eye(4)\r\n ...: affine_matrix[:3, :3] = rot # Fill the top-left 3x3 part with the rotation matrix\r\n ...: affine_matrix[:3, 3] = trans # Fill the top three rows of the rightmost column with the translation vector\r\n ...: \r\n ...: # Convert the affine matrix to fractional form and add it to the list\r\n ...: affine_matrices_in_fractions.append(to_fraction_matrix(affine_matrix))\r\n ...: \r\n ...: # Convert each affine matrix in the list to the desired format\r\n ...: formatted_affine_matrices = []\r\n ...: for matrix in affine_matrices_in_fractions:\r\n ...: formatted_matrix = [list(row) for row in matrix]\r\n ...: formatted_affine_matrices.append(formatted_matrix)\r\n ...: \r\n ...: # Print or return the list of all affine matrices in fractional form\r\n ...: print(formatted_affine_matrices)\r\n[[['1', '0', '0', '0'], ['0', '1', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['1', '0', '0', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['0', '0', '1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['1', '0', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['0', '0', '1', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['0', '1', '0', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['0', '-1', '0', '1/4'], ['0', '0', '-1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '0', '1']], [['0', '0', '1', '0'], ['1', '0', '0', '0'], ['-1', '-1', '-1', '0'], ['0', '0', '0', '1']], [['-1', '0', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '-1', '0', '1/4'], ['0', '0', '0', '1']], [['-1', '-1', '-1', '0'], ['0', '1', '0', '0'], ['0', '0', '1', '0'], ['0', '0', '0', '1']], [['0', '0', '-1', '1/4'], ['0', '-1', '0', '1/4'], ['1', '1', '1', '1/4'], ['0', '0', '0', '1']], [['1', '0', '0', '0'], ['0', '0', '1', '0'], ['0', '1', '0', '0'], ['0', '0', '0', '1']], [['1', '1', '1', '1/4'], ['-1', '0', '0', '1/4'], ['0', '0', '-1', '1/4'], ['0', '0', '0', '1']], [['0', '1', '0', '0'], ['-1', '-1', '-1', '0'], ['1', '0', '0', '0'], ['0', '0', '0', '1']]]\r\n```\r\n\r\nThen check them in [gap](https://www.gap-system.org/) as follows:\r\n\r\n\r\n```gap\r\ngap> POSCAR_ms:=[[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [0, 0, -1, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [-1, -1, -1, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [1, 0, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [0, -1, 0, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [0, 0, 1, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, 0, -1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [-1, -1, -1, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [0, 0, 1, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [1, 1, 1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [-1, -1, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [-1, 0, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [0, 1, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, 0, -1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [0, 0, 1, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, 0, -1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [-1, -1, -1, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, 0, -1, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [-1, -1, -1, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, -1, 0, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [1, 1, 1, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [1, 0, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [0, 0, -1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [-1, -1, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [0, 1, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [0, -1, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 0, 1, 0], [1, 0, 0, 0], [0, 0, 0, 1]]];\r\n\r\ngap> POSCAR_vaspkit:=[[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, 0, -1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [1, 0, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [1, 1, 1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [-1, 0, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [-1, -1, -1, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [0, 0, -1, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [-1, -1, -1, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [0, -1, 0, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [0, 0, 1, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [0, 0, 1, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [-1, -1, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [0, 1, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, 0, -1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 0, 1, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [-1, -1, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, 0, -1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [0, 1, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [-1, -1, -1, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [0, -1, 0, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [0, 0, 1, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [1, 1, 1, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [0, 0, -1, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[0, -1, 0, 1/4], [0, 0, -1, 1/4], [-1, 0, 0, 1/4], [0, 0, 0, 1]], [[0, 0, 1, 0], [1, 0, 0, 0], [-1, -1, -1, 0], [0, 0, 0, 1]], [[-1, 0, 0, 1/4], [1, 1, 1, 1/4], [0, -1, 0, 1/4], [0, 0, 0, 1]], [[-1, -1, -1, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[0, 0, -1, 1/4], [0, -1, 0, 1/4], [1, 1, 1, 1/4], [0, 0, 0, 1]], [[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]], [[1, 1, 1, 1/4], [-1, 0, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]], [[0, 1, 0, 0], [-1, -1, -1, 0], [1, 0, 0, 0], [0, 0, 0, 1]]];\r\n\r\ngap> S1:=AffineCrystGroupOnLeft(POSCAR_ms);\r\n<matrix group with 48 generators>\r\ngap> S2:=AffineCrystGroupOnLeft(POSCAR_vaspkit);\r\n<matrix group with 48 generators>\r\ngap> # This is the result given by pymatgen StructureMatcher:\r\ngap> conj:=AugmentedMatrixOnLeft([[ 0, 0, -1],\r\n> [ 0, -1, 0],\r\n> [-1, 0, 0]], [1/4, 1/4, 1/4]);\r\n[ [ 0, 0, -1, 1/4 ], [ 0, -1, 0, 1/4 ], [ -1, 0, 0, 1/4 ], [ 0, 0, 0, 1 ] ]\r\ngap> S1^(conj^-1)=S1;\r\ntrue\r\ngap> # This is the result given by BCS identify group:\r\ngap> S1=S2;\r\ntrue\r\n```\r\n\r\n"
] | 2024-03-28T13:38:21
| 2024-04-03T13:37:45
|
2024-04-03T13:34:05Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Based on the POSCARs [here](https://mp.weixin.qq.com/s?__biz=MzI2OTQ4OTExOA==&mid=2247485044&idx=2&sn=80178d0bda6de43e3a5e4a47a72aa158&chksm=eadec0c5dda949d31853dafa37ae593b96f872990bf7b7ada0cbb89bf5e64bbc66903d8794e4&scene=21#wechat_redirect), I try to find the transformation matrix between the following two POSCARs:
```
werner@X10DAi:~$ cat POSCAR_ms
Si2-primitive cell from MS software
1.0
3.8670001030 0.0000000000 0.0000000000
1.9335000515 3.3489203256 0.0000000000
1.9335000515 1.1163067752 3.1573923625
Si
2
Direct
0.000000000 0.000000000 0.000000000
0.250000002 0.250000005 0.249999992
werner@X10DAi:~$ cat POSCAR_vaspkit
Si2-primitive cell from VASPKIT software
1.000000
0.00000000000000 2.73436403275000 2.73436403275000
2.73436403275000 0.00000000000000 2.73436403275000
2.73436403275000 2.73436403275000 0.00000000000000
Si
2
DIRECT
0.0000000000000000 0.0000000000000000 0.0000000000000000 Si1
0.2500000000000000 0.2500000000000000 0.2500000000000000 Si2
```
First, I tried to use the `StructureMatcher` method as follows:
```python
from pymatgen.core import Structure
from pymatgen.analysis.structure_matcher import StructureMatcher
poscar1 = 'POSCAR_ms'
poscar2 = 'POSCAR_vaspkit'
structure1 = Structure.from_file(poscar1)
structure2 = Structure.from_file(poscar2)
matcher = StructureMatcher(primitive_cell=False)
matches = matcher.fit(structure1, structure2)
if matches:
try:
transformation = matcher.get_transformation(structure1, structure2)
print(transformation)
except ValueError as e:
print(f"error:{str(e)}")
else:
print("Failed to match.")
(array([[ 0, 0, -1],
[ 0, -1, 0],
[-1, 0, 0]]), array([0.25, 0.25, 0.25]), [0, 1])
```
Then, I tried to identify the spacegroup using [IDENTIFY GROUP](https://www.cryst.ehu.es/cgi-bin/cryst/programs/checkgr.pl?tipog=gesp) as follows:
```python
In [23]: from pymatgen.core import Structure
...: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
...:
...: structure = Structure.from_file("./POSCAR_ms")
...: analyzer = SpacegroupAnalyzer(structure)
...:
...: space_group_symbol = analyzer.get_space_group_symbol()
...: print(f"Space Group Symbol: {space_group_symbol}")
...:
...: symmetry_operations = analyzer.get_symmetry_operations()
...: for i, op in enumerate(symmetry_operations, start=1):
...: #print(f"Operation {i}:")
...: print(op.as_xyz_str())
...:
Space Group Symbol: Fd-3m
x, y, z
-y+1/4, -z+1/4, x+y+z+1/4
z, -x-y-z, x
x+y+z+1/4, -x+1/4, -y+1/4
y, x, -x-y-z
-z+1/4, -y+1/4, -x+1/4
-x-y-z, z, y
-x+1/4, x+y+z+1/4, -z+1/4
z, x, y
x+y+z+1/4, -y+1/4, -z+1/4
x, z, -x-y-z
-y+1/4, x+y+z+1/4, -x+1/4
-x-y-z, y, x
-x+1/4, -z+1/4, -y+1/4
y, -x-y-z, z
-z+1/4, -x+1/4, x+y+z+1/4
y, z, x
-z+1/4, x+y+z+1/4, -y+1/4
-x-y-z, x, z
-x+1/4, -y+1/4, x+y+z+1/4
x, -x-y-z, y
-y+1/4, -x+1/4, -z+1/4
z, y, -x-y-z
x+y+z+1/4, -z+1/4, -x+1/4
-x+1/4, -y+1/4, -z+1/4
y, z, -x-y-z
-z+1/4, x+y+z+1/4, -x+1/4
-x-y-z, x, y
-y+1/4, -x+1/4, x+y+z+1/4
z, y, x
x+y+z+1/4, -z+1/4, -y+1/4
x, -x-y-z, z
-z+1/4, -x+1/4, -y+1/4
-x-y-z, y, z
-x+1/4, -z+1/4, x+y+z+1/4
y, -x-y-z, x
x+y+z+1/4, -y+1/4, -x+1/4
x, z, y
-y+1/4, x+y+z+1/4, -z+1/4
z, x, -x-y-z
-y+1/4, -z+1/4, -x+1/4
z, -x-y-z, y
x+y+z+1/4, -x+1/4, -z+1/4
x, y, -x-y-z
-x+1/4, x+y+z+1/4, -y+1/4
y, x, z
-z+1/4, -y+1/4, x+y+z+1/4
-x-y-z, z, x
In [22]: from pymatgen.core import Structure
...: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
...:
...: structure = Structure.from_file("./POSCAR_vaspkit")
...: analyzer = SpacegroupAnalyzer(structure)
...:
...: space_group_symbol = analyzer.get_space_group_symbol()
...: print(f"Space Group Symbol: {space_group_symbol}")
...:
...: symmetry_operations = analyzer.get_symmetry_operations()
...: for i, op in enumerate(symmetry_operations, start=1):
...: #print(f"Operation {i}:")
...: print(op.as_xyz_str())
...:
Space Group Symbol: Fd-3m
x, y, z
x+y+z+1/4, -z+1/4, -x+1/4
y, x, -x-y-z
-z+1/4, x+y+z+1/4, -y+1/4
-x-y-z, z, y
-y+1/4, -x+1/4, -z+1/4
z, -x-y-z, x
-x+1/4, -y+1/4, x+y+z+1/4
z, x, y
-x+1/4, x+y+z+1/4, -z+1/4
-x-y-z, y, x
-y+1/4, -z+1/4, x+y+z+1/4
y, -x-y-z, z
-z+1/4, -y+1/4, -x+1/4
x, z, -x-y-z
x+y+z+1/4, -x+1/4, -y+1/4
y, z, x
-z+1/4, -x+1/4, x+y+z+1/4
x, -x-y-z, y
x+y+z+1/4, -y+1/4, -z+1/4
z, y, -x-y-z
-x+1/4, -z+1/4, -y+1/4
-x-y-z, x, z
-y+1/4, x+y+z+1/4, -x+1/4
-x+1/4, -y+1/4, -z+1/4
-x-y-z, z, x
-y+1/4, -x+1/4, x+y+z+1/4
z, -x-y-z, y
x+y+z+1/4, -z+1/4, -y+1/4
y, x, z
-z+1/4, x+y+z+1/4, -x+1/4
x, y, -x-y-z
-z+1/4, -x+1/4, -y+1/4
x, -x-y-z, z
x+y+z+1/4, -y+1/4, -x+1/4
y, z, -x-y-z
-y+1/4, x+y+z+1/4, -z+1/4
z, y, x
-x+1/4, -z+1/4, x+y+z+1/4
-x-y-z, x, y
-y+1/4, -z+1/4, -x+1/4
z, x, -x-y-z
-x+1/4, x+y+z+1/4, -y+1/4
-x-y-z, y, z
-z+1/4, -y+1/4, x+y+z+1/4
x, z, y
x+y+z+1/4, -x+1/4, -z+1/4
y, -x-y-z, x
```
But in this way, the above two sets of generators give the exactly same results, as shown below:

This isn't very clear to me and any tips or comments would help.
See https://github.com/materialsproject/pymatgen/discussions/3717 for the related discussion.
Regards,
Zhao
|
{
"login": "hongyi-zhao",
"id": 11155854,
"node_id": "MDQ6VXNlcjExMTU1ODU0",
"avatar_url": "https://avatars.githubusercontent.com/u/11155854?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hongyi-zhao",
"html_url": "https://github.com/hongyi-zhao",
"followers_url": "https://api.github.com/users/hongyi-zhao/followers",
"following_url": "https://api.github.com/users/hongyi-zhao/following{/other_user}",
"gists_url": "https://api.github.com/users/hongyi-zhao/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hongyi-zhao/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hongyi-zhao/subscriptions",
"organizations_url": "https://api.github.com/users/hongyi-zhao/orgs",
"repos_url": "https://api.github.com/users/hongyi-zhao/repos",
"events_url": "https://api.github.com/users/hongyi-zhao/events{/privacy}",
"received_events_url": "https://api.github.com/users/hongyi-zhao/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3720/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3720/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3721
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3721/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3721/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3721/events
|
https://github.com/materialsproject/pymatgen/issues/3721
| 2,214,147,220
|
I_kwDOACgets6D-TSU
| 3,721
|
Duplicate atom generated with Structure.from_spacegroup
|
{
"login": "LindaHung-TRI",
"id": 35808296,
"node_id": "MDQ6VXNlcjM1ODA4Mjk2",
"avatar_url": "https://avatars.githubusercontent.com/u/35808296?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/LindaHung-TRI",
"html_url": "https://github.com/LindaHung-TRI",
"followers_url": "https://api.github.com/users/LindaHung-TRI/followers",
"following_url": "https://api.github.com/users/LindaHung-TRI/following{/other_user}",
"gists_url": "https://api.github.com/users/LindaHung-TRI/gists{/gist_id}",
"starred_url": "https://api.github.com/users/LindaHung-TRI/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/LindaHung-TRI/subscriptions",
"organizations_url": "https://api.github.com/users/LindaHung-TRI/orgs",
"repos_url": "https://api.github.com/users/LindaHung-TRI/repos",
"events_url": "https://api.github.com/users/LindaHung-TRI/events{/privacy}",
"received_events_url": "https://api.github.com/users/LindaHung-TRI/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-03-28T21:04:11
| 2024-03-28T21:04:11
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
3.10.8
### Pymatgen version
2024.2.8
### Operating system version
_No response_
### Current behavior
The Ge atoms index 0 and 3 are generated almost on top of each other, just at opposite ends of the unit cell. Input is:
`Structure.from_spacegroup(
154,
Lattice.from_parameters(4.98502, 4.98502, 5.648, 90., 90., 120.),
('Ge', 'O'),
((0.4513, 0.0, 0.6667), (0.3969, 0.3021, 0.12)),
tol=0.01)`
### Expected Behavior
Correct structure should only have 3 Ge atoms.
### Minimal example
```Python
Structure.from_spacegroup(
154,
Lattice.from_parameters(4.98502, 4.98502, 5.648, 90., 90., 120.),
('Ge', 'O'),
((0.4513, 0.0, 0.6667), (0.3969, 0.3021, 0.12)),
tol=0.01)
```
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3721/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3721/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3723
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3723/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3723/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3723/events
|
https://github.com/materialsproject/pymatgen/issues/3723
| 2,214,419,563
|
I_kwDOACgets6D_Vxr
| 3,723
|
KPOINTS_OPT based one-shot calculation input files generation and the corresponding post-processing.
|
{
"login": "hongyi-zhao",
"id": 11155854,
"node_id": "MDQ6VXNlcjExMTU1ODU0",
"avatar_url": "https://avatars.githubusercontent.com/u/11155854?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hongyi-zhao",
"html_url": "https://github.com/hongyi-zhao",
"followers_url": "https://api.github.com/users/hongyi-zhao/followers",
"following_url": "https://api.github.com/users/hongyi-zhao/following{/other_user}",
"gists_url": "https://api.github.com/users/hongyi-zhao/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hongyi-zhao/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hongyi-zhao/subscriptions",
"organizations_url": "https://api.github.com/users/hongyi-zhao/orgs",
"repos_url": "https://api.github.com/users/hongyi-zhao/repos",
"events_url": "https://api.github.com/users/hongyi-zhao/events{/privacy}",
"received_events_url": "https://api.github.com/users/hongyi-zhao/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Hi Hongsheng,\r\n\r\nAs described in the [VASP wiki](https://www.vasp.at/wiki/index.php/KPOINTS_OPT) you mentioned:\r\n> KPOINTS_OPT is an optional input file to perform an additional one-shot calculation after self-consistency is reached. The format is the same as for the [KPOINTS](https://www.vasp.at/wiki/index.php/KPOINTS) file. \r\n\r\nAs such, I wouldn't expect the `KPOINTS_OPT` to differ from `KPOINTS` file except for the naming.",
"Hello Yang,\r\n\r\nThank you for your comments. But this feature is available as of VASP 6.3.0 and vasp needs to be compiled with hdf5 support for some features related to this tag. So, in this sense, it's not the same as the traditional [KPOINTS](https://www.vasp.at/wiki/index.php/KPOINTS) file.",
"Please refer to the [VASP WIKI for HD5 support](https://www.vasp.at/wiki/index.php/Category:HDF5_support), I don't think HDF5 in any way alters the behavior of using INCAR/KPOINTS/POSCAR/POTCAR to start a calculation?"
] | 2024-03-29T01:06:26
| 2024-03-29T11:47:33
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
I'm not sure if Pymatgen currently supports [KPOINTS_OPT](https://www.vasp.at/wiki/index.php/KPOINTS_OPT) based one-shot calculation input file generation and the corresponding post-processing. Any tips and comments will be helpful.
Regards,
Zhao
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3723/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3723/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3725
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3725/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3725/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3725/events
|
https://github.com/materialsproject/pymatgen/pull/3725
| 2,215,091,295
|
PR_kwDOACgets5rJy7C
| 3,725
|
Remove deprecated `analysis.interface`, rename classes to PascalCase and rename `with_*` to `from_*`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5529392097,
"node_id": "LA_kwDOACgets8AAAABSZPT4Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/api",
"name": "api",
"color": "D21149",
"default": false,
"description": "Application programming interface"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates to the pymatgen library focus on standardizing method naming conventions, particularly in the transition from methods prefixed with `with_` to those starting with `from_` for initializing and constructing graphs. This change affects various modules, enhancing consistency and readability. Additionally, there's a minor correction in class naming and a push towards more descriptive and uniform naming across different modules, improving the overall clarity and usability of the library.\n\n## Changes\n\n| Files | Change Summary |\n|--------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| `.../analysis/bond_dissociation.py`, `.../dimensionality.py` | Updated to use `MoleculeGraph.from_local_env_strategy` and `from_edges` for `MoleculeGraph` instances. |\n| `.../analysis/fragmenter.py`, `tests/.../test_fragmenter.py` | Switched to `from_local_env_strategy` and `from_edges` in fragmenter modules and tests. |\n| `.../analysis/functional_groups.py`, `tests/.../test_functional_groups.py` | Updated `FunctionalGroupExtractor` to use `MoleculeGraph.from_local_env_strategy`. |\n| `.../analysis/graphs.py`, `tests/.../test_graphs.py` | Renamed methods from `with_` to `from_` with deprecation warnings. |\n| `.../analysis/local_env.py`, `tests/.../test_local_env.py` | Added `deprecated` import and renamed methods, switching to `from_local_env_strategy`. |\n| `.../analysis/magnetism/heisenberg.py` | Modified method calls to use `StructureGraph.from_local_env_strategy` and `from_empty_graph`. |\n| `.../analysis/quasiharmonic.py` | Corrected class name spelling and removed PascalCase recommendation. |\n| `.../command_line/critic2_caller.py` | Updated `structure_graph` method to use `StructureGraph.from_empty_graph`. |\n| `.../io/cp2k/inputs.py`, `.../sets.py` | Renamed classes and entities for consistency and deprecated old names. |\n| `.../io/qchem/outputs.py` | Updated to use `MoleculeGraph.from_local_env_strategy` for graph initialization. |\n| `tests/io/test_babel.py` | Modified to use `MoleculeGraph.from_empty_graph`. |\n\n> 🐇✨ \n> In the realm of atoms and bonds, where the graphs do weave and sway, \n> A change was made, from `with_` to `from_`, in a most harmonious way. \n> Names now flow like a gentle stream, clarity in every line, \n> As the code rabbit hops along, through the pymatgen shrine. \n> 🌟📚 \n> Celebrate we shall, for consistency's light, \n> Guides us through the code, making everything right. \n> 🎉🐾\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/bond_dissociation.py, pymatgen/analysis/dimensionality.py:\n- Updated `bond_dissociation.py` and `dimensionality.py` in `pymatgen/analysis` to use `MoleculeGraph.from_local_env_strategy` instead of `with_local_env_strategy` and `MoleculeGraph.from_edges` instead of `with_edges` for constructing `MoleculeGraph` instances, impacting initialization and construction from edges.\n\npymatgen/analysis/fragmenter.py, tests/analysis/test_fragmenter.py:\n- Switched from `with_local_env_strategy` to `from_local_env_strategy` and `with_edges` to `from_edges` in `fragmenter.py` and corresponding test cases, affecting `MoleculeGraph` initialization based on edges and metal edge extenders. The `open_ring` function now returns a `MoleculeGraph` using `from_local_env_strategy`.\n\npymatgen/analysis/functional_groups.py, tests/analysis/test_functional_groups.py:\n- Updated `FunctionalGroupExtractor` in `functional_groups.py` and its test cases to use `MoleculeGraph.from_local_env_strategy` for graph initialization.\n\npymatgen/analysis/graphs.py, tests/analysis/test_graphs.py:\n- Renamed methods from `with_` to `from_` in `graphs.py` and `test_graphs.py` for class initialization, with deprecation warnings added. Added import from `monty.dev` for deprecation functionality.\n\npymatgen/analysis/local_env.py, tests/analysis/test_local_env.py:\n- Added `deprecated` import and renamed methods in `local_env.py` and corresponding tests, switching to `from_local_env_strategy` for `StructureGraph` and `MoleculeGraph` construction. Renamed `BrunnerNN_reciprocal`, `BrunnerNN_relative`, and `BrunnerNN_real`.\n\npymatgen/analysis/magnetism/heisenberg.py:\n- Modified method calls in `heisenberg.py` to use `StructureGraph.from_local_env_strategy` and `from_empty_graph`, impacting graph generation logic.\n\npymatgen/analysis/quasiharmonic.py:\n- Corrected class name spelling from `QuasiharmonicDebyeApprox` to `QuasiHarmonicDebyeApprox` and removed PascalCase recommendation in deprecation message.\n\npymatgen/command_line/critic2_caller.py:\n- Updated `structure_graph` method in `critic2_caller.py` to use `StructureGraph.from_empty_graph` for `struct_graph` initialization.\n\npymatgen/io/cp2k/inputs.py:\n- Renamed classes related to cube file printing in `inputs.py` and deprecated old names for future removal.\n\npymatgen/io/cp2k/sets.py:\n- Renamed entities for consistency in `sets.py`, such as `Band_Structure` to `BandStructure`, `E_Density_Cube` to `EDensityCube`, `MO_Cubes` to `MOCubes`, `V_Hartree_Cube` to `VHartreeCube`, and `Xc_Functional` to `XCFunctional`.\n\npymatgen/io/qchem/outputs.py:\n- Updated `check_for_structure_changes` in `outputs.py` to use `MoleculeGraph.from_local_env_strategy` for graph initialization.\n\ntests/io/test_babel.py:\n- Modified `test_from_molecule_graph` in `test_babel.py` to use `MoleculeGraph.from_empty_graph`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request (PR #3725) focuses on three main objectives as part of the ongoing development and cleanup of the pymatgen codebase:\n\n1. **Removal of Legacy Code**: The PR proposes the removal of the `analysis.interface` module, which was deprecated three years prior. This action follows a discussion that highlighted the module's obsolescence and the need for its removal to streamline the codebase.\n\n2. **Class Naming Convention Changes**: Several classes within the pymatgen library, particularly in the `cp2k.inputs` module, are being renamed to adhere to PascalCase naming conventions. This change aims to ensure consistency across the library, making the code more readable and easier to maintain. The decision to rename these classes was also discussed and agreed upon by contributors.\n\n3. **Method Renaming for Clarity**: The PR includes the renaming of several `with_*` methods to `from_*`. This change is intended to improve clarity in method naming, making it more intuitive for developers to understand the purpose and functionality of these methods. The renaming affects methods across various modules, including `analysis`, `io`, and others, and involves critical functionalities such as graph initialization and construction.\n\n### Comments Summary\n\nThe comments on the PR provide valuable insights into the implementation details and the necessary steps for a smooth transition:\n\n- **Deprecation Warnings**: Janosh emphasized the importance of including deprecation warnings for all changes to guide users through the transition and avoid breaking existing code. This approach ensures that users are informed about the deprecated features and the new alternatives.\n\n- **Flawed Deprecation Method for Class Methods**: DanielYang59 encountered an issue with the deprecation method for class methods (`with_*`), which resulted in a `TypeError` when calling the deprecated class method. This problem highlights the need for a robust solution to deprecate class methods effectively without causing runtime errors.\n\n- **Proactive Deprecation Handling**: Following Janosh's advice, DanielYang59 took a proactive approach by moving the `replacement` and `old` methods closer together in the codebase to ensure that deprecations are handled alongside each change. This strategy aims to prevent any omissions of necessary deprecations.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR introduces significant changes across the pymatgen library, focusing on code cleanup, consistency in naming conventions, and method renaming for improved clarity. Key changes include:\n\n- The removal of the deprecated `analysis.interface` module, aligning with previous discussions on its obsolescence.\n- A widespread adoption of PascalCase naming for classes, particularly noted in the `cp2k.inputs` module, to ensure consistency and readability throughout the library.\n- The renaming of `with_*` methods to `from_*` across various modules, affecting functionalities such as graph initialization and construction. This change aims to make method purposes more intuitive and align with common Python practices.\n- The introduction of deprecation warnings for renamed methods and classes to facilitate a smooth transition for users. This includes addressing a specific issue with deprecating class methods, which required a careful approach to avoid runtime errors.\n\nOverall, these changes reflect a concerted effort to modernize the pymatgen codebase, making it more accessible, maintainable, and user-friendly.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- dfa183e252802f3f611f7bf473bf2e4aef3fea59 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"bear in mind that we need deprecations for all these changes. might be easier to do them alongside each change rather than all at once at the end to ensure we don't forget any",
"It looks like my method to deprecate class methods (`with_*`) is flawed, and therefore [calling the deprecated class method](https://github.com/materialsproject/pymatgen/actions/runs/8480100001/job/23235225278) would trigger an error, can you please give me some advice on this @janosh? Thanks!\r\n```python\r\n def wrapped(*args, **kwargs):\r\n msg = craft_message(old, replacement, message)\r\n warnings.warn(msg, category=category, stacklevel=2)\r\n> return old(*args, **kwargs)\r\nE TypeError: 'classmethod' object is not callable\r\n```\r\n\r\n",
"> might be easier to them alongside each change rather than all at once at the end to ensure we don't forget any\r\n\r\nAgreed :) Already moved `replacement` and `old` together in 0a2461b1a26f73d0ec3d0b367f7e0d2a27f28be9. Thanks for the head up!",
"Please review @janosh. Thanks!",
"Thanks again for reviewing @janosh! Cheers!"
] | 2024-03-29T10:33:46
| 2024-04-12T05:49:13
|
2024-03-29T11:31:35Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Summary
- Remove legacy `analysis.interface` (deprecated 3 years ago, see [discussion](https://github.com/materialsproject/pymatgen/pull/3702#issuecomment-2016370354))
- Rename several classes to PascalCase (see [discussion](https://github.com/materialsproject/pymatgen/pull/3702#issuecomment-2016363666))
- Rename several `with_*` classmethods to `from_*` in `analysis.graphs`
### Note:
The renamed classes in `cp2k.inputs` does not have corresponding unit tests at all.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Enhanced graph initialization methods across various modules for improved consistency and future maintenance.
- **Bug Fixes**
- Corrected class name spelling in the quasiharmonic module for clarity.
- **Documentation**
- Added deprecation warnings for renamed methods and classes to guide developers towards updated usage.
- **Style**
- Standardized naming conventions in input and set modules for better readability and consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3725/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3725/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3725",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3725",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3725.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3725.patch",
"merged_at": "2024-03-29T11:31:35Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3726
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3726/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3726/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3726/events
|
https://github.com/materialsproject/pymatgen/pull/3726
| 2,215,762,559
|
PR_kwDOACgets5rMHoG
| 3,726
|
Define `ElementType` enum in `core/periodic_table.py`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5648629103,
"node_id": "LA_kwDOACgets8AAAABUK89bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/core",
"name": "core",
"color": "299448",
"default": false,
"description": "Pymatgen core"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates focus on optimizing and extending functionality across several scripts and modules within a development environment. Key enhancements include improved data structure handling, such as the use of tuples and `setdefault` for efficiency and clarity, and the introduction of the `ElementType` enum to categorize elements more effectively. These changes streamline operations, enhance readability, and expand the capabilities for handling chemical and periodic table data.\n\n## Changes\n\n| Files | Change Summary |\n|----------------------------------------|--------------------------------------------------------------------------------------------------|\n| `.../get_plane_permutations_optimized.py` | Modified condition to check user input from a list to a tuple. |\n| `.../update_pt_data.py` | Replaced a conditional check with `setdefault` for initializing nested dictionaries. |\n| `pymatgen/core/composition.py` | Updated imports and methods for handling `ElementType`, improving error messages and efficiency.|\n| `pymatgen/core/periodic_table.py`, `tests/core/test_periodic_table.py` | Added `ElementType` enum and tests for new element categories. |\n| `tests/core/test_composition.py` | Enhanced test cases for `Composition` class, including element types and charge removal. |\n\n> **A whimsical ode by a rabbit to code:**\n>\n> In a burrow deep, where the code does sleep, \n> Changes stir, in the digital deep. \n> 🐇 With a hop and a skip, on the keyboard I tap, \n> Enums and tuples, in Python's lap. \n> From elements to lists, our code does leap, \n> Crafting a world, where the data does creep. \n> So here's to the changes, both big and small, \n> In the heart of the code, a rabbit stands tall. 🌟\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\ndev_scripts/chemenv/get_plane_permutations_optimized.py: ## Short summary\n\nIn the `get_plane_permutations_optimized.py` script, the change involves modifying the condition for checking user input from a list to a tuple, specifically changing `if test not in [\"y\", \"q\"]` to `if test not in (\"y\", \"q\")`.\n\n---\n\ndev_scripts/update_pt_data.py: ## Short summary\n\nIn the `parse_shannon_radii` function, the change involves replacing a conditional check with `setdefault` to initialize a nested dictionary if it doesn't exist.\n\n---\n\npymatgen/core/composition.py: ## Short summary\n\n- Modified the import statement to include `ElementType` from `pymatgen.core.periodic_table`.\n- Updated the `contains_element_type` method to use a list comprehension to extract values from `ElementType` for `allowed_categories` and updates the error message for invalid categories.\n\n---\n\npymatgen/core/periodic_table.py: ## Short summary\n\nAdded an `ElementType` enum with various element types like noble gas, transition metal, metalloid, etc.\n\n---\n\ntests/core/test_composition.py: ## Short summary\n\n- Modified test methods in the `test_composition.py` file to use the `Composition` class with different initialization approaches and assertions.\n- Added additional assertions and test cases to cover various scenarios related to element types and validity checks.\n- Changed variable names from `cmp` to `comp` for better clarity.\n- Tested the `remove_charges` method with different compositions before and after charge removal.\n\n---\n\ntests/core/test_periodic_table.py: ## Short summary\n\nAdded the `ElementType` enum to `pymatgen.core.periodic_table` module with constants for actinoid and metalloid elements, and a test to verify the enum properties.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of Pull Request (PR) #3726 is to introduce a new enumeration, `ElementType`, within the `core/periodic_table.py` file of the project. This enumeration categorizes chemical elements into various types based on their properties and positions in the periodic table, such as noble gases, transition metals, post-transition metals, rare earth metals, metalloids, alkali and alkaline metals, halogens, chalcogens, lanthanoids, actinoids, and also includes categories based on their block in the periodic table (s-block, p-block, d-block, f-block). The addition of the `ElementType` enum is aimed at enhancing the project's ability to categorize and work with different types of chemical elements in a structured and consistent manner.\n\nThe PR description explicitly mentions the structure and members of the `ElementType` enum, providing clear documentation on the categorization of elements. This addition is carefully designed to avoid breaking changes in the `Composition.contains_element_type` method, which is part of the `pymatgen/core/composition.py` file. The PR also includes modifications to other parts of the project to integrate and utilize the new `ElementType` enum effectively.\n\n### AI-generated Summary of Generated Summaries\n\nThis PR introduces the `ElementType` enum in `pymatgen/core/periodic_table.py`, categorizing elements into various types such as noble gases, transition metals, and more, based on their properties and periodic table positions. It ensures compatibility with existing functionalities, particularly with the `Composition.contains_element_type` method in `pymatgen/core/composition.py`, which is updated to utilize the new enum for element type checks. The PR also includes modifications across several scripts and test files to integrate and validate the new enum's usage.\n\nKey changes include:\n- The addition of the `ElementType` enum to classify elements into distinct categories, including block-based categories.\n- Modification of the `Composition.contains_element_type` method to support the new enum, enhancing the method's ability to check for specific element types within compositions.\n- Updates to test files, such as `tests/core/test_composition.py` and `tests/core/test_periodic_table.py`, to include tests for the new enum and its integration, ensuring the changes are well-tested and reliable.\n- Adjustments in scripts like `dev_scripts/chemenv/get_plane_permutations_optimized.py` and `dev_scripts/update_pt_data.py` for improved efficiency and code quality, such as optimizing condition checks and dictionary initialization.\n\nThese changes collectively aim to enhance the project's element categorization capabilities, improve code efficiency, and ensure robust testing of the new functionalities introduced by the PR.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- d97a62e9af3c52077f7e3223e7013e83d22637f8 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit-tests for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit tests for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit tests.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-03-29T17:44:47
| 2024-03-29T18:38:08
|
2024-03-29T18:38:07Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
```py
@unique
class ElementType(Enum):
"""Enum for element types."""
noble_gas = "noble_gas" # He, Ne, Ar, Kr, Xe, Rn
transition_metal = "transition_metal" # Sc-Zn, Y-Cd, La-Hg, Ac-Cn
post_transition_metal = "post_transition_metal" # Al, Ga, In, Tl, Sn, Pb, Bi, Po
rare_earth_metal = "rare_earth_metal" # Ce-Lu, Th-Lr
metal = "metal"
metalloid = "metalloid" # B, Si, Ge, As, Sb, Te, Po
alkali = "alkali" # Li, Na, K, Rb, Cs, Fr
alkaline = "alkaline" # Be, Mg, Ca, Sr, Ba, Ra
halogen = "halogen" # F, Cl, Br, I, At
chalcogen = "chalcogen" # O, S, Se, Te, Po
lanthanoid = "lanthanoid" # La-Lu
actinoid = "actinoid" # Ac-Lr
quadrupolar = "quadrupolar"
s_block = "s-block"
p_block = "p-block"
d_block = "d-block"
f_block = "f-block"
```
defined as above to avoid breaking changes in `Composition.contains_element_type`. definitely think this could be improved. we can make (breaking) changes later up to 1 or 2 releases down the road when adoption is still low
https://github.com/materialsproject/pymatgen/blob/3a49dd918db2b64c48493ac6e1eb837d65930d86/pymatgen/core/composition.py#L492-L512
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced `ElementType` enum to classify elements such as noble gas, transition metal, metalloid, etc.
- **Improvements**
- Optimized the condition for checking user input in scripts.
- Enhanced the `parse_shannon_radii` function for better dictionary initialization.
- Updated the `contains_element_type` method for improved element type validation.
- **Tests**
- Added and modified tests to cover new scenarios related to element types and composition validity.
- Improved test clarity by renaming variables and testing additional cases.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3726/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3726/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3726",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3726",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3726.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3726.patch",
"merged_at": "2024-03-29T18:38:07Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3727
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3727/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3727/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3727/events
|
https://github.com/materialsproject/pymatgen/pull/3727
| 2,216,092,844
|
PR_kwDOACgets5rNOUk
| 3,727
|
Add a fix for if a parameter is None in AimsControlIn
|
{
"login": "tpurcell90",
"id": 7539573,
"node_id": "MDQ6VXNlcjc1Mzk1NzM=",
"avatar_url": "https://avatars.githubusercontent.com/u/7539573?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tpurcell90",
"html_url": "https://github.com/tpurcell90",
"followers_url": "https://api.github.com/users/tpurcell90/followers",
"following_url": "https://api.github.com/users/tpurcell90/following{/other_user}",
"gists_url": "https://api.github.com/users/tpurcell90/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tpurcell90/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tpurcell90/subscriptions",
"organizations_url": "https://api.github.com/users/tpurcell90/orgs",
"repos_url": "https://api.github.com/users/tpurcell90/repos",
"events_url": "https://api.github.com/users/tpurcell90/events{/privacy}",
"received_events_url": "https://api.github.com/users/tpurcell90/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThis update brings a subtle but important enhancement to how control parameters are handled in the `pymatgen` library for AIMS input file generation. It ensures that when a control parameter's value is `None`, the method responsible for creating the control parameter strings will now produce an empty string, improving the reliability and robustness of AIMS simulation input file generation.\n\n## Changes\n\n| File Path | Change Summary |\n|--------------------------------------|---------------------------------------------------------------------------------------------------|\n| `pymatgen/io/aims/inputs.py` | Added a check in the `get_aims_control_parameter_str` method to return an empty string if `value` is `None`. |\n| `tests/io/aims/test_aims_inputs.py` | - Changed array declarations from floating-point to integers for lattice and coordinates. |\n| | - Converted floating-point numbers to integers for coordinates in `test_read_h2o_in`. |\n| | - Modified floating-point numbers to integers for edges in `test_aims_cube`. |\n\n> 🐇✨ \n> In the realm of code, where logic does bind, \n> A tiny tweak, leaving confusion behind. \n> No more `None` to see, in parameters so fine, \n> Just empty strings, in their orderly line. \n> 🌟📝 \n> - CodeRabbit, hopping through the code, so divine.\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/aims/inputs.py: ## Short summary\n\nAdded a check in the `get_aims_control_parameter_str` method to return an empty string if the `value` is `None`.\n\n---\n\ntests/io/aims/test_aims_inputs.py: ## Short summary\n\n- Changes in the declaration of arrays from floating-point numbers to integers for lattice and coordinates in `test_read_write_si_in` and `test_read_h2o_in` functions.\n- Conversion of floating-point numbers to integers for coordinates in `test_read_h2o_in` function.\n- Modification of floating-point numbers to integers for edges in `test_aims_cube` function.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3727, addresses a specific fix related to the atomate2's phonon workflow, focusing on symmetry handling in FHI-aims. The fix involves disabling symmetry handling for displaced cells to ensure the workflow functions correctly. The PR includes additions to the `AimsControlIn` functionality and adheres to project guidelines by adding Google format doc strings, type annotations, tests for new features, and duecredit decorators for referencing relevant papers. Contributors are advised to use `pre-commit` hooks for automated code quality checks.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR enhances `pymatgen/io/aims/inputs.py` by updating the `get_aims_control_parameter_str` method to handle `None` parameter values, ensuring it returns an empty string when needed. This adjustment is critical for the atomate2's phonon workflow in FHI-aims, requiring symmetry handling to be disabled for displaced cells. Additionally, the PR includes changes in test functions within `tests/io/aims/test_aims_inputs.py`, focusing on converting floating-point numbers to integers for various arrays, improving data handling consistency. These modifications align with coding standards and best practices, emphasizing documentation, type annotations, testing, and proper crediting of relevant sources using duecredit decorators. Contributors are encouraged to leverage `pre-commit` hooks for streamlined code quality assurance.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 8c8361ab9fe1b1c039eed6f1928c22cff5d26f17 -->\n<!-- 61f8c1fc9ad3c631476504359b6274ff2d3725ea -->\n<!-- 9fac4ebcc165f85aeb62e498e89df8fb783422e7 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-03-29T23:49:28
| 2024-03-30T06:03:53
|
2024-03-30T06:03:53Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
For the atomate2's phonon workflow the symmetry handling in FHI-aims must be turned off for the displaced cells for it to work. Adding that option here
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
- [x] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Bug Fixes**
- Improved the `get_aims_control_parameter_str` method to return an empty string when the `value` is `None`, enhancing robustness and preventing potential errors.
- Updated array declarations from floating-point numbers to integers for lattice and coordinates in specific test functions to ensure accurate testing and consistency.
- Converted floating-point numbers to integers for coordinates in a particular test function for improved precision.
- Modified floating-point numbers to integers for edges in a specific test function to enhance accuracy.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3727/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3727/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3727",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3727",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3727.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3727.patch",
"merged_at": "2024-03-30T06:03:53Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3728
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3728/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3728/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3728/events
|
https://github.com/materialsproject/pymatgen/pull/3728
| 2,216,203,988
|
PR_kwDOACgets5rNk4a
| 3,728
|
Replace general `raise Exception` and add missing `raise` keyword
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates across various components of a widely used library focus primarily on refining error handling mechanisms. By replacing generic exceptions with more specific ones like `RuntimeError`, `ValueError`, and `KeyError`, as well as ensuring that `NotImplementedError` is properly raised, the changes aim to enhance the clarity and precision of error messages, thereby improving the debugging experience for developers.\n\n## Changes\n\n| File Path | Change Summary |\n|-----------|----------------|\n| `.../coordination_geometries.py`, `.../operations.py`, `.../bandstructure.py`, `.../advanced_transformations.py` | Replaced `Exception` with `RuntimeError` for improved error messaging. |\n| `.../battery/battery_abc.py` | Changed `NotImplementedError` to `raise NotImplementedError` for consistency. |\n| `.../adf.py` | Changed raised exception from `Exception` to `KeyError` for specificity. |\n| `.../io/cif.py` | Improved exception handling by replacing generic exceptions with `ValueError` and `NotImplementedError`. |\n| `.../io/vasp/outputs.py` | Enhanced error handling by using specific exceptions like `ValueError` and `RuntimeError`. |\n\n> 🐰✨ \n> Changes abound, errors more clear, \n> A rabbit hops, spreading cheer. \n> No more confusion in the night, \n> With precise errors, code takes flight. \n> Let's raise a carrot, toast the day, \n> For clearer paths, we've found our way. \n> 🥕🌟\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py:\n- In the `is_a_valid_coordination_geometry` function, changed exception type raised from `Exception` to `RuntimeError`.\n\npymatgen/apps/battery/battery_abc.py:\n- In the `get_sub_electrodes` method of the `Battery` class, changed `NotImplementedError` to `raise NotImplementedError`.\n\npymatgen/core/operations.py:\n- Modified time reversal operator handling:\n - `__init__` method raises a `RuntimeError` if the time reversal value is not -1 or 1.\n - `from_xyzt_str` method now raises a `RuntimeError` when the time reversal operator cannot be parsed.\n\npymatgen/electronic_structure/bandstructure.py:\n- Replaced an `Exception` with `RuntimeError` in a conditional check related to projections and structure object presence.\n\npymatgen/io/adf.py:\n- In the `iterlines` function, changed raised exception from a generic `Exception` to a more specific `KeyError`.\n\npymatgen/io/cif.py:\n- Improved exception handling:\n - Changed `return NotImplementedError` to `raise NotImplementedError`.\n - Replaced `raise Exception` with `raise ValueError` for more specific error indication.\n - Updated the import statement from `from inspect import getfullargspec as getargspec` to `from inspect import getfullargspec` for consistency.\n\npymatgen/io/vasp/outputs.py:\n- Enhanced error handling:\n - Replaced `raise Exception` with specific exceptions like `ValueError` and `RuntimeError`.\n - Updated exception types and messages for better clarity.\n\npymatgen/transformations/advanced_transformations.py:\n- Replaced `Exception` with `RuntimeError` in error handling within the `_remove_dummy_species` function for improved error messaging.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe PR titled \"Replace general `raise Exception` and add missing `raise` keyword\" aims to enhance the codebase by addressing two main issues: replacing generic exceptions with specific ones for clearer error messages and ensuring the correct usage of the `raise` keyword where missing. The PR initially considered using `contextlib.suppress` for exception handling but reverted this change due to significant performance differences compared to traditional `try/except` blocks.\n\n### Comments Summary\n\nDiscussions in the PR comments revolve around the performance impact of using `contextlib.suppress` versus `try/except` blocks. Benchmark tests showed `contextlib.suppress` to be 4 to 5 times slower, leading to a decision to prioritize essential changes like type annotations and bug fixes over syntactic improvements. Janosh highlighted the negligible absolute impact of the performance difference and suggested cleaner testing approaches. Ultimately, the consensus favored reverting the `contextlib.suppress` change until its necessity became more compelling.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR focuses on refining exception handling by replacing generic exceptions with specific ones like `RuntimeError`, `KeyError`, and `ValueError for clearer error messages. It also ensures the correct usage of the `raise` keyword where missing. The PR explored but reverted the use of `contextlib.suppress` due to significant performance differences compared to `try/except` blocks. Changes span multiple files, enhancing error handling in functions related to coordination geometries, battery analysis, operations handling, electronic structure analysis, file I/O, and transformations, contributing to the codebase's robustness and maintainability.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 12f1585ca1c74f67cb8022d454fa7ee6c1bdc79d -->\n<!-- 8b52416a66b17dec39cfb073a15ca4498cefb7f3 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->",
"Sure I would have a test and let you know (happy to revert these if `contextlib` is significantly slower). I'm currently double-checking the `re` pattern for identify missing `raise` keywords (as I did notice some)",
"Could confirm `contextlib` is \"significantly\" (4x time) slower than `try/except`:\r\n```python\r\nimport timeit\r\n\r\ncommon_setup_code = \"\"\"\r\nimport contextlib\r\ntest_list = [0, 1, 2]\r\n\"\"\"\r\n\r\nmethod1_code = \"\"\"\r\ntry:\r\n test_list[10]\r\nexcept IndexError:\r\n pass\r\n\"\"\"\r\n\r\nmethod2_code = \"\"\"\r\nwith contextlib.suppress(IndexError):\r\n test_list[10]\r\n\"\"\"\r\n\r\n# Execute method 1 and measure runtime\r\nmethod1_time = timeit.timeit(stmt=method1_code, setup=common_setup_code, number=100000)\r\n\r\n# Execute method 2 and measure runtime\r\nmethod2_time = timeit.timeit(stmt=method2_code, setup=common_setup_code, number=100000)\r\n\r\nprint(\"Method 1 (except block) time:\", method1_time)\r\nprint(\"Method 2 (contextlib.suppress) time:\", method2_time)\r\n```\r\n\r\nGives:\r\n```\r\nMethod 1 (except block) time: 0.0103234\r\nMethod 2 (contextlib.suppress) time: 0.040782500000000006\r\n```",
"> Could confirm `contextlib` is \"significantly\" (4x time) slower than `try/except`:\r\n\r\nprobably doesn't matter given we're talking about microseconds here but i'm still a bit ambivalent about this change. also, a slightly cleaner test would be to not include the `import contextlib` for `try/except` since it's not needed there and to only import it once in the `contextlib` case since it's then cached for the rest of the Python session",
"> probably doesn't matter given we're talking about microseconds here but i'm still a bit ambivalent about this change. \r\n\r\nI'm quite unsure about this change too. `contextlib.suppress` is much cleaner though being slower (ms difference in 100000 cycles is not a huge difference I guess?). \r\n\r\n> also, a slightly cleaner test would be to not include the `import contextlib` for `try/except` since it's not needed there and to only import it once in the `contextlib` case since it's then cached for the rest of the Python session\r\n\r\nI actually included the import block for both intentionally such that `import` would not be the cause of time difference, here is the updated script (5x this time):\r\n```python\r\nimport timeit\r\n\r\nsetup_code = \"\"\"\r\ntest_list = [0, 1, 2]\r\n\"\"\"\r\n\r\nmethod1_code = \"\"\"\r\ntry:\r\n test_list[10]\r\nexcept IndexError:\r\n pass\r\n\"\"\"\r\n\r\nmethod2_code = \"\"\"\r\nimport contextlib\r\nwith contextlib.suppress(IndexError):\r\n test_list[10]\r\n\"\"\"\r\n\r\n# Execute method 1 and measure runtime\r\nmethod1_time = timeit.timeit(stmt=method1_code, setup=setup_code, number=100000)\r\n\r\n# Execute method 2 and measure runtime\r\nmethod2_time = timeit.timeit(stmt=method2_code, setup=setup_code, number=100000)\r\n\r\nprint(\"Method 1 (except block) time:\", method1_time)\r\nprint(\"Method 2 (contextlib.suppress) time:\", method2_time)\r\n```\r\n\r\ngives:\r\n```\r\nMethod 1 (except block) time: 0.009449200000000001\r\nMethod 2 (contextlib.suppress) time: 0.0490635000000000\r\n```\r\n\r\n",
"Well I guess it's better to focus on changes \"we really need\" at this moment (like type annotation and bug fixes)? I would revert this until we really need it. ",
"@coderabbitai review",
"@janosh Please review. I'm not 100% confident the proper type of `Error` was used, please help me double-check. Thanks!",
"Thanks for reviewing. There seems to be quite a lot of \"catching general exceptions\" as well (`except Exception`), might be good to address this as well."
] | 2024-03-30T04:14:06
| 2024-04-12T05:49:29
|
2024-03-30T07:41:00Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Major changes:
- Some `Exception` is missing the `raise` keyword (thought there would be some as I did notice some in previous clean up, but luckily just found one in fae74b023c07a5805b36faf7871f45ab897c4464) (tried `re` pattern: `^\s?(?!raise)\s+\w+error\(\w?`, `^\s?(?!raise)\s+\w?exception\(\w?`)
- Replace too general `raise Exception` with specific `Error`
Reverted for now:
- Suppress `Exception` with `contextlib.suppress` for simplicity (use `re` pattern: `except\s+.*:\n\s+pass`)
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3728/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3728/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3728",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3728",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3728.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3728.patch",
"merged_at": "2024-03-30T07:41:00Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3729
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3729/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3729/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3729/events
|
https://github.com/materialsproject/pymatgen/pull/3729
| 2,217,124,442
|
PR_kwDOACgets5rQavl
| 3,729
|
Add `pymatgen.io.openff` module
|
{
"login": "orionarcher",
"id": 27712051,
"node_id": "MDQ6VXNlcjI3NzEyMDUx",
"avatar_url": "https://avatars.githubusercontent.com/u/27712051?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/orionarcher",
"html_url": "https://github.com/orionarcher",
"followers_url": "https://api.github.com/users/orionarcher/followers",
"following_url": "https://api.github.com/users/orionarcher/following{/other_user}",
"gists_url": "https://api.github.com/users/orionarcher/gists{/gist_id}",
"starred_url": "https://api.github.com/users/orionarcher/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/orionarcher/subscriptions",
"organizations_url": "https://api.github.com/users/orionarcher/orgs",
"repos_url": "https://api.github.com/users/orionarcher/repos",
"events_url": "https://api.github.com/users/orionarcher/events{/privacy}",
"received_events_url": "https://api.github.com/users/orionarcher/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5653124555,
"node_id": "LA_kwDOACgets8AAAABUPPVyw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/molecules",
"name": "molecules",
"color": "EF81DB",
"default": false,
"description": "Molecule stuff"
},
{
"id": 5952080879,
"node_id": "LA_kwDOACgets8AAAABYsWL7w",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/feature",
"name": "feature",
"color": "241DAB",
"default": false,
"description": "PRs with new features, not enhancements to existing features"
},
{
"id": 6147649573,
"node_id": "LA_kwDOACgets8AAAABbm2wJQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/md",
"name": "md",
"color": "072E9C",
"default": false,
"description": "Molecular dynamics"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->\n\n> [!WARNING]\n> ## Rate Limit Exceeded\n> \n> @janosh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **21 minutes and 28 seconds** before requesting another review.\n> \n> <details>\n> \n> <summary>How to resolve this issue?</summary>\n> \n> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.\n> \n> We recommend that you space out your commits to avoid hitting the rate limit.\n> \n> </details>\n> \n> <details>\n> \n> <summary>How do rate limits work?</summary>\n> \n> CodeRabbit enforces hourly rate limits for each developer per organization.\n> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.\n> Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.\n> \n> </details>\n> \n> <details>\n> <summary>Commits</summary>\n> Files that changed from the base of the PR and between 1410a2e5f15a8a6d85d04803de12f11cf8e432d9 and 780394dbfd2b6a6989f58c661a9c90dd61eb5779.\n> </details>\n\n<!-- end of auto-generated comment: rate limited by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\nThe updates in this version enhance the interoperability between Pymatgen and OpenFF, focusing on molecular analysis and integration improvements. These changes streamline molecular conversions, refine force field handling, optimize dependencies, and enhance testing for a smoother user experience in computational chemistry and materials science.\n\n## Changes\n\n| Files | Summary |\n|-------|---------|\n| `pymatgen/io/openff.py`, `pymatgen/io/babel.py` | Introduced utility functions for molecular conversions and updated OpenBabel method calls for consistency. |\n| `pymatgen/io/abinit/abiobjects.py` | Enhanced key filtering in class methods through dictionary comprehension updates. |\n| `.github/workflows/test.yml`, `requirements-optional.txt`, `setup.py` | Adjusted installation commands and dependencies for improved environment setup. |\n| `tests/io/test_openff.py`, `tests/files/classical_md_mols/CCO.xyz` | Added tests for molecular conversions and introduced new molecular structures. |\n| Tests related to `analysis/chemenv/connectivity` and `cp2k/test_inputs.py` | Refactored serialization logic and renamed test methods for clarity. |\n| `tests/phonon/test_dos.py` | Modified assertion for checking JSON structure prefix in tests. |\n\n> 🐰✨ \n> In the realm where molecules dance, \n> A rabbit hopped, taking a chance. \n> Bridging worlds with a magical flair, \n> OpenFF and Pymatgen, a perfect pair. \n> With tests and tweaks, it leaps ahead, \n> Through code and docs, its wisdom spread. \n> 🌌🔬✨\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/openff.py:\n- Introduces utility functions for converting between Pymatgen and OpenFF molecules.\n- Added functions for converting molecule graphs, inferring molecules, adding conformers, assigning partial charges, and creating OpenFF molecules from SMILES strings and geometries.\n\npymatgen/io/babel.py:\n- In the `pymatgen/io/babel.py` file, the changes involve updating the method calls related to finding force field types in OpenBabel. The `OBForceField_FindType` method calls have been replaced with `OBForceField.FindType` for consistency. Additionally, there are minor adjustments in warning messages and print statements for force field handling.\n\npymatgen/io/abinit/abiobjects.py:\n- In the `abiobjects.py` file of `pymatgen/io/abinit`, the change involves updating a dictionary comprehension by changing the variable name from `k` to `key` within the `from_dict` class method. This modification affects the logic of filtering keys from the input dictionary based on the class fields.\n\n.github/workflows/test.yml:\n- Added new `micromamba install` commands to install `enumlib`, `packmol`, `bader`, `openbabel`, and `openff-toolkit` dependencies within a specific environment named `pmg`. Adjusted the installation of `torch`, `numpy`, `cython`, `ase`, and updated the `pytest` command to activate the `pmg` environment.\n\nrequirements-optional.txt:\n- Added `openbabel>=3.1.1` to the optional requirements in `requirements-optional.txt`.\n\ntests/io/test_openff.py:\n- Included test functions for converting between different molecular representations using OpenFF toolkit and pymatgen. Covered scenarios like transforming molecule graphs, ensuring isomorphism, and validating properties such as atom maps, atom counts, bond counts, and partial charges.\n\ntests/files/classical_md_mols/CCO.xyz:\n- Introduces new molecular structures in XYZ format for molecules containing carbon, oxygen, hydrogen, and fluorine atoms. Introduces a single atom of Lithium positioned at coordinates (0.0, 0.0, 0.0). Defines the coordinates of a PF6 molecule in Cartesian space.\n\nsetup.py: \n- In the `setup.py` file, the change involves uncommenting the dependency on `openbabel` for Linux systems.\n\ntests/analysis/test_graphs.py: \n- In the `test_graphs.py` file, the changes involve importing the `re` module, modifying the error message handling related to inappropriate strategies for molecules, specifically updating the way the error message is constructed using `re.escape` for `match` in the `pytest.raises` block.\n\ntests/analysis/chemenv/connectivity/test_connected_components.py: \n- The functionality change in the `test_connected_components.py` file involves refactoring the serialization logic for `ConnectedComponent` instances. The code now uses JSON serialization exclusively, removing the dependency on `bson` for serialization and deserialization. The test cases have been updated accordingly to reflect this change.\n\ntests/analysis/chemenv/connectivity/test_environment_nodes.py: \n- The changes in the `test_environment_nodes.py` file involve renaming variables related to `EnvironmentNode` instances and updating method calls accordingly. The test methods now use `env_node` instead of `en` for `EnvironmentNode` instances, reflecting these variable name changes. Additionally, the test methods now utilize JSON serialization for `EnvironmentNode` objects.\n\ntests/analysis/chemenv/connectivity/test_structure_connectivity.py: \n- The functionality change in the `test_structure_connectivity.py` file involves replacing a BSON serialization check with JSON serialization, simplifying the code logic and control flow.\n\ntests/files/.pytest-split-durations: ## Short summary\n\nThe change in functionality involves renaming a test method from `test_sectionlist` to `test_section_list` in the `TestInput` class within the `tests/io/cp2k/test_inputs.py` file.\n\ntests/io/cp2k/test_inputs.py: ## Short summary\n\nThe change in functionality involves renaming the `test_sectionlist` function to `test_section_list` in the `test_inputs.py` file, affecting the test method's name.\n\ntests/phonon/test_dos.py: ## Short summary\n\nIn the `test_get_smeared_densities` method, the assertion related to the JSON string has been modified to check for a specific JSON structure prefix.\n\ntests/io/lammps/test_inputs.py: ## Short summary\n\nIn the `test_inputs.py` file, the `maxDiff` attribute has been removed from the `TestLammpsRun` class, specifically from the `test_md` method.\n\ntests/io/qchem/test_inputs.py: ## Short summary\n\nIn the `test_inputs.py` file, the `test_multi_molecule_template` function had the line `self.maxDiff = None` removed.\n\ntests/io/qchem/test_outputs.py: ## Short Summary\n\nIn the `test_outputs.py` file, the `assert_array_equal` function from `numpy.testing` has been replaced with `assert_allclose` with an additional `atol` parameter in two places within the `_test_property` method. This change likely indicates a shift from strict array equality checks to a more tolerant check for numerical closeness.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis Pull Request (PR) aims to integrate the `openff.toolkit` Molecule representation into `pymatgen` through the new `pymatgen.io.openff` module. The goal is to enhance support for `classical_md` workflows in `atomate2` and `emmet` by enabling seamless conversion between `pymatgen` and `openff.toolkit` molecular representations. The PR introduces utility functions for IO operations, restructures testing using micromamba, fixes errors in `babel.py`, and ensures adherence to coding standards with Google format doc strings and type annotations.\n\n### Comments Summary\n\nDiscussions in the PR comments focus on the challenges of integrating OpenFF toolkit dependencies, particularly OpenBabel, into the `pymatgen` testing environment. Contributors explore solutions like building from source or using micromamba for dependency management in CI. Switching to micromamba improved CI performance but revealed failing tests, especially in `test_babel.py`, `analysis/test_graphs.py`, and `io/qchem/test_outputs.py`. Strategies discussed include temporarily disabling tests and seeking assistance from maintainers for debugging.\n\n### AI-Generated Summary of Generated Summaries\n\nThe PR introduces the `pymatgen.io.openff` module for seamless conversion between `pymatgen` and `openff.toolkit` molecular representations, enhancing support for `classical_md` workflows. It includes utility functions for conversions, updates `pymatgen/io/babel.py` for consistency, and adjusts testing infrastructure to use micromamba for faster performance. The PR addresses challenges with OpenBabel integration, highlighting the complexities of managing non-pip dependencies. Overall, it improves molecular modeling workflows by addressing functional and testing infrastructure challenges.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- f52a8df25d9016e016f4769faa55950f56490584 -->\n<!-- b9b36b9c9eba541100acdbeff12b905a7c0114ad -->\n<!-- 2902ea4592a033dc2598f4d1a457bb767361ee50 -->\n<!-- 8eb6b4c435b1b6609641e9e4d68a6873c8a9a627 -->\n<!-- 8a7d9c0fe38e3b3fc9353e696c83b45d17b8d2e1 -->\n<!-- f95e2d51321a69ba48b72ffa26921b7f77144b52 -->\n<!-- 305945cb593162ba802846355ae6e381916bcc96 -->\n<!-- 8cf2cc4a0e7abd5c895c5fb454398c04d2aed9a1 -->\n<!-- 186e365871ba9d4c87ccc360c2810d2e156c76b0 -->\n<!-- 3b88415f03f7d2a1c53d07bed0f23bfab58295d0 -->\n<!-- 0b7b6ebbb5ca2881ddbf111428d58b91d60f4ac4 -->\n<!-- b200a78e4d2be19822db0362268dcbb1c16a9415 -->\n<!-- 49bb35ffc5d48d6ed5b353ceaf606f82c9be5f53 -->\n<!-- 040e701d03bf8b2ddf48c86abfdad81c9f6fe5b2 -->\n<!-- cf2df3213661a98b89c455dde6d7da00f127a1c3 -->\n<!-- 4802525a0f1282dacf2231c9ef92e16d61c09206 -->\n<!-- 7c26ddf801ccd59e0754d365fa6c287cecafa775 -->\n<!-- e07eb5628c991b9b64ef326d8a987cf571107ecb -->\n<!-- 39fe79e4cb5a3a363f53cc56eb5eabf52c018802 -->\n<!-- 347008ea2280009361fcc3d68d5b3db78af681a5 -->\n<!-- f6b384a42c1cd3b6d3d62eaf096a6a763fbbbd7f -->\n<!-- c837d781717215217315b2ce2774cef2bdaa7a4f -->\n<!-- 7389f30675eb5894cba658416af1a1011281a97d -->\n<!-- db4e32474d14f981be168d26202d3e54c6406be5 -->\n<!-- 30be59aa2a1eb060493572635ce98ce5a304c63b -->\n<!-- e023eec8fad9cc45853c40e07eafd10b98569758 -->\n<!-- 1410a2e5f15a8a6d85d04803de12f11cf8e432d9 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"> we could try installing from source in CI\r\n\r\nSounds good! I'll try adding that to the CI.",
"OpenBabel is a core dependency of the OpenFF toolkit, and I don't believe it is pip installable. I believe that's the reason openff doesn't support pip). I believe we'd either have to build it from source OR use conda to install it. \r\n\r\nI know this is a problem in other parts of the MP ecosystem and I am curious how you'd recommend handling it?",
"> OpenBabel is a core dependency of the OpenFF toolkit, and I don't believe it is pip installable. \r\n\r\nI'm interested in hearing about this as well, as `OpenBabel` is not installed in CI as well https://github.com/materialsproject/pymatgen/issues/3684. Feel free to ping me if there is anything I could help with.\r\n\r\n\r\n",
"we used to install `openbabel` in CI with `conda` but it was removed in mid 2022 due to causing frequent issues. see https://github.com/materialsproject/pymatgen/commit/b13c65bd59b1f2b55b769c928a8ab8af7e539181. i'm open to giving it another try but i'd prefer not to install with `conda` and instead follow the [build from source instructions](https://open-babel.readthedocs.io/en/latest/Installation/install.html#basic-build-procedure). `conda` is slow and not currently used in pymatgen CI so would have to be installed first just to install a single dep",
"I'll try building from source.\r\n\r\nWe could conda install openbabel, packmol, and the three required packages from the openff toolkit, which would be a little more worthwhile. A lower overhead option could be [micromamba](https://github.com/marketplace/actions/setup-micromamba) but I think that would require larger changes to the build script. Just a thought!\r\n\r\n",
"Installing `openff-toolkit` from source requires separately installing all dependencies, some of which are only available on conda. I don't think there is a clean way to make testing work in CI without using either `conda` or `micromamba`.",
"let's give `micromamba` a try then? interested to see how it performs here given it's meant to be faster than `conda`",
"I switched over the test suite to use micromamba and the speed is ~20-30% faster on ubuntu and comparable on windows. The test file is also significantly shorter because I switched `bader`, `enumlib`, `openbabel` and `packmol` to mamba installs rather than building from source.\r\n\r\nBy adding openbabel I discovered several failing tests that were flying under the radar and that are now causing CI to fail.\r\n- errors in `test_babel.py` which I fixed\r\n- errors in `analysis/test_graphs.py` and `io/qchem/test_outputs.py` that I am not sure how to debug. These are failing both locally and in the ubuntu CI. It's not an issue in the windows CI because openbabel is not being installed.\r\n\r\n@janosh, what do you recommend as the path forward here?\r\n\r\nShould we:\r\na) merge as is with tests failing?\r\nb) disable the tests and contact the maintainers?\r\nc) have someone (preferably other than me) try to debug the failing tests triggered by the addition of openbabel?",
"@orionarcher luckily fixing the 3 failing tests was fairly easy. fixing the third surfaced a 4 issue so there's still 1 failing test\r\n\r\n> b) disable the tests and contact the maintainers?\r\n\r\ni think we can skip `TestQCOutput.test_all` for now and ping @samblau and @espottesmith. if you guys have time to take a look, feel free to suggest a fix"
] | 2024-03-31T18:26:39
| 2024-04-10T08:15:01
|
2024-04-10T08:15:00Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
This PR adds basic integration with the `openff.toolkit` Molecule representation. It is intended to be use in the `classical_md` workflows in `atomate2` and `emmet`.
Currently, this functionality is downstream in a PR to [atomate2](https://github.com/materialsproject/atomate2/pull/782). As basic IO functionality, I would like to migrate it upstream to `pymatgen`. Especially because some functions will also be used in the `classical_md` `emmet` `Builder`.
Major changes:
- Several utility functions that support IO between `pymatgen.Molecule`/`pymatgen.MoleculeGraph` <-> `openff.toolkit.Molecule`
- Restructure testing to use micromamba
- Fix errors in babel.py
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
- [x] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced utility functions for seamless conversion between Pymatgen and OpenFF molecules, enhancing interoperability.
- Added support for new molecular structures in XYZ format, expanding the range of molecules that can be analyzed.
- **Enhancements**
- Updated method calls for force field types in OpenBabel for improved consistency.
- Enhanced test suite with functions for converting between different molecular representations and ensuring isomorphism.
- **Bug Fixes**
- Adjusted warning messages and print statements for force field handling in OpenBabel integration.
- **Dependencies**
- Added `openbabel>=3.1.1` to optional requirements, broadening the toolkit's compatibility.
- Updated GitHub workflows and setup configurations to include essential dependencies for a more robust testing environment.
- **Refactor**
- Improved code readability and efficiency in several modules by updating variable names and simplifying serialization logic.
- **Tests**
- Expanded testing framework to cover new functionalities and ensure reliability across molecular conversion and analysis tasks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3729/reactions",
"total_count": 4,
"+1": 3,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 1,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3729/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3729",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3729",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3729.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3729.patch",
"merged_at": "2024-04-10T08:15:00Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3730
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3730/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3730/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3730/events
|
https://github.com/materialsproject/pymatgen/pull/3730
| 2,218,984,645
|
PR_kwDOACgets5rWxsP
| 3,730
|
pre-commit autoupdate
|
{
"login": "pre-commit-ci[bot]",
"id": 66853113,
"node_id": "MDM6Qm90NjY4NTMxMTM=",
"avatar_url": "https://avatars.githubusercontent.com/in/68672?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D",
"html_url": "https://github.com/apps/pre-commit-ci",
"followers_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/pre-commit-ci%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Auto Review Skipped\n> \n> Bot user detected.\n> \n> To trigger a single review, invoke the `@coderabbitai review` command.\n\n<!-- end of auto-generated comment: skip review by coderabbit.ai --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with CodeRabbit:\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### CodeRabbit Discord Community\n\nJoin our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-01T20:12:49
| 2024-04-02T05:51:38
|
2024-04-02T05:51:35Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.4 → v0.3.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.4...v0.3.5)
<!--pre-commit.ci end-->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3730/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3730/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3730",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3730",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3730.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3730.patch",
"merged_at": null
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3731
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3731/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3731/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3731/events
|
https://github.com/materialsproject/pymatgen/issues/3731
| 2,219,410,942
|
I_kwDOACgets6ESYX-
| 3,731
|
ValueError:dictionary update sequence element #0 has length 1; 2 is required
|
{
"login": "yjhao11",
"id": 139045226,
"node_id": "U_kgDOCEmpag",
"avatar_url": "https://avatars.githubusercontent.com/u/139045226?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/yjhao11",
"html_url": "https://github.com/yjhao11",
"followers_url": "https://api.github.com/users/yjhao11/followers",
"following_url": "https://api.github.com/users/yjhao11/following{/other_user}",
"gists_url": "https://api.github.com/users/yjhao11/gists{/gist_id}",
"starred_url": "https://api.github.com/users/yjhao11/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/yjhao11/subscriptions",
"organizations_url": "https://api.github.com/users/yjhao11/orgs",
"repos_url": "https://api.github.com/users/yjhao11/repos",
"events_url": "https://api.github.com/users/yjhao11/events{/privacy}",
"received_events_url": "https://api.github.com/users/yjhao11/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"I fixed it.Thank you very much!",
"> I fixed it.Thank you very much!\r\n\r\nHi! Is it possible for you to tell me how to fix it? I am having the same issue as you!"
] | 2024-04-02T01:54:11
| 2024-04-17T20:52:36
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
python3.9
### Pymatgen version
2023.12.18
### Operating system version
ubuntu 22.04 LTS
### Current behavior
when I install atomate2 and configure pymatgen, and then type pmg config --add PMG_VASP_PSP_DIR /abs/path/to/psp PMG_MAPI_KEY my_api_key , there are some errors.
pmg config --add PMG_VASP_PSP_DIR /home/hyj/soft/atomate/pps my_api_key
Traceback (most recent call last):
File "/home/hyj/miniconda3/envs/atomate2/bin/pmg", line 5, in <module>
from pymatgen.cli.pmg import main
File "/home/hyj/miniconda3/envs/atomate2/lib/python3.9/site-packages/pymatgen/cli/pmg.py", line 12, in <module>
from pymatgen.cli.pmg_analyze import analyze
File "/home/hyj/miniconda3/envs/atomate2/lib/python3.9/site-packages/pymatgen/cli/pmg_analyze.py", line 12, in <module>
from pymatgen.apps.borg.hive import SimpleVaspToComputedEntryDrone, VaspToComputedEntryDrone
File "/home/hyj/miniconda3/envs/atomate2/lib/python3.9/site-packages/pymatgen/apps/borg/hive.py", line 15, in <module>
from pymatgen.entries.computed_entries import ComputedEntry, ComputedStructureEntry
File "/home/hyj/miniconda3/envs/atomate2/lib/python3.9/site-packages/pymatgen/entries/__init__.py", line 16, in <module>
from pymatgen.core.composition import Composition
File "/home/hyj/miniconda3/envs/atomate2/lib/python3.9/site-packages/pymatgen/core/__init__.py", line 79, in <module>
locals().update(SETTINGS)
ValueError: dictionary update sequence element #0 has length 1; 2 is required
How to solve? Thank you very much!
### Expected Behavior
How to solve ? Thank you very much!
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3731/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3731/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3732
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3732/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3732/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3732/events
|
https://github.com/materialsproject/pymatgen/pull/3732
| 2,219,813,599
|
PR_kwDOACgets5rZmGH
| 3,732
|
Test `EntrySet.ground_states` and CIF writing in `NEBSet.write_input`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
},
{
"id": 5698361208,
"node_id": "LA_kwDOACgets8AAAABU6YXeA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/dx",
"name": "dx",
"color": "73339B",
"default": false,
"description": "Developer experience"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates across various modules in pymatgen focus on enhancing clarity and consistency. Key changes include renaming variables for better understanding, correcting typos in documentation, and refining function signatures. This contributes to improved readability and usability of the code, making it more accessible for developers and researchers working with materials science computations.\n\n## Changes\n\n| Files | Change Summary |\n|---------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| `.../adsorption.py`, `.../polarization.py`, `.../local_env.py`, `.../lattice.py`, `.../utils.py`, `.../symmetry/kpath.py`, `.../coord_cython.pyx` | Renamed `r` to `radius` or similar for clarity. |\n| `.../bond_valence.py`, `.../ferroelectricity/polarization.py`, `.../electronic_structure/cohp.py` | Corrected typos and renamed variables for clarity. |\n| Various files across `analysis`, `core`, `electronic_structure`, `io`, `phonon`, `symmetry`, `transformations`, `util`, and their submodules | Updated variable names, refined function signatures, and improved documentation for better clarity. |\n| `.../analysis/structure_matcher.py`, `.../entries/entry_tools.py` | Refined return types and refactored logic. |\n| `.../io/lammps/inputs.py`, `.../io/lammps/utils.py` | Improved variable naming consistency. |\n| `tests/...` | Renamed variables in test files for clarity and added assertions. |\n\n> \"In the realm of code, where clarity is king, \n> A rabbit hopped through, making variables sing. \n> 🐇 With a leap and a bound, 'r' became 'radius', quite bright, \n> Typos corrected, in the moon's gentle light. \n> 🌕 A tale of transformation, of clarity and might, \n> In pymatgen's land, where code shines ever so bright.\"\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/adsorption.py: \n- In the `plot_slab` function, renamed `verts` to `vertices` and `r` to `radius` for clarity.\n\n---\n\npymatgen/analysis/bond_valence.py: \n- Corrected typo in docstring for `calculate_bv_sum` and `calculate_bv_sum_unordered`.\n- Renamed `bvsum` to `bv_sum` in `calculate_bv_sum_unordered`.\n\n---\n\npymatgen/analysis/chemenv/utils/coordination_geometry_utils.py: \n- Updated variable names for clarity in `rectangle_surface_intersection` and `solid_angle` functions.\n\n---\n\npymatgen/analysis/ferroelectricity/polarization.py: \n- Updated `get_nearest_site` function to use `radius` instead of `r`.\n\n---\n\npymatgen/analysis/local_env.py: \n- Updated `_semicircle_integral` function to use `radius` instead of `r`.\n\n---\n\npymatgen/analysis/phase_diagram.py: \n- Changed variable names and simplified `uniquelines` function.\n\n---\n\npymatgen/analysis/structure_matcher.py: \n- Refined return type of `get_rms_anonymous` method and updated documentation.\n\n---\n\npymatgen/analysis/surface_analysis.py: \n- Renamed variables for clarity in `surface_analysis.py`.\n\n---\n\npymatgen/core/lattice.py: \n- Renamed `lattice_matrix` to `latt_matrix` and converted `r` to float in `get_points_in_sphere` function.\n\n---\n\npymatgen/core/operations.py: \n- Modified `SymmOp` class methods for improved variable naming.\n\n---\n\npymatgen/core/structure.py: \n- Updated `get_reduced_structure` method and refactored variable names.\n\n---\n\npymatgen/core/surface.py: \n- Updated variable names and added comments for clarity.\n\n---\n\npymatgen/electronic_structure/bandstructure.py: \n- Adjusted parameter declaration and format in `bandstructure.py`.\n\n---\n\npymatgen/electronic_structure/cohp.py: \n- Renamed method `has_antibnd_states_below_efermi` to `has_antiband_states_below_efermi`.\n\n---\n\npymatgen/electronic_structure/plotter.py: \n- Modified `_rgbline` function for plotting RGB lines.\n\n---\n\npymatgen/entries/entry_tools.py: \n- Refactored logic in `ground_states` method using dictionary comprehension.\n\n---\n\npymatgen/ext/cod.py: \n- Renamed variables in `cod.py` methods for consistency.\n\n---\n\npymatgen/ext/matproj.py: \n- Renamed variables in `matproj.py` methods for consistency.\n\n---\n\npymatgen/ext/matproj_legacy.py: \n- Updated variable names for consistency in `matproj_legacy.py`.\n\n---\n\npymatgen/io/lammps/inputs.py: \n- Improved variable naming consistency in `from_str` function.\n\n---\n\npymatgen/io/lammps/utils.py: \n- Renamed variable `s` to `mol` in `run` method.\n\n---\n\npymatgen/io/vasp/help.py: \n- Renamed variables related to HTTP responses for clarity.\n\n---\n\npymatgen/io/vasp/outputs.py: \n- Updated variable names in functions for clarity.\n\n---\n\npymatgen/io/vasp/sets.py: \n- Changed construction of `sites` and updated variable names in `get_structure_from_prev_run` function.\n\n---\n\npymatgen/phonon/plotter.py: \n- Renamed variables in `_make_color` function for clarity.\n\n---\n\npymatgen/symmetry/analyzer.py: \n- Modified translation processing in `_get_symmetry` function.\n\n---\n\npymatgen/symmetry/kpath.py: \n- Renamed variable `r` to `rot_mat` in `_get_magnetic_symmetry_operations` function.\n\n---\n\npymatgen/transformations/advanced_transformations.py: \n- Added type hint to `SubstitutionTransformation` call.\n\n---\n\npymatgen/transformations/standard_transformations.py: \n- Updated `apply_transformation` method in `EwaldMinimizationTransformation` class.\n\n---\n\npymatgen/util/coord.py: \n- Updated function signatures to use `PbcLike` type in `coord.py`.\n\n---\n\npymatgen/util/coord_cython.pyx: \n- Renamed variable `r` to `rng` in `coord_cython.pyx`.\n\n---\n\npymatgen/util/plotting.py: \n- Updated docstring handling in decorator function.\n\n---\n\ntests/electronic_structure/test_cohp.py: \n- Renamed method in `test_cohp.py`.\n\n---\n\ntests/entries/test_entry_tools.py: \n- Renamed variables in loops for clarity.\n\n---\n\ntests/io/vasp/test_sets.py: \n- Added assertion in `test_write_input` function.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of Pull Request (PR) #3732 is to enhance the functionality and readability of the codebase within the pymatgen library, specifically targeting the `EntrySet.ground_states` method and the CIF writing capabilities in the `NEBSet.write_input` method. The PR encompasses a broad scope of modifications, including the implementation of tests for the mentioned methods, code cleanup, and the renaming of single-letter variables to more descriptive names to improve code readability. These changes are spread across various modules within pymatgen, touching upon analysis, core functionalities, input/output operations, and more. The description succinctly encapsulates the essence of the PR, highlighting the dual focus on enhancing functionality and readability through meticulous code refinements.\n\n### AI-generated Summary of Generated Summaries\n\nThis PR introduces a comprehensive set of modifications aimed at refining the pymatgen library's codebase for improved functionality, readability, and consistency. Key changes include:\n\n- **Variable Renaming for Clarity**: Across multiple modules, single-letter variables and ambiguously named variables have been renamed to more descriptive alternatives. For instance, `verts` to `vertices`, `r` to `radius`, and `bvsum` to `bv_sum`, among others. This renaming effort spans various functionalities, including analysis tools, core structures, electronic structure analysis, and more, ensuring that the code is more accessible and understandable.\n\n- **Functionality Enhancements and Refinements**: The PR introduces specific functionality improvements, such as the refactoring of the `ground_states` method in `entry_tools.py` using dictionary comprehension, and the addition of an assertion in the `test_write_input` function within the VASP sets tests. These changes are indicative of a broader effort to optimize the library's performance and reliability.\n\n- **Documentation and Type Hinting Improvements**: Corrections to typos in docstrings and the refinement of method documentation enhance the library's usability. Additionally, the introduction of type hints in certain areas, like the `SubstitutionTransformation` call, contributes to clearer code semantics.\n\n- **Consistency in Variable Naming and Methodology**: Efforts to standardize variable naming and methodological approaches are evident, with changes made in various modules for consistency. This includes updates to variable names in the COD and MatProj extensions, as well as adjustments in the handling of HTTP responses and plotting functions.\n\n- **Code Cleanup**: Beyond functional enhancements and renaming efforts, the PR also includes general code cleanup activities. These range from simplifying complex functions to adding comments for better code comprehension and updating function signatures to use more precise types.\n\nIn summary, PR #3732 significantly enhances the pymatgen library by improving code readability through systematic variable renaming, refining functionality with targeted enhancements, ensuring consistency across the codebase, and cleaning up the code for better maintainability and usability.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- f62708cc9a0d48983b9b82465b9ef3edd2af8802 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-02T07:50:37
| 2024-04-02T08:03:20
|
2024-04-02T08:00:31Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
plus code clean up and single-letter variable renaming for readability
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Improved variable naming and clarity across multiple modules for better readability and consistency.
- **Documentation**
- Corrected typos and updated documentation in various functions for enhanced understanding.
- **Tests**
- Updated test cases with clearer variable names and added assertions for robustness.
- **Bug Fixes**
- Fixed incorrect parameter declarations and refined method return types for accuracy.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3732/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3732/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3732",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3732",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3732.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3732.patch",
"merged_at": "2024-04-02T08:00:31Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3733
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3733/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3733/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3733/events
|
https://github.com/materialsproject/pymatgen/issues/3733
| 2,220,428,823
|
I_kwDOACgets6EWQ4X
| 3,733
|
create a hcp mg grain boundary mgΣ7[0001](0001) too many values to unpack (expected 3)
|
{
"login": "TongaoY",
"id": 141820494,
"node_id": "U_kgDOCHQCTg",
"avatar_url": "https://avatars.githubusercontent.com/u/141820494?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/TongaoY",
"html_url": "https://github.com/TongaoY",
"followers_url": "https://api.github.com/users/TongaoY/followers",
"following_url": "https://api.github.com/users/TongaoY/following{/other_user}",
"gists_url": "https://api.github.com/users/TongaoY/gists{/gist_id}",
"starred_url": "https://api.github.com/users/TongaoY/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/TongaoY/subscriptions",
"organizations_url": "https://api.github.com/users/TongaoY/orgs",
"repos_url": "https://api.github.com/users/TongaoY/repos",
"events_url": "https://api.github.com/users/TongaoY/events{/privacy}",
"received_events_url": "https://api.github.com/users/TongaoY/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"You need to use the 3-integer specification of the rotation axis. Not 4. In hexagonal structures, one of the indices (the third) is redundant. ",
"> You need to use the 3-integer specification of the rotation axis. Not 4. In hexagonal structures, one of the indices (the third) is redundant.\r\n**when I change code as you say:**\r\nfrom pymatgen.core import Structure, Element\r\nfrom pymatgen.analysis.gb.grain import GrainBoundary, GrainBoundaryGenerator\r\n#找到给定西格玛值的所有可能的旋转角度。\r\nangle = GrainBoundaryGenerator.get_rotation_angle_from_sigma(7, [0, 0, 0, 1], lat_type='h')\r\n\r\nstruc = Structure.from_file(\"mg.cif\")\r\ngenerator = GrainBoundaryGenerator(struc)\r\ngb = generator.gb_from_parameters(\r\n [0,0,1],angle[0], \r\n expand_times=4,\r\n vacuum_thickness=1.0,\r\n plane=None\r\n)\r\n\r\ngb.to(filename=\"Mg_GB.cif\")\r\n\r\n**It turns a new wrong:**\r\n---------------------------------------------------------------------------\r\nRuntimeError Traceback (most recent call last)\r\nCell In[4], line 8\r\n 6 struc = Structure.from_file(\"mg.cif\")\r\n 7 generator = GrainBoundaryGenerator(struc)\r\n----> 8 gb = generator.gb_from_parameters(\r\n 9 [0,0,1],21.79, \r\n 10 expand_times=4,\r\n 11 vacuum_thickness=1.0,\r\n 12 plane=None\r\n 13 )\r\n 14 #gb = generator.gb_from_parameters([[1, 0, -1, 0], rotation_angle,angle[0],plane=[1,-2,1,4] , expand_times=4,vacuum_thickness=1.0)\r\n 15 gb.to(filename=\"Mg_GB.cif\")\r\n\r\nFile /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:567, in GrainBoundaryGenerator.gb_from_parameters(self, rotation_axis, rotation_angle, expand_times, vacuum_thickness, ab_shift, normal, ratio, plane, max_search, tol_coi, rm_ratio, quick_gen)\r\n 564 index = reduce(gcd, plane)\r\n 565 plane = [int(round(x / index)) for x in plane]\r\n--> 567 t1, t2 = self.get_trans_mat(\r\n 568 r_axis=rotation_axis,\r\n 569 angle=rotation_angle,\r\n 570 normal=normal,\r\n 571 trans_cry=trans_cry,\r\n 572 lat_type=lat_type,\r\n 573 ratio=ratio,\r\n 574 surface=plane,\r\n 575 max_search=max_search,\r\n 576 quick_gen=quick_gen,\r\n 577 )\r\n 579 # find the join_plane\r\n 580 if lat_type.lower() != \"c\":\r\n\r\nFile /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:1202, in GrainBoundaryGenerator.get_trans_mat(r_axis, angle, normal, trans_cry, lat_type, ratio, surface, max_search, quick_gen)\r\n 1199 r_matrix = (np.array(r_list) / com_fac / sigma).reshape(3, 3)\r\n 1201 if sigma > 1000:\r\n-> 1202 raise RuntimeError(\"Sigma >1000 too large. Are you sure what you are doing, Please check the GB if exist\")\r\n 1203 # transform surface, r_axis, r_matrix in terms of primitive lattice\r\n 1204 surface = np.matmul(surface, np.transpose(trans_cry))\r\n\r\nRuntimeError: Sigma >1000 too large. Are you sure what you are doing, Please check the GB if exist\r\n\r\nBut \r\n\r\nexist\r\n\r\n"
] | 2024-04-02T12:43:00
| 2024-04-02T14:21:42
|
2024-04-02T14:15:28Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python3.10
### Pymatgen version
2024.3.1
### Operating system version
ubuntu22.04-py310-torch2.1.2-tf2.14.0-1.13.1
### Current behavior
from pymatgen.core import Structure, Element
from pymatgen.analysis.gb.grain import GrainBoundary, GrainBoundaryGenerator
angle = GrainBoundaryGenerator.get_rotation_angle_from_sigma(7,[0,0,0,1], lat_type='H',ratio=None)
struc = Structure.from_file("mg.cif")
generator = GrainBoundaryGenerator(struc)
gb = generator.gb_from_parameters(
rotation_axis=[0,0,0,1],
rotation_angle=angle[0],
expand_times=8,
vacuum_thickness=0.0,
plane=None,
)
gb.to(filename="Mg_GB.cif")
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[19], line 10
8 generator = GrainBoundaryGenerator(struc)
9 #gb = generator.gb_from_parameters([0,0,0,1],angle[0], plane = None, expand_times=8, vacuum_thickness=0.0)
---> 10 gb = generator.gb_from_parameters(
11 rotation_axis=[0,0,0,1], # 旋转轴向量,应为长度为3的列表
12 rotation_angle=angle[0], # 旋转角度,假设 `angle` 已经定义并包含所需角度
13 expand_times=8, # 扩展次数
14 vacuum_thickness=0.0, # 真空厚度
15 plane=None, # 平面信息
16 )
17 gb.to(filename="Mg_GB.cif")
File /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:567, in GrainBoundaryGenerator.gb_from_parameters(self, rotation_axis, rotation_angle, expand_times, vacuum_thickness, ab_shift, normal, ratio, plane, max_search, tol_coi, rm_ratio, quick_gen)
564 index = reduce(gcd, plane)
565 plane = [int(round(x / index)) for x in plane]
--> 567 t1, t2 = self.get_trans_mat(
568 r_axis=rotation_axis,
569 angle=rotation_angle,
570 normal=normal,
571 trans_cry=trans_cry,
572 lat_type=lat_type,
573 ratio=ratio,
574 surface=plane,
575 max_search=max_search,
576 quick_gen=quick_gen,
577 )
579 # find the join_plane
580 if lat_type.lower() != "c":
File /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:1110, in GrainBoundaryGenerator.get_trans_mat(r_axis, angle, normal, trans_cry, lat_type, ratio, surface, max_search, quick_gen)
1108 r_matrix = (np.array(r_list) / com_fac / sigma).reshape(3, 3)
1109 else:
-> 1110 u, v, w = r_axis
1111 if lat_type.lower() == "c":
1112 mu = 1
ValueError: too many values to unpack (expected 3)
### Expected Behavior
generate gbs
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "shyuep",
"id": 577107,
"node_id": "MDQ6VXNlcjU3NzEwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/577107?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/shyuep",
"html_url": "https://github.com/shyuep",
"followers_url": "https://api.github.com/users/shyuep/followers",
"following_url": "https://api.github.com/users/shyuep/following{/other_user}",
"gists_url": "https://api.github.com/users/shyuep/gists{/gist_id}",
"starred_url": "https://api.github.com/users/shyuep/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/shyuep/subscriptions",
"organizations_url": "https://api.github.com/users/shyuep/orgs",
"repos_url": "https://api.github.com/users/shyuep/repos",
"events_url": "https://api.github.com/users/shyuep/events{/privacy}",
"received_events_url": "https://api.github.com/users/shyuep/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3733/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3733/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3734
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3734/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3734/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3734/events
|
https://github.com/materialsproject/pymatgen/pull/3734
| 2,222,280,831
|
PR_kwDOACgets5riEVL
| 3,734
|
Fix `ChemicalPotentialDiagram` 2D plot not respecting `formal_chempots` setting
|
{
"login": "uliaschauer",
"id": 22442761,
"node_id": "MDQ6VXNlcjIyNDQyNzYx",
"avatar_url": "https://avatars.githubusercontent.com/u/22442761?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/uliaschauer",
"html_url": "https://github.com/uliaschauer",
"followers_url": "https://api.github.com/users/uliaschauer/followers",
"following_url": "https://api.github.com/users/uliaschauer/following{/other_user}",
"gists_url": "https://api.github.com/users/uliaschauer/gists{/gist_id}",
"starred_url": "https://api.github.com/users/uliaschauer/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/uliaschauer/subscriptions",
"organizations_url": "https://api.github.com/users/uliaschauer/orgs",
"repos_url": "https://api.github.com/users/uliaschauer/repos",
"events_url": "https://api.github.com/users/uliaschauer/events{/privacy}",
"received_events_url": "https://api.github.com/users/uliaschauer/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5322856717,
"node_id": "LA_kwDOACgets8AAAABPURZDQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/data%20viz",
"name": "data viz",
"color": "3C19AC",
"default": false,
"description": "PRs and issues about pymatgen plotting functionality"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n\n## Walkthrough\n\nThe update introduces the `formal_chempots` attribute to the `ChemicalPotentialDiagram` class, enhancing its ability to manage formal chemical potentials. This addition enriches the class's functionality, allowing for more nuanced handling of chemical potential data within the pymatgen library. Additionally, a new test method `test_dim_reduction` was added to `test_chempot_diagram.py` for comparing plots with formal and non-formal data.\n\n## Changes\n\n| File(s) | Change Summary |\n|-----------------------------------------------------|--------------------------------------------------------------------------------------------------|\n| `pymatgen/analysis/chempot_diagram.py` | Added `formal_chempots` attribute to class initialization and method in `ChemicalPotentialDiagram`. |\n| `tests/analysis/test_chempot_diagram.py` | Added `test_dim_reduction` method to compare plots with formal and non-formal data. |\n\n> 🐇✨ \n> In the realm of atoms, where potentials sway, \n> A rabbit hopped in, with an update to play. \n> \"Behold,\" it whispered, with a soft, gleeful cheer, \n> \"Formal chempots are here, bringing data near.\" \n> With a twitch of its nose and a flick of its ear, \n> \"Let's calculate,\" it said, \"without any fear.\" \n> 🌟🐾\n\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/chempot_diagram.py: Added `formal_chempots` attribute to the class initialization and method call in `ChemicalPotentialDiagram` for handling formal chemical potentials.\n\ntests/analysis/test_chempot_diagram.py: Added new test methods `test_dim_reduction` and `test_formal_chempots_get_plot` to compare plots with formal and non-formal data, asserting the correctness of the plotted data points.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request (PR) titled \"subset 2D plot inherits the formal_chempots setting\" (number 3734) aims to address an issue in the `ChemicalPotentialDiagram` class within the pymatgen library. Specifically, it resolves the problem where the `formal_chempots=False` setting from the initial ChemicalPotentialDiagram is not correctly passed on to subset 2D plots created with more than two elements. This results in the unintended display of formal chemical potentials in all cases for such plots.\n\nTo rectify this issue, the PR introduces a significant update to the `ChemicalPotentialDiagram` class. It involves adding a new `formal_chempots` attribute to the class and ensuring that this attribute is appropriately utilized when creating subset ChemicalPotentialDiagram objects. By incorporating this attribute during initialization and in the relevant method, the PR ensures that the formal chemical potential settings are correctly inherited in subset 2D plots, leading to consistent and accurate displays.\n\nThe PR does not outline any additional tasks beyond the implementation of this feature. However, it emphasizes the importance of maintaining coding standards by recommending the use of Google format doc strings, inclusion of type annotations, addition of tests for new functionalities or fixes, and the installation of `pre-commit` hooks for automated type and linting checks before each commit to uphold code quality.\n\n### AI-generated Summary of Generated Summaries\n\nThis PR enhances the `ChemicalPotentialDiagram` class in pymatgen to address formal chemical potential handling in subset 2D plots. By introducing the `formal_chempots` attribute and ensuring its propagation during subset ChemicalPotentialDiagram creation, it enforces consistent display of formal chemical potentials across all plot types. This resolves the issue where formal chemical potential settings were not correctly inherited in subset 2D plots, leading to unintended displays. The PR emphasizes code quality through a checklist advocating for Google format doc strings, type annotations, tests for new features, and the use of `pre-commit` hooks for automated checks.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 3df342cff82212240291a41b3991aef78452fd6e -->\n<!-- a39f89c981c18dc3b7bc0bde9794f7bf8df2947f -->\n<!-- 91b5a6e819de154d6ae0d5106583d1178c357950 -->\n<!-- 0109aae30d08e49eb6d598e80271a4a2dafc1f93 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-03T08:33:37
| 2024-04-05T07:41:35
|
2024-04-05T07:41:35Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
When a ChemicalPotentialDiagram is generated with more than 2 elements and then shown as a 2D plot via an elements argument with two entries, the formal_chempots=False setting of the initial ChemicalPotentialDiagram is not passed on, resulting in formal chemical potentials in all cases.
Major changes:
- added a formal_chempots attribute to the ChemicalPotentialDiagram class
- passed this attribute in get_plot() when creating the subset ChemicalPotentialDiagram object
## Todos
none
## Checklist
- [ ] Google format doc strings added. Check with `ruff`.
- [ ] Type annotations included. Check with `mypy`.
- [ ] Tests added for new features/fixes.
- [ ] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced the ability to handle formal chemical potentials in the Chemical Potential Diagram feature.
- Added a new test method to compare plots with formal and non-formal data.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3734/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3734/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3734",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3734",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3734.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3734.patch",
"merged_at": "2024-04-05T07:41:35Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3735
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3735/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3735/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3735/events
|
https://github.com/materialsproject/pymatgen/issues/3735
| 2,223,141,351
|
I_kwDOACgets6EgnHn
| 3,735
|
Spacegroup P212121 does not give a valid pointgroup
|
{
"login": "lopsided",
"id": 1258160,
"node_id": "MDQ6VXNlcjEyNTgxNjA=",
"avatar_url": "https://avatars.githubusercontent.com/u/1258160?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/lopsided",
"html_url": "https://github.com/lopsided",
"followers_url": "https://api.github.com/users/lopsided/followers",
"following_url": "https://api.github.com/users/lopsided/following{/other_user}",
"gists_url": "https://api.github.com/users/lopsided/gists{/gist_id}",
"starred_url": "https://api.github.com/users/lopsided/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/lopsided/subscriptions",
"organizations_url": "https://api.github.com/users/lopsided/orgs",
"repos_url": "https://api.github.com/users/lopsided/repos",
"events_url": "https://api.github.com/users/lopsided/events{/privacy}",
"received_events_url": "https://api.github.com/users/lopsided/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"The complete bug reproduction code snippet is shown below:\r\n\r\n```python\r\nIn [12]: from pymatgen.symmetry.groups import SpaceGroup, PointGroup\r\n ...: \r\n ...: # Create an instance of the SpaceGroup for 'P212121'\r\n ...: sg = SpaceGroup('P212121')\r\n ...: \r\n ...: # Fetch the point group symbol from the space group\r\n ...: point_group_symbol = sg.point_group\r\n ...: \r\n ...: # Display the space group and its point group symbol\r\n ...: print(f\"Space Group: {sg.symbol}\")\r\n ...: print(f\"Point Group Symbol: {point_group_symbol}\")\r\n ...: \r\n ...: # Now let's try creating the PointGroup.\r\n ...: try:\r\n ...: pg = PointGroup(point_group_symbol)\r\n ...: print(f\"Processed Point Group: {pg}\")\r\n ...: except Exception as e:\r\n ...: print(f\"Error: {e}\")\r\n ...: \r\nSpace Group: P212121\r\nPoint Group Symbol: D2^4\r\nError: 'D2^4'\r\n\r\n```"
] | 2024-04-03T14:46:53
| 2024-08-08T04:49:30
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.9.18
### Pymatgen version
2024.2.8
### Operating system version
Fedora 38
### Current behavior
Loading the SpaceGroup `P212121` works fine, but the `point_group` symbol it reports (`D2^4`) is not recognised. I believe it should be `222`. The issue appears to be here: https://github.com/materialsproject/pymatgen/blob/81dc677462d164182115903e28318cb5cf2ea804/pymatgen/symmetry/groups.py#L223 as the symbol `P212121` is not in `SpaceGroup.sg_encoding` - instead it appears there with the underscores `P2_12_12_1` and the correct pointgroup (`222`). As it can't find it here it uses the `schoenflies` entry of the spacegroup (`D2^4`) instead. I don't know what this is, or how to use it to find the 222 space group..?
At the top of this class some effort is made to duplicate entries for the `SG_SYMBOLS` so they also contain copies without underscores. If this was also done for the `sg_encoding` then the problem would be fixed, but I don't know if that is a reasonable thing to do or if it would cause other problems?
### Expected Behavior
I should be able to instantiate a PointGroup from a SpaceGroup by using the associated point_group symbol
### Minimal example
```Python
sg = SpaceGroup('P212121')
pg = PointGroup(sg.point_group) # Fails
```
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3735/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3735/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3736
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3736/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3736/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3736/events
|
https://github.com/materialsproject/pymatgen/pull/3736
| 2,226,844,109
|
PR_kwDOACgets5rx8jR
| 3,736
|
Avoid using `exec` in code
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5944618676,
"node_id": "LA_kwDOACgets8AAAABYlOutA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/security",
"name": "security",
"color": "5319e7",
"default": false,
"description": "Security issues or fixes"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent update across `pymatgen` LAMMPS-related modules brings improvements in file handling, data manipulation, and code robustness. Changes include adopting Unicode encoding, refining dictionary operations, ensuring default values, enhancing assignments for clarity, and optimizing file processing for efficiency.\n\n## Changes\n\n| Files | Summary |\n|-------|---------|\n| `pymatgen/io/lammps/data.py`, `pymatgen/io/lammps/inputs.py` | - Added `encoding=\"utf-8\"` in file operations.<br>- Simplified dictionary updates.<br>- Managed default values for specific data fields.<br>- Clarified variable assignments for improved readability.<br>- Optimized file parsing and error handling. |\n| `pymatgen/io/lammps/outputs.py` | - Updated file sorting based on a pattern.<br>- Adjusted regular expression handling for file access. |\n\n> 🐇✨ \n> To the code we hop and leap, \n> Through the files, our changes seep. \n> With each line, we aim to enhance, \n> Unicode and syntax dance. \n> A rabbit's touch, so light and deft, \n> Leaves the codebase improved and left. \n> 🌟📄🚀\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/lammps/data.py: ## Short summary\n\n- Added `encoding=\"utf-8\"` parameter in `open` function calls.\n- Changed dictionary update syntax from `body.update({name: section})` to `body[name] = section`.\n- Modified the handling of `topo.charges` to use a default value if `topo.charges` is empty.\n- Updated assignment of `self.force_field` to use `ff_dfs or None` for clarity.\n- Revised the `from_files` method to handle file parsing and clustering more efficiently.\n- Improved error handling for different atom styles in files.\n- Updated type annotations in `from_files` method parameters.\n\npymatgen/io/lammps/inputs.py: ### Short Summary\n\n- In the `ncomments` method, the variable `_args` is used instead of `args` in the list comprehension.\n- In the `merge_stages` method, the condition is changed to check if any stage is not in `self.stages_names` instead of all stages.\n- In the `from_str` method, the construction of the `header` variable is optimized using a list comprehension.\n- In the `_add_comment` method, the condition for inline comments is simplified.\n- In the `md` method, the file is opened with explicit encoding specified.\n- In the `write_lammps_inputs` method, the assignment of `data_filename` is updated using the walrus operator.\n\npymatgen/io/lammps/outputs.py: ### Short Summary\n\nIn the `pymatgen/io/lammps/outputs.py` file, the changes involve modifying how files are sorted based on a pattern and accessing matched groups in regular expressions. Specifically, the sorting of files based on a key function and accessing matched groups in regular expressions have been adjusted to simplify the code logic.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPR #3736 aims to bolster security and code quality in the `pymatgen` library by eliminating the use of `exec`, particularly from untrusted sources like external filenames, to mitigate security risks such as the `xz` backdoor. Additionally, minor enhancements suggested by `sourcery` are applied to refine the codebase.\n\n### Comments Summary\n\n- Request for review by `DanielYang59` directed to `@janosh`.\n- Code changes in `pymatgen/io/lammps/data.py`, `pymatgen/io/lammps/inputs.py`, and `pymatgen/io/lammps/outputs.py` include:\n - Standardizing file operations with `encoding=\"utf-8\"`.\n - Refactoring dictionary updates for clarity.\n - Improving default value handling for specific cases.\n - Enhancing code readability and error handling.\n - Optimizing methods for efficiency and error prevention.\n\n### AI-generated Summary of Generated Summaries\n\nKey changes in PR #3736 for `pymatgen/io/lammps`:\n\n- Enhanced security by removing `exec` usage to mitigate risks from untrusted sources.\n- Standardized file operations with `encoding=\"utf-8\"` for consistency.\n- Improved dictionary operations by switching to direct assignment.\n- Enhanced default value handling for specific scenarios.\n- Clarified code for better readability and maintenance.\n- Optimized methods for improved efficiency and error handling.\n\nThese modifications collectively aim to fortify security, efficiency, and maintainability in the `pymatgen` library's LAMMPS data processing support.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- febea7894c8565c22a1bf948b6ba3d570e6c6f6e -->\n<!-- 0be94350a16df060162d0d43c088b3a36ee0b4b0 -->\n<!-- ebd1184d10421ba2f5e4d7011d371f0b9613c54a -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Can you please review this @janosh. Thanks!",
"Thanks for reviewing! This is the only occurrence of `exec` cross the whole code base AFAIK.",
"I noticed several usage of `eval` across the code base. I would open an PR to avoid them if possible very soon."
] | 2024-04-05T02:34:50
| 2024-05-15T00:59:47
|
2024-04-05T06:10:26Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Avoid using `exec`, especially from potentially untrusted source (external filename in this case) to avoid potential security issue (alerted by the `xz` backdoor)
- Minor `sourcery` fixes
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3736/reactions",
"total_count": 2,
"+1": 2,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3736/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3736",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3736",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3736.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3736.patch",
"merged_at": "2024-04-05T06:10:26Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3739
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3739/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3739/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3739/events
|
https://github.com/materialsproject/pymatgen/pull/3739
| 2,229,650,014
|
PR_kwDOACgets5r7bEX
| 3,739
|
Avoid using `eval`, replace manual offset in `enumerate` and rename single letter variables
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5944618676,
"node_id": "LA_kwDOACgets8AAAABYlOutA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/security",
"name": "security",
"color": "5319e7",
"default": false,
"description": "Security issues or fixes"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Auto Review Skipped\n> \n> More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.\n> \n> 26 files out of 83 files are above the max files limit of 50. Please upgrade to Pro plan to get higher limits.\n\n<!-- end of auto-generated comment: skip review by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent updates across various components of the pymatgen library focus on enhancing code safety, efficiency, and readability. Notable improvements include the optimization of loop logic and conditionals, safer handling of dynamic expressions, and more precise and clear documentation. These changes collectively aim to refine the library's usability and maintainability, ensuring it remains a robust tool for materials science research.\n\n## Changes\n\n| Files | Summary |\n|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `.../analysis/magnetism/heisenberg.py` | - Adjusted loop logic and conditionals<br>- Simplified filename condition<br>- Optimized energy rounding and duplicate removal<br>- Replaced `eval` with `literal_eval` |\n| `.../electronic_structure/boltztrap2.py` | - Unified `dosweight` assignment based on spin polarization<br>- Simplified `structure` assignment<br>- Refined calculation and property access methods |\n| `.../io/vasp/inputs.py` | - Changed parameter type comparison and assignment methods<br>- Removed integer value handling for hashing<br>- Updated docstring for clarity |\n\n> 🐇✨ \n> In the realm of pymatgen, where atoms dance, \n> CodeRabbit hopped through, improving at a glance. \n> Loops were tightened, and safety enhanced, \n> With every line, the code advanced. \n> 🌟'Twas a leap for science, in every stance. \n> 🐾📚\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/magnetism/heisenberg.py: ## Short summary\n\n- In the `_get_nn_dict` method, the loop logic was adjusted to start from index 1 and compare the current element with the next one.\n- In the `get_interaction_graph` method, the condition for adding \".json\" to the filename was simplified.\n- In the `_do_cleanup` method, the tolerance value for energy rounding was moved outside the loop, and the condition for removing duplicates was simplified.\n- In the `from_dict` class method, the use of `eval` was replaced with `literal_eval` for safety.\n\n---\n\npymatgen/electronic_structure/boltztrap2.py: ## Short summary\n\n- Consolidated the assignment of `dosweight` based on `is_spin_polarized`.\n- Simplified conditional assignment for `structure`.\n- Refactored the calculation of `h` in `bandana` method.\n- Updated the assignment of `dosweight` based on `is_spin_polarized`.\n- Modified property access in `plot_props` method.\n\n---\n\npymatgen/io/vasp/inputs.py: ## Short summary\n\n- In the `check_params` method, the comparison for parameter type has been changed to use `type(val).__name__` instead of `isinstance`.\n- In the `from_str` method, the assignment of `m` has been changed to use the walrus operator `:=`.\n- In the `md5_header_hash` method, the handling of integer values for hashing has been removed.\n- The docstring for the `__iter__` method in the `Potcar` class has been updated for clarity.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of Pull Request (PR) #3739 is to enhance the security and maintainability of the codebase by eliminating the use of the `eval` function, which is known for its potential security vulnerabilities. Instead, safer alternatives are employed to achieve the same functionality without compromising security. This PR encompasses modifications across several files within the project, specifically targeting areas where `eval` was previously used and replacing it with `literal_eval` or other safer methods. Additionally, the PR introduces minor formatting tweaks to improve the readability and consistency of the code. These changes span across multiple modules, including `pymatgen/analysis/magnetism/heisenberg.py`, `pymatgen/electronic_structure/boltztrap2.py`, and `pymatgen/io/vasp/inputs.py`, indicating a broad and impactful set of improvements aimed at enhancing the code's overall quality and security posture.\n\n### AI-generated Summary of Generated Summaries\n\nThe Pull Request introduces several key changes across different modules to improve security, readability, and efficiency. Notably, the unsafe `eval` function has been replaced with `literal_eval` in the `from_dict` class method within `pymatgen/analysis/magnetism/heisenberg.py`, directly addressing the primary objective of enhancing security. This module also sees adjustments in loop logic, condition simplifications, and the optimization of tolerance value handling and duplicate removals, contributing to cleaner and more efficient code.\n\nIn `pymatgen/electronic_structure/boltztrap2.py`, the changes focus on refining the logic related to spin polarization and structural assignments, alongside methodological refinements in property access and calculation processes. These modifications streamline the handling of spin-polarized calculations and improve the clarity and performance of property plotting and band analysis methods.\n\nThe `pymatgen/io/vasp/inputs.py` module experiences enhancements in parameter type checking, utilizing the walrus operator for more concise assignment operations, and the removal of unnecessary integer value handling for hashing. Additionally, the documentation for the `__iter__` method in the `Potcar` class has been clarified, aiding in better understanding and usage of the method.\n\nCollectively, these changes across the three modules not only address the critical security concerns associated with the use of `eval` but also introduce several optimizations and clarifications that contribute to the overall maintainability, readability, and efficiency of the codebase. The PR effectively moves the project away from potentially hazardous practices while streamlining various aspects of the code, demonstrating a comprehensive approach to improving the project's quality and security.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 5ca3aff1b81589ca37b03279f1cf6a3f716a4085 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"> sorry for hijacking this PR \r\n\r\nNo worries at all. I'm going off topic a bit too (Just cannot resist the pulse to change them, I understand that).\r\n\r\n> but i'd be interested to get your opinion on these variable renames. single-letter variables are a pet peeve of mine for hurting code readability so been trying to get rid of them for a while\r\n\r\nI would fully support such improvements, which makes the code much more readable (especially without reading the full code block). \r\n\r\nBut for some simple cases, I sometimes think it might not be necessary \r\n- Very simple and widely accepted cases like `i/j` for index, `k/v` for `key/value`\r\n- Where the var is immediately returned (mostly list comprehensions like `[idx for idx, site in enumerate(structure) if condition]`)\r\n\r\nFor some cases, using a more detailed var name is much better\r\n- When similar name could occur, which could be very confusing, for example the `core.surface` I'm currently cleaning up, I need to guess `c` stands for cluster or c-coordinate\r\n- When the var name is carried for a long distance (I would easily forget what it stands for if it needs to go dozens lines forward)\r\n- When people don't want to read the full code block\r\n",
"@janosh Please review. Thanks!",
"`ruff` has had [limited auto-typing ability](https://docs.astral.sh/ruff/rules/missing-return-type-special-method) for a while.\r\n\r\ni just ran\r\n\r\n```sh\r\nruff check . --select ANN204 --unsafe-fixes\r\nFound 674 errors.\r\n[*] 550 fixable with the --fix option.\r\n```\r\n\r\nwould you be interested in submitting a PR with those changes as a followup to #3705?",
"> `ruff` has had [limited auto-typing ability](https://docs.astral.sh/ruff/rules/missing-return-type-special-method) for a while.\r\n> \r\n> i just ran\r\n> \r\n> ```shell\r\n> ruff check . --select ANN204 --unsafe-fixes\r\n> Found 674 errors.\r\n> [*] 550 fixable with the --fix option.\r\n> ```\r\n> \r\n> would you be interested in submitting a PR with those changes as a followup to #3705?\r\n\r\nWow this sounds very interesting (always amazed how much you know about all kinds of stuff). I would have a go at this after I finish cleaning up `core.surface`. Thanks for the useful input."
] | 2024-04-07T09:22:07
| 2024-05-15T01:00:27
|
2024-04-07T10:51:29Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Replace `eval` with safer alternatives
- Replace manual offset in `enumerate` with the `start` argument
- Minor format tweaks
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3739/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3739/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3739",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3739",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3739.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3739.patch",
"merged_at": "2024-04-07T10:51:28Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3740
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3740/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3740/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3740/events
|
https://github.com/materialsproject/pymatgen/pull/3740
| 2,229,778,494
|
PR_kwDOACgets5r72F5
| 3,740
|
Add type annotations for `io.vasp.inputs/optics`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->\n\n> [!WARNING]\n> ## Rate Limit Exceeded\n> \n> @DanielYang59 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **27 minutes and 11 seconds** before requesting another review.\n> \n> <details>\n> \n> <summary>How to resolve this issue?</summary>\n> \n> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.\n> \n> We recommend that you space out your commits to avoid hitting the rate limit.\n> \n> </details>\n> \n> <details>\n> \n> <summary>How do rate limits work?</summary>\n> \n> CodeRabbit enforces hourly rate limits for each developer per organization.\n> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.\n> Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.\n> \n> </details>\n> \n> <details>\n> <summary>Commits</summary>\n> Files that changed from the base of the PR and between 2954c809b3daca54a403dd381e8d4bba534090f2 and 2991771b90e29847da5ccd7af6e54d95a9298b5b.\n> </details>\n\n<!-- end of auto-generated comment: rate limited by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\n\nThis update primarily focuses on enhancing code clarity and reliability across the pymatgen library and associated scripts. Key changes include the introduction of explicit type annotations for variables and attributes, the addition of timeouts to HTTP requests to prevent hanging processes, and minor adjustments such as renaming variables and updating method signatures. These modifications aim to improve the maintainability and performance of the codebase, ensuring more robust and clear code structure.\n\n## Changes\n\n| File Path | Change Summary |\n|------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| `dev_scripts/update_pt_data.py` | Added a 60-second timeout to HTTP requests. |\n| `pymatgen/.../filters.py`, `transmuters.py` | Specified `structure_list` and `structure_data` as lists. |\n| `pymatgen/analysis/...` | Updated various attributes to explicitly specify types such as lists and dictionaries. |\n| `pymatgen/apps/...`, `pymatgen/command_line/...` | Enhanced clarity with type hints and modified variable handling. |\n| `pymatgen/ext/...`, `pymatgen/io/...` | Added timeouts to HTTP requests, updated type annotations in various I/O related files. |\n| `pymatgen/transformations/...`, `pymatgen/vis/...` | Updated type specifications for attributes and parameters. |\n| `tasks.py`, `tests/ext/...` | Standardized the addition of a 60-second timeout across various test and task scripts. |\n| `tests/io/vasp/test_outputs.py` | Applied `@pytest.mark.skip()` decorator to skip certain tests, no significant functionality changes. |\n\nThis table groups files with similar changes, focusing on type annotations and the addition of timeouts, which are prevalent throughout this update.\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n```plaintext\ndev_scripts/update_pt_data.py: Added a timeout of 60 seconds to the HTTP request when fetching data from a Wikipedia page for updating electron affinities in the periodic table data.\n\npymatgen/alchemy/filters.py: Updated the declaration of the `structure_list` attribute to explicitly specify its type as a list.\npymatgen/alchemy/transmuters.py: Updated the declaration of the `structure_data` variable to explicitly specify its type as a list.\n\npymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py: Updated the declaration of the `separations_cg` attribute to explicitly specify its type as a dictionary.\npymatgen/analysis/chemenv/coordination_environments/structure_environments.py: Updated the declaration of `coord_geoms` in the `ChemicalEnvironments` class to explicitly specify its type as a dictionary.\n\npymatgen/analysis/ewald.py: Updated the declaration of the `_output_lists` attribute to explicitly specify its type as a list.\npymatgen/analysis/structure_prediction/substitution_probability.py: Updated the `_px` attribute's type annotation to specify it as a `defaultdict`.\n\npymatgen/analysis/wulff.py: Updated the `points` and `outer_lines` attributes to be explicitly typed as lists using type hints.\n\npymatgen/apps/battery/plotter.py: Updated the declaration of the `_electrodes` attribute to explicitly specify its type as a dictionary. Additionally, type hints have been added to method parameters and return types for improved code clarity.\npymatgen/apps/borg/queen.py: Updated the declaration of the `_data` attribute to explicitly specify its type as a list.\n\npymatgen/cli/pmg_analyze.py: In the `get_magnetizations` function, renamed variable `mags` to `_mags` to avoid shadowing.\n\npymatgen/command_line/vampire_caller.py: Modified the handling of subprocess output by explicitly typing the `stdout` variable as a string after decoding it.\n\npymatgen/core/interface.py: The `__str__` method now explicitly specifies its return type as `str`.\npymatgen/core/structure.py: Modified the `from_str` function call related to reading a POSCAR file by changing the argument `default_names=False` to `default_names=None`.\n\npymatgen/ext/cod.py: Added a timeout of 60 seconds to the HTTP requests made in the `get_structure_by_id` and `get_structure_by_formula` functions.\npymatgen/ext/matproj_legacy.py: Included a timeout parameter in the `requests.get` call in the `_check_nomad_exist` method, setting it to 60 seconds.\n\npymatgen/io/abinit/abitimer.py: Updated the type annotations for `_filenames` to explicitly specify it as a list and for `_timers` to explicitly specify it as a dictionary.\npymatgen/io/abinit/pseudos.py: Specified the type of `_parsed_paths` and `_wrong_paths` as lists. In the `PseudoPotential` class, the types of `valence_states` and `rad_grids` are now explicitly defined as dictionaries.\n\npymatgen/io/cp2k/outputs.py: Updated the type annotations for `self.filenames` and `self.data` to explicitly specify them as dictionaries. Also updated the types for `self.structures` and `self.ionic_steps` to explicitly indicate them as lists.\n\npymatgen/io/pwscf.py: Updated the type annotation for the `data` attribute in the `PWSCFOutput` class to specify `defaultdict` explicitly.\n\npymatgen/io/qchem/inputs.py: Added type annotations to the `__str__` method, specifying the return type as `str` and declaring `combined_list` as a list explicitly.\n\npymatgen/io/vasp/help.py: Added type annotations to method parameters and return types, specifying `str` for `tag` parameters and return types for methods. Also included a `timeout` parameter set to 60 in `requests.get` calls.\npymatgen/io/vasp/optics.py: Updated variable declarations to explicitly specify types as `float`. Adjusted method signatures and added type annotations for various functions.\npymatgen/io/vasp/outputs.py: ## Short summary\n- Added return type annotations to several class and function `__init__` methods.\n- Changed the type annotations for attributes like `run_stats`, `data`, `weights`, `headers`, `phase_factors`, `coords_str`, and `mesh` to be more specific.\n- Updated the type annotations for lists and dictionaries used in various methods.\n- Added return type annotations to the `__str__` method of a class.\n- Modified the type annotations for variables like `band_energy`, `Gpoints`, `tcoeffs`, and `t` to be more specific.\n- Adjusted the type annotations for variables in assignments within methods.\n- Updated the type annotation for the `data` attribute in the `PWSCFOutput` class to specify `defaultdict` explicitly.\n\npymatgen/io/xtb/outputs.py: Updated the type annotations for `cmd_options` to a dictionary type and for `sorted_structures_energies` to a list type.\n\npymatgen/transformations/advanced_transformations.py: Updated the `ab_shift` parameter in the `__init__` method to accept a tuple of floats instead of a list of floats.\npymatgen/transformations/standard_transformations.py: Updated the declaration of the `_all_structures` attribute to explicitly specify its type as a list.\n\npymatgen/vis/plotters.py: Updated the type annotations for the `colors` and `_spectra` attributes to explicitly specify them as `list` and `dict` types, respectively.\npymatgen/vis/structure_vtk.py: Updated the declaration of the `mapper_map` attribute to explicitly specify its type as a dictionary.\n\ntasks.py: Added a timeout of 60 seconds to the `requests.get` call for fetching pull request information from GitHub.\n\ntests/ext/test_cod.py: Added a timeout of 60 seconds to the `requests.get` call for the URL \"https://www.crystallography.net\".\ntests/ext/test_matproj.py: Added a timeout of 60 seconds to HTTP requests made to \"https://materialsproject.org\" in the `test_matproj.py` file, ensuring that requests do not hang indefinitely.\ntests/ext/test_optimade.py: Added a timeout of 60 seconds to requests made to different URLs, including \"https://providers.optimade.org\" and specific aliases.\n\ntests/io/vasp/test_outputs.py: ## Short summary\n- Added `@pytest.mark.skip()` decorator to multiple test methods in the `TestVasprun` class.\n- No significant changes in functionality, just skipping the execution of certain tests.\n```\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3740, is titled \"Add type annotations for `io.vasp.inputs/optics`\" and focuses on enhancing the type annotations within the `io.vasp.inputs/optics` module of the pymatgen library. The main objectives outlined in the PR description include:\n\n1. Adding type annotations to the specified module to improve code clarity and maintainability.\n2. Replacing the use of `str` as a path type with `PathLike` to standardize file path handling across the module.\n3. Making adjustments to docstrings to improve documentation consistency and clarity.\n\nThe PR was initially proposed following a suggestion by @janosh to experiment with the `ruff` tool for auto-fixing type annotations specifically for \"special\" methods as indicated by the rule `ANN204`. This rule checks that methods like `__init__`, `__new__`, and `__call__` have return type annotations. The use of `ruff` unearthed 135 `mypy` errors, indicating a significant need for manual type annotation efforts across the module.\n\n### Comments Summary\n\nThe discussion in the PR comments revolves around the methodology of implementing type annotations across the pymatgen library. Initially, there was a suggestion to apply type annotations globally using the `ruff` tool, but concerns were raised about the piecemeal approach leading to inconsistent type coverage and potentially loose type definitions due to interdependencies within modules.\n\nA consensus was reached to tackle the type annotation effort module by module, starting with `pymatgen/io/vasp`. This approach aims to maintain consistency and manageability in the type annotation process. The PR will not be closed but instead refocused to start with the `io/vasp` module.\n\nAdditionally, there was a discussion about the order of methods within classes, specifically about relocating class methods such that dunder methods and properties come first. However, concerns were raised about this causing pollution in the git history, with no straightforward solution to mitigate this side effect.\n\n### AI-Generated Summary of Generated Summaries\n\nThe pull request introduces extensive type annotations across various modules of the pymatgen library, focusing particularly on the `io/vasp` module. Key changes include:\n\n- Explicit type specifications for attributes and method return types across multiple files, enhancing code clarity and type checking robustness.\n- Introduction of `PathLike` for file path definitions, replacing `str` types to standardize file handling.\n- Adjustments in method signatures and attribute types to align with more precise type definitions, such as specifying list and dictionary types explicitly.\n- Timeout parameters have been added to HTTP requests in several modules to prevent indefinite hanging during data fetching operations.\n- Some organizational changes in code structure, such as method relocations within classes, although this has raised concerns regarding the impact on git history.\n\nOverall, these changes aim to improve the maintainability, readability, and performance of the pymatgen library by enforcing more stringent type checks and clearer code documentation practices.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- ff52da8eee2960707f0235354d06ccc4dc657967 -->\n<!-- cee21ef7d8001fe4c82855282f64aca6ef4ddd0f -->\n<!-- aab17cd0ae49282f4d4f3c1d56d21b0a197099b0 -->\n<!-- 555e609e4c2dac2982d4f061d255d93f99f99826 -->\n<!-- e8055cdc0ec13ff002d09bdf610c5338d2132155 -->\n<!-- 2954c809b3daca54a403dd381e8d4bba534090f2 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@janosh I re-visited this PR and realized it might not be a good idea to work on a single method globally like this, we should push the type annotation effort module by module. \r\n\r\nThough I agree `ruff` auto-fix is looking promising but we should not run it globally.\r\n\r\nMy reason being: by working like this, we're just adding types for a single (or very few) function among many other un-typed functions. But as the types within a module heavily depend on others, it would either dig out huge amount of extra work, or make the type very loose.\r\n\r\nI would prefer close this and push our type-annotation effort module by module as discussed previously (starting for `core`, `io.vasp`, `electronic`, `phonon` and such). What do you think?",
"going folder by folder sounds good. no need to close this PR though, we can just start with `pymatgen/io/vasp` in this one.\r\n\r\ni just reverted the initial \r\n\r\n```sh\r\nruff check . --select ANN204 --unsafe-fixes --fix\r\n```\r\n\r\nand force pushed\r\n\r\n```sh\r\nruff check pymatgen/io/vasp --select ANN204 --unsafe-fixes --fix\r\n```\r\n\r\ninstead and keeping your manual fixes. you just need to run `git reset --hard @{u}` to get back to the tip of this branch",
"> going folder by folder sounds good. no need to close this PR though, we can just start with `pymatgen/io/vasp` in this one.\r\n\r\nGood point. Let's do it.\r\n\r\n> instead and keeping your manual fixes. you just need to run `git reset --hard @{u}` to get back to the tip of this branch\r\n\r\nThere aren't many valuable fixes though. Thanks for the tip!\r\n\r\n",
"I'm trying to relocate the class methods such that dunder methods and properties come first. But this seems to pollute git history. Wondering if there is a way to relocate codes without such side effect? ",
"@coderabbitai review",
"Can you please review this @janosh? I decided to separate the work for different modules as there are too many changes. Some return types are removed for completely un-typed `__init__` in io.vasp.outputs to avoid `mypy` checking for now, I would work on it later.\r\n\r\nThere is one minor fix for the default value of `default_names` in https://github.com/materialsproject/pymatgen/pull/3740#discussion_r1569868926.\r\n\r\nUPDATE: ~~And there are two requests for changing the default values for type compatibility in https://github.com/materialsproject/pymatgen/pull/3740#discussion_r1570594077.~~\r\n\r\nOther than these two, I don't expect further functional changes (the unit test failure is related to the requested default value change, I would need your confirmation before I could change the unit test :) ). Thanks!\r\n",
"> Wondering if there is a way to relocate codes without such side effect?\r\n\r\nnot really. have a look at [this video](https://youtu.be/qYJWBJvHqj0) which doesn't solve your problem but is slightly relevant",
"> > Wondering if there is a way to relocate codes without such side effect?\r\n> \r\n> not really. have a look at [this video](https://youtu.be/qYJWBJvHqj0) which doesn't solve your problem but is slightly relevant\r\n\r\nThanks. It's always great to know more tips :)\r\n\r\nShould be ready for reviewing then. I reverted the default values to `None`. Thanks!\r\n",
"Thanks for reviewing!\r\n\r\n> given the generic type annotations like `var_name: list = []` are easy to find and fix later\r\n\r\nYes I don't know how `mypy` made those decisions, but it seems to require type annotations for some unrelated and un-typed code sections. Such general types were added to stop such `mypy` complaints :)\r\n\r\n"
] | 2024-04-07T13:41:59
| 2024-04-21T12:12:10
|
2024-04-21T09:41:47Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Add type annotations for `io.vasp.inputs/optics`
- Replace `str` as path type with `PathLike`
- Docstring tweaks
### Originally
Proposed by @janosh in https://github.com/materialsproject/pymatgen/pull/3739#issuecomment-2041429466.
- Run `ruff check . --select ANN204 --unsafe-fixes` to auto-fix "ANN204", to experiment on auto typing fix with `ruff`.
- 135 `mypy` errors were dug out and need to be fixed.
[`ANN204`](https://docs.astral.sh/ruff/rules/missing-return-type-special-method/) refers to:
> Checks that "special" methods, like `__init__`, `__new__`, and `__call__`, have return type annotations.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Added a 60-second timeout to HTTP requests across various modules to improve system reliability during data fetching.
- **Refactor**
- Enhanced code clarity by specifying explicit types for various attributes and variables across multiple modules.
- **Bug Fixes**
- Adjusted handling of subprocess output and method argument defaults to prevent errors and improve data handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3740/reactions",
"total_count": 2,
"+1": 2,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3740/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3740",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3740",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3740.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3740.patch",
"merged_at": "2024-04-21T09:41:47Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3741
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3741/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3741/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3741/events
|
https://github.com/materialsproject/pymatgen/pull/3741
| 2,232,416,821
|
PR_kwDOACgets5sE542
| 3,741
|
Update ENCUT type to float in incar_parameters.json
|
{
"login": "yuuukuma",
"id": 4986887,
"node_id": "MDQ6VXNlcjQ5ODY4ODc=",
"avatar_url": "https://avatars.githubusercontent.com/u/4986887?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/yuuukuma",
"html_url": "https://github.com/yuuukuma",
"followers_url": "https://api.github.com/users/yuuukuma/followers",
"following_url": "https://api.github.com/users/yuuukuma/following{/other_user}",
"gists_url": "https://api.github.com/users/yuuukuma/gists{/gist_id}",
"starred_url": "https://api.github.com/users/yuuukuma/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/yuuukuma/subscriptions",
"organizations_url": "https://api.github.com/users/yuuukuma/orgs",
"repos_url": "https://api.github.com/users/yuuukuma/repos",
"events_url": "https://api.github.com/users/yuuukuma/events{/privacy}",
"received_events_url": "https://api.github.com/users/yuuukuma/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThis update brings a nuanced but pivotal modification to the pymatgen library, specifically within the VASP input configuration. The essence of the change revolves around enhancing the precision of the `ENCUT` parameter by transitioning its data type from an integer to a float, thereby allowing for more refined energy cutoff specifications in simulations.\n\n## Changes\n\n| File Path | Change Summary |\n|----------------------------------------|------------------------------------------------|\n| `.../io/vasp/incar_parameters.json` | Changed `ENCUT` parameter type from `int` to `float` |\n\n> 🐇✨ \n> In the realm of atoms and ions, where precision is key, \n> A rabbit hopped through the code, with a tweak so free. \n> \"Let the `ENCUT` be float,\" it said with glee, \n> For a world more precise, as fine as can be. \n> Hop, hop, hop, on the path to discovery! \n> 🌟🐾 \n\n\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/vasp/incar_parameters.json: ## Short summary\n\nThe change in functionality involves altering the data type of the `ENCUT` parameter from `int` to `float` in the `incar_parameters.json` file.\n\n\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of Pull Request (PR) #3741 is to update the data type of the `ENCUT` parameter within the `incar_parameters.json` file, which is part of the pymatgen library's VASP (Vienna Ab initio Simulation Package) input settings. The PR title succinctly states the intention: \"Update ENCUT type to float in incar_parameters.json\". The description further clarifies the necessity of this change, indicating that the `ENCUT` parameter, which is used in VASP INCAR settings, should be of type float rather than its previous type, int. This modification is aimed at enhancing the flexibility and accuracy of VASP simulations by allowing for non-integer values of the `ENCUT` parameter, which specifies the plane-wave energy cutoff in electronvolt (eV). This change is technical and specific, focusing solely on the data type alteration of a single parameter within a JSON configuration file. There are no linked issues mentioned in the provided details, suggesting that this change might be a direct improvement or correction rather than a response to a reported issue.\n\n### AI-generated Summary of Generated Summaries\n\nThe modification made in PR #3741 involves a precise and singular change: the data type of the `ENCUT` parameter in the `incar_parameters.json` file, part of the pymatgen library's VASP settings, has been updated from an integer (int) to a floating-point number (float). This adjustment is aimed at enhancing the precision and flexibility of specifying the plane-wave energy cutoff in VASP simulations, reflecting the need for more nuanced control over simulation parameters.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 070996a3a4467fe38770e6913d9d029a921bb0c8 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Thanks @yuuukuma!"
] | 2024-04-09T01:07:17
| 2024-04-12T05:49:49
|
2024-04-09T03:41:05Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
ENCUT in VASP INCAR settings should be float
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Updated the data type for the `ENCUT` parameter to enhance precision in calculations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "mkhorton",
"id": 2976580,
"node_id": "MDQ6VXNlcjI5NzY1ODA=",
"avatar_url": "https://avatars.githubusercontent.com/u/2976580?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mkhorton",
"html_url": "https://github.com/mkhorton",
"followers_url": "https://api.github.com/users/mkhorton/followers",
"following_url": "https://api.github.com/users/mkhorton/following{/other_user}",
"gists_url": "https://api.github.com/users/mkhorton/gists{/gist_id}",
"starred_url": "https://api.github.com/users/mkhorton/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/mkhorton/subscriptions",
"organizations_url": "https://api.github.com/users/mkhorton/orgs",
"repos_url": "https://api.github.com/users/mkhorton/repos",
"events_url": "https://api.github.com/users/mkhorton/events{/privacy}",
"received_events_url": "https://api.github.com/users/mkhorton/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3741/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3741/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3741",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3741",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3741.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3741.patch",
"merged_at": "2024-04-09T03:41:05Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3743
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3743/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3743/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3743/events
|
https://github.com/materialsproject/pymatgen/pull/3743
| 2,232,525,514
|
PR_kwDOACgets5sFRA0
| 3,743
|
Replace unnecessary usage of `len` for iterable existence check
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates across the pymatgen library aim to enhance code efficiency and readability by simplifying conditional checks and leveraging truthiness. These changes streamline logic and improve code clarity, reflecting a commitment to optimizing the library's functionality.\n\n## Changes\n\n| Files | Summary |\n|------------------------------------|----------------------------------------------------------------------------------------------------------|\n| `pymatgen/core/lattice.py`, `.../structure.py`, `.../mixing_scheme.py`, `.../io/cif.py` | Streamlined logic and improved readability by replacing length checks with truthiness conditions for enhanced code efficiency. Various warnings and method adjustments also implemented for better code maintenance. |\n\n> 🐰✨ \n> To the code we hop and bound, \n> Where truthiness in logic is found. \n> Simplifying checks, making code light, \n> Pymatgen shines ever bright. \n> Cheers to efficiency, our coding creed, \n> In the realm of logic, we take the lead! \n> 🌟📚\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/core/lattice.py, pymatgen/core/structure.py: ## Short summary\n- In `pymatgen/core/lattice.py`, streamlined logic by replacing `len(neighbors) < 1` with `not neighbors` in `get_points_in_sphere_py` and `len(valid_coords) < 1` with `not valid_coords` in `get_points_in_spheres`.\n- In `pymatgen/core/structure.py`, improved readability by replacing `len(some_list) > 0` checks with `if some_list` in various methods related to neighbor lists, site manipulation, and species removal.\n\npymatgen/entries/mixing_scheme.py: ## Short summary\n- The changes in the `mixing_scheme.py` file involve simplifying conditional checks by replacing `len(df) > 0` with truthy checks like `if df`. This modification streamlines the logic by leveraging the truthiness of dataframes for more concise code.\n\npymatgen/io/cif.py: ## Short summary\n- The condition checks for the presence of certain data have been simplified by replacing `len(some_list) > 0` with `if some_list`.\n- Various warnings are appended based on conditions related to data processing.\n- Changes have been made to match new specifications, triggering warnings accordingly.\n- The method `get_structures` now uses `if args` instead of `len(args) > 0` for argument extraction.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request aims to enhance code readability and efficiency across the pymatgen codebase by eliminating unnecessary usage of the `len` function for iterable existence checks. Specifically, it targets instances where the code checks for the presence or absence of elements in an iterable (such as a list or dictionary) using `len(x) > 0` and `len(x) < 1`. These checks are replaced with more Pythonic and concise expressions: `if x` to replace `if len(x) > 0`, and `if not x` to replace `if len(x) < 1`. This change not only simplifies the code, making it easier to read and understand, but also aligns with Python's idiomatic practices that leverage the truthiness of iterables, where empty sequences are considered `False` and non-empty sequences are considered `True`.\n\n### AI-generated Summary of Generated Summaries\n\nThe pull request simplifies conditional checks in pymatgen by replacing verbose `len` comparisons with more concise and Pythonic iterable existence checks. Key changes include:\n\n- Refinement in `pymatgen/analysis/bond_valence.py` to use more concise iterable checks for `icsd_bv_data` initialization based on the presence or absence of `forbidden_species`.\n- Streamlined conditional checks across various pymatgen modules, including analysis tools, CLI interfaces, I/O handlers, and core functionalities, by replacing `if len(list) > 0` with more succinct `if list` or `not list` expressions. This simplification applies to methods handling lists, dictionaries, and general logic, enhancing code readability.\n- Updates in specific test cases in `tests/core/test_periodic_table.py` and `tests/io/aims/test_sets/test_input_set.py` to reflect these changes, such as direct truthiness assessment of `el.oxidation_states` in the periodic table test and simplification of a list comprehension for line stripping in an input set test.\n\nOverall, the PR refines the pymatgen codebase by replacing verbose iterable existence checks with cleaner, more Pythonic expressions, improving code readability and adherence to best practices.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- e72f936b804501107f110b0001d11862a755b867 -->\n<!-- 5a60fce5cf68892d2d6c0d35c0b6c31db1c8f43d -->\n<!-- 11694e5012141fb559df6dd77f0e3bfbcff7a494 -->\n\n<!-- commit_ids_reviewed_end --><!-- tweet_start -->\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<!-- tweet_end --><!-- tips_start -->\n\n---\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"> i think if len(lst) > 0: is more explicit and can be more readable than if lst: but don't feel strongly about that.\r\n> \r\n> would be interested to hear other's opinions. maybe @mkhorton wants to chime in?\r\n\r\nI like the first one more. (Sorry not sure how I ended up editing the old post 😬. Sometimes, I am a bit distracted.) Also funny how there are two exactly opposite recommendations by code rabbit 😅",
"It's not strongly held by me too (though stronger for the \"`if len(x) < 1` -> `if not x`\" replacement). I think the readability of `if var` strongly depends on how descriptive (indicating its an iterable) the variable name is. \r\n\r\nFeel free to close this if you think it's adding ambiguity.",
"I would close this for now until someone decide it's necessary. Sorry for the confusion 😄 "
] | 2024-04-09T03:17:17
| 2024-04-09T10:00:22
|
2024-04-09T10:00:22Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Replace unnecessary usage of `len` for iterable existence check:
- `if len(x) > 0` replaced with `if x`
- `if len(x) < 1` replaced with `if not x`
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Streamlined logic in lattice module for improved efficiency.
- Enhanced readability by replacing length checks with boolean evaluations.
- Simplified conditional checks in structure module for better readability.
- Improved initialization logic for bond valence calculations, enhancing compatibility with specific species.
- Simplified conditional checks in mixing scheme module for streamlined logic.
- Simplified condition checks for data presence in CIF module.
- Updated method in CIF module to use boolean evaluation for argument extraction.
- Appended various warnings based on data processing conditions.
- **Tests**
- Simplified conditions in test cases for oxidation states and file line processing for clarity.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3743/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3743/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3743",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3743",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3743.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3743.patch",
"merged_at": null
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3744
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3744/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3744/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3744/events
|
https://github.com/materialsproject/pymatgen/issues/3744
| 2,234,803,553
|
I_kwDOACgets6FNGVh
| 3,744
|
New pymatgen version
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"there was this PR https://github.com/materialsproject/pymatgen/pull/3624 which you know the downstream implications of better than I.\r\n\r\nthere also [appears to have been an accidental change](https://github.com/materialsproject/pymatgen/pull/3705/files#r1558895539) in https://github.com/materialsproject/pymatgen/pull/3705",
"> there was this PR #3624 which you know the downstream implications of better than I.\r\n> \r\n> there also [appears to have been an accidental change](https://github.com/materialsproject/pymatgen/pull/3705/files#r1558895539) in #3705\r\n\r\nYes, this one will fix our bug and add some enhancements! Thank you. 😃",
"Ah I'm terribly sorry. I don't know why I made such change in https://github.com/materialsproject/pymatgen/pull/3705#discussion_r1558895539. And it certainly should not be there. I'm looking into the commit history now.",
"Subscribing because I'm waiting on the next release too :)",
"closed by [v2024.4.12](https://github.com/materialsproject/pymatgen/releases/tag/v2024.4.12).\r\n\r\nthis is a larger-than-usual release with many small and a couple large changes. please report any issues that might come up. e.g. i confirmed that https://github.com/materialsproject/pymatgen/pull/3624 breaks `atomate2` tests",
"@naik-aakash and I are on it! Thanks!\r\n\r\nSide note: We were thinking about a meta package in the foundation meeting but maybe checking automatically in pymatgen before release if it breaks atomate2 would be enough?",
"@janosh : This method name got changend in a way that it does not even describe what it does anymore: https://github.com/materialsproject/pymatgen/blob/696aace7fb082a1f9d959201059fe1a9c9a81c22/pymatgen/electronic_structure/cohp.py#L160\r\nLeading to failures in LobsterPy. \r\n\r\nWill investigate further but this needs to be changed in any case. It was named \"has_antibnd_states_below_efermi\" before for Antibonding not antiband.",
"Collecting some more issues here: https://github.com/materialsproject/pymatgen/pull/3705#issuecomment-2051980163",
"i think this can be called closed by [v2024.4.13](https://github.com/materialsproject/pymatgen/releases/tag/v2024.4.13)?",
"Yes, thank you! 😄"
] | 2024-04-10T05:48:03
| 2024-04-16T04:58:16
|
2024-04-16T04:55:46Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Feature Requested
I would like to ask for a new pymatgen version after many new implementations in the last month. We currently face a bug in the atomate2 LOBSTER workflow that can only be fixed with a new version. (Cc @naik-aakash )
### Proposed Solution
Release of a new version.
I am wondering if the many new type hints and improvements in recent weeks might have an effect on other packages (atomate2, matminer). Do you expect anything like this, @janosh ?
### Relevant Information
_No response_
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3744/reactions",
"total_count": 2,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 2
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3744/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3745
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3745/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3745/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3745/events
|
https://github.com/materialsproject/pymatgen/pull/3745
| 2,236,967,086
|
PR_kwDOACgets5sUd3B
| 3,745
|
Fix `io.cp2k.input.DataFile`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 6809609890,
"node_id": "LA_kwDOACgets8AAAABleJmog",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/cp2k",
"name": "cp2k",
"color": "FA6833",
"default": false,
"description": "CP2K quantum chemistry package"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent changes in the `pymatgen` library bring enhancements to file handling and data consistency across various modules. These updates aim to streamline processes and improve clarity in code structure.\n\n## Changes\n\n| File Path | Change Summary |\n|-------------------------------------------|----------------------------------------------------------------------------------------------------------------|\n| `.../io/cp2k/inputs.py` | Updated `from_file` method for improved file loading, data processing, object naming, and added type hints. |\n| `.../electronic_structure/plotter.py` | Refactored variable names for consistency in power factor plotting functions. |\n| `tests/io/test_openff.py` | Replaced `np.allclose` with `assert_allclose` for clearer partial charge assertions in tests. |\n| `tests/io/cp2k/test_inputs.py` | Various changes including imports, variable renaming, and improved clarity in test functions. |\n\n## Poem\n\n> 🐰🌟\n> Code changes flutter like leaves in the wind,\n> Bringing order where chaos once grinned.\n> Test assertions now shine bright and clear,\n> In the land of bytes, with nary a tear.\n> Cheers to the updates, a dance so sweet,\n> In the world of `pymatgen`, where changes meet.\n> 🌟🐰\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/cp2k/inputs.py: ## Short summary\n\nIn the `DataFile` class of `pymatgen/io/cp2k/inputs.py`, the `from_file` method has been updated to handle file loading differently. The method now reads data from a file, processes it, and assigns filenames to objects within the data. Additionally, type hints have been added to specify the return type and handle potential type mismatches.\n\npymatgen/electronic_structure/plotter.py: ## Short summary\n\nIn the `plot_power_factor_mu`, `plot_power_factor_temp`, and `plot_power_factor_dop` functions in `plotter.py`, the variable names `pf` have been changed to `pow_factor` for consistency. Additionally, the variable `tlist` is now sorted based on `pow_factor[\"n\"]` instead of `pf[\"n\"]` when `temps == \"all\"` in the `plot_power_factor_temp` and `plot_power_factor_dop` functions.\n\ntests/io/test_openff.py: ## Short summary\n\nThe diff in `test_openff.py` involves replacing `np.allclose` with `assert_allclose` for assertions related to partial charges in tests, maintaining the same functionality but potentially improving clarity and consistency.\n\ntests/io/cp2k/test_inputs.py: ## Short summary\n\n- Added `pytest` import.\n- Renamed `Si_structure` to `si_struct`.\n- Renamed `molecule` to `ch_mol`.\n- Renamed `basis` to `BASIS_FILE_STR`.\n- Renamed `all_hydrogen` to `ALL_HYDROGEN_STR`.\n- Renamed `pot_hydrogen` to `POT_HYDROGEN_STR`.\n- Added `CP2K_INPUT_STR`.\n- Renamed variables in test functions for clarity.\n- Updated test functions to use the renamed variables.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPR #3745, titled \"Fix `io.cp2k.input.DataFile`,\" aims to rectify a flawed change introduced in PR #3705. The adjustment in the `from_file` method within `pymatgen/io/cp2k/inputs.py` addresses issues discussed in the linked GitHub comment. This fix involves refining file loading by reading and processing data from files, ensuring accurate assignment of filenames to data objects, and adding preventative comments to avoid similar issues.\n\n### Comments Summary\n\nDanielYang59 requested a review for the fix, seeking feedback from @janosh and expressing regret for any inconvenience caused by the previous flawed change. This collaborative approach demonstrates a commitment to resolving issues and maintaining code quality.\n\n### AI-Generated Summary of Generated Summaries\n\n- **Code Refinement in `pymatgen/io/cp2k/inputs.py`**:\n - Updated `from_file` method in `DataFile` class for improved file handling.\n - Enhanced data processing and filename assignment within the method.\n - Added type hints for return types and type mismatch management.\n\n- **Testing Procedure Enhancement in `tests/io/test_openff.py`**:\n - Replaced `np.allclose` with `assert_allclose` for clearer and consistent partial charge assertions.\n \nThese changes aim to enhance functionality, improve code quality, and ensure consistency across file handling and testing procedures in the `pymatgen` codebase.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 21461f4409ebba6d1e4a7f4d3b2faf34610a9b7c and 8e3a6929f06160aa21b9ac46f243245154f9f55f.\n</details>\n\n\n<details>\n<summary>Files selected for processing (3)</summary>\n\n* pymatgen/electronic_structure/plotter.py (3 hunks)\n* pymatgen/io/cp2k/inputs.py (2 hunks)\n* tests/io/cp2k/test_inputs.py (12 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (1)</summary>\n\n* pymatgen/io/cp2k/inputs.py\n\n</details>\n\n\n<details><summary>Additional comments not posted (15)</summary><blockquote>\n<details><summary>tests/io/cp2k/test_inputs.py (15)</summary><blockquote>\n\n`4-4`: Added `pytest` import.\n\nThis import is necessary for using `pytest.raises` in the test cases.\n\n---\n\n`27-27`: Renamed `Si_structure` to `si_struct`.\n\nThis change aligns with Python's naming conventions for variables, which prefer lowercase with underscores.\n\n---\n\n`39-39`: Renamed `molecule` to `ch_mol`.\n\nThe new name `ch_mol` provides a clearer indication of the molecule's composition, improving code readability.\n\n---\n\n`41-41`: Introduced `BASIS_FILE_STR` as a constant.\n\nUsing a constant for the basis file string is a good practice as it enhances maintainability and reusability of the code.\n\n---\n\n`53-53`: Introduced `ALL_HYDROGEN_STR` as a constant.\n\nDefining string constants for configuration or data blocks like this one improves clarity and reduces the risk of typos in multiple uses.\n\n---\n\n`58-58`: Introduced `POT_HYDROGEN_STR` as a constant.\n\nSimilar to other string constants, this change helps in managing the data more efficiently and makes the code cleaner.\n\n---\n\n`64-69`: Added `CP2K_INPUT_STR` constant.\n\nStoring configuration strings as constants is a good practice. It centralizes the configuration data, making it easier to manage and modify.\n\n---\n\n`75-92`: Updated `test_basis_info` to use new constants and improved assertions.\n\nThe updates in the test function make use of the newly introduced constants and enhance the assertions for better test coverage and clarity.\n\n---\n\n`101-104`: Enhanced `test_potential_info` with soft-matching checks.\n\nThe addition of soft-matching checks is a good improvement, providing more robust testing for the potential information functionality.\n\n---\n\n`133-154`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [108-147]\n\nRefined tests for basis and potential files to use new constants and improved assertions.\n\nThe changes in these test functions are well-made, utilizing the new constants and enhancing the assertions to ensure the functionality is thoroughly tested.\n\n---\n\n`165-179`: Updated `test_basic_sections` and `test_section_list` to use new `CP2K_INPUT_STR` and improved section handling.\n\nThese updates improve the structure and clarity of the tests, making them more maintainable and robust.\n\n---\n\n`191-198`: Enhanced `test_coords` and `test_kind` functions with better structure handling and assertions.\n\nThe improvements in these test functions enhance the clarity and effectiveness of the tests, ensuring that the coordinate and kind functionalities are correctly implemented.\n\n---\n\n`215-228`: Introduced a new test scenario in `test_odd_file` to handle scrambled input.\n\nThis test is innovative as it checks the robustness of the input handling against non-standard and scrambled inputs, ensuring the parser's resilience.\n\n---\n\n`243-249`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [246-256]\n\nUpdated `test_mongo` to use new `CP2K_INPUT_STR` and enhanced keyword handling.\n\nThe updates to this test function improve the testing of the configuration handling, ensuring that the keyword manipulations are correctly implemented.\n\n---\n\n`259-264`: Added a test case to ensure `DataFile.from_file` raises `NotImplementedError`.\n\nThis test case is crucial as it verifies that the expected exception is raised for unimplemented functionality, which is important for avoiding runtime errors.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- cb28af61e75102cd14670b5f2d58237bc03400d8 -->\n<!-- 21461f4409ebba6d1e4a7f4d3b2faf34610a9b7c -->\n<!-- 8e3a6929f06160aa21b9ac46f243245154f9f55f -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Can you please review this fix? @janosh Apologize again for the trouble.",
"Thanks for reviewing and making it a real \"fix\" 😄 "
] | 2024-04-11T05:57:12
| 2024-05-15T01:07:27
|
2024-04-11T08:28:26Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Fixed a flawed change in `io.cp2k.input.DataFile.from_file` made by me in #3705, discussed in https://github.com/materialsproject/pymatgen/pull/3705#discussion_r1558895539. Also added comment to prevent this from happening again.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3745/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3745/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3745",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3745",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3745.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3745.patch",
"merged_at": "2024-04-11T08:28:26Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3746
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3746/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3746/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3746/events
|
https://github.com/materialsproject/pymatgen/pull/3746
| 2,237,479,657
|
PR_kwDOACgets5sWNvu
| 3,746
|
Separate test files by modules and collect test files `csv/cif` into folders
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 4974004892,
"node_id": "LA_kwDOACgets8AAAABKHlKnA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/tests",
"name": "tests",
"color": "654021",
"default": false,
"description": "Issues with or changes to the pymatgen test suite"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: review paused by coderabbit.ai -->\n\n> [!NOTE]\n> ## Reviews Paused\n> \n> Use the following commands to manage reviews:\n> - `@coderabbitai resume` to resume automatic reviews.\n> - `@coderabbitai review` to trigger a single review.\n\n<!-- end of auto-generated comment: review paused by coderabbit.ai --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@coderabbitai ignore",
"@janosh Can you please review this? Thank you!",
"> how about instead of subfolders based on filetype, we split test files by the corresponding pymatgen module?\r\n\r\nIt would be good to make the test file folders follow the same hierarchy as the code, but I'm afraid there would be huge overlap (and confusion) at least at this stage? (Currently we don't have a one-to-one mapping between test and test files) Multiple module might require access to the same format of file (or even the same file). For example `electronic_structure` might require `DOSCAR` from `vasp`, how can we decide where `DOSCAR` should go then (not sure if it truly did, just for example)?\r\n\r\nOn the other hand, separating files by format seems much easier to access for developers? And would encourage test file re-use (If we group them by modules, people would tend to have a set of test files for each module, and test files from other module may not be re-used). Though people might need to access multiple test file folders if multiple formats are involved within the test.\r\n",
"> On the other hand, separating files by format seems much easier to access for developers\r\n\r\nhmmm... not sure. how does it become easier? the file extension already makes searching by file type easy. i just type `.json` in the file picker to get a list\r\n\r\n\r\n\r\nputting it in a JSON folder doesn't confer additional meaning on what the file was meant to be used for.\r\nputting it in `tests/files/phonons` gives more information. that doesn't mean a phonon test file can't be used for tests elsewhere. we just have to decide on a location. e.g. in your `DOSCAR` example, i think it should definitely go in `tests/files/io/vasp`",
"> how does it become easier? the file extension already makes searching by file type easy. i just type `.json` in the file picker to get a list. putting it in a JSON folder doesn't confer additional meaning on what the file was meant to be used for. putting it in `tests/files/phonons` gives more information. \r\n\r\nI think my intention for cleaning up test files is not to add more information, but to clean up the \"root directory\" of test file folder 😄 . Currently we have quite a lot `json` and `cif` files lie flat under the test file dir, and it would flood `ls` command (of course if you do a more explicit search there would be no difference).\r\n\r\n> we just have to decide on a location. e.g. in your `DOSCAR` example, i think it should definitely go in `tests/files/io/vasp`\r\n\r\nYes that what I'm concerned about, others would need to \"learn\" about this agreement then. People would not need to read a `positioning_convention` file or `README` file to know cif files would reside in the `cif` dir I assume?\r\n\r\n",
"I would say it's great to make test files follow the same hierarchy as the test in the long term. But that would take more effort and is not what this PR is intended for (just want to avoid having everything lie flat under the root of test file dir).\r\n\r\nThough I would be happy to help push towards this in the long term :)",
"> how about we leave the `cif/` folder as you currently have it but split the `json/` based on what `pymatgen` module the test file belongs to? \r\n\r\nThat's a great idea! Also sounds like a good start towards organizing test files by modules. I would get my hands on this next week.\r\n\r\n",
"@coderabbitai ignore",
"@janosh Please review this as well. I wasn't thinking that we could just do everything in one PR, but luckily here we are :) All test files sorted by module.\r\n\r\nA side note being: the test files for `io.qchem` seem very large (146 MB alone, total size 554 MB), might be good to compress those as well.",
"Thanks for reviewing!\r\n\r\nYes should be safe. No functional changes just relocating test files.\r\n\r\nSeveral test files removed with caution though (did global search before removing any), but still could be used implicitly by those disabled tests, so I tagged them in the summary section in case we need to recover any.\r\n\r\nDo we need to run garbage collection or something? Current clone size seems over 800 MB?",
"> Do we need to run garbage collection or something? Current clone size seems over 800 MB?\r\n\r\nit used to be ~1GB so 800MB is already an improvement. don't think there's such a thing as garbage collection for `git`. history just keeps growing. you can decrease clone time by only getting the last commit\r\n\r\n```sh\r\ngit clone https://github.com/materialsproject/pymatgen --depth 1\r\n```",
"\r\n> it used to be ~1GB so 800MB is already an improvement. \r\n\r\nGreat to know!\r\n\r\n> don't think there's such a thing as garbage collection for `git`. history just keeps growing. \r\n\r\nThere actually is https://git-scm.com/docs/git-gc. Not sure if it would be run automatically or not.\r\n\r\n> you can decrease clone time by only getting the last commit\r\n> \r\n> ```shell\r\n> git clone https://github.com/materialsproject/pymatgen --depth 1\r\n> ```\r\n\r\nThanks for the tip. Just saying though, I don't clone very often so it's not a problem :)\r\n"
] | 2024-04-11T11:16:01
| 2024-04-19T12:36:12
|
2024-04-19T12:14:26Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Collect test files `csv/cif` into their own folders
- Separate `json` files by modules
- Relocate test files by modules
## Tasks
- [x] Separate folders by modules
- [x] Separate `json` files by modules
- [x] Many of the files under `molecules` are specific to `io.qchem`, but there is terribly strong interdependence need to be clarified
- [x] Some test files are located inside test dir
### Important: removed unused test files
- [qc_aimd](https://github.com/materialsproject/pymatgen/pull/3746/commits/65f3c7c38b8b7f4d89ea764359fc8a5cfb63e734)
- Four seemingly unused file from `molecules` d32b7d9a6c46b3469a862197e7da79048d5e0e07
### Side note
- The `re` pattern used for renaming `json` file path in VS code: source `(f"\{TEST_FILES_DIR\})(/[^/]+\.json(\.gz)?")`, target `$1/json$2`, [reference here](https://learn.microsoft.com/en-us/visualstudio/ide/using-regular-expressions-in-visual-studio?view=vs-2022)
- The `re` pattern for `cif`: just replace above `json` with `cif`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3746/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3746/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3746",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3746",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3746.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3746.patch",
"merged_at": "2024-04-19T12:14:26Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3747
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3747/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3747/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3747/events
|
https://github.com/materialsproject/pymatgen/issues/3747
| 2,238,565,249
|
I_kwDOACgets6FbcuB
| 3,747
|
Numerical instability in lattice matrix operations : get_slabs / StructureMatcher / _cart_dists
|
{
"login": "misko",
"id": 1045095,
"node_id": "MDQ6VXNlcjEwNDUwOTU=",
"avatar_url": "https://avatars.githubusercontent.com/u/1045095?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/misko",
"html_url": "https://github.com/misko",
"followers_url": "https://api.github.com/users/misko/followers",
"following_url": "https://api.github.com/users/misko/following{/other_user}",
"gists_url": "https://api.github.com/users/misko/gists{/gist_id}",
"starred_url": "https://api.github.com/users/misko/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/misko/subscriptions",
"organizations_url": "https://api.github.com/users/misko/orgs",
"repos_url": "https://api.github.com/users/misko/repos",
"events_url": "https://api.github.com/users/misko/events{/privacy}",
"received_events_url": "https://api.github.com/users/misko/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-04-11T20:41:19
| 2024-04-11T20:41:19
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.9.12
### Pymatgen version
2023.5.10
### Operating system version
Ubuntu
### Current behavior
I have a very limited understanding of the materials side of our project. We have some code to generate slabs using pymatgen, however I noticed that on two different machines with identical software environments we get back a different integer number of slabs from SlabGenerator.get_slabs() . I think the root of the problem is when a Lattice is constructed with specific gamma/beta parameters that result in some of the entries in the lattice matrix being dominated by numerical error.
```
from pymatgen.core.lattice import Lattice
a = 4.49919228
b = 7.361330199082434
c = 30.60553418277412
alpha = 100.89339464913091
beta = 90.0
# gamma = 90.0
gamma = 0.0
Lattice.from_parameters(a, b, c, alpha, beta, gamma)
```
Using gamma = 0 , puts a value ~ 1e-16 into lattice matrix position [1,0], that is seems to be completely error or due to floating point error on the machine / underlying library.
These types of lattice matrices are initialized inside our call to get_slabs() and then passed through StructureMatcher, which eventually find their way into the call (inside of .fit/match/strict_match),
```
self._cart_dists(s1fc, t_s2fc, avg_l, mask, normalization, lll_frac_tol)
```
Here the small differences (1e-15) in the avg_l matrix lead to large differences in the returned value (0.2->0.6). The same python code run on two different machines, with identical environments), and change if a structure matches or not.
https://app.circleci.com/pipelines/github/Open-Catalyst-Project/Open-Catalyst-Dataset/140/workflows/d34fe055-e7a3-4e87-87b2-fd51dbe99837/jobs/286 (local machine vs circleci with identical enviornments)
I am attaching an example where 6 slabs are generated, as they would be inside of a get_slabs() call, and then run through StructureMatcher. This code produces different results on two different machines with identical software setup. If the lattice matrix is rounded, it produces different but consistent results across the two machines.
### Expected Behavior
I would expect SlabGenerator.get_slabs() to behave more robustly to numerical error introduced inside of the get_slabs() call that I cannot control as a caller. Maybe rounding the generated lattice matrices to 12 digits? or something one or two orders of magnitude above machine epsilon.
### Minimal example
```Python
from ase.atom import Atom
from ase.atoms import Atoms
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.core.surface import SlabGenerator, Slab
from pymatgen.core.lattice import Lattice
bulk_atoms = Atoms(
[
Atom("Re", position=position)
for position in [
[-1.0578273257344506e-06, 1.6063739546985365, 1.12479807],
[1.3911606605782731, 0.8031869653014636, 3.37439421],
]
],
pbc=True,
cell=[
[2.78232129, 0.0, 0.0],
[-1.39116064, 2.40956092, 0.0],
[0.0, 0.0, 4.49919228],
],
)
struct = AseAtomsAdaptor.get_structure(bulk_atoms)
sga = SpacegroupAnalyzer(struct, symprec=0.1)
standardized_struct = sga.get_conventional_standard_structure()
slab_gen = SlabGenerator(
initial_structure=standardized_struct,
miller_index=(2, 1, 0),
min_slab_size=7.0,
min_vacuum_size=20.0,
lll_reduce=False,
center_slab=True,
primitive=True,
max_normal_search=1,
)
# generate the slabs from inside of SlabGenerator.get_slabs before reducing by StructureMatcher
slabs = []
for shift in slab_gen._calculate_possible_shifts(tol=0.1):
bonds_broken = 0
slab = slab_gen.get_slab(shift, tol=0.3, energy=bonds_broken)
slabs.append(slab)
# Round lattic matrix to 10 sigdig
from math import log10
round_to = 1e-10
round_to_sigdig = -int(log10(round_to))
rounded_slabs = [
Slab(
Lattice(
matrix=s.lattice._matrix.copy().round(round_to_sigdig),
pbc=s.lattice._pbc,
),
s.species_and_occu,
s.frac_coords,
s.miller_index,
s.oriented_unit_cell,
s.shift,
s.scale_factor,
reorient_lattice=False,
)
for s in slabs
]
# Run structurematcher
from pymatgen.analysis.structure_matcher import StructureMatcher
m = StructureMatcher(ltol=0.3, stol=0.3, primitive_cell=False, scale=False)
print("Non rounded slabs similar to slab idx=0:")
for s_idx, s in enumerate(slabs):
print(f"\t0vs{s_idx}", m.fit(slabs[0], s, skip_structure_reduction=True))
print(f"Rounded (to 1e-{round_to_sigdig}) slabs similar to slab idx=0:")
for s_idx, s in enumerate(rounded_slabs):
print(f"\t0vs{s_idx}", m.fit(rounded_slabs[0], s, skip_structure_reduction=True))
```
### Relevant files to reproduce this bug
_No response_
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3747/reactions",
"total_count": 4,
"+1": 4,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3747/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3748
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3748/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3748/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3748/events
|
https://github.com/materialsproject/pymatgen/pull/3748
| 2,238,929,115
|
PR_kwDOACgets5sbPBa
| 3,748
|
Clarify argument `shift` for `SlabGenerator.get_slab`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5456916296,
"node_id": "LA_kwDOACgets8AAAABRUHvSA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/docs",
"name": "docs",
"color": "35B067",
"default": false,
"description": "Documentation, examples, user guides"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
},
{
"id": 5692928617,
"node_id": "LA_kwDOACgets8AAAABU1MyaQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/surfaces",
"name": "surfaces",
"color": "521BBE",
"default": false,
"description": "Surface analysis"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Auto Review Skipped\n> \n> Draft detected.\n> \n> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository.\n> \n> To trigger a single review, invoke the `@coderabbitai review` command.\n> \n\n<!-- end of auto-generated comment: skip review by coderabbit.ai --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"I would need discussion/confirmation/suggestion on these proposed changes, as they more or less seem to introduce functional changes. @janosh @shyuep \r\n\r\nAlso trying to ping the original author (I guess) @CifLord in case you have any comment 😃 ",
"> sorry for the slow reply. \r\n\r\nNo problem at all @janosh! \r\n\r\n> this all looks good. [just had 1 question](https://github.com/materialsproject/pymatgen/pull/3748/files#r1583984225)\r\n\r\nSorry it seems I wasn't making my intention clear enough, as I haven't actually started making changes yet. I proposed [several issues to address](https://github.com/materialsproject/pymatgen/pull/3748#issue-2238929115) but I want to hear about your comments/suggestions before getting my hands on it, because most of them seem more or less breaking (breaking in a way to fix issues, not for enhancement).",
"> Sorry it seems I wasn't making my intention clear enough, as I haven't actually started making changes yet. I proposed https://github.com/materialsproject/pymatgen/pull/3748#issue-2238929115 but I want to hear about your comments/suggestions before getting my hands on it, because most of them seem more or less breaking (breaking in a way to fix issues, not for enhancement).\r\n\r\nthat i understood. but i was tentatively advising against all but one of the breaking changes you suggested (the one you clearly identified as a bug). how much does that leave to change here?",
"> that i understood. but i was tentatively advising against all but one of the breaking changes you suggested (the one you clearly identified as a bug). how much does that leave to change here?\r\n\r\nSurely, let's focus on bug fixes then. Not sure if you mean \"site positions change during`center_slab` loop\"? This is clearly a bug, and the `get_d` unbound bug should already have been fixed during previous `pyright` fixes. Not sure about the change, should not be a lot, let's see.\r\n\r\n",
"@janosh Please review this. \r\n\r\nEverything is looking good and simple with the argument name clarified. Please refer to the head of this PR for details. Thanks!",
"@janosh Sorry for pinging you everywhere. Can you please comment on this one as well?\r\n\r\nAnd sorry for proposing another potentially breaking change, but in this case `get_slab` should be a private method (though we're seeing it being call outside, in `analysis.interfaces.coherent_interfaces`). So I assume a one year deprecation year should be pretty safe.\r\n\r\nOr if you prefer not to rename this, we could clarify in the docstring :)",
"@janosh I decide to minimize (potentially) breaking changes and just clarify in the docstring.",
"@janosh thanks for reviewing. Resolved\r\n\r\nI begin to notice [this CI failure](https://github.com/materialsproject/pymatgen/actions/runs/9329648034/job/25682314347?pr=3748) about 12 hours ago:\r\n```\r\nerror: Failed to download distributions\r\n Caused by: Failed to fetch wheel: chgnet==0.3.7\r\n Caused by: Failed to build: `chgnet==0.3.7`\r\n Caused by: Build backend failed to build wheel through `build_wheel()` with exit status: 1\r\n\r\n--- stderr:\r\nchgnet/graph/cygraph.c:1238:10: fatal error: fast_converter_libraries/create_graph.c: No such file or directory\r\n 1238 | #include \"fast_converter_libraries/create_graph.c\"\r\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\ncompilation terminated.\r\nerror: command '/usr/bin/gcc' failed with exit code 1\r\n```\r\n\r\nIs this some issue from the latest release 0.3.7 of `chgnet`?"
] | 2024-04-12T02:35:20
| 2024-06-04T17:34:30
|
2024-06-03T20:42:18Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
A follow-up PR for #3691.
- Clarify misleading arg name `shift` for **private** method `SlabGenerator.get_slab`
- Fix typing of `slab` in function `center_slab` (should be `Structure` instead of `Slab`)
### Rationale
- This method should be a private method (as per the docstring).
- The arg name `shift` for `SlabGenerator.get_slab` corresponds to the desired `termination` coordinate (instead of the shift vector to get the `Slab`), which could be misleading: https://github.com/materialsproject/pymatgen/blob/578d29ca2e27393c4afe38454b5915a3a984a544/pymatgen/core/surface.py#L1087
Which might cause confusion in understanding the implementation:
https://github.com/materialsproject/pymatgen/blob/578d29ca2e27393c4afe38454b5915a3a984a544/pymatgen/core/surface.py#L1119
<img width="901" alt="image" src="https://github.com/materialsproject/pymatgen/assets/80093591/3d87e545-7060-4d92-b875-6447ddaadc14">
#### Clarify `shift` attribute of `Slab`
Similarly, the description of `shift` attribute of `Slab` is incorrect, it is NOT the shift but the **negative** shift.
https://github.com/materialsproject/pymatgen/blob/578d29ca2e27393c4afe38454b5915a3a984a544/pymatgen/core/surface.py#L118-L119
<details>
<summary> TODO for future PRs </summary>
## In future PRs
1. Function `center_slab`: https://github.com/materialsproject/pymatgen/blob/ad6eafee2474718813cba57aa8e1752f1181b639/pymatgen/core/surface.py#L759-L788
**a.** During the `for site in slab:` loop, site coordinates would change.
**b.** This method to put the `Slab` to the center seems overly complex, can we just calculate the z-center of the `Slab`, and move it to z=0.5 (fractional)?
**c.** If not **b**, Sites with z<0 is not considered (it would only move `nn[1] >= slab.lattice.c`).
**d.** A magic number for determining near neighbors by cutoff radius: `cutoff_radius = bond_dists[0] * 3`.
2. The `move_to_other_side` method of `SlabGenerator`: https://github.com/materialsproject/pymatgen/blob/ad6eafee2474718813cba57aa8e1752f1181b639/pymatgen/core/surface.py#L1459-L1473
https://github.com/materialsproject/pymatgen/pull/3691#discussion_r1555181912
3. Currently there are three very similar methods/functions that need to **clarify in docstring**:
a. `get_slab` of `SlabGenerator`: The actual method to generate `Slab`, should be a private method (as per the docstring, but have already been used externally).
b. `get_slabs` of `SlabGenerator`: A wrapper method on top of `get_slab` to generate possible shifts and then call `get_slab`.
c. `generate_all_slabls`: A wrapper function on top of `get_slabs`, which generate slabs up to a given Miller index.
## Next up: Fix some `Slab` related issues
Don't think I could resolve them in one shot, but good to collect them:
- #2591
- #3411
- #3412
- #3682
</details>
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3748/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3748/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3748",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3748",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3748.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3748.patch",
"merged_at": "2024-06-03T20:42:17Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3749
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3749/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3749/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3749/events
|
https://github.com/materialsproject/pymatgen/pull/3749
| 2,239,058,555
|
PR_kwDOACgets5sbrwu
| 3,749
|
Breaking: all plot methods return `plt.Axes`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5322856717,
"node_id": "LA_kwDOACgets8AAAABPURZDQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/data%20viz",
"name": "data viz",
"color": "3C19AC",
"default": false,
"description": "PRs and issues about pymatgen plotting functionality"
},
{
"id": 5456916296,
"node_id": "LA_kwDOACgets8AAAABRUHvSA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/docs",
"name": "docs",
"color": "35B067",
"default": false,
"description": "Documentation, examples, user guides"
},
{
"id": 5457867742,
"node_id": "LA_kwDOACgets8AAAABRVBz3g",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/breaking",
"name": "breaking",
"color": "41396E",
"default": false,
"description": "Breaking change"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates in pymatgen involve refining function signatures, variable names, return types, and plot settings for improved usability and clarity. These changes enhance the overall user experience in materials science computations.\n\n## Changes\n\n| File Path | Change Summary |\n|----------------------------------|--------------------------------------------------------------|\n| pymatgen/analysis/wulff.py | `get_plot` returns `mpl_toolkits.mplot3d.Axes3D` for 3D Wulff shape plot. |\n| pymatgen/util/plotting.py | Variable name consistency, return type updates, plot setting adjustments, and documentation improvements. |\n| tests/analysis/test_wulff.py | Assertions updated for `get_plot` to check specific properties of Axes3D object. |\n| tests/util/test_plotting.py | Return values assigned to `fig` and `ax`, assertions modified to check types and properties. |\n\n> 🐰✨\n> In the gardens of code, where the data trees grow,\n> A rabbit hopped by, with updates in tow.\n> Refining and tweaking, with a meticulous hand,\n> To make all the structures much grander and grand.\n> Cheers to the changes, may they be ever so bright,\n> In the realm of pymatgen, all is now right! 🌟\n> 🐰💻\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n```\npymatgen/analysis/wulff.py:\n- The `get_plot` function now returns `mpl_toolkits.mplot3d.Axes3D` instead of `matplotlib.pyplot`, indicating a change in the return type to a 3D plot of the Wulff shape.\n\npymatgen/util/plotting.py:\n- Changed variable names `labelsize` and `ticksize` to `label_size` and `tick_size` respectively for consistency.\n- Updated return type from `matplotlib.pyplot` to `plt.Axes` in function `pretty_plot_two_axis`.\n- Adjusted font sizes and parameters in various plot settings.\n- Improved documentation clarity and formatting.\n- Enhanced readability and maintainability of the code.\n\ntests/analysis/test_wulff.py:\n- The functionality change in the `test_get_plot` method involves modifying the assertions related to the returned plot object. The assertions now check for specific properties of the Axes3D object returned by `wulff.get_plot()`, including the number of collections, title, xlabel, and ylabel.\n\ntests/util/test_plotting.py:\n- In `test_plotting.py`, the changes involve updating the return values and assertions in the `test_plot_periodic_heatmap` and `test_van_arkel_triangle` functions. The return values are now assigned to `fig` and `ax` respectively, and the assertions are modified to check the types and properties of the returned objects.\n```\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPull Request #3749 titled \"Breaking: all plot methods return `plt.Axes`\" addresses a significant consistency issue within the `pymatgen` library's plotting API. During the migration detailed in issue #3237, several plotting methods were not updated from returning `plt` to returning `ax`. This PR ensures that all plotting methods in `pymatgen` now return `plt.Axes`, standardizing the return type across the library. Additionally, it corrects return types in docstrings and adds missing `Returns:` sections, enhancing the documentation's clarity and completeness.\n\n### AI-Generated Summary of Generated Summaries\n\nThe changes in PR #3749 focus on standardizing return types to `plt.Axes` across various modules in `pymatgen`, improving documentation, and refining function signatures and variable names. Key modifications include:\n\n1. **Standardization of Return Types**: Plotting methods in modules like `chempot_diagram`, `diffraction`, `ewald`, `local_env`, `structure_analyzer`, `wulff`, `core`, and `electronic_structure` now consistently return `plt.Axes`, ensuring a uniform interface.\n\n2. **Documentation Enhancements**: Corrections to return types in docstrings and addition of `Returns:` sections enhance documentation clarity, particularly in `core/interface.py` and `util/plotting.py`.\n\n3. **Function Signature and Variable Name Changes**: Notable changes in `electronic_structure/boltztrap.py` improve function definition clarity and consistency.\n\n4. **Miscellaneous Changes**: Minor adjustments in default value assignments and other files contribute to overall library consistency and functionality.\n\nPR #3749 achieves consistency in return types of plotting methods and enhances documentation clarity, making the library more accessible and maintainable.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 7cac3f6b91081bf3911091e04554487fff113a69 and b0fd1c1a41419d2ebe5b1f6d0545864869114f50.\n</details>\n\n\n<details>\n<summary>Files selected for processing (4)</summary>\n\n* pymatgen/analysis/wulff.py (2 hunks)\n* pymatgen/util/plotting.py (12 hunks)\n* tests/analysis/test_wulff.py (1 hunks)\n* tests/util/test_plotting.py (2 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (2)</summary>\n\n* pymatgen/analysis/wulff.py\n* pymatgen/util/plotting.py\n\n</details>\n\n\n<details><summary>Additional comments not posted (3)</summary><blockquote>\n<details><summary>tests/util/test_plotting.py (2)</summary><blockquote>\n\n`18-22`: Changes align with PR objectives to standardize return types. Good use of conditional assertions based on the availability of `pymatviz`.\n\n---\n\n`42-48`: Thorough testing of `Axes` properties ensures the plotting function behaves as expected. Good job on ensuring detailed checks.\n\n</blockquote></details>\n<details><summary>tests/analysis/test_wulff.py (1)</summary><blockquote>\n\n`78-83`: Thorough testing of `Axes3D` properties ensures the plotting function behaves as expected. Good job on ensuring detailed checks.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 7cac3f6b91081bf3911091e04554487fff113a69 -->\n<!-- b0fd1c1a41419d2ebe5b1f6d0545864869114f50 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-12T04:40:21
| 2024-04-12T05:41:30
|
2024-04-12T05:41:29Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
a few plotting methods were overlooked in the `return plt` to `return ax` migration #3237.
this PR makes `pymatgen`'s plotting API consistent by returning `plt.Axes` from all plotting methods
also fixes the return types in many doc strings and adds `Returns:` section to several doc strings that were missing them
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Documentation**
- Improved documentation clarity and formatting in plotting utilities.
- Enhanced readability and maintainability of the code with updated documentation.
- **Refactor**
- Changed variable names for consistency in plotting utilities.
- Adjusted font sizes and parameters in various plot settings for improved visualization.
- **New Features**
- Updated the `get_plot` function to return a 3D plot of the Wulff shape.
- **Style**
- Adjusted font sizes and parameters in various plot settings for improved visualization.
- Enhanced readability and maintainability of the code in plotting utilities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3749/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3749/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3749",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3749",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3749.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3749.patch",
"merged_at": "2024-04-12T05:41:29Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3750
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3750/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3750/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3750/events
|
https://github.com/materialsproject/pymatgen/pull/3750
| 2,239,199,990
|
PR_kwDOACgets5scKqY
| 3,750
|
Revert mistaken `Cohp.has_antibnd_states_below_efermi` rename
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5966808010,
"node_id": "LA_kwDOACgets8AAAABY6ZDyg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/electronic%20structure",
"name": "electronic structure",
"color": "6027F8",
"default": false,
"description": "Electronic structure functionality related"
},
{
"id": 6043913731,
"node_id": "LA_kwDOACgets8AAAABaD7OAw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/lobster",
"name": "lobster",
"color": "F51A76",
"default": false,
"description": "Lobster package (Local Orbital Basis Suite Towards Electronic-Structure Reconstruction)"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe update involves a renaming of a function within the pymatgen library, specifically in the electronic structure module related to COHP analysis. The original function name `has_antiband_states_below_efermi` was changed to `has_antibnd_states_below_efermi` to presumably streamline naming or enhance clarity.\n\n## Changes\n\n| File Path | Change Summary |\n|------------------------------------------------|--------------------------------------------------------------|\n| `.../electronic_structure/cohp.py` | Renamed `has_antiband_states_below_efermi` to `has_antibnd_states_below_efermi` |\n| `.../electronic_structure/test_cohp.py` | Updated tests to reflect function name change |\n\n> 🐇💻✨\n> Oh, how names shift and slide,\n> From `antiband` to `antibnd` with pride.\n> In the code's garden, changes bloom,\n> Refactoring under the digital moon.\n> Hop along, dear bits and bytes, hop along! 🌙\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/electronic_structure/cohp.py, tests/electronic_structure/test_cohp.py: The function `has_antiband_states_below_efermi` has been renamed to `has_antibnd_states_below_efermi`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of this pull request (PR #3750) is to address and rectify a breaking change introduced in the `cohp` module of the Python Materials Genomics (pymatgen) library. This issue was initially reported in issue #3744, where it was noted that a method's name was altered in a manner that disrupted the functionality of LobsterPy, a tool dependent on pymatgen.\n\nThe specific change involved the renaming of a method which is critical for LobsterPy's operations. The method previously known as `has_antiband_states_below_efermi` was renamed to `has_antibnd_states_below_efermi`. This renaming led to compatibility issues, prompting the need for this fix. The PR aims to correct this by possibly reverting the name change or adjusting the dependent codebase to align with the new method name, ensuring that LobsterPy and potentially other dependent tools continue to function correctly with the latest version of pymatgen.\n\n### AI-Generated Summary of Generated Summaries\n\nIn the `cohp` module of pymatgen, specifically within the file `pymatgen/electronic_structure/cohp.py`, and its corresponding test file `tests/electronic_structure/test_cohp.py`, the method `has_antiband_states_below_efermi` was renamed to `has_antibnd_states_below_efermi`. This change is the focal point of the adjustments made in the pull request.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 696aace7fb082a1f9d959201059fe1a9c9a81c22 and be2a351e57887f0af944bc5fbbc55edb591528a0.\n</details>\n\n\n<details>\n<summary>Files selected for processing (2)</summary>\n\n* pymatgen/electronic_structure/cohp.py (1 hunks)\n* tests/electronic_structure/test_cohp.py (1 hunks)\n\n</details>\n\n\n\n\n\n\n\n<details><summary>Additional comments not posted (6)</summary><blockquote>\n<details><summary>pymatgen/electronic_structure/cohp.py (1)</summary><blockquote>\n\n`160-160`: Renaming of `has_antiband_states_below_efermi` to `has_antibnd_states_below_efermi` aligns with PR objectives to resolve compatibility issues with LobsterPy.\n\n</blockquote></details>\n<details><summary>tests/electronic_structure/test_cohp.py (5)</summary><blockquote>\n\n`82-84`: The method name change to `has_antibnd_states_below_efermi` is correctly implemented in the test cases.\n\n---\n\n`79-87`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [85-179]\n\nThe tests in `TestIcohpValue` are comprehensive and well-structured.\n\n---\n\nLine range hint `180-365`: The tests in `TestCombinedIcohp` are comprehensive and cover a wide range of scenarios.\n\n---\n\nLine range hint `366-1030`: The tests in `TestCompleteCohp` are comprehensive and cover a wide range of scenarios.\n\n---\n\nLine range hint `1031-1380`: The tests in `TestMethod` are comprehensive and cover a wide range of scenarios.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- be2a351e57887f0af944bc5fbbc55edb591528a0 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Windows tests are failing. Not sure why ",
"Will try to install from the repo to check all tests in LobsterPy as well... ;)",
"All fine from LobsterPy side now. Thanks!"
] | 2024-04-12T06:39:26
| 2024-04-12T15:57:20
|
2024-04-12T07:08:19Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
closes #3744
the rename of `Cohpl.has_antib(''->a)nd_states_below_efermi` confuses it's purpose and broke
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3750/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3750/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3750",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3750",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3750.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3750.patch",
"merged_at": "2024-04-12T07:08:19Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3751
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3751/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3751/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3751/events
|
https://github.com/materialsproject/pymatgen/issues/3751
| 2,240,584,303
|
I_kwDOACgets6FjJpv
| 3,751
|
`typing_extension` imported at run time causing ImportError
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Thanks for fixing! Just tracked them down and found these were added in 2adde29 (guess we were both too distracted because there were just too many `mypy` errors), and wondering why unit tests didn't capture such errors (we don't explicitly install `typing_extensions` in our CI too)?",
"Mistakes happen. It's not a big deal especially if we fix them quickly.\n\nWe don't install typing_extensions in CI but one of our optional dependencies must. Which means it's available in our CI but not necessarily available in others CI or local machines. So we didn't see the error but #3646 by @ml-evs would have caught this which is why I'm eager to get it merged. Sadly, lots of legacy issues in the way. maybe it makes sense to split out a PR that only adds minimal dependency checking and do all the type stuff in #3646 separately.",
"> We don't install typing_extensions in CI but one of our optional dependencies must. \r\n\r\nCould be (just guess, didn't check).\r\n\r\n> So we didn't see the error but #3646 by @ml-evs would have caught this which is why I'm eager to get it merged. Sadly, lots of legacy issues in the way. maybe it makes sense to split out a PR that only adds minimal dependency checking and do all the type stuff in #3646 separately.\r\n\r\nYes I just had a look and there are 700+ `pyright` errors. It's certainly too much work for a single person and I would see if I could give him a hand on that.",
"Help with fixing pyright issues would be hugely appreciated!",
"This same issue was just flagged up in the matminer CI when upgrading pymatgen to 2024.5.31 from 2024.5.1: https://github.com/hackingmaterials/matminer/actions/runs/9346511294/job/25721508373?pr=939",
"Yes we noticed that #3852 :( sorry for the overlook"
] | 2024-04-12T17:19:11
| 2024-06-03T12:23:53
|
2024-04-12T19:36:05Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Hi! Thanks for your work on `pymatgen`! 😃
Just to flag, this update seems to be causing some failures on our GitHub Actions tests (for [`ShakeNBreak`](https://shakenbreak.readthedocs.io/en/latest/) and [`doped`](https://doped.readthedocs.io/en/latest/)) with the latest `pymatgen` version. I'm not sure if it just needs `typing_extensions` to be added to the requirements?
```
Run pytest -vv -m "not mpl_image_compare" tests # all non-plotting tests
============================= test session starts ==============================
platform linux -- Python 3.11.9, pytest-8.1.1, pluggy-1.4.0 -- /opt/hostedtoolcache/Python/3.11.9/x64/bin/python
cachedir: .pytest_cache
Matplotlib: 3.8.4
Freetype: 2.6.1
rootdir: /home/runner/work/ShakeNBreak/ShakeNBreak
configfile: pyproject.toml
plugins: mpl-0.1[7](https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/8663869495/job/23758934155#step:6:8).0
collecting ... collected 121 items / 1 error / 29 deselected / 92 selected
==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_analysis.py ____________________
ImportError while importing test module '/home/runner/work/ShakeNBreak/ShakeNBreak/tests/test_analysis.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/_pytest/python.py:520: in importtestmodule
mod = import_path(
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/_pytest/pathlib.py:5[8](https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/8663869495/job/23758934155#step:6:9)4: in import_path
importlib.import_module(module_name)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
???
<frozen importlib._bootstrap>:1176: in _find_and_load
???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:6[9](https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/8663869495/job/23758934155#step:6:10)0: in _load_unlocked
???
/opt/hostedtoolcache/Python/3.[11](https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/8663869495/job/23758934155#step:6:12).9/x64/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
exec(co, module.__dict__)
tests/test_analysis.py:[14](https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/8663869495/job/23758934155#step:6:15): in <module>
from shakenbreak import analysis
shakenbreak/analysis.py:23: in <module>
from shakenbreak import input, io
shakenbreak/input.py:30: in <module>
from doped.generation import DefectsGenerator, name_defect_entries
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/doped/generation.py:32: in <module>
from pymatgen.transformations.advanced_transformations import CubicSupercellTransformation
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pymatgen/transformations/advanced_transformations.py:36: in <module>
from pymatgen.transformations.standard_transformations import (
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pymatgen/transformations/standard_transformations.py:[17](https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/8663869495/job/23758934155#step:6:18): in <module>
from pymatgen.analysis.elasticity.strain import Deformation
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pymatgen/analysis/elasticity/__init__.py:5: in <module>
from .elastic import (
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pymatgen/analysis/elasticity/elastic.py:21: in <module>
from pymatgen.analysis.elasticity.stress import Stress
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pymatgen/analysis/elasticity/stress.py:11: in <module>
from typing_extensions import Self
E ModuleNotFoundError: No module named 'typing_extensions'
```
_Originally posted by @kavanase in https://github.com/materialsproject/pymatgen/issues/3705#issuecomment-2051980163_
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3751/reactions",
"total_count": 3,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 2,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3751/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3752
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3752/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3752/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3752/events
|
https://github.com/materialsproject/pymatgen/pull/3752
| 2,240,608,568
|
PR_kwDOACgets5shEFJ
| 3,752
|
Fix `typing_extension` `ImportError` in downstream packages
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates to the `pymatgen` codebase involve enhancing type handling and code readability. Changes include updating the `ruff-pre-commit` repository version, consolidating imports in core modules, and adding conditional imports for improved type checking.\n\n## Changes\n\n| File Path | Change Summary |\n|----------------------------|---------------------------------------------------------|\n| `.pre-commit-config.yaml` | Updated `ruff-pre-commit` repository to `v0.3.7` |\n| `pymatgen/core/...` | Grouped imports for better readability |\n| `pymatgen/analysis/...`<br>`pymatgen/ext/...`<br>`pymatgen/io/abinit/...` | Added `TYPE_CHECKING` and conditional `Self` imports |\n| `tests/io/test_packmol.py` | Added `import re`, error message constant, and test modifications |\n| `tests/transformations/...`| Removed unnecessary comment directive |\n\n## Assessment against linked issues\n\n| Objective | Addressed | Explanation |\n|--------------------------------------------------|-----------|--------------|\n| Import `typing_extension` at runtime causing ImportError [#3751] | ✅ | |\n\n## Poem\n\n> 🐇 Hop, hop, hooray! Let's celebrate today, \n> Code has been groomed, with imports well-tuned. \n> From `Self` imports sly, to a version bump high, \n> Every line and dot, makes our code a top-notch spot! \n> 🚀 Let's code away, in a much smoother way!\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n.pre-commit-config.yaml: Updated the revision of the `ruff-pre-commit` repository from version `v0.3.5` to `v0.3.7`.\n\n---\n\npymatgen/core/__init__.py: Consolidated imports, switching from individual imports to grouped imports for various core modules and classes to improve code readability.\n\n---\n\npymatgen/analysis/elasticity/stress.py: Added an import for `TYPE_CHECKING` from `typing` to conditionally import `Self` from `typing_extensions`.\n\n---\n\npymatgen/ext/optimade.py: Introduced a new import statement for `TYPE_CHECKING` from `typing` module and added conditional imports for `Self` from `typing_extensions` to enhance type hinting and conditional type checking.\n\n---\n\npymatgen/io/abinit/netcdf.py: Added a `TYPE_CHECKING` block and imported `Self` from `typing_extensions`.\n\n---\n\ntests/io/test_packmol.py: ## Short summary\n\nIn the `tests/io/test_packmol.py` file, the changes include:\n- Addition of `import re`\n- Declaration of `ERR_MSG_173` with a specific error message\n- Modification in test functions to use `ERR_MSG_173` in `pytest.raises`\n\n---\n\ntests/transformations/test_standard_transformations.py: Removed `# ruff: noqa: N806` comment directive.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives (User Provided Facts)\n\nThis pull request (PR #3752) aims to address an issue (#3751) reported by users of the `pymatgen` library. The issue involves an `ImportError` related to the `typing_extensions` module, impacting downstream packages like `ShakeNBreak` and `doped`. The error occurs due to the absence of `typing_extensions` when importing certain classes from `pymatgen`, leading to test failures during GitHub Actions tests.\n\nThe PR intends to resolve this issue by adjusting import statements in the `pymatgen` codebase. By introducing conditional imports for the `Self` type from `typing_extensions`, the PR aims to ensure that the `Self` type is only imported during type checking, preventing runtime errors in environments where `typing_extensions` is not available.\n\n### AI-Generated Summary of Generated Summaries\n\nThe PR introduces changes across the `pymatgen` library to handle conditional imports effectively and enhance code readability:\n\n1. **Pre-commit Configuration Update**:\n - Updated the revision of the `ruff-pre-commit` repository in `.pre-commit-config.yaml` from `v0.3.5` to `v0.3.7`.\n\n2. **Code Readability Improvements**:\n - Consolidated imports in `pymatgen/core/__init__.py` from individual to grouped imports for core modules and classes, improving code readability.\n\n3. **Conditional Imports for `typing_extensions`**:\n - Added conditional imports for the `Self` type from `typing_extensions` in `pymatgen/analysis/elasticity/stress.py`, `pymatgen/ext/optimade.py`, and `pymatgen/io/abinit/netcdf.py` within `TYPE_CHECKING` blocks. These imports ensure `Self` is only imported during type checking, addressing the `ImportError` issue.\n\n4. **Test Enhancements**:\n - In `tests/io/test_packmol.py`, added `import re`, declared `ERR_MSG_173` with a specific error message, and modified test functions to use `ERR_MSG_173` for standardized error handling.\n - Removed an unnecessary comment directive (`# ruff: noqa: N806`) in `tests/transformations/test_standard_transformations.py`.\n\nThese changes collectively aim to improve the maintainability and functionality of the `pymatgen` library by handling dependencies more effectively and enhancing code clarity.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 666db915e3ed3e6f07f56c50f3915b5a486b5e99 and 16af9e4f6f69b802a5418d0389e4cbfd3b2c1e81.\n</details>\n\n\n<details>\n<summary>Files selected for processing (1)</summary>\n\n* tests/io/test_packmol.py (4 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (1)</summary>\n\n* tests/io/test_packmol.py\n\n</details>\n\n\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 1f14f27bc84014b0c3ad9c78734ce7a0c69bc948 -->\n<!-- 666db915e3ed3e6f07f56c50f3915b5a486b5e99 -->\n<!-- 32c320e11a55b3c0bd828098d977a065b2c2542b -->\n<!-- 16af9e4f6f69b802a5418d0389e4cbfd3b2c1e81 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Hi @janosh @DanielYang59 !\r\nSorry to be the bearer of bad news, but this issue has cropped up again in the recent release of `pymatgen`, which again is causing failures in our CI for `doped`/`ShakeNBreak` (and I imagine other downstream packages of `pymatgen`).\r\n(https://github.com/SMTG-Bham/ShakeNBreak/actions/runs/9323684325/job/25667402879, https://github.com/SMTG-Bham/doped/actions/runs/9323686497).\r\n\r\nThe issue is that `typing_extensions` is now imported before the `TYPE_CHECKING` block in `pymatgen.core.structure`, added in this commit: https://github.com/materialsproject/pymatgen/commit/d0ad785f9b4e9a57717ef2c56eef19ceb8e90c25\r\nAs far as I can tell, it's correctly imported in the `TYPE_CHECKING` block in all other usages, but might be worth a quick check.\r\n",
"sorry for the trouble!\r\n\r\nwe'll get a fix in asap ofc but really we need to setup CI that only installs non-optional deps so we catch these mistakes in the future.",
"Also minor issue that doesn't really matter but might be useful to know about, `pymatgen.core.periodic_table` uses the `monty.dev` `@deprecated()` decorator with the `deadline` keyword argument, but this was only added by @DanielYang59 in v`2024.3.31` of `monty`, but this isn't a version requirement of `pymatgen`, so when I updated to the new `pymatgen` it was throwing `top_level_collect` error messages about this until I upgrade `monty`. \r\nSo probably worth adding `monty>=2024.3.31` to the dependencies!",
"that should be easy to prevent in future since we use `uv` which offers [`--resolution=lowest`](https://astral.sh/blog/uv) to install the oldest allowed versions of all packages",
"Sorry for the trouble, again. And I really want some automated import guard against `TYPE_CHECKING` only imports #3827, which would prevent such issues.\r\n\r\n> Also minor issue that doesn't really matter but might be useful to know about, `pymatgen.core.periodic_table` uses the `monty.dev` `@deprecated()` decorator with the `deadline` keyword argument, but this was only added by @DanielYang59 in v`2024.3.31` of `monty`, but this isn't a version requirement of `pymatgen`, so when I updated to the new `pymatgen` it was throwing `top_level_collect` error messages about this until I upgrade `monty`. So probably worth adding `monty>=2024.3.31` to the dependencies!\r\n\r\nLooks like I forgot about the `monty` version in `setup.py`: https://github.com/materialsproject/pymatgen/blob/2982968a44d0ff65392057488aee4871210bc847/setup.py#L30-L32\r\n\r\nAnd updated the `monty` version in `requirements.txt` alone: https://github.com/materialsproject/pymatgen/blob/2982968a44d0ff65392057488aee4871210bc847/requirements.txt#L4\r\n\r\nPerhaps we should [reuse `requirements.txt` in `setup.py` ](https://stackoverflow.com/questions/14399534/reference-requirements-txt-for-the-install-requires-kwarg-in-setuptools-setup-py) instead of having duplicates? Maybe there are reasons that I'm not aware of?\r\n\r\n",
"> Perhaps we should [reuse requirements.txt in setup.py ](https://stackoverflow.com/questions/14399534/reference-requirements-txt-for-the-install-requires-kwarg-in-setuptools-setup-py)instead of having duplicates? Maybe there are reasons that I'm not aware of?\r\n\r\nbetter yet, get rid of `requirements.txt` as i've been saying for years. no good reasons for keeping it imo",
"I would also be pro removing. Would it actually make sense to have a pymatgen[strict] similar to atomate2[strict] to have exact version numbers of all packages as well?"
] | 2024-04-12T17:36:57
| 2024-06-01T13:36:42
|
2024-04-12T19:36:04Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
closes #3751
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Improved code readability by consolidating imports in core modules.
- Enhanced type hinting and conditional type checking across various modules.
- **Tests**
- Updated test functions with specific error messages for better clarity.
- **Chores**
- Updated revision of pre-commit hooks to ensure code quality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3752/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3752/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3752",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3752",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3752.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3752.patch",
"merged_at": "2024-04-12T19:36:04Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3753
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3753/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3753/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3753/events
|
https://github.com/materialsproject/pymatgen/issues/3753
| 2,240,671,614
|
I_kwDOACgets6Fje9-
| 3,753
|
OptimadeRester
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Thanks for the report. I had used it recently and noticed a few endpoints broken, but wasn’t sure if it was them being out of spec or an issue with the parsing logic — seems likely the latter.\r\n\r\nWhen this client was first added there was no good alternative, but now there is a very nice client from @ml-evs over in [`optimade-python-tools`](https://www.optimade.org/optimade-python-tools/latest/getting_started/client/) which may be helpful. I added a pointer to this in the pymatgen client docstring.\r\n\r\nNevertheless, we should either fix the pymatgen client or formally deprecate it, or perhaps change the backend to use `optimade-python-tools`. It is useful to be able to easily retrieve entries in `Structure` format so I would like to be able to retain this somehow.",
"Thanks, @mkhorton . Will then switch to the optimade-python-tools for this particular example !",
"Looks like something has gone wrong with the URL construction, the \"v1\" is being added in the wrong place, it should be https://aiida.materialscloud.org/mc3d/optimade/v1/ rather than https://aiida.materialscloud.org/mc3d/v1/optimade, so either the aliases in pymatgen need to be refreshed or there is a bug.\r\n\r\nThis does come up every now and again, if desirable I can move the optimade-python-tools client into its own package with only httpx as a dependency. It wouldn't be too much work to replicate the current `OptimadeRester` functionality by wrapping the `OptimadeClient` class we have.",
"Equivalent query with o-p-t, after `pip install optimade[http-client]`:\r\n\r\n```shell\r\noptimade-get --response-fields \"cartesian_site_positions,lattice_vectors,species,species_at_sites\" --filter 'elements HAS ALL \"Ti\" AND nelements=1' https://aiida.materialscloud.org/mc3d/optimade \r\n```\r\n\r\nor \r\n\r\n```python\r\nfrom optimade.client import OptimadeClient\r\n\r\nclient = OptimadeClient(\"https://aiida.materialscloud.org/mc3d/optimade\")\r\nresults = client.get(\r\n filter='elements HAS ALL \"Ti\" AND nelements=1',\r\n response_fields=[\r\n \"cartesian_site_positions\",\r\n \"lattice_vectors\",\r\n \"species\",\r\n \"species_at_sites\",\r\n ],\r\n)\r\n```",
"My use-case is showing optimade in a lecture including code example. It worked when I drafted it a few weeks ago 😅. But I can surely switch as well.",
"Weird, I just tried your code snippet and it works fine for me:\r\n\r\n```\r\n>>> from pymatgen.ext.optimade import OptimadeRester\r\n>>> with OptimadeRester(aliases_or_resource_urls=[\"mcloud.mc3d\"]) as o:\r\n... structures=o.get_structures([\"Ti\"], nelements=1 )\r\n...\r\nmcloud.mc3d: 100%|█████████████████████████████████████| 6/6 [00:00<?, ?it/s]\r\n>>> structures\r\n{'mcloud.mc3d': {'105195': Structure Summary\r\nLattice\r\n abc : 2.8175362595703968 2.8175362595703968 2.8175362595703968\r\n angles : 109.47122063449069 109.47122063449069 109.47122063449069\r\n volume : 17.21815648938191\r\n A : -1.6267053179145 1.6267053179145 1.6267053179145\r\n B : 1.6267053179145 -1.6267053179145 1.6267053179145\r\n C : 1.6267053179145 1.6267053179145 -1.6267053179145\r\n pbc : True True True\r\n...\r\n```",
"I had installed the latest pymatgen and the one before.\r\n\r\nWhich Python version?",
"Installed pymatgen 2024.04.12 again. Still fails. This time with Python 3.9. ",
"When I manually correct the url construction within the code, it works... Will check in the code if some logic got removed at some point.",
"My feeling is that it is this commit: \r\nhttps://github.com/materialsproject/pymatgen/commit/cf1b61a88a8d1f959de4f29c0ce48d5a46611563\r\n\r\nurljoin somehow cuts off the \"optimade\" from the URL, then joins the URLs and then the \"optimade\" is missing. I don't really have time to fix it properly. I could replace the urljoin with join again but I guess this is not a good fix as we will then have problems on other operating systems again.\r\n\r\nAdding this here as well: https://stackoverflow.com/questions/10893374/python-confusions-with-urljoin\r\n\r\n@janosh @ml-evs , any ideas? (Maybe also operating system dependent?)\r\n\r\n",
"> My feeling is that it is this commit: [cf1b61a](https://github.com/materialsproject/pymatgen/commit/cf1b61a88a8d1f959de4f29c0ce48d5a46611563)\r\n> \r\n> urljoin somehow cuts off the \"optimade\" from the URL, then joins the URLs and then the \"optimade\" is missing. I don't really have time to fix it properly. I could replace the urljoin with join again but I guess this is not a good fix as we will then have problems on other operating systems again.\r\n> \r\n> Adding this here as well: https://stackoverflow.com/questions/10893374/python-confusions-with-urljoin\r\n> \r\n> @janosh @ml-evs , any ideas? (Maybe also operating system dependent?)\r\n\r\nYep, sorry, I realise I was running your failing snippet with 2024.1. I can try to fix this now.",
"Annoyingly simple fix... some aliases are root domains whereas others already have paths; if you don't end a URL with a path with a slash, then urljoin scrubs the last section of the path.",
"> Annoyingly simple fix... some aliases are root domains whereas others already have paths; if you don't end a URL with a path with a slash, then urljoin scrubs the last section of the path.\r\n\r\nAh, didn't realize the additional \"/\" would already fix it. 😅 But good to know! Maybe, we should add an additional test as well to avoid this from breaking in the future. At the moment, only MP is tested",
"> > Annoyingly simple fix... some aliases are root domains whereas others already have paths; if you don't end a URL with a path with a slash, then urljoin scrubs the last section of the path.\r\n> \r\n> Ah, didn't realize the additional \"/\" would already fix it. 😅 But good to know! Maybe, we should add an additional test as well to avoid this from breaking in the future. At the moment, only MP is tested\r\n\r\nSee #3756! I'm thinking of adding a couple more tests that depend on other \"stable\" databases, indeed. Also that refreshing the aliases list can fail nicely even when a given database is down."
] | 2024-04-12T18:14:06
| 2024-04-13T12:48:37
|
2024-04-13T12:48:37Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
3.11
### Pymatgen version
2024.3.1
### Operating system version
Linux
### Current behavior
OptimadeRester seems to be broken. Will not get any results via:
```py
from pymatgen.ext.optimade import OptimadeRester
with OptimadeRester(aliases_or_resource_urls=["mcloud.mc3d"]) as o:
structures=o.get_structures(["Ti"], nelements=1 )
```
I then get:
`Failed to parse https://aiida.materialscloud.org/mc3d/v1/info when validating: Expecting value: line 1 column 1 (char 0)
Could not retrieve required information from provider mcloud.mc3d and url='https://aiida.materialscloud.org/mc3d/v1/structures?filter=(elements HAS ALL "Ti") AND (nelements=1)&response_fields=cartesian_site_positions,lattice_vectors,species,species_at_sites': Expecting value: line 1 column 1 (char 0)
{}`
I actually get this for everything except "mp".
### Expected Behavior
Return a material
### Minimal example
```Python
from pymatgen.ext.optimade import OptimadeRester
with OptimadeRester(aliases_or_resource_urls=["mcloud.mc3d"]) as o:
structures=o.get_structures(["Ti"], nelements=1 )
```
### Relevant files to reproduce this bug
None
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3753/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3753/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3754
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3754/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3754/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3754/events
|
https://github.com/materialsproject/pymatgen/pull/3754
| 2,240,836,012
|
PR_kwDOACgets5sh2LI
| 3,754
|
Update some of the OPTIMADE aliases
|
{
"login": "ml-evs",
"id": 7916000,
"node_id": "MDQ6VXNlcjc5MTYwMDA=",
"avatar_url": "https://avatars.githubusercontent.com/u/7916000?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ml-evs",
"html_url": "https://github.com/ml-evs",
"followers_url": "https://api.github.com/users/ml-evs/followers",
"following_url": "https://api.github.com/users/ml-evs/following{/other_user}",
"gists_url": "https://api.github.com/users/ml-evs/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ml-evs/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ml-evs/subscriptions",
"organizations_url": "https://api.github.com/users/ml-evs/orgs",
"repos_url": "https://api.github.com/users/ml-evs/repos",
"events_url": "https://api.github.com/users/ml-evs/events{/privacy}",
"received_events_url": "https://api.github.com/users/ml-evs/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 6817617461,
"node_id": "LA_kwDOACgets8AAAABllyWNQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ext",
"name": "ext",
"color": "3766AC",
"default": false,
"description": "pymatgen ext package for API data fetching"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe `OptimadeRester` class has been enhanced with additional database aliases, expanding its connectivity to new endpoints like \"alexandria\", \"odbx\", and \"odbx.gnome\". This update also introduces specific aliases for different computational methods within the \"alexandria\" database, namely \"pbe\" and \"pbesol\".\n\n## Changes\n\n| File | Change Summary |\n|-------------------------|--------------------------------------------------------------------------------------------------------|\n| `.../ext/optimade.py` | Added aliases for \"alexandria\", \"odbx\", \"odbx.gnome\", \"alexandria.pbe\", and \"alexandria.pbesol\" endpoints |\n\n> 🐇✨\n> In the code's woven maze, a rabbit hops,\n> Adding paths where data never stops.\n> Alexandria's gates, ODBX streams,\n> Through lines of code, a developer dreams.\n> 🌟🌌\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/ext/optimade.py: ## Short summary\n\nThe `OptimadeRester` class in `pymatgen/ext/optimade.py` has been updated to include new aliases for different databases, specifically adding aliases for the \"alexandria\", \"odbx\", and \"odbx.gnome\" endpoints with updated URLs. Additionally, aliases for \"alexandria.pbe\" and \"alexandria.pbesol\" have been introduced.\n\n\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request (PR #3754) aims to address issues with broken OPTIMADE aliases as highlighted in the related issue (cc #3753). The primary focus is on updating and adding new aliases within the `OptimadeRester` class in the `pymatgen/ext/optimade.py` file. This update includes the introduction of aliases for new database endpoints such as \"alexandria\", \"odbx\", and \"odbx.gnome\", along with their respective URLs. Additionally, the PR introduces specific aliases for \"alexandria.pbe\" and \"alexandria.pbesol\", expanding the coverage and functionality of the OPTIMADE interface in the pymatgen library.\n\n### AI-Generated Summary of Generated Summaries\n\nThe `OptimadeRester` class in `pymatgen/ext/optimade.py` has been enhanced by adding several new aliases for OPTIMADE database endpoints. These additions include aliases for \"alexandria\", \"odbx\", and \"odbx.gnome\", each accompanied by updated URLs to ensure proper access and integration. Furthermore, the update introduces specialized aliases for \"alexandria.pbe\" and \"alexandria.pbesol\", catering to specific computational needs and preferences within the materials science community. These changes collectively aim to improve the utility and accuracy of the OPTIMADE interface provided by pymatgen.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between f81535f5647b3c6f877dd473164f67fce22b6cd9 and d07e76c333a4e540d96c6221ce0909e266409844.\n</details>\n\n\n<details>\n<summary>Files selected for processing (1)</summary>\n\n* pymatgen/ext/optimade.py (2 hunks)\n\n</details>\n\n\n\n\n\n\n\n<details><summary>Additional comments not posted (2)</summary><blockquote>\n<details><summary>pymatgen/ext/optimade.py (2)</summary><blockquote>\n\n`55-57`: The new aliases for \"alexandria\", \"alexandria.pbe\", and \"alexandria.pbesol\" are correctly added with distinct and appropriate URLs.\n\n---\n\n`76-76`: The new alias for \"odbx.gnome\" is correctly added with an appropriate URL.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- d07e76c333a4e540d96c6221ce0909e266409844 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@coderabbitai disable",
"<!-- This is an auto-generated reply by CodeRabbit -->\n\n\n@ml-evs, I'm disabling the automated reviews for this pull request as requested. If you need to resume reviews or have any other requests, feel free to let me know!\n\n\n\n<details>\n<summary>Actions performed</summary>\n\nReviews paused.\n\n</details>",
"~Just to clarify, this does not fix the \"mcloud.mc3d\" provider, so @JaGeo's issue should remain open?~\r\n\r\ndidn't see the discussion in #3753 about the issue not reproducing",
"> ~Just to clarify, this does not fix the \"mcloud.mc3d\" provider, so @JaGeo's issue should remain open?~\r\n> \r\n> didn't see the discussion in #3753 about the issue not reproducing\r\n\r\nIt does repro, I was just doing it badly late on a Friday evening ;) I'll try to cook up a fix (I think this came up once before)",
"How does calendar versioning work when you need to do another fix on the same day? :grin: ",
"It doesn't. I guess you could add a `-1` suffix. Still one of several reasons calendar versioning is inferior to semantic. "
] | 2024-04-12T20:18:28
| 2024-04-13T13:31:47
|
2024-04-13T05:37:38Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
cf #3753, this PR fixes some of the broken OPTIMADE aliases.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Updated the `OptimadeRester` with new database aliases for enhanced connectivity options, including "alexandria", "odbx", "odbx.gnome", "alexandria.pbe", and "alexandria.pbesol".
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3754/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3754/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3754",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3754",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3754.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3754.patch",
"merged_at": "2024-04-13T05:37:38Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3755
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3755/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3755/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3755/events
|
https://github.com/materialsproject/pymatgen/pull/3755
| 2,240,959,376
|
PR_kwDOACgets5siSGC
| 3,755
|
Remove duplicate ruff rule in `pyproject.toml`
|
{
"login": "Andrew-S-Rosen",
"id": 8674072,
"node_id": "MDQ6VXNlcjg2NzQwNzI=",
"avatar_url": "https://avatars.githubusercontent.com/u/8674072?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Andrew-S-Rosen",
"html_url": "https://github.com/Andrew-S-Rosen",
"followers_url": "https://api.github.com/users/Andrew-S-Rosen/followers",
"following_url": "https://api.github.com/users/Andrew-S-Rosen/following{/other_user}",
"gists_url": "https://api.github.com/users/Andrew-S-Rosen/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Andrew-S-Rosen/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Andrew-S-Rosen/subscriptions",
"organizations_url": "https://api.github.com/users/Andrew-S-Rosen/orgs",
"repos_url": "https://api.github.com/users/Andrew-S-Rosen/repos",
"events_url": "https://api.github.com/users/Andrew-S-Rosen/events{/privacy}",
"received_events_url": "https://api.github.com/users/Andrew-S-Rosen/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent changes focus on enhancing functionality and improving code structure across various files in the project. From simplifying logic in functions to refining data handling and parsing processes, these updates aim to streamline operations and boost clarity within the codebase.\n\n## Changes\n\n| Files | Change Summary |\n|---------------------------------------------|--------------------------------------------------------------------------------------------------------------------|\n| `connected_components.py` | Consolidated edge data retrieval logic for a more structured approach |\n| `cohp.py` | Restructured `from_file` to handle cases based on `are_multi_center_cobis` presence |\n| `bs.py` | Simplified logic for updating `current_segment` length |\n| `outputs.py` | Refactored eigenvalue parsing in VASP output files |\n| `sets.py` | Simplified logic for determining `encut` value |\n| `plotter.py` | Restructured y-axis limits setting logic in `get_plot` function |\n| `provenance.py` | Updated return type annotation in `parse_history_node` method |\n| `structure_vtk.py` | Modified logic for checking `istruct` in `apply_tags` method |\n| `pyproject.toml` | Removed \"TID\" linting tool and added \"flake8-tidy-imports\" in `lint.select` configuration |\n| `test_outputs.py`, `test_init.py` | Reorganized imports for ElementTree and modules in `pymatgen.phonon` |\n\n## Poem\n\n> 🐇✨ \n> Code changes dance in the digital light, \n> Logic refined, clarity takes flight. \n> From TID to flake8, a shift so bright, \n> In fields of code, progress alight. 🌟📄\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/chemenv/connectivity/connected_components.py: The change in functionality involves consolidating the edge data retrieval logic by checking for various key combinations in the `links_data` dictionary, leading to a more concise and structured approach to handling edge data assignment.\n\npymatgen/electronic_structure/cohp.py: In the `pymatgen/electronic_structure/cohp.py` file, the changes involve the restructuring of the `from_file` function to handle different cases based on the presence of `are_multi_center_cobis`. The logic now distinguishes between cases where `are_multi_center_cobis` is not present, leading to the creation of `avg_cohp`, and cases where it is present, resulting in the calculation of `cohp` and `icohp` averages separately for spin channels.\n\npymatgen/io/aims/sets/bs.py: In the `prepare_band_input` function in `bs.py`, the logic for updating the length of `current_segment` has been simplified by removing an unnecessary `if` condition, resulting in a more concise control flow.\n\npymatgen/io/vasp/outputs.py: The change in functionality involves refactoring the logic related to parsing eigenvalues and projected eigenvalues in VASP output files. The modification consolidates the handling of \"eigenvalues_kpoints_opt\" and \"projected_kpoints_opt\" tags, improving the organization and clarity of the parsing process.\n\npymatgen/io/vasp/sets.py: In the `calculate_ng` function of `pymatgen/io/vasp/sets.py`, the logic for determining the `encut` value has been simplified. Now, if `custom_encut` is provided or if the INCAR parameter \"ENCUT\" is greater than 0, `encut` is set accordingly; otherwise, it is calculated as the maximum of `i_species.enmax` for each `i_species` in the POTCAR entries.\n\npymatgen/phonon/plotter.py: In the `get_plot` function of `plotter.py`, the logic for setting the y-axis limits has been restructured. Now, when `ylim` is not specified but `invert_axes` is True, the y-axis limits are adjusted based on the x-axis limits. Additionally, the handling of relevant y-values for setting the y-axis limits has been updated.\n\npymatgen/util/provenance.py: The change in functionality involves updating the return type annotation from `History node` to `HistoryNode` in the `parse_history_node` method, aligning it with the actual class name.\n\npymatgen/vis/structure_vtk.py: In the `apply_tags` method of `structure_vtk.py`, the logic for checking `istruct` has been modified to use `not in` with a tuple instead of comparing directly to \"all\" and `self.istruct`.\n\npyproject.toml: The change in functionality involves removing the linting tool \"TID\" and replacing it with \"flake8-tidy-imports\" in the `lint.select` configuration in the `pyproject.toml` file.\n\ntests/io/vasp/test_outputs.py: The change in functionality involves reorganizing imports in the `test_outputs.py` file, specifically switching from importing `xml.etree.ElementTree` to importing `ElementTree` from `xml.etree`. This modification alters the way the ElementTree module is imported, potentially affecting how it is referenced in the code.\n\ntests/phonon/test_init.py: The change in functionality involves reorganizing the import statements in the `test_init.py` file related to `pymatgen.phonon` module. The `dos` and `plotter` modules are now imported directly from `pymatgen.phonon` instead of individually importing them. This change streamlines the import statements and potentially improves code readability.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request #3755 addresses a redundancy issue in the `pyproject.toml` file of a Python project. Specifically, the duplicate entry of the linting tool \"TID\" is being removed to clean up the configuration settings and improve the project setup.\n\n### AI-generated Summary of Generated Summaries\n\nThe changes across various files involve enhancing functionality and improving code organization. In `pyproject.toml`, the duplicate linting tool entry \"TID\" is replaced with \"flake8-tidy-imports\" in the `lint.select` configuration, streamlining the linting process. Other changes include restructuring logic for edge data retrieval, handling different cases in file parsing functions, simplifying control flow, updating return type annotations, and optimizing import statements for better code readability. These modifications aim to enhance code clarity, maintainability, and efficiency across different modules within the project.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between e2e11a84260ad1b2cf4cb4d1a387aba0be045ac0 and fcefc3d8a0217f6c49c67dd53fa159b6ea54724e.\n</details>\n\n\n<details>\n<summary>Files selected for processing (11)</summary>\n\n* pymatgen/analysis/chemenv/connectivity/connected_components.py (1 hunks)\n* pymatgen/electronic_structure/cohp.py (1 hunks)\n* pymatgen/io/aims/sets/bs.py (1 hunks)\n* pymatgen/io/vasp/outputs.py (3 hunks)\n* pymatgen/io/vasp/sets.py (1 hunks)\n* pymatgen/phonon/plotter.py (1 hunks)\n* pymatgen/util/provenance.py (1 hunks)\n* pymatgen/vis/structure_vtk.py (1 hunks)\n* pyproject.toml (2 hunks)\n* tests/io/vasp/test_outputs.py (1 hunks)\n* tests/phonon/test_init.py (1 hunks)\n\n</details>\n\n\n\n\n<details>\n<summary>Files skipped from review due to trivial changes (1)</summary>\n\n* tests/phonon/test_init.py\n\n</details>\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (1)</summary>\n\n* pyproject.toml\n\n</details>\n\n\n<details><summary>Additional comments not posted (51)</summary><blockquote>\n<details><summary>pymatgen/io/aims/sets/bs.py (1)</summary><blockquote>\n\n`48-51`: Simplified logic for updating `current_segment[\"length\"]` enhances readability and likely improves performance by reducing conditional checks.\n\n</blockquote></details>\n<details><summary>pymatgen/util/provenance.py (1)</summary><blockquote>\n\n`96-99`: Correcting the return type annotation from `History node` to `HistoryNode` improves type clarity and correctness.\n\n</blockquote></details>\n<details><summary>pymatgen/analysis/chemenv/connectivity/connected_components.py (1)</summary><blockquote>\n\n`244-253`: Consolidating edge data retrieval logic by checking various key combinations simplifies and structures the approach, enhancing maintainability.\n\n</blockquote></details>\n<details><summary>pymatgen/vis/structure_vtk.py (1)</summary><blockquote>\n\n`991-991`: The change from direct comparison to using `not in` with a tuple for checking `istruct` is a good improvement for clarity and future extensibility. This allows for easier addition of more conditions without changing the structure of the condition.\n\n</blockquote></details>\n<details><summary>pymatgen/electronic_structure/cohp.py (1)</summary><blockquote>\n\n`775-820`: The restructuring of the `from_file` method in the `CompleteCohp` class to handle `are_multi_center_cobis` is well-implemented. However, consider adding more detailed comments explaining the logic, especially for the averaging process in lines 787-806. This will improve maintainability and understandability of the code.\n\n</blockquote></details>\n<details><summary>tests/io/vasp/test_outputs.py (31)</summary><blockquote>\n\n`10-10`: Consider adding a docstring to the `TestVasprun` class to explain its purpose and the functionalities it tests.\n\n---\n\nLine range hint `28-28`: Add a docstring to the `test_vasprun_ml` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `38-38`: Add a docstring to the `test_vasprun_md` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `48-48`: Add a docstring to the `test_bad_random_seed` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `58-58`: Add a docstring to the `test_multiple_dielectric` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `68-68`: Add a docstring to the `test_charge_charge_dielectric` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `78-78`: Add a docstring to the `test_optical_absorption_coeff` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `88-88`: Add a docstring to the `test_vasprun_with_more_than_two_unlabelled_dielectric_functions` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `98-98`: Add a docstring to the `test_bad_vasprun` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `108-108`: Add a docstring to the `test_runtype` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `118-118`: Add a docstring to the `test_vdw` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `128-128`: Add a docstring to the `test_energies` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `138-138`: Add a docstring to the `test_nonlmn` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `148-148`: Add a docstring to the `test_standard` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `158-158`: Add a docstring to the `test_unconverged` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `168-168`: Add a docstring to the `test_dfpt` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `178-178`: Add a docstring to the `test_dfpt_ionic` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `188-188`: Add a docstring to the `test_dfpt_unconverged` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `198-198`: Add a docstring to the `test_chi` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `208-208`: Add a docstring to the `test_uniform` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `218-218`: Add a docstring to the `test_no_projected` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `228-228`: Add a docstring to the `test_dielectric` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `238-238`: Add a docstring to the `test_dielectric_vasp608` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `248-248`: Add a docstring to the `test_indirect_vasprun` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `258-258`: Add a docstring to the `test_optical_vasprun` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `268-268`: Add a docstring to the `test_force_constants` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `278-278`: Add a docstring to the `test_xe` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `288-288`: Add a docstring to the `test_invalid_element` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `298-298`: Add a docstring to the `test_selective_dynamics` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `308-308`: Add a docstring to the `test_as_dict` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n---\n\nLine range hint `318-318`: Add a docstring to the `test_get_band_structure` method to explain what specific aspect of the `Vasprun` class it is testing.\n\n</blockquote></details>\n<details><summary>pymatgen/io/vasp/outputs.py (15)</summary><blockquote>\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nRefactor the `_generate_nbmax` method to improve readability and maintainability.\n\n```diff\n- def _generate_nbmax(self) -> None:\n+ def _calculate_max_g_vectors(self) -> np.ndarray:\n # existing code...\n- self._nbmax = np.max([nbmaxA, nbmaxB, nbmaxC], axis=0).astype(int)\n+ return np.max([nbmaxA, nbmaxB, nbmaxC], axis=0).astype(int)\n\n- self._generate_nbmax()\n+ self._nbmax = self._calculate_max_g_vectors()\n```\nRenaming `_generate_nbmax` to `_calculate_max_g_vectors` and changing it to return the calculated values instead of setting them directly improves the method's clarity and testability.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nOptimize the loop in `_generate_G_points` to enhance performance.\n\nConsider using numpy operations to vectorize the loop that calculates G-points, which could significantly speed up the execution if the number of iterations is large.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nVerify the normalization factor in `evaluate_wavefunc`.\n\nEnsure that the normalization factor used in the wavefunction evaluation is consistent with the VASP documentation and the physical interpretation of the wavefunction.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nAdd documentation for the `fft_mesh` method to clarify its usage and parameters.\n\nImproving the documentation for this method will help users understand its purpose and how to use it effectively, especially the meaning and impact of the `shift` parameter.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nRefactor `eigenvalue_band_properties` to improve clarity and efficiency.\n\n```diff\n- for d in self.eigenvalues.values():\n+ for spin, d in self.eigenvalues.items():\n # existing code...\n```\nUsing `.items()` to iterate over the dictionary provides both the key and value, which can be used to enhance the readability and potential debugging of the method.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nOptimize data processing in `Waveder.from_file` for efficiency.\n\nConsider using numpy operations to process data arrays directly from the file buffer, which can significantly speed up the data handling and reduce memory usage.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nAdd documentation for the `WSWQ` class to clarify its usage and parameters.\n\nImproving the documentation for this class will help users understand its purpose and how to use it effectively, especially the meaning and impact of the overlap operator and matrix elements.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nVerify the data reshaping logic in `WSWQ.from_file`.\n\nEnsure that the reshaping of data arrays from the WSWQ file matches the expected dimensions and order of indices, which is crucial for the correct interpretation of wavefunction overlaps.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nEnsure consistent usage of `UnconvergedVASPWarning` across different modules.\n\nVerify that `UnconvergedVASPWarning` is used consistently in all modules where VASP run convergence is checked, to maintain uniformity in handling and reporting unconverged runs.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nRefactor the `_generate_nbmax` method to improve readability and maintainability.\n\n```diff\n- def _generate_nbmax(self) -> None:\n+ def _calculate_max_g_vectors(self) -> np.ndarray:\n # existing code...\n- self._nbmax = np.max([nbmaxA, nbmaxB, nbmaxC], axis=0).astype(int)\n+ return np.max([nbmaxA, nbmaxB, nbmaxC], axis=0).astype(int)\n\n- self._generate_nbmax()\n+ self._nbmax = self._calculate_max_g_vectors()\n```\nRenaming `_generate_nbmax` to `_calculate_max_g_vectors` and changing it to return the calculated values instead of setting them directly improves the method's clarity and testability.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nOptimize the loop in `_generate_G_points` to enhance performance.\n\nConsider using numpy operations to vectorize the loop that calculates G-points, which could significantly speed up the execution if the number of iterations is large.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nVerify the normalization factor in `evaluate_wavefunc`.\n\nEnsure that the normalization factor used in the wavefunction evaluation is consistent with the VASP documentation and the physical interpretation of the wavefunction.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nAdd documentation for the `fft_mesh` method to clarify its usage and parameters.\n\nImproving the documentation for this method will help users understand its purpose and how to use it effectively, especially the meaning and impact of the `shift` parameter.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nRefactor `eigenvalue_band_properties` to improve clarity and efficiency.\n\n```diff\n- for d in self.eigenvalues.values():\n+ for spin, d in self.eigenvalues.items():\n # existing code...\n```\nUsing `.items()` to iterate over the dictionary provides both the key and value, which can be used to enhance the readability and potential debugging of the method.\n\n---\n\n`355-361`: > :memo: **NOTE**\n> This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [358-414]\n\nOptimize data processing in `Waveder.from_file` for efficiency.\n\nConsider using numpy operations to process data arrays directly from the file buffer, which can significantly speed up the data handling and reduce memory usage.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- e2e11a84260ad1b2cf4cb4d1a387aba0be045ac0 -->\n<!-- fcefc3d8a0217f6c49c67dd53fa159b6ea54724e -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-12T21:32:35
| 2024-04-13T05:43:20
|
2024-04-13T05:43:20Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
"TID" was listed twice.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Chores**
- Updated the linting tool from "TID" to "flake8-tidy-imports" for improved code quality checks.
- **Refactor**
- Restructured the logic for setting y-axis limits in the `get_plot` function of `plotter.py`.
- Simplified the logic for updating the length of `current_segment` in the `prepare_band_input` function in `bs.py`.
- Consolidated the edge data retrieval logic in the `connected_components.py` file for a more structured approach.
- Refactored the logic related to parsing eigenvalues in VASP output files for improved organization.
- Simplified the logic for determining the `encut` value in the `calculate_ng` function of `sets.py`.
- Modified the logic for checking `istruct` in the `apply_tags` method of `structure_vtk.py`.
- **Documentation**
- Updated the return type annotation from `History node` to `HistoryNode` in the `parse_history_node` method.
- **Tests**
- Reorganized imports in the `test_outputs.py` file by switching to import `ElementTree` from `xml.etree`.
- Streamlined import statements in the `test_init.py` file related to `pymatgen.phonon` module.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3755/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3755/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3755",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3755",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3755.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3755.patch",
"merged_at": "2024-04-13T05:43:20Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3756
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3756/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3756/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3756/events
|
https://github.com/materialsproject/pymatgen/pull/3756
| 2,241,470,562
|
PR_kwDOACgets5skBK9
| 3,756
|
Fix OPTIMADE rester URL contruction and improve testing
|
{
"login": "ml-evs",
"id": 7916000,
"node_id": "MDQ6VXNlcjc5MTYwMDA=",
"avatar_url": "https://avatars.githubusercontent.com/u/7916000?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ml-evs",
"html_url": "https://github.com/ml-evs",
"followers_url": "https://api.github.com/users/ml-evs/followers",
"following_url": "https://api.github.com/users/ml-evs/following{/other_user}",
"gists_url": "https://api.github.com/users/ml-evs/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ml-evs/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ml-evs/subscriptions",
"organizations_url": "https://api.github.com/users/ml-evs/orgs",
"repos_url": "https://api.github.com/users/ml-evs/repos",
"events_url": "https://api.github.com/users/ml-evs/events{/privacy}",
"received_events_url": "https://api.github.com/users/ml-evs/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 6817617461,
"node_id": "LA_kwDOACgets8AAAABllyWNQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ext",
"name": "ext",
"color": "3766AC",
"default": false,
"description": "pymatgen ext package for API data fetching"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates focus on enhancing the URL handling in the pymatgen library, particularly for the OptimadeRester, ensuring proper URL formatting with trailing slashes. Additionally, the test suite has been adjusted to align with these changes and to handle new scenarios, improving the robustness of the library. Ownership paths in the repository have also been updated to reflect responsibility for specific code paths.\n\n## Changes\n\n| Files | Change Summary |\n|----------------------------|----------------|\n| `.../ext/optimade.py` | Updated URL handling logic to ensure trailing slashes and consistency in URL formatting. |\n| `tests/ext/...` | Updated test URLs and added new tests for OPTIMADE providers. Adjusted handling for connection errors and test conditions based on website status. |\n| `.github/CODEOWNERS` | Added new paths for ownership, including specific directories under `pymatgen/io/` and `tests/ext/`. |\n\n## Assessment against linked issues\n\n| Objective | Addressed | Explanation |\n|-----------|-----------|-------------|\n| Ensure proper URL formatting in OptimadeRester to prevent errors (#3753) | ✅ | |\n| Fix the issue with OptimadeRester not retrieving results for non-\"mp\" URLs (#3753) | ❓ | It's unclear if the URL formatting fix directly resolves the issue with retrieving results as the error might be related to server response or data parsing. |\n\n> 🐇✨\n> A hop, a skip, a code deploy,\n> With trailing slashes, oh what joy!\n> From paths to tests, we refine,\n> Ensuring every line does shine.\n> In pymatgen's land, we weave,\n> A tapestry that none would believe! 🌟\n> 🐾\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/ext/optimade.py: The changes in the `pymatgen/ext/optimade.py` file involve updating logic to ensure URLs have a trailing slash where necessary, aiming to prevent issues with URL handling and path concatenation. The adjustments are made in various methods within the file to maintain consistency in URL formatting.\n\ntests/ext/test_optimade.py: The changes in `tests/ext/test_optimade.py` involve updating URLs for requests, handling connection errors for new URLs, adjusting test conditions based on website status, adding a new test for OPTIMADE providers, and modifying test functions related to OPTIMADE services and filters.\n\n.github/CODEOWNERS: The changes in the `.github/CODEOWNERS` file involve modifications to the declarations of exported entities, specifically adding new paths for ownership assignment. The alterations include adding ownership for paths related to `pymatgen/io/abinit/`, `pymatgen/io/lobster/`, `pymatgen/ext/`, and `tests/ext/`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request (PR #3756) addresses a critical issue identified in issue #3753 concerning the `OptimadeRester` in the `pymatgen` library. The main problem revolves around the incorrect construction of URLs when using the `urljoin` function, which fails to handle paths correctly if they do not end with a trailing slash. This issue is particularly significant for providers serving multiple databases from different URL paths, as seen with the failure in fetching data from the `mcloud.mc3d` database.\n\nThe PR introduces a dynamic fix to ensure that URLs are correctly formatted with trailing slashes where necessary, thus preserving the integrity of the URL paths and preventing the mangling of URLs by `urljoin`. This fix is crucial for maintaining the functionality of the `OptimadeRester` across various providers.\n\nAdditionally, the PR re-enables several tests that were previously disabled. These tests include running MP OPTIMADE tests without an API key, executing the filter builder without network calls, and testing the alias refresher when the OPTIMADE providers list is accessible. These changes aim to enhance the robustness of the testing framework and ensure that the `OptimadeRester` functions correctly across different scenarios and configurations.\n\n### Comments Summary\n\nIn the comments on the PR, there is a notable request from `ml-evs`, asking to be added as a CODEOWNER for the submodule related to `OptimadeRester`. This request is motivated by the desire to maintain oversight over potential breakages, especially in the context of tutorials involving the `pymatgen` notebooks. This addition would help in quicker identification and resolution of issues that might arise in the future, ensuring the submodule remains stable and reliable for users.\n\n### AI-Generated Summary of Generated Summaries\n\nThe PR introduces several key changes across different files:\n\n1. **pymatgen/ext/optimade.py**: The logic for URL handling has been updated to ensure that all URLs are correctly formatted with trailing slashes where necessary. This change is implemented across various methods within the file to prevent issues with URL handling and path concatenation, which were previously leading to failures in data retrieval from certain providers.\n\n2. **tests/ext/test_optimade.py**: The test suite for `OptimadeRester` has been expanded and refined. This includes updates to handle new URL formats, adjustments in test conditions based on the availability of websites, and the addition of new tests for checking the functionality of OPTIMADE providers. These changes aim to enhance the reliability and coverage of the tests.\n\n3. **.github/CODEOWNERS**: The file has been updated to include new paths for ownership assignment, specifically adding `ml-evs` as a CODEOWNER for the submodule related to `OptimadeRester`. This change is intended to improve the management and oversight of the submodule, facilitating quicker responses to issues and ensuring the stability of the tutorials and documentation involving `pymatgen`.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between a38a316f3e845c61d00b834bd59a4c54bed25547 and f58a2531d40b43c405d82281740054672929b6e5.\n</details>\n\n\n<details>\n<summary>Files selected for processing (1)</summary>\n\n* .github/CODEOWNERS (1 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (1)</summary>\n\n* .github/CODEOWNERS\n\n</details>\n\n\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 647a0ed26183cece1aebcc5e472491707693fe7d -->\n<!-- 239d0e9e9116fc23c519d49423304bb0e801158d -->\n<!-- 64ddf037b8e0a9c6bec7fe2e976871455039dce9 -->\n<!-- d6be99ff6627cd4cc000f0d2e540049718256a70 -->\n<!-- a38a316f3e845c61d00b834bd59a4c54bed25547 -->\n<!-- f58a2531d40b43c405d82281740054672929b6e5 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Also question for @janosh / @mkhorton, could you add me as a CODEOWNER for this submodule? That way I can at least keep up with any possible breakages for tutorials I'm giving with the pymatgen notebooks",
"@janosh code owner status only works with write access. Currently, two people on that list don't have it",
"> @janosh code owner status only works with write access. Currently, two people on that list don't have it\r\n\r\nHmmm, I didn't appreciate this (thought it was just as automated review request)...",
"\r\n",
"Thanks for letting us know @JaGeo. I didn't know that either. Bit annoying. I can't add editors. That would have to be done by @shyuep ",
"Thanks for the fix @ml-evs!\r\n\r\nRegarding CODEOWNERS, even if the integration isn’t working, I’m not opposed to keeping the file: it at least gives us a way to know who to contact or tag."
] | 2024-04-13T09:58:58
| 2024-05-01T18:44:32
|
2024-04-13T12:48:36Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Closes #3753.
URLs with paths need to have trailing slashes otherwise `urljoin` mangles them. OPTIMADE base URLs do not need to have trailing slashes, hence an issue arises for any provider that serves multiple databases from different URL paths.
This PR dynamically fixes these URLs when they occur (so that the aliases still match those given by providers).
I also tweaked re-enabled some tests that were disabled for some reason:
- Run MP OPTIMADE tests even without API key (not necessary)
- Run filter builder without needing to make any network calls
- Test alias refresher when OPTIMADE providers list is accessible.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Updated URL handling in the software to ensure all URLs correctly include a trailing slash, enhancing consistency and reliability in accessing web resources.
- **Bug Fixes**
- Improved test coverage and error handling for URL requests in the test suite, ensuring robust performance.
- **Chores**
- Modified code ownership assignments to ensure proper management and accountability for specific paths in the project repository.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3756/reactions",
"total_count": 3,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 1,
"rocket": 2,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3756/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3756",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3756",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3756.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3756.patch",
"merged_at": "2024-04-13T12:48:36Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3757
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3757/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3757/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3757/events
|
https://github.com/materialsproject/pymatgen/pull/3757
| 2,241,499,276
|
PR_kwDOACgets5skHXk
| 3,757
|
`pyright` fixes for `ext/io/phonon/symmetry/transformations/util/vis/dev_scripts` and improve `io.lobster`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5436106752,
"node_id": "LA_kwDOACgets8AAAABRARoAA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/housekeeping",
"name": "housekeeping",
"color": "64CC86",
"default": false,
"description": "Moving around or cleaning up old code/files"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates across the pymatgen library focus on improving code quality through enhanced readability, efficiency, and robustness. Changes include variable renaming for clarity, refactoring for better logic flow, and the integration of modern Python features like the walrus operator. Additionally, stricter type checking with `pyright` has been introduced to ensure higher code quality.\n\n## Changes\n| Files | Change Summary |\n|-------------------------------------------|--------------------------------------------------------------------------------|\n| `.github/workflows/lint.yml`, `.pre-commit-config.yaml`, `pyproject.toml` | Integrated `pyright` for improved linting and type checking. |\n| `pymatgen/command_line/vampire_caller.py`, `pymatgen/io/.../*.py`, `pymatgen/io/.../outputs.py`, `pymatgen/io/.../inputs.py` | Variable renaming, enhanced string formatting, and logic simplification. |\n| `pymatgen/core/...`, `pymatgen/ext/...` | Code refactoring for efficiency and readability, including regex and error handling enhancements. |\n| `pymatgen/symmetry/...`, `pymatgen/phonon/...`, `pymatgen/transformations/...` | Updated variable naming, added checks, and refactored logic. |\n| `pymatgen/util/...`, `dev_scripts/...` | Improved clarity in variable names, adjusted import handling, and updated encoding settings. |\n| `tests/...` | Updated test scripts to align with code changes and ensure robustness. |\n\n## Poem\n> 🐇💻✨ \n> Oh, hop through the fields of code, so spry, \n> Where bugs once lurked, now none shall lie. \n> With `pyright` by side, we leap and bound, \n> In cleaner pastures, our bytes resound. \n> Celebrate, dear friends, with vim and cheer, \n> For cleaner, swifter code is here! 🎉🌟\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n```plaintext\n.github/workflows/lint.yml:\n- Updated the dependencies installation step to include `pyright` alongside `ruff` and `mypy`.\n- Added a new job named `pyright` to run the `pyright` tool.\n\n.pre-commit-config.yaml:\n- Added a new repository hook for `pyright` from the `RobertCraigie/pyright-python` repository at version `v1.1.358`.\n\npymatgen/command_line/vampire_caller.py:\n- Renamed variables for clarity and consistency, including changes from `vanhelsing` to `van_helsing`, `nmats` to `n_mats`, and `mat_id_dict` to `mat_id_dict`.\n\npymatgen/core/ion.py:\n- Refactored the handling of formula strings in the `from_formula` method to extract charge information more robustly using regex patterns.\n\npymatgen/core/periodic_table.py:\n- Refactored code for better readability and efficiency, including the use of the walrus operator for assignment within conditionals, enhanced regex usage for string parsing, and simplified logic for attribute retrieval and orbital parsing.\n\npymatgen/ext/matproj_legacy.py:\n- Modified the calculation of `chunks` in the `get_chunks` function to use `math.ceil` directly on the division result.\n\npymatgen/io/abinit/abiobjects.py:\n- Modified the logic for setting `kptopt` based on the values of `use_symmetries` and `use_time_reversal` using `elif` and `else` statements.\n\npymatgen/io/abinit/inputs.py:\n- Added a variable `has_hints = False` to the function `_find_ecut_pawecutdg`.\n\npymatgen/io/abinit/pseudos.py:\n- Comprehensive updates to string formatting, logic simplification, and method enhancements across multiple functions and methods.\n\npymatgen/io/cif.py:\n- Comprehensive updates to string formatting, error handling, and parsing logic, including the use of f-strings and improved handling of site properties and structure parsing.\n\npymatgen/io/cp2k/sets.py:\n- Added checks and modified filename generation and basis assignment in various methods.\n\npymatgen/io/feff/inputs.py:\n- Changed the condition in a loop to use a set for comparison.\n- Added a `raise TypeError` for an unsupported type in a conditional block.\n- Modified the `open` function call to include `encoding=\"utf-8\".\n- Updated a warning message to use an f-string for formatting.\n- Refactored a regex match block to use the walrus operator and indexing for capturing groups.\n- Simplified regex matching and value processing in a function.\n- Improved handling of boolean type keys in a function.\n- Enhanced error handling and message formatting in a function.\n- Reorganized conditional logic in an `__init__` method.\n\npymatgen/io/fiesta.py:\n- Changed the assignment of `_nwcheminput_fn`, `_nwchemoutput_fn`, and `_nwchemmovecs_fn` to use f-strings for formatting.\n- Modified the logic in `_gw_run` and `bse_run` methods to set `init_folder` before checking the folder equality.\n- Updated the `_parse_file` method to take `lines` instead of `input` and adjusted variable assignments accordingly.\n- Refactored the string formatting in `set_auxiliary_basis_set` method to use f-strings.\n- Altered the argument type in `dump_bse_data_in_gw_run` and `dump_tddft_data_in_gw_run` methods from `boolean` to `bool`.\n- Simplified the geometry construction in the `__str__` method using list comprehension.\n- Improved variable assignments in the `_parse_job` method using walrus operator and adjusted access to regex match groups.\n\npymatgen/io/gaussian.py:\n- Added `route_lower` dictionary, initialized `atom_idx` and `coeffs` lists, created `mulliken_txt` list, and adjusted handling of `parse_freq` condition in the `_parse` method.\n- Adjustments are made to handle the `parse_freq` condition and the initialization of `vals` in the `_parse_hessian` method.\n- Modifications include using `match` instead of `m` for regex matches in various parts of the code.\n\npymatgen/io/lobster/inputs.py:\n- Replaced `OSError` with `KeyError` in exception handling for duplicates.\n- Refactored key comparison logic in `__setitem__`, `__getitem__`, and `__delitem__` methods.\n- Updated error messages to raise `KeyError` instead of `ValueError` in certain cases.\n- Adjusted variable names and assignments for clarity.\n- Modified logic in `diff` method for key comparison and value handling.\n- Replaced `OSError` with `ValueError` in `_get_nbands` method.\n- Updated `write_lobsterin` method to handle key overwriting.\n- Adjusted file writing logic in `write_lobsterin` method.\n- Replaced `OSError` with `ValueError` in `_get_potcar_symbols` method.\n- Updated error handling in `standard_calculations_from_vasp_files` method.\n- Renamed variables and updated settings in `standard_calculations_from_vasp_files` method.\n- Replaced `OSError` with `RuntimeError` in `from_file` method.\n\npymatgen/io/pwscf.py:\n- Changed the regex capture group access from `re.match(...).group(0)` to `re.match(...)[0]`.\n- Added encoding parameter \"utf-8\" to the `open` function call.\n- Added new variables `kpoints_mode`, `kpoints_grid`, `kpoints_shift`, `coords_are_cartesian`.\n- Refactored regex capture group access from `m.group(1).strip()` to `m[1].strip()`.\n\npymatgen/io/vasp/inputs.py:\n- Updated the `from_str` method with refined control flow for symbol extraction and error handling.\n\npymatgen/io/vasp/outputs.py:\n- Improved exception handling in `_parse_v_parameters` and `_parse_from_incar` functions to provide more context.\n- Enhanced warning message formatting in `_parse_from_incar` function.\n- Refactored `optical_absorption_coeff` method to return `None` under certain conditions.\n- Enhanced error handling and string formatting in warnings and messages.\n- Added type hints for methods to return specific types.\n- Improved list comprehensions in `optical_absorption_coeff` and related functions.\n- Updated handling of exceptions in various functions for better error reporting and flow control.\n\npymatgen/io/xr.py:\n- Updated the `from_str` method to use the walrus operator `:=` for improved readability and efficiency in regex match handling.\n\npymatgen/io/xtb/outputs.py:\n- Added the `encoding=\"utf-8\"` parameter when opening files using `open()`.\n\npymatgen/io/zeopp.py:\n- Updated file and directory names to use f-strings, changed file encoding to \"utf-8\", and modified return values in methods for better clarity and functionality.\n\npymatgen/phonon/bandstructure.py:\n- Added a new variable `max_idx` initialized to 0 within the `estimate_band_connection` function.\n\npymatgen/phonon/gruneisen.py:\n- Updated import handling for `TotalDos` from `phonopy.phonon.dos`, setting it to `None` if an `ImportError` occurs.\n\npymatgen/phonon/thermal_displacements.py:\n- Updated the `typing` import to include `Literal` and refined the parameter type and error handling in the `visualize_directionality_quality_criterion` method.\n\npymatgen/symmetry/analyzer.py:\n- Initialized a variable `transf` to `None` and made whitespace adjustments in the `get_conventional_standard_structure` method.\n\npymatgen/symmetry/bandstructure.py:\n- Added a new variable `key` initialized to `None` within a loop in the `_get_klabels` function.\n\npymatgen/symmetry/groups.py:\n- Updated the `get_settings` method to initialize `int_number` to `None` before conditional checks.\n\npymatgen/symmetry/kpath.py:\n- Refactored code related to finding face centers for different rotational symmetries using a common function `find_face_center`.\n\npymatgen/symmetry/maggroups.py:\n- Renamed the variable `m` to `multiplicity` in the `get_label` function for clarity in calculating the label.\n\npymatgen/transformations/advanced_transformations.py:\n- Added checks and adjusted control flow and error handling in various methods related to transformation criteria.\n\npymatgen/util/coord.py:\n- Renamed the variable `m` to `mask_arr` in the `is_coord_subset_pbc` function for improved clarity.\n\npymatgen/util/coord_cython.pyx:\n- Renamed the variable `m` to `mask_arr` in the `pbc_shortest_vectors` function for consistency in handling the mask array.\n\npymatgen/util/provenance.py:\n- Modified the import statement for `errors` from the `pybtex` module to include it along with `pybtex` and `bibtex`.\n\npymatgen/util/string.py:\n- Adjusted the logic for handling different output formats in the `disordered_formula` function to ensure proper formatting.\n\npymatgen/vis/structure_vtk.py:\n- Updated color assignment and radius calculation logic for sites, polyhedra, and triangles based on species properties.\n\npyproject.toml:\n- Added configuration for `pyright` tool to adjust type checking settings and exclusions.\n\ntests/files/cohp/lobsterin.1:\n- Corrected the capitalization of the keyword from \"skipdos\" to \"skipDOS\".\n\ntests/files/cohp/lobsterin.3:\n- Added `skipcoBI` and `SKIPDOS` directives at the end of the file.\n\ntests/io/lobster/test_inputs.py:\n- Added the `encoding=\"utf-8\"` parameter when opening the file `structure_KF.json` and updated exceptions in various test methods.\n\ndev_scripts/chemenv/equivalent_indices.py:\n- Modified the logic for determining points in a square face using curly braces `{}` and added a check to raise a `RuntimeError` when a point cannot be determined.\n\ndev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py:\n- Adjusted the logic for handling morphing descriptions in the `get_structure` method and specified the encoding when opening the `ce_pairs.json` file.\n\ndev_scripts/chemenv/view_environment.py:\n- Added a declaration for the variable `algo` and initialized it to `None`.\n\ndev_scripts/update_pt_data.py:\n- Added initialization of variables and replaced `wb.get_sheet_names()` with `wb.sheetnames()` in relevant functions.\n\npymatgen/analysis/ewald.py:\n- Modified the calculation of `m` by applying `np.sin` directly to the expression `(gr[None, :] + pi / 4) - gr[:, None)`.\n\npymatgen/ext/optimade.py:\n- Updated the functionality to reset the `url` variable to `None` before reassigning it in the `is_url` and `_parse_provider` functions.\n```\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3757 and initiated by @ml-evs, aims to integrate `pyright` into the CI process gradually to address numerous errors across modules from `vis` to `dev_scripts` in the `ext/io/phonon/symmetry/transformations/util/vis/dev_scripts` directory. The PR also includes improvements to `io.lobster` by @JaGeo and minor format adjustments using `sourcery`. Confirmation is sought on a unit test failure specific to MacOS in `io.lobster.inputs`.\n\n### Comments Summary\n\nIn the comments, DanielYang59 suggests refining error handling in `io.lobster` by replacing inappropriate uses of `OSError` with `RuntimeError` or custom exceptions to better reflect encountered issues. JaGeo agrees with the proposed `RuntimeError` solution to avoid excessive time investment in this aspect.\n\n### AI-Generated Summary of Generated Summaries\n\nThe PR encompasses a range of enhancements across pymatgen:\n\n1. **CI and Pre-commit Configuration**: Updates include integrating `pyright` into CI and pre-commit configurations for future type checking and code quality improvements.\n\n2. **Error Handling Refinement**: Notable changes in error handling, especially in `io` modules like `io.lobster`, `io.cif`, and `io.gaussian`, involve replacing `OSError` with more appropriate exceptions like `RuntimeError` for better error representation.\n\n3. **Code Refactoring and Enhancements**: Extensive refactoring across various modules improves readability, efficiency, and error handling, utilizing modern Python features like the walrus operator and enhanced regex parsing.\n\n4. **Variable Renaming and Logic Simplification**: Clearer variable names and simplified logic in scripts such as `pymatgen/core/periodic_table.py` and `pymatgen/transformations/advanced_transformations.py` enhance code maintainability.\n\n5. **Type Checking and Annotations**: The introduction of `pyright` emphasizes type annotations and stricter type checking, ensuring codebase adherence to robust type standards for improved maintainability.\n\nThese changes collectively enhance the reliability, efficiency, and clarity of the pymatgen codebase, laying a solid foundation for future improvements and ensuring code robustness.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 3b4163504ec11fec1c6afb25c10be946e87d1688 -->\n<!-- 46987fd870a46148afc95f3e1c0ee353e0e0abb9 -->\n<!-- 58050bb75b1560bddb727dfd9429942d4c7a646b -->\n<!-- 6f9d344cda867a48fb585f78961dee3c1e84e899 -->\n<!-- 247a08c2f671ce38bf8f14e144d35f4d71945c77 -->\n<!-- b8d03f103c3ea2623453f35e5ce457a05ecf118e -->\n<!-- befe3505d241d521dab9d70a1a80218b5bf3431f -->\n<!-- 136a0e4490f239434a27842e6cfc28d3fefd7acf -->\n<!-- 4b1c8d05e9c000e50aef7aa26bda531a1ec4b6b4 -->\n<!-- 6cc78ce07743257c8b6472bf1f19ffd565eb191c -->\n<!-- afc4f6d13a595e38590fca22e7b621e15929b6a8 -->\n<!-- 2ce0368d70d34240089f4410e16a3deba7616552 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"I just changed some error types for `io.lobster` in 72981f1d7bd6f4a62d2fa063652e5588ae3e0049. I'm not very good at deciding the type of errors either, but it seems most usage of `OSError` is inappropriate in this case. From the [official docs](https://docs.python.org/3/library/exceptions.html):\r\n> exception OSError(errno, strerror[, filename[, winerror[, filename2]]])\r\n\r\n> This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full” (not for illegal argument types or other incidental errors).\r\n\r\nIt should be raised in cases of OS-related issues (like unable to read/write file, unable to start/close a process or such). \r\n\r\nIn our case the file is read just fine, but the file content is empty. Perhaps we should raise a general `RuntimeError`, or perhaps write a custom `EmptyInputFileError` which could then be reused around the entire code base?",
"> I just changed some error types for `io.lobster` in [72981f1](https://github.com/materialsproject/pymatgen/commit/72981f1d7bd6f4a62d2fa063652e5588ae3e0049). I'm not very good at deciding the type of errors either, but it seems most usage of `OSError` is inappropriate in this case. From the [official docs](https://docs.python.org/3/library/exceptions.html):\r\n> \r\n> > exception OSError(errno, strerror[, filename[, winerror[, filename2]]])\r\n> \r\n> > This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full” (not for illegal argument types or other incidental errors).\r\n> \r\n> It should be raised in cases of OS-related issues (like unable to read/write file, unable to start/close a process or such).\r\n> \r\n> In our case the file is read just fine, but the file content is empty. Perhaps we should raise a general `RuntimeError`, or perhaps write a custom `EmptyInputFileError` which could then be reused around the entire code base?\r\n\r\nThat's fine. I am also fine with `RuntimeError`. I would just like to avoid spending too much time on it.",
"My last bit of concern about this PR would be the default coordinate system of `pwscf` here https://github.com/materialsproject/pymatgen/pull/3757#discussion_r1564052381. Please help me confirm this. Thanks!",
"Thanks for reviewing @janosh and great to collaborate with you on this one @JaGeo.\r\n\r\nSorry for hijacking this topic @ml-evs. ",
"> Sorry for hijacking this topic @ml-evs.\r\n\r\nNo problem, this is great work! It looks this was fairly comprehensive; I'll try reopening my PR that adds the CI runs that triggered this.",
"> > Sorry for hijacking this topic @ml-evs.\r\n> \r\n> No problem, this is great work! It looks this was fairly comprehensive; I'll try reopening my PR that adds the CI runs that triggered this.\r\n\r\nThis is only for some modules. More work is needed",
"\r\n> This is only for some modules. More work is needed\r\n\r\nYes! It's only like 1/3 of the all work needed. I would ping you once it's all ready. @ml-evs \r\n\r\n",
"> > This is only for some modules. More work is needed\r\n> \r\n> Yes! It's only like 1/3 of the all work needed. I would ping you once it's all ready. @ml-evs\r\n\r\nUnderstood, I've opened #3759 with the same changes as before (except enabling pyright), hopefully the CI is now stable enough after the `uv` switch that it won't go stale again so quickly. ",
"> Yes! It's only like 1/3 of the all work needed. I would ping you once it's all ready. @ml-evs\r\n\r\n@DanielYang59 thanks a lot for donating your time to work on this! 👍 ",
"\r\n> @DanielYang59 thanks a lot for donating your time to work on this! 👍\r\n\r\nGlad I can help :)\r\n",
"@janosh I'm still experimenting on an issue I met with @JaGeo in https://github.com/materialsproject/pymatgen/pull/3757#discussion_r1564074174. I would appreciate it if you could give me some advice 😄 \r\n\r\nI just created a minimal code to recreate this issue:\r\n```python\r\nfrom collections import UserDict\r\n\r\nclass TestClass(UserDict):\r\n\r\n def __init__(self, settingsdict: dict):\r\n super().__init__()\r\n self.update(settingsdict)\r\n\r\n def __setitem__(self, key, val):\r\n \"\"\"Remove case sensitivity.\"\"\"\r\n new_key = next((key_here for key_here in self if key.strip().lower() == key_here.lower()), key)\r\n\r\n super().__setitem__(new_key, val)\r\n\r\n def __getitem__(self, item):\r\n \"\"\"Implements getitem from dict to avoid problems with cases.\"\"\"\r\n new_item = next((key_here for key_here in self if item.strip().lower() == key_here.lower()), item)\r\n\r\n return super().__getitem__(new_item)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n test_dict = {\"ConTent\": \"hello\", }\r\n test_instance = TestClass(test_dict)\r\n\r\n print(f\"{test_instance=}\")\r\n print(test_instance.get(\"content\"), test_instance[\"content\"])\r\n```\r\n\r\nOn this same machine (MacOS Sonoma 14.4.1, Apple Silicon and Python managed by miniconda3).\r\n\r\nWith Python 3.10 and 3.11, I got:\r\n```python\r\n(base) yang@Yang-MacBook test % python3 -V\r\nPython 3.10.14\r\n(base) yang@Yang-MacBook test % python3 recreate.py \r\ntest_instance={'ConTent': 'hello'}\r\nhello hello\r\n```\r\n\r\n```python\r\n(base) yang@Yang-MacBook test % python3 -V\r\nPython 3.11.8\r\n(base) yang@Yang-MacBook test % python3 recreate.py \r\ntest_instance={'ConTent': 'hello'}\r\nhello hello\r\n```\r\n\r\nWhile with Python 3.12, the two methods get different results:\r\n```python\r\n(base) yang@Yang-MacBook test % python3 -V \r\nPython 3.12.2\r\n(base) yang@Yang-MacBook test % python3 recreate.py \r\ntest_instance={'ConTent': 'hello'}\r\nNone hello\r\n```\r\n\r\nIs it some known issue/change from Python 3.12?\r\n",
"Ah, interesting, Python version 😅. \r\nThis is why it has not shown up on CI.",
"@DanielYang59 I think I found it: https://github.com/python/cpython/issues/105524",
"> @DanielYang59 I think I found it: [python/cpython#105524](https://github.com/python/cpython/issues/105524)\r\n\r\n👍 So speedy. Yes looks like exactly what we're experiencing. I guess it's not intended?\r\n\r\nThe `get` method:\r\n```python\r\n def get(self, key, default=None):\r\n if key in self:\r\n return self[key]\r\n return default\r\n```\r\n\r\nWhich indeed does not use `__getitem__`.\r\n\r\nBut at least confirmed my machine is not the \"outlier\" 😅 ",
"> > @DanielYang59 I think I found it: [python/cpython#105524](https://github.com/python/cpython/issues/105524)\r\n> \r\n> 👍 So speedy. Yes looks like exactly what we're experiencing. I guess it's not intended?\r\n> \r\n> The `get` method:\r\n> \r\n> ```python\r\n> def get(self, key, default=None):\r\n> if key in self:\r\n> return self[key]\r\n> return default\r\n> ```\r\n> \r\n> Which indeed does not use `__getitem__`.\r\n> \r\n> But at least confirmed my machine is not the \"outlier\" 😅\r\n\r\nNo idea if intended.\r\n But a solution is described there as well. Could potentially affect other parts of the code as well.",
"there's only 1 use of `UserDict` in all of `pmg` i think. we can try the [proposed fix](https://github.com/python/cpython/issues/105524#issuecomment-1610750842) or try to make it work without `UserDict`. the [docs weakly recommend to subclass `dict` directly](https://docs.python.org/3/library/collections.html#userdict-objects) instead of `UserDict`",
"I think we recently switched to UserDict for other issues.",
"> there's only 1 use of `UserDict` in all of `pmg` i think. we can try the [proposed fix](https://github.com/python/cpython/issues/105524#issuecomment-1610750842) or try to make it work without `UserDict`. the [docs weakly recommend to subclass `dict` directly](https://docs.python.org/3/library/collections.html#userdict-objects) instead of `UserDict`\r\n\r\nI would keep it in mind. I'm now [secretly working on simplifying `io.lobster.inputs`](https://github.com/DanielYang59/pymatgen/tree/tweak-lobster) (prefer not to push it here for now because I'm not having much time to work on this).\r\n"
] | 2024-04-13T10:38:18
| 2024-04-16T02:34:55
|
2024-04-15T08:26:12Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Started by @ml-evs in #3646:
- Install `pyright` to CI (delayed until all chunks are finished)
- Related `pyright` fixes
- Improvement on `io.lobster` by @JaGeo
- Format tweaks (`sourcery`), I should not have done this (make it hard to view difference)
### Need confirmation on the following:
- [x] https://github.com/materialsproject/pymatgen/pull/3757#discussion_r1564052381
#### `pyright` is commented out until all chunks are finished, otherwise everyone's CI would fail.
There are too many (713) `pyright` errors to fix in a single PR, I'm planning to chop up into chunks. First chunk would fix the following modules:
- [x] vis
- [x] util
- [x] transformations
- [x] symmetry
- [x] phonon
- [x] io
- [x] ext
- [x] dev_scripts
### Side note
- Unit test of `io.lobster.inputs` only failed on my MacOS machine: https://github.com/materialsproject/pymatgen/pull/3757#discussion_r1564074174
- `io.lobster` `diff` method could potentially be simplified: https://github.com/materialsproject/pymatgen/pull/3757#discussion_r1565120000
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
## Summary by CodeRabbit
- **New Features**
- Enhanced the logic for setting calculation parameters based on symmetry and time reversal considerations.
- Introduced better error handling and contextual exception messages across various modules.
- Improved file handling with UTF-8 encoding for consistent data processing.
- **Bug Fixes**
- Fixed issues with string formatting and variable initialization that affected data parsing and output consistency.
- Corrected logical errors in conditional statements that impacted computational routines.
- **Refactor**
- Streamlined string formatting using f-strings for better readability and performance.
- Simplified and optimized various methods and functions for enhanced maintainability and clarity.
- **Documentation**
- Updated method descriptions and error messages to be more informative and user-friendly.
- **Style**
- Standardized variable naming and method calls to adhere to project coding standards.
- **Tests**
- Adjusted file encoding in test setups to ensure compatibility and correctness during testing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3757/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3757/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3757",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3757",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3757.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3757.patch",
"merged_at": "2024-04-15T08:26:12Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3758
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3758/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3758/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3758/events
|
https://github.com/materialsproject/pymatgen/pull/3758
| 2,242,162,271
|
PR_kwDOACgets5smNPE
| 3,758
|
Convert `kpts` in `Kpoints` to `Sequence[tuple]` and set it as `property`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
},
{
"id": 5529392097,
"node_id": "LA_kwDOACgets8AAAABSZPT4Q",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/api",
"name": "api",
"color": "D21149",
"default": false,
"description": "Application programming interface"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->\n\n> [!WARNING]\n> ## Rate Limit Exceeded\n> \n> @DanielYang59 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **9 minutes and 39 seconds** before requesting another review.\n> \n> <details>\n> \n> <summary>How to resolve this issue?</summary>\n> \n> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.\n> \n> We recommend that you space out your commits to avoid hitting the rate limit.\n> \n> </details>\n> \n> <details>\n> \n> <summary>How do rate limits work?</summary>\n> \n> CodeRabbit enforces hourly rate limits for each developer per organization.\n> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.\n> Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.\n> \n> </details>\n> \n> <details>\n> <summary>Commits</summary>\n> Files that changed from the base of the PR and between 596d256f3620cd080621bddbbec60609e77fd74d and 879530c974ce35bb93eae50c965065a4846463c5.\n> </details>\n\n<!-- end of auto-generated comment: rate limited by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\n\nThe updates across various files in the `pymatgen` library primarily involve reorganization and clarification of type annotations and imports, particularly concerning `Vector3D` and `Matrix3D` types. These types are now centralized under `pymatgen.util.typing`. Enhancements in type safety and consistency, such as using tuples instead of lists for fixed-length sequences and improving method signatures with explicit type hints, are notable. These changes aim to increase the maintainability and clarity of the codebase.\n\n## Changes\n\n| Files | Change Summary |\n|-------|----------------|\n| `interface.py`, `lattice.py`, `cif.py`, `res.py` | Moved `Vector3D` import from `pymatgen.core.trajectory` to `pymatgen.util.typing`. |\n| `trajectory.py`, `io/aims/outputs.py`, `io/aims/parsers.py` | Reorganized and introduced new type aliases like `Matrix3D`, `SitePropsType`. Adjusted imports related to these types. |\n| `io/cp2k/inputs.py`, `io/lobster/inputs.py`, `io/lobster/outputs.py` | Enhanced type annotations and handling of tuples. Improved conditional checks and error handling. |\n| `io/vasp/inputs.py`, `io/vasp/outputs.py`, `io/vasp/sets.py` | Extensive updates to type annotations, handling of `Kpoints` and `Vector3D`. Improved conditions and error handling in label processing. |\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/core/interface.py: ## Alterations to the declarations of exported or public entities\n\n- `from pymatgen.core.trajectory import Vector3D` => Removed\n- `from pymatgen.util.typing import CompositionLike, Vector3D` => Added\n\n---\n\npymatgen/core/lattice.py: ## Short Summary\nThe change in functionality involves reorganizing imports in `pymatgen/core/lattice.py` by moving the import of `Vector3D` from `pymatgen.core.trajectory` to `pymatgen.util.typing`.\n\n## Alterations to the declarations of exported or public entities\n- `from pymatgen.core.trajectory import Vector3D` => `from pymatgen.util.typing import PbcLike, Vector3D`\n\n---\n\npymatgen/core/trajectory.py: ## Short Summary\n\nThe diff in `pymatgen/core/trajectory.py` involves changes to the import statements and type annotations. Specifically, the `collections.abc.Iterator`, `collections.abc.Sequence`, and `Union` types are removed, and new type aliases `Matrix3D`, `SitePropsType`, and `Vector3D` are introduced.\n\n## Alterations to the declarations of exported or public entities\n\n- Removed `collections.abc.Iterator` import\n- Removed `collections.abc.Sequence` import\n- Removed `Union` import\n- Introduced `Matrix3D` type alias\n- Introduced `SitePropsType` type alias\n- Introduced `Vector3D` type alias\n\n---\n\npymatgen/io/aims/outputs.py: ## Short Summary\n\nThe change in `pymatgen/io/aims/outputs.py` involves reorganizing imports related to `Matrix3D` and `Vector3D` types, switching from `emmet.core.math` to `pymatgen.util.typing`.\n\n## Alterations to the declarations of exported or public entities\n\n- `from emmet.core.math import Matrix3D, Vector3D` => `from pymatgen.util.typing import Matrix3D, Vector3D`\n\n---\n\npymatgen/io/aims/parsers.py: ### Summary\n\nIn `pymatgen/io/aims/parsers.py`:\n- Added `cast` to `typing` import.\n- Changed import from `emmet.core.math` to `pymatgen.util.typing`.\n- Modified the parsing of coordinates and velocities to use `cast` for type hints.\n\n---\n\npymatgen/io/cif.py: ## Alterations to the declarations of exported or public entities\n\n- `from pymatgen.core.trajectory import Vector3D` => `from pymatgen.util.typing import Vector3D`\n\n---\n\npymatgen/io/cp2k/inputs.py: ## Short Summary\n\nThe changes in `pymatgen/io/cp2k/inputs.py` involve modifications to the `from_kpoints` method. Specifically, adjustments were made to handle different `KpointsSupportedModes` and improve type annotations.\n\n## Alterations to the declarations of exported or public entities\n\n- Added import: `from pymatgen.util.typing import Kpoint`\n- Changed assignment: `k = kpts[0]` to `kpt: Kpoint = kpts[0] # type: ignore[assignment]`\n- Changed assignment: `x, y, z = (k, k, k) if isinstance(k, (int, float)) else k` to `x, y, z = (kpt, kpt, kpt) if isinstance(kpt, (int, float)) else kpt # type: ignore[misc]`\n- Added conditional check and raise `ValueError` if `structure` is not provided\n- Changed assignment: `_kpts, weights = zip(*sga.get_ir_reciprocal_mesh(mesh=kpts))` to `_kpts, weights = zip(*sga.get_ir_reciprocal_mesh(mesh=kpts)) # type: ignore[assignment]`\n- Changed assignment: `kpts = list(itertools.chain.from_iterable(_kpts))` to `kpts = tuple(itertools.chain.from_iterable(_kpts))`\n\n---\n\npymatgen/io/lobster/inputs.py: ## Short Summary\n\nThe changes in `pymatgen/io/lobster/inputs.py` involve updating the type annotations for the `input_grid` parameter in the `write_KPOINTS` function from a `Sequence[int]` to a `tuple[int, int, int]`. Additionally, the `input_grid` parameter description has been modified from `list` to `tuple`, aligning with the actual type used.\n\n## Alterations to the Declarations of Exported or Public Entities\n\n- `def write_KPOINTS(..., input_grid: Sequence[int] = (5, 5, 5), ...)` => `def write_KPOINTS(..., input_grid: tuple[int, int, int] = (5, 5, 5), ...)`\n- `input_grid (list): grid to generate the KPOINTS file` => `input_grid (tuple): grid to generate the KPOINTS file`\n- `kpts=kpts,` => `kpts=tuple(kpts),`\n\n---\n\npymatgen/io/lobster/outputs.py: ## Short Summary\nThe change in functionality involves a conditional check for `kpoints_object.labels` before iterating over them to populate `label_dict`.\n\n## Alterations to the declarations of exported or public entities\n- No modifications to the declarations of exported or public entities.\n\n---\n\npymatgen/io/res.py: ## Alterations to the declarations of exported or public entities\n\n- `from pymatgen.core.trajectory import Vector3D` => `from pymatgen.util.typing import Vector3D`\n\n---\n\npymatgen/io/vasp/inputs.py: ### Alterations to the declarations of exported or public entities:\n\n- Added import: `from collections.abc import Sequence`\n- Modified `Kpoints` class:\n - Changed class docstring from `\"KPOINT reader/writer.\"` to `\"KPOINTS reader/writer.\"`\n - Changed parameter `kpts` type from `Sequence[float | Sequence[float]]` to `Sequence[Kpoint]`\n - Changed parameter `kpts_weights` type from `None` to `list[float] | None`\n - Changed parameter `coord_type` type from `None` to `Literal[\"Reciprocal\", \"Cartesian\"] | None`\n - Changed parameter `labels` type from `None` to `list[str] | None`\n - Changed parameter `tet_connections` type from `None` to `list[tuple] | None`\n- Added method `__eq__(self, other: object) -> bool` to compare `Kpoints` objects\n- Added method `__repr__(self) -> str` to customize the string representation of `Kpoints`\n- Added property `kpts` with getter and setter methods to handle kpoints as a sequence of tuples\n- Modified method `automatic(cls, subdivisions)` by adding type hint for `subdivisions: int`\n- Modified methods `gamma_automatic(cls, kpts: Kpoint = (1, 1, 1), shift: Vector3D = (0, 0, 0))` and `monkhorst_automatic(cls, kpts: Kpoint = (2, 2, 2), shift: Vector3D = (0, 0, 0))` by changing the type of `kpts` parameter to `Kpoint`\n- Modified method `automatic_density(cls, structure: Structure, kppa: float, force_gamma: bool)` by adding type hints for `kppa: float` and `force_gamma: bool`\n- Modified method `automatic_gamma_density(cls, structure: Structure, kppa: float)` by adding type hint for `kppa: float`\n- Modified method `automatic_density_by_lengths(cls, structure: Structure, length_densities: list[float], force_gamma: bool = False)` by adding type hint for `length_densities: list[float]`\n- Modified method `automatic_linemode(cls, divisions: int, ibz: HighSymmKpath)` by adding type hints for `divisions: int` and `ibz: HighSymmKpath`\n- Modified method `from_str(cls, string: str) -> Self` by adding type hints for parameters and return type\n- Modified method `write_file(self, filename: str) -> None` by adding type hint for `filename: str`\n- Modified method `from_dict(cls, dct: dict) -> Self` by adding type hints for parameters and return type\n\n---\n\npymatgen/io/vasp/outputs.py: ## Summary\n\nThe changes in the `get_band_structure` function in `pymatgen/io/vasp/outputs.py` involve adjustments to how labels are handled. Specifically, there are modifications to the conditions for label processing and error handling related to band structure calculations along symmetry lines.\n\n## Alterations to the declarations of exported or public entities\n\n- `if kpoint_file.labels[i] is not None:` => `if kpoint_file.labels is not None and kpoint_file.labels[i] is not None:`\n- `if \"\" in kpoint_file.labels:` => `if kpoint_file.labels is not None:`\n- `labels_dict = dict(zip(kpoint_file.labels, kpoint_file.kpts))` => `labels_dict = dict(zip(kpoint_file.labels, kpoint_file.kpts))`\n- `labels_dict.pop(None, None)` => `labels_dict.pop(None, None) # type: ignore[call-overload]`\n\n---\n\npymatgen/io/vasp/sets.py: ## Short Summary\nThe changes in `pymatgen/io/vasp/sets.py` involve modifications to type annotations and refactoring of the `_combine_kpoints` function to handle multiple `Kpoints` objects more efficiently. The function now combines multiple `Kpoints` objects by concatenating their labels, kpoints, and weights.\n\n## Alterations to the declarations of exported or public entities\n- `from typing import Any, Literal, Union, cast` => `from typing\n\n---\n\npymatgen/util/typing.py: ## Short Summary\nAdded new type declarations for `Vector3D`, `Matrix3D`, `SitePropsType`, and `Kpoint` in `pymatgen/util/typing.py`.\n\n## Alterations to the declarations of exported or public entities\n- `Vector3D: TypeAlias = tuple[float, float, float]`\n- `Matrix3D: TypeAlias = tuple[Vector3D, Vector3D, Vector3D]`\n- `SitePropsType: TypeAlias = Union[list[dict[Any, Sequence[Any]]], dict[Any, Sequence[Any]]]`\n- `Kpoint: TypeAlias = Union[tuple[float, float, float], tuple[int,]]`\n\n---\n\ntests/io/vasp/test_inputs.py: ## Alterations to the declarations of exported or public entities\n\n- `def gamma_automatic([3, 3, 3], [0, 0, 0])` in class `Kpoints` => `def gamma_automatic((3, 3, 3), [0, 0, 0])` in class `Kpoints`\n- `def monkhorst_automatic([2, 2, 2], [0, 0, 0])` in class `Kpoints` => `def monkhorst_automatic((2, 2, 2), [0, 0, 0])` in class `Kpoints`\n- `def automatic(100)` in class `Kpoints` => `def automatic((100,))` in class `Kpoints`\n- `def automatic_density(struct, 500)` in class `Kpoints` => `def automatic_density(struct, 500)` in class `Kpoints`\n- `def automatic_density_by_vol(struct, 1000)` in class `Kpoints` => `def automatic_density_by_vol(struct, 1000)` in class `Kpoints`\n- `def automatic_density_by_lengths(struct, [50, 50, 1], force_gamma=True)` in class `Kpoints` => `def automatic_density_by_lengths(struct, [50, 50, 1], force_gamma=True)` in class `Kpoints`\n- `def monkhorst_automatic([2, 2, 2], [0, 0, 0])` in function `test_as_dict_from_dict` => `def monkhorst_automatic((2, 2, 2), [0, 0, 0])` in function `test_as_dict_from_dict`\n- `def monkhorst_automatic([2, 2, 2], [0, 0, 0])` in function `test_eq` => `def monkhorst_automatic((2, 2, 2), [0, 0, 0])` in function `test_eq`\n- `def automatic_density_by_lengths(structure, length_densities)` in function `test_automatic_density_by_lengths` => `def automatic_density_by_lengths(structure, length_densities)` in function `test_automatic_density_by_lengths`\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request (PR) aims to enhance the `Kpoints` class in the `pymatgen` library by making several modifications:\n1. The `kpts` attribute within the `Kpoints` class is converted from its current type to a `tuple` of three integers (`tuple[int, int, int]`), ensuring type safety and immutability.\n2. The `kpts` attribute is encapsulated as a property with a corresponding setter method to manage modifications securely and maintain immutability.\n3. Custom types such as `Vector3D`, `Matrix3D`, and `SitePropsType` are relocated to a new module `util.typing` to centralize type definitions and facilitate easier maintenance and updates.\n4. The PR also discusses the potential impacts of these changes and highlights the need for further discussion and unit testing to ensure robust integration.\n\nThe changes are motivated by a previous commit discussion, aiming to improve the codebase's structure, maintainability, and type safety.\n\n### Comments Summary\n\nThe discussion in the PR comments revolves around several key decisions:\n1. **Type Choice for `kpts`**: There was a debate between using `int` and `float` types for the elements of `kpts`. The consensus leaned towards using `int` for clarity and to avoid overfitting to edge cases like zero-decimal floats.\n2. **Introduction of Custom Types**: It was agreed to introduce a custom type alias `Kpoint = tuple[int, int, int]` in the `util.typing` module to simplify future modifications and maintain consistency across the codebase. There's also a suggestion to consider a similar approach for coordinates in the future.\n3. **Collection Type for `kpts`**: The discussion also touched upon the choice of collection type for `kpts`. It was suggested to use `Sequence[Kpoint]` instead of `tuple[Kpoint]` to not enforce immutability on the collection of `kpts`, allowing for more natural operations like adding or removing elements.\n\nThese discussions are crucial as they directly influence the implementation details and the future maintainability of the code.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR introduces several changes across multiple files in the `pymatgen` library, primarily focusing on enhancing type safety, code maintainability, and structural organization:\n\n1. **Centralization of Type Definitions**: Types such as `Vector3D`, `Matrix3D`, and `SitePropsType` are moved to `util.typing`. This change affects multiple files (`interface.py`, `lattice.py`, `trajectory.py`, `aims/outputs.py`, `aims/parsers.py`, `cif.py`, `cp2k/inputs.py`, `res.py`) where these types are used, updating their import statements to reflect the new location.\n\n2. **Enhancements in `Kpoints` Class**:\n - The `kpts` attribute is now handled as a tuple of integers (`tuple[int, int, int]`), and it's managed through a property with a getter and setter, enhancing encapsulation and immutability.\n - The `Kpoints` class sees comprehensive updates including new methods for equality checks, string representation, and various utility methods to handle different modes and configurations of k-points generation (`io/vasp/inputs.py`).\n\n3. **Refactoring and Type Annotation Improvements**:\n - Several files have updated type annotations to align with the new type definitions, improving the clarity and robustness of type checking throughout the library.\n - The `lobster/inputs.py` updates the type annotations for `input_grid` parameter and adjusts related descriptions.\n\n4. **Handling of `Kpoints` in Various Contexts**:\n - Adjustments in handling `Kpoints` in different modules like `cp2k/inputs.py` and `lobster/inputs.py` reflect the broader changes, ensuring that the new type definitions and structures are consistently applied.\n\n5. **Error Handling and Conditional Checks**:\n - Modifications in `vasp/outputs.py` improve the robustness of label handling in band structure calculations, adding necessary conditional checks to prevent errors.\n\nThese changes collectively aim to refine the structure, type safety, and usability of the `pymatgen` library, setting a foundation for more reliable and maintainable code.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 9d7b883f81b60c5be1a2f8d19097148dddfe885e -->\n<!-- 26404d1f654edadaeebd695132bb1f4fd30e746f -->\n<!-- 9cc2cb8415c0b5c1cc8d5834a5d92ee277956c19 -->\n<!-- 596d256f3620cd080621bddbbec60609e77fd74d -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"I just opened this early PR @janosh. Seems a lot of work and I'm quite concerned this might break many others (in typing, I don't expect much functional change thought, except for mutability).\r\n\r\nWould you suggest `tuple[float, float, float]` or `tuple[int, int, int]` for each single kpoint (compatibility for 0-decimal float? )?",
"I would prefer typing as int since float will still work and only cause a type error",
"> I would prefer typing as int since float will still work and only cause a type error\r\n\r\nI agree with you on this, we should not cater too much to edge cases (0-decimal `float` in this case) , `int` is much clearer for `KPoint`.\r\n\r\nShouldn't we add another custom type to `util.typing` for simplicity (which also ensures that we don't need to change types everywhere like we're doing now, in case we need to change the type of `Kpoint` in the future)?\r\n```python\r\nKpoint = tuple[int, int, int]\r\n```\r\n\r\nMaybe do the same to coordinates in the near future?\r\n```python\r\nCoordinate = tuple[float, float, float]\r\n```\r\n\r\nMeanwhile, maybe we should consider using a more general `Sequence[Kpoint]` instead of `tuple[Kpoint]`? Currently we just want to hint developers/users that `kpts` is a \"collection\" of `Kpoint`, and using `tuple` for `Kpoint` could provide fixed length. Do we have a good reason for immutability for the collection itself (I thought it might be natural to add/remove `Kpoint` from the collection)?",
"> Shouldn't we add another custom type to `util.typing` for simplicity (which also ensures that we don't need to change types everywhere like we're doing now, in case we need to change the type of Kpoint in the future)?\r\n\r\ngood idea!\r\n\r\n> Maybe do the same to coordinates in the near future?\r\n\r\nyes, i forgot to add could you move the `Vector3D` type to `util/typing.py`? not sure about renaming to `Coordinate`. `Vector3D` sounds more general to me.\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/37d1066a8f45b24dff8cf8c18b2549648897afce/pymatgen/core/trajectory.py#L30\r\n\r\n> Meanwhile, maybe we should consider using a more general Sequence[Kpoint] instead of tuple[Kpoint]? Currently we just want to hint developers/users that kpts is a \"collection\" of Kpoint, and using tuple for Kpoint could provide fixed length. Do we have a good reason for immutability for the collection itself (I thought it might be natural to add/remove Kpoint from the collection)?\r\n\r\nthat's a good point. let's do it your way",
"> yes, i forgot to add could you move the `Vector3D` type to `util/typing.py`? not sure about renaming to `Coordinate`. `Vector3D` sounds more general to me.\r\n>\r\n> https://github.com/materialsproject/pymatgen/blob/37d1066a8f45b24dff8cf8c18b2549648897afce/pymatgen/core/trajectory.py#L30\r\n\r\nYes sure. `Vector3D` sounds better (more general), and could be also used on types like velocity which is not actually a \"coordinate\".\r\n\r\n> > Meanwhile, maybe we should consider using a more general Sequence[Kpoint] instead of tuple[Kpoint]? Currently we just want to hint developers/users that kpts is a \"collection\" of Kpoint, and using tuple for Kpoint could provide fixed length. Do we have a good reason for immutability for the collection itself (I thought it might be natural to add/remove Kpoint from the collection)?\r\n> \r\n> that's a good point. let's do it your way\r\n\r\nGreat. I would try implement this. Thanks for the feedback.\r\n\r\nMeanwhile, I don't know what is the best place to put the type `Kpoint`. Contrary to `Vector3D`, this sounds more specific to `vasp`. But if we put it under `io.vasp`, it might be confused with `Kpoints` (the data class). Though don't need to worry about this too much now, it could be easily relocated (but might break other's type checking).\r\n",
"Please review this if you have time @janosh :)\r\n\r\nI ended up adding type alias as `Kpoint = Union[tuple[float, float, float], tuple[int,]]`:\r\n- `tuple[int,]` for \"automatic\" mode: https://github.com/materialsproject/pymatgen/blob/ff94faa5bb490354c420f188f1abeac17cb40931/pymatgen/io/vasp/inputs.py#L1185-L1200\r\n- I have to use `float` for `tuple[float, float, float]` to consider the line mode (where each Kpoint is actually a `Vector3D`).\r\n\r\nAny suggestion would be appreciated :)\r\n",
"> you're writing excellent tests 🧪\r\n\r\nThanks for reviewing and saying that! Appreciate it.",
"@janosh Also worth noting it appears `uv` is less reliable than native `pip`, as you might have noticed in tests for previous several commits where tests failed randomly. I'm not sure how much speedup `uv` gives over native `pip`, but if not that much, I would personally prefer a \"slower but more reliable\" method than a \"faster but less reliable\" method (because I assume CI is not performance critical?).\r\n\r\nI was always wondering, does GitHub provide some dedicated container for CI tests (like codespace for CI)? As I notice environment preparation time is almost as much as actual test running time, it would be good to avoid building a new test env every time when there is no dependency change?\r\n\r\n",
"> @janosh Also worth noting it appears uv is less reliable than native pip,\r\n\r\nare you referring to this error? \r\n\r\n```py\r\nE _tkinter.TclError: Can't find a usable tk.tcl in the following directories: \r\n```\r\n\r\nThat also used to happen with `pip` occasionally. I wasn't keeping a close eye on CI last week so it's possible i missed other issues but didn't notice anything specific to `uv` other than the `pytorch` installation time out.\r\n\r\n> I was always wondering, does GitHub provide some dedicated container for CI tests (like codespace for CI)? \r\n\r\nThe `setup-python` GH action, supports caching which we used before with `pip`. But [I read in here](https://github.com/actions/setup-python/issues/822#issuecomment-1963717925) that it's slower than installing from scratch with `uv`. I didn't test this myself, but I also noticed that the post-setup step for creating the `pip` cache could be quite slow so it's possible that for `uv` it's slower than not using a cache",
"\r\n> are you referring to this error?\r\n> \r\n> ```python\r\n> E _tkinter.TclError: Can't find a usable tk.tcl in the following directories: \r\n> ```\r\n> \r\n> That also used to happen with `pip` occasionally. I wasn't keeping a close eye on CI last week so it's possible i missed other issues \r\n\r\nYes I did notice [this error](https://github.com/materialsproject/pymatgen/actions/runs/8867856257/job/24346817459?pr=3758) multiple times within this PR, and sometimes the following:\r\n```\r\n>> Run micromamba activate pmg\r\n/home/runner/work/_temp/225b20ec-6d19-4bb8-b69d-17e4bb02f7d0.sh: line 2: pytest: command not found\r\n``` \r\n\r\nfor example [here](https://github.com/materialsproject/pymatgen/actions/runs/8867514343/job/24346160517?pr=3758). I would let you know if I notice any others.\r\n\r\nThe reason seems to be: in cases where `uv` failed to install some package, it would not interrupt the workflow (not sure if intended), and thus the \"dependency installation\" stage would pass without any issue, for example [this](https://github.com/materialsproject/pymatgen/pull/3786/checks?check_run_id=24347497826).\r\n\r\n> didn't notice anything specific to `uv` other than the `pytorch` installation time out.\r\n\r\nFor some reason `uv` cannot install `boltztrap2` in #3786 too, other than this, no other issues so far.\r\n\r\n> > I was always wondering, does GitHub provide some dedicated container for CI tests (like codespace for CI)?\r\n> \r\n> The `setup-python` GH action, supports caching which we used before with `pip`. But [I read in here](https://github.com/actions/setup-python/issues/822#issuecomment-1963717925) that it's slower than installing from scratch with `uv`. I didn't test this myself, but I also noticed that the post-setup step for creating the `pip` cache could be quite slow so it's possible that for `uv` it's slower than not using a cache\r\n\r\nThat sounds interesting and worth some experiments on it. I might give it a try in the near future and let you know how everything goes :) Thanks for the input!\r\n\r\n",
"> ```sh\r\n> >> Run micromamba activate pmg\r\n> /home/runner/work/_temp/225b20ec-6d19-4bb8-b69d-17e4bb02f7d0.sh: line 2: pytest: command not found\r\n> ```\r\n\r\nyou're right, i did see that one as well. are you sure this is a `uv` issue? could also be a `micromamba` or a `uv`-`micromamba` interop issue\r\n",
"I'm not 100% sure. But as we could see from the [log here](https://github.com/materialsproject/pymatgen/actions/runs/8867514343/job/24346160517?pr=3758) inside the \"install pymatgen and dependencies\" section:\r\n```\r\nerror: Failed to download distributions\r\n Caused by: Failed to fetch wheel: chgnet==0.3.5\r\n Caused by: Failed to extract archive\r\n Caused by: error decoding response body\r\n Caused by: request or response body error\r\n Caused by: error reading a body from connection\r\n Caused by: end of file before message length reached\r\n```\r\n\r\nI would assume it's likely a `uv` issue (`uv` randomly failed to install some package), as the venv creates and activates just fine. But I'm not sure if `micromamba` is in play here.\r\n\r\n",
"FYI that this is a slight breaking change re: kpts no longer being a list but a tuple, although you likely are aware of this due to the change in the test suite.\r\n\r\nEdit: nvm, I see the comment here https://github.com/materialsproject/pymatgen/commit/6a06f3cb0a8b551ed782d86ed5963cd8aaed6674#r140944147",
"Hi @Andrew-S-Rosen, yes we're fully aware it might be breaking to change `Kpoint` from a `list` to a `tuple`. Janosh said he prefer it be to immutable wherever possible, and I agree using `tuple` would bring more convenience when typing (`list[float, float, float]` would not work).\r\n\r\nBut frankly I'm not quite sure if there is any unexpected side effect. Ideally things should only rely on the values of `Kpoint` instead of the type. Any suggestion would be appreciated.",
"I don't think there will be too many practical side effects. I just noticed it failing my CI runs because I was checking for exact matches on `[kpt, kpt, kpt]` instead of `(kpt, kpt, kpt)`.",
"Yes the original unit tests were doing the same and we have to change the types too. Hopefully there would not be many operations that replies on `Kpoint` to be exactly `list` or mutable. Thanks for the input!"
] | 2024-04-14T13:04:49
| 2024-05-07T02:45:20
|
2024-04-28T22:06:54Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
As discussed in https://github.com/materialsproject/pymatgen/commit/6a06f3cb0a8b551ed782d86ed5963cd8aaed6674#r140944147.
- Convert `kpts` in `Kpoints` to `Sequence[tuple[float, float, float]]`, and related type fixes
- Set `kpts` as `property` and add its `setter`, also add unit tests for this property
- Relocate custom types (Vector3D Matrix3D SitePropsType) to `util.typing`
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3758/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3758/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3758",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3758",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3758.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3758.patch",
"merged_at": "2024-04-28T22:06:54Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3759
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3759/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3759/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3759/events
|
https://github.com/materialsproject/pymatgen/pull/3759
| 2,243,099,379
|
PR_kwDOACgets5spThG
| 3,759
|
Add a CI run that only tests non-optional deps (optimistically)
|
{
"login": "ml-evs",
"id": 7916000,
"node_id": "MDQ6VXNlcjc5MTYwMDA=",
"avatar_url": "https://avatars.githubusercontent.com/u/7916000?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ml-evs",
"html_url": "https://github.com/ml-evs",
"followers_url": "https://api.github.com/users/ml-evs/followers",
"following_url": "https://api.github.com/users/ml-evs/following{/other_user}",
"gists_url": "https://api.github.com/users/ml-evs/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ml-evs/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ml-evs/subscriptions",
"organizations_url": "https://api.github.com/users/ml-evs/orgs",
"repos_url": "https://api.github.com/users/ml-evs/repos",
"events_url": "https://api.github.com/users/ml-evs/events{/privacy}",
"received_events_url": "https://api.github.com/users/ml-evs/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Auto Review Skipped\n> \n> Draft detected.\n> \n> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository.\n> \n> To trigger a single review, invoke the `@coderabbitai review` command.\n> \n\n<!-- end of auto-generated comment: skip review by coderabbit.ai --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@coderabbit disable",
"Superseded by #3857"
] | 2024-04-15T08:59:22
| 2024-06-09T15:36:24
|
2024-06-09T15:36:24Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
New version of #3646.
This PR adds a separate test suite run for the case that only mandatory dependencies have been installed (directly via `pip install -e .[dev]`), attempting to mimic what a user will actually have when they just `pip install pymatgen`. This will then hopefully catch errors where either optional imports are not properly guarded, or main functionality is rendered broken by optional dependency updates.
Not sure if this is something that you would actually want to merge given the potential maintenance overhead, but this might be able to spot more issues before they arise now that #3757 is merged.
Someone will need to carefully look at how I am invoking the tests, as I'm not sure if there is any coverage/durations magic going on that needs to be separated between the two runs (the comments to that effect at the top of `test.yml` might now be out of date).
|
{
"login": "ml-evs",
"id": 7916000,
"node_id": "MDQ6VXNlcjc5MTYwMDA=",
"avatar_url": "https://avatars.githubusercontent.com/u/7916000?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ml-evs",
"html_url": "https://github.com/ml-evs",
"followers_url": "https://api.github.com/users/ml-evs/followers",
"following_url": "https://api.github.com/users/ml-evs/following{/other_user}",
"gists_url": "https://api.github.com/users/ml-evs/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ml-evs/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ml-evs/subscriptions",
"organizations_url": "https://api.github.com/users/ml-evs/orgs",
"repos_url": "https://api.github.com/users/ml-evs/repos",
"events_url": "https://api.github.com/users/ml-evs/events{/privacy}",
"received_events_url": "https://api.github.com/users/ml-evs/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3759/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3759/timeline
| null | true
| true
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3759",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3759",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3759.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3759.patch",
"merged_at": null
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3760
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3760/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3760/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3760/events
|
https://github.com/materialsproject/pymatgen/issues/3760
| 2,245,842,625
|
I_kwDOACgets6F3NbB
| 3,760
|
Overlayed subplots from `BSPlotterProjected.get_projected_plots_dots()` and `get_projected_plots_dots_patom_pmorb()`
|
{
"login": "HERTZCAI",
"id": 34959884,
"node_id": "MDQ6VXNlcjM0OTU5ODg0",
"avatar_url": "https://avatars.githubusercontent.com/u/34959884?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/HERTZCAI",
"html_url": "https://github.com/HERTZCAI",
"followers_url": "https://api.github.com/users/HERTZCAI/followers",
"following_url": "https://api.github.com/users/HERTZCAI/following{/other_user}",
"gists_url": "https://api.github.com/users/HERTZCAI/gists{/gist_id}",
"starred_url": "https://api.github.com/users/HERTZCAI/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/HERTZCAI/subscriptions",
"organizations_url": "https://api.github.com/users/HERTZCAI/orgs",
"repos_url": "https://api.github.com/users/HERTZCAI/repos",
"events_url": "https://api.github.com/users/HERTZCAI/events{/privacy}",
"received_events_url": "https://api.github.com/users/HERTZCAI/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
},
{
"id": 5322856717,
"node_id": "LA_kwDOACgets8AAAABPURZDQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/data%20viz",
"name": "data viz",
"color": "3C19AC",
"default": false,
"description": "PRs and issues about pymatgen plotting functionality"
},
{
"id": 5966808010,
"node_id": "LA_kwDOACgets8AAAABY6ZDyg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/electronic%20structure",
"name": "electronic structure",
"color": "6027F8",
"default": false,
"description": "Electronic structure functionality related"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Hopefully the fix produces satisfactory results for you @HERTZCAI (feel free to ping me if you have more suggestions). \r\n\r\nAlso to improve the overlapping markers, you could now pass a `marker_size` arg for example:\r\n\r\n```python\r\nplotter = BSPlotterProjected(bs=bs_data)\r\nplotter.get_projected_plots_dots({\"Cu\":[\"s\", \"d\"], \"O\":[\"p\"]}, marker_size=6.5)\r\n\r\nplt.show()\r\n```"
] | 2024-04-16T11:47:51
| 2024-05-04T04:29:01
|
2024-05-02T14:28:53Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
3.11.7
### Pymatgen version
2024.4.13
### Operating system version
Ubuntu 22.04.3 LTS
### Current behavior
I try to get band structures with specific elements and orbitals with `get_projected_plots_dots()`. While a figure with 3 subfigures is expected, the program returns a figure with only one subfigure and the place where the other two subfigures are supposed to be is blank.

However, when I downgrade pymatgen to 2023.8.10, no such problems occur.
`get_projected_plots_dots_patom_pmorb()` also does not work properly.
Moreover, there are extra axes in the figure.
`matplotlib` version is 3.8.0.
### Expected Behavior
A figure with several subfigures displays normally
### Minimal example
```Python
vasprun = Vasprun("vasprun.xml",parse_projected_eigen=True)
bs_data = vasprun.get_band_structure(line_mode=True)
plt_3=BSPlotterProjected(bs=bs_data)
plt_3.get_projected_plots_dots({'K':['s'],'Ti':['d'],'O':['p']})
plt.show()
```
### Relevant files to reproduce this bug
_No response_
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3760/reactions",
"total_count": 2,
"+1": 2,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3760/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3761
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3761/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3761/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3761/events
|
https://github.com/materialsproject/pymatgen/issues/3761
| 2,246,604,461
|
I_kwDOACgets6F6Hat
| 3,761
|
`atom_site_label` in CIF file are not unique
|
{
"login": "fxcoudert",
"id": 1980544,
"node_id": "MDQ6VXNlcjE5ODA1NDQ=",
"avatar_url": "https://avatars.githubusercontent.com/u/1980544?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/fxcoudert",
"html_url": "https://github.com/fxcoudert",
"followers_url": "https://api.github.com/users/fxcoudert/followers",
"following_url": "https://api.github.com/users/fxcoudert/following{/other_user}",
"gists_url": "https://api.github.com/users/fxcoudert/gists{/gist_id}",
"starred_url": "https://api.github.com/users/fxcoudert/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/fxcoudert/subscriptions",
"organizations_url": "https://api.github.com/users/fxcoudert/orgs",
"repos_url": "https://api.github.com/users/fxcoudert/repos",
"events_url": "https://api.github.com/users/fxcoudert/events{/privacy}",
"received_events_url": "https://api.github.com/users/fxcoudert/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
},
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 6072177337,
"node_id": "LA_kwDOACgets8AAAABae4SuQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/cif",
"name": "cif",
"color": "B04CCD",
"default": false,
"description": "Crystallographic information file"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"One of the reasons labels should be unique: they are used to indicate bonding (and angles, torsions, etc). If they are not unique, this information is useless. (And I am working on a PR to add that capability to pymatgen.)",
"I can confirm that this is likely a bug (in terms of having agreement with the CIF spec).",
"The bug may not necessarily be in the CifWriter itself. Pymatgen expands the structure to P1 when reading a cif file (symmetry information gets lost). This includes duplicating the labels.",
"Does pymatgen require labels to be unique? I do not know. If so, the bug is in the symmetry expansion. But what is sure is that labels in a CIF file should be unique (whether pymatgen accepts duplicate labels or not).",
"No, pymatgen does not require unique labels. The duplication of labels happens when the symmetry is expanded in the CifParser:\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/0e57abf35d620f5c09149d72ba12493184135611/pymatgen/io/cif.py#L1003-L1011\r\n\r\nOne way to solve would be to ensure labels are suffixed 'abcde...' when the symmetry gets expanded there. Although this can also be a check on the CifWriter side.\r\n\r\n",
"@stefsmeets I just wanted to mention that this might be problematic for very large structures. There are only 26 letters in the alphabet. With exception to this drawback, such a solution would be nice.",
"I'd be happy to have a go at this",
"@stefsmeets sound great. (cc @janosh)",
"Some options:\r\n\r\n1. `CifWriter` raises `ValueError` if Structure contains duplicate label -> user is *forced* to correct it\r\n2. `CifWriter` raises `UserWarning` if Structure contains duplicate label -> user can *choose* to correct it\r\n3. `CifWriter` overwrites labels to fix the issue -> less hassle for the users, but can lead to unexpected labels in CIF file\r\n4. `CifParser.parse_structures()` ensures unique labels when reading CIF -> if the user modifies the sites, they may still end up with duplicate labels\r\n\r\nI want to avoid agressively/automatically relabelling, because I know that this can lead to unexpected results which can be frustrating. So I'm leaning towards 1 or 2.\r\n\r\nTo help with 1 or 2, I want to add a method: `Structure.relabel_sites()` to give users some room to quickly relabel a large number of sites and ensure uniqueness. I think this can be useful to add regardless.\r\n\r\nLet me know what you think.\r\n",
"- Option 1: sadly, there are CIF files (mostly from computational tools) that have this problem, so I think that is not viable.\r\n- Option 2: sounds nice, but does not account for situations where pymatgen itself is creating label duplicates (when lowering symmetry). How about an option to `CifWriter` to make labels unique."
] | 2024-04-16T17:58:13
| 2024-04-25T18:36:00
|
2024-04-25T18:36:00Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.11.6
### Pymatgen version
2023.10.4
### Operating system version
macOS 14.4.1
### Current behavior
Read a structure with symmetry, and write it to a CIF file. My example is:
```
$ cat MOF-71.cif
data_MOF-71
_audit_creation_method 'generated by CrystalMaker 8.6.5'
_publ_section_comment
;
From DOI: 10.1021/ja045123o
http://www.chemistry.ucla.edu/crmr/yaghi/pdfPublications/Rod-PkgsMtlOrgFrJAmChemSoc2005.
pdf
;
_cell_length_a 8.8481(0)
_cell_length_b 7.2386(0)
_cell_length_c 19.2301(0)
_cell_angle_alpha 90.0000(0)
_cell_angle_beta 90.0000(0)
_cell_angle_gamma 90.0000(0)
_symmetry_space_group_name_H-M 'P 2/m'
_symmetry_Int_Tables_number 10
_symmetry_cell_setting monoclinic
loop_
_symmetry_equiv_pos_as_xyz
'+x,+y,+z'
'-x,+y,-z'
'-x,-y,-z'
'+x,-y,+z'
loop_
_atom_site_label
_atom_site_type_symbol
_atom_site_occupancy
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
C1 C 1.0000 0.0134 0.0000 0.2761
C2 C 1.0000 0.5463 0.0000 0.4307
C3 C 1.0000 0.0463 0.5000 0.9307
C4 C 1.0000 0.5134 0.5000 0.7761
C5 C 1.0000 0.5463 0.0000 0.0693
C6 C 1.0000 0.0238 0.3362 0.5341
C7 C 1.0000 0.0238 0.6638 0.9659
C8 C 1.0000 0.1469 0.0000 0.1670
C9 C 1.0000 0.6469 0.5000 0.6670
C10 C 1.0000 0.2871 0.0000 0.2815
C11 C 1.0000 0.7871 0.5000 0.7815
C12 C 1.0000 0.5238 0.1638 0.4659
C13 C 1.0000 0.5238 0.8362 0.0341
C14 C 1.0000 0.0463 0.5000 0.5693
C15 C 1.0000 0.5974 0.0000 0.1442
C16 C 1.0000 0.0974 0.5000 0.6442
C17 C 1.0000 0.5974 0.0000 0.3558
C18 C 1.0000 0.0974 0.5000 0.8558
Co Co 1.0000 0.7500 0.7500 0.2500
H1 H 1.0000 0.7353 0.0000 0.8506
H2 H 1.0000 0.5310 0.5000 0.6469
H3 H 1.0000 0.5409 0.2755 0.4433
H4 H 1.0000 0.7975 0.3678 0.8154
H5 H 1.0000 0.0134 0.0000 0.3341
H6 H 1.0000 0.7259 0.0000 0.6618
H7 H 1.0000 0.6492 0.1322 0.7363
H8 H 1.0000 0.7100 0.3678 0.6488
H9 H 1.0000 0.8742 0.5000 0.7410
H10 H 1.0000 0.9143 0.8678 0.8525
H11 H 1.0000 0.5409 0.7245 0.0567
H12 H 1.0000 0.0409 0.2245 0.5567
H13 H 1.0000 0.0409 0.7755 0.9433
H14 H 1.0000 0.5134 0.5000 0.8291
N1 N 1.0000 0.6427 0.5000 0.7500
N2 N 1.0000 0.1427 0.0000 0.2500
O1 O 1.0000 0.3875 0.5000 0.7500
O2 O 1.0000 0.6148 0.8462 0.1722
O3 O 1.0000 0.1148 0.3461 0.6722
O4 O 1.0000 0.6148 0.1538 0.3278
O5 O 1.0000 0.1148 0.6539 0.8278
O6 O 1.0000 0.8875 0.0000 0.2500
```
Then read it and write it back to CIF file:
```
structure = Structure.from_file("MOF-71.cif")
cif_writer = CifWriter(bonded_struct.structure)
cif_writer.write_file("output.cif")
```
The new CIF file will have atoms with duplicate `atom_site_label`:
```
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Co Co0 1 0.75000000 0.75000000 0.25000000 1.0
Co Co1 1 0.25000000 0.75000000 0.75000000 1.0
Co Co2 1 0.25000000 0.25000000 0.75000000 1.0
Co Co3 1 0.75000000 0.25000000 0.25000000 1.0
H H1 1 0.73530000 0.00000000 0.85060000 1.0
H H1 1 0.26470000 0.00000000 0.14940000 1.0
H H2 1 0.53100000 0.50000000 0.64690000 1.0
H H2 1 0.46900000 0.50000000 0.35310000 1.0
H H3 1 0.54090000 0.27550000 0.44330000 1.0
H H3 1 0.45910000 0.27550000 0.55670000 1.0
H H3 1 0.45910000 0.72450000 0.55670000 1.0
H H3 1 0.54090000 0.72450000 0.44330000 1.0
[…]
```
CIF format specifies (https://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Iatom_site_label.html):
> The [_atom_site_label](https://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Iatom_site_label.html) is a unique identifier for a particular site in the crystal.
So this shouldn't happen. I believe this incorrect behavior was introduced by https://github.com/materialsproject/pymatgen/pull/3183 (and follow-ups: https://github.com/materialsproject/pymatgen/pull/3423 and https://github.com/materialsproject/pymatgen/pull/3527)
### Expected Behavior
All sites in the CIF file should be given a unique `atom_site_label`. This should be enforced by the `CifWriter` class.
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3761/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3761/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3762
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3762/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3762/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3762/events
|
https://github.com/materialsproject/pymatgen/issues/3762
| 2,246,801,964
|
I_kwDOACgets6F63os
| 3,762
|
CrystalNN gives incorrect result for simple aromatic ring
|
{
"login": "fxcoudert",
"id": 1980544,
"node_id": "MDQ6VXNlcjE5ODA1NDQ=",
"avatar_url": "https://avatars.githubusercontent.com/u/1980544?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/fxcoudert",
"html_url": "https://github.com/fxcoudert",
"followers_url": "https://api.github.com/users/fxcoudert/followers",
"following_url": "https://api.github.com/users/fxcoudert/following{/other_user}",
"gists_url": "https://api.github.com/users/fxcoudert/gists{/gist_id}",
"starred_url": "https://api.github.com/users/fxcoudert/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/fxcoudert/subscriptions",
"organizations_url": "https://api.github.com/users/fxcoudert/orgs",
"repos_url": "https://api.github.com/users/fxcoudert/repos",
"events_url": "https://api.github.com/users/fxcoudert/events{/privacy}",
"received_events_url": "https://api.github.com/users/fxcoudert/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Hi @fxcoudert ,\r\n\r\nhave you tested some of other algorithms in the same module as well? I fear CrystalNN might be optimized mostly for typical inorganic crystals. \r\n\r\nJust a reminder: the alogrithm uses Voronoi partitioning, solid angles/distances, electronegativities and so on. I would assume the H atoms are not found, right?",
"`JMolNN()` seems to work at least for the C atoms mentioned above in that example. However, I would not trust the radii in there (they are horribly far away from the atomic radii in P, for example). You might want to provide a list of radii and tolerances yourself (e.g., atomic radii). I would assume that it should work very efficiently for molecular crystals. I am not sure there is currently any implementation directly in pymatgen or related package optimized for molecular crystals. (cc @Andrew-S-Rosen ?)",
"@fxcoudert should we add more documentation to the module and the respective classes to make clear that this is likely only working for inorganic/ionic crystals? If you look at the CrystalNN benchmark, it's also clear that it has never been benchmarked against molecular crystals (see https://pubs.acs.org/doi/10.1021/acs.inorgchem.0c02996) ",
"Historically, I have had to toggle some of the defaults to get CrystalNN to play nicely with MOF linkers, which I imagine was the source of the motivation for @fxcoudert's question. I can dig up the arguments, if it would be helpful. Of course, one would hope the defaults would suffice... ",
"> Historically, I have had to toggle some of the defaults to get CrystalNN to play nicely with MOF linkers, which I imagine was the source of the motivation for @fxcoudert's question. I can dig up the arguments, if it would be helpful. Of course, one would hope the defaults would suffice...\r\n\r\nAh, I see! Sorry that I did not know that! At least, I figured out who to ping 😅.",
"> Historically, I have had to toggle some of the defaults to get CrystalNN to play nicely with MOF linkers, which I imagine was the source of the motivation for fxcoudert's question\r\n\r\nNo I didn't know (or didn't remember) that. I just wanted to play with CrystalNN and see what it gave. I have seen it used on MOFs in a couple of papers, though:\r\n- https://pubs.acs.org/doi/full/10.1021/acs.jctc.0c01229\r\n- https://www.nature.com/articles/s41524-022-00796-6\r\n- https://pubs.acs.org/doi/full/10.1021/acs.chemmater.1c02439\r\n- https://pubs.acs.org/doi/full/10.1021/acs.jcim.1c01124\r\n\r\n@Andrew-S-Rosen if you know what parameters can give good results for MOFs, I'd be interested, indeed",
"After looking again: I find it still puzzling that it does not consider the second C despite the fact that the bond lengths should be extremely similar. ",
"> No I didn't know (or didn't remember) that. I just wanted to play with CrystalNN and see what it gave.\r\n\r\nAh, I was unclear in my phrasing. I meant that you were probably asking about an organic molecule because you're interested in MOF linkers. :) Edit: I now see you were indeed referring to a MOF! I only saw the image at first. This is what I get for responding to GitHub issues from my phone...\r\n\r\n>if you know what parameters can give good results for MOFs, I'd be interested, indeed\r\n\r\nI did some digging and noticed that for the MOF Explorer App on the Materials Project, we used the following:\r\n\r\n```python\r\ncnn = CrystalNN(porous_adjustment=True, x_diff_weight=1.5, search_cutoff=4.5)\r\nStructureGraph.with_local_env_strategy(structure, cnn).to_json()\r\n```\r\n\r\nSo, we were playing around with `x_diff_weight` and `search_cutoff` to address some issues with the organics. That said, the behavior reported in this issue is indeed odd. I would not rule out a bug or problem in general here, although I personally do not have time to look into the issue further. Hopefully someone else can!",
"This is only tangentially related, but it also implies issues with C and `CrystalNN` (but this time on an inorganic surface): https://github.com/materialsproject/pymatgen/issues/2618",
"I would like to add an additional weird behaviour of one of the other algorithms from the same module which relies on the MinimumDistance. It could be related as many functionalities are shared between the two classes.\r\n\r\n```py\r\nfrom pymatgen.core.structure import Structure\r\nfrom pymatgen.analysis.local_env import JmolNN, CrystalNN, MinimumDistanceNN, VoronoiNN, MinimumOKeeffeNN\r\nfrom collections import Counter\r\n\r\nstructure = Structure.from_file(\"MOF-71.cif\")\r\n\r\nnn = MinimumDistanceNN(0.5)\r\nbonded_struct = nn.get_bonded_structure(structure)\r\nlen_neighbors = []\r\nimport numpy as np\r\n\r\nfor n, site in enumerate(bonded_struct.structure.sites):\r\n connected_sites = len(bonded_struct.get_connected_sites(n))\r\n if np.abs(site.coords[0] - 4.63463478) < 0.01 and np.abs(site.coords[1] - 1.18568268) < 0.01 and np.abs(\r\n site.coords[2] - 8.95930359) < 0.01:\r\n print(connected_sites)\r\n print(bonded_struct.get_connected_sites(n))\r\n len_neighbors.append(connected_sites)\r\ncounter = Counter(len_neighbors)\r\n```\r\nI only get the 2nd C if I add a very large tolerance criterion, which is very weird. And the weight is much lower. The weights are different for the different C atoms even so it is a purely distance-based metric.",
"I think I have a idea: it's due to the bonded structure. \r\n\r\n```py\r\nfrom pymatgen.core.structure import Structure\r\nfrom pymatgen.analysis.local_env import JmolNN, CrystalNN, MinimumDistanceNN, VoronoiNN, MinimumOKeeffeNN\r\nfrom collections import Counter\r\n\r\nstructure = Structure.from_file(\"MOF-71.cif\")\r\n\r\nnn =MinimumDistance()\r\nprint(nn.get_cn(structure, 76))\r\n\r\n```\r\nAs expected, this gives 1. Same for CrystalNN() btw. \r\n\r\nI am not entirely sure where this comes from but potentially that both algorithms detect a bond from one side but not the other. Thus, changing the cutoffs should likely be enough. (Tested, `nn =CrystalNN( x_diff_weight=1.5, search_cutoff=4.5)` and it seems to work for this example as well)\r\n\r\nMy hypothesis for now:\r\nIf you use the CN tools, you get 1. Thus, some cutoff cuts off the C-C bonds for this particular C. One of the neighboring Cs has a bond to it... (the one bonded to 3Cs) but not the other (2Cs and 1 H) Then, in the graph, you will get a 2-fold coordination.... The graph should probably be a directed one but the output doesn't seem to care.\r\n",
"@fxcoudert I hope my answer is clear and helps. I don't think it is a bug. Just suboptimal weights for the C-H vs. C-C bond case. ",
"I have closed this issue now with an update to the documentation. Let us know if there are still any problems. "
] | 2024-04-16T20:06:39
| 2024-04-18T06:37:52
|
2024-04-18T06:36:41Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.11.6
### Pymatgen version
2023.10.4
### Operating system version
macOS 14.4.1
### Current behavior
1. Take this CIF file: https://gist.github.com/fxcoudert/f13193d91eacc7e3d67cf355f805ee36
2. Run this:
```
structure = Structure.from_file("/Users/fx/Documents/structures/MOFs/MOF-71.cif")
nn = CrystalNN()
bonded_struct = nn.get_bonded_structure(structure)
for n, site in enumerate(bonded_struct.structure.sites):
print(site.label, len(bonded_struct.get_connected_sites(n)))
```
3. The code will output the number of neighbords detected for each atom by CrystalNN. Atoms C6, C7, C12, C13 are detected to have only two neighbours.
4. This is incorrect, they are carbon atoms in benzene rings (the ones in purple) and should be detected to have 3 neighboring atoms.
<img width="502" alt="Capture d’écran 2024-04-16 à 22 05 46" src="https://github.com/materialsproject/pymatgen/assets/1980544/f252d0e0-bf84-4e7d-bfe9-fa0ce8dd5af4">
### Expected Behavior
No carbon atom in this structure should be two-connected.
### Minimal example
_No response_
### Relevant files to reproduce this bug
_No response_
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3762/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3762/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3763
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3763/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3763/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3763/events
|
https://github.com/materialsproject/pymatgen/pull/3763
| 2,246,834,689
|
PR_kwDOACgets5s2Iyk
| 3,763
|
add `get_string->get_str` alias for `Poscar`
|
{
"login": "timurbazhirov",
"id": 721112,
"node_id": "MDQ6VXNlcjcyMTExMg==",
"avatar_url": "https://avatars.githubusercontent.com/u/721112?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/timurbazhirov",
"html_url": "https://github.com/timurbazhirov",
"followers_url": "https://api.github.com/users/timurbazhirov/followers",
"following_url": "https://api.github.com/users/timurbazhirov/following{/other_user}",
"gists_url": "https://api.github.com/users/timurbazhirov/gists{/gist_id}",
"starred_url": "https://api.github.com/users/timurbazhirov/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/timurbazhirov/subscriptions",
"organizations_url": "https://api.github.com/users/timurbazhirov/orgs",
"repos_url": "https://api.github.com/users/timurbazhirov/repos",
"events_url": "https://api.github.com/users/timurbazhirov/events{/privacy}",
"received_events_url": "https://api.github.com/users/timurbazhirov/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5563699492,
"node_id": "LA_kwDOACgets8AAAABS59RJA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ux",
"name": "ux",
"color": "28DEA4",
"default": false,
"description": "User experience"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nA new method named `get_string` has been introduced in the `pymatgen/io/vasp/inputs.py` as an alias to the existing `get_str` method. This update enhances usability without impacting the existing functionality of the class.\n\n## Changes\n\n| File Path | Change Summary |\n|-----------------------------|--------------------------------------------------------|\n| `pymatgen/.../inputs.py` | Added `get_string` method as an alias to `get_str`. |\n\n> 🐇✨\n> In the land of code and byte,\n> A new alias shines so bright.\n> `get_string` joins the fray,\n> With `get_str` it will stay.\n> Hopping through the lines of code,\n> A rabbit leaves its whimsy ode. 🌟\n> 🐇💻\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/vasp/inputs.py: ## Short summary\n\nIn the `pymatgen/io/vasp/inputs.py` file, the `get_string` method was added as an alias for the existing `get_str` method. This change introduces a new method to the class without altering the existing functionality.\n\n\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives (User Provided Facts)\n\nThis pull request, titled \"chore: add get_string alias for Poscar,\" is numbered 3763. It introduces a minor change to the `Poscar` class within the `pymatgen` library, specifically in the `pymatgen/io/vasp/inputs.py` file. The change involves adding a new method called `get_string`, which serves as an alias for the existing `get_str` method. This addition is intended for convenience and to maintain compatibility with earlier implementations of the library.\n\nThe pull request does not include any major changes. The description confirms that all necessary checks and tests have passed, as evidenced by the successful execution of various pre-commit hooks and the listing of current package versions in the project's virtual environment. These checks ensure that the new alias integrates well with the existing codebase without introducing errors or inconsistencies.\n\n### AI-Generated Summary of Generated Summaries\n\nIn the `pymatgen/io/vasp/inputs.py` file, the `Poscar` class has been updated to include a new method named `get_string`. This method is an alias for the previously existing `get_str` method, ensuring that the functionality remains consistent while enhancing usability and compatibility with prior versions of the library. This change is minor and does not affect the core functionalities of the `Poscar` class or the `pymatgen` library.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: CodeRabbit UI**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 0e57abf35d620f5c09149d72ba12493184135611 and d08f40f3b7f9e668ef9e0be647abc674bd8728c7.\n</details>\n\n\n<details>\n<summary>Files selected for processing (1)</summary>\n\n* pymatgen/io/vasp/inputs.py (1 hunks)\n\n</details>\n\n\n\n\n<details>\n<summary>Files skipped from review due to trivial changes (1)</summary>\n\n* pymatgen/io/vasp/inputs.py\n\n</details>\n\n\n\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- d08f40f3b7f9e668ef9e0be647abc674bd8728c7 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@janosh Can we please for the love of god keep backward compatibility when it is trivial to do so? There is no reason for this backward incompatibility to exist.",
"@timurbazhirov apologies for the trouble. are you using another package that depends on `pymatgen` which didn't update to `get_str`?\r\n\r\n@shyuep you green-lighted this change last year including the deprecation period.\r\n\r\nlooks like [monty@v2024.4.16](https://github.com/materialsvirtuallab/monty/releases/tag/v2024.4.16) didn't keep backwards compatibility as deserialization is failing across the code base.",
"@janosh I green lighted the change for sure. But I was under the impression the deprecation period is longer? The Monty issue has nothing to do with deprecation but a bug introduced that were not caught by existing tests. Those I accept. \n\n",
"> But I was under the impression the deprecation period is longer?\r\n\r\nsorry about that, i probably could have been clearer.",
"Incidentally, keep your comments related to the existing bug report and package. Arguing by using equivalence on other packages is petty. If you have a problem with a bug on Monty, feel free to comment over at the Monty Issues. ",
"re this PR: adding back `get_string` class by class is probably not ideal. better to ask why there's no migration path for @timurbazhirov",
"Thank you. This seemed like a benign workaround to avoid having to handle the function signature(s) when using py3.8-compatible earlier version(s) like in https://github.com/Exabyte-io/made/blob/main/src/py/mat3ra/made/tools/convert.py#L121. For production workloads, it's often good to have compatibility with earlier versions for longer. \r\n\r\nNot sure what you mean by:\r\n\r\n> adding back get_string class by class is probably not ideal\r\n\r\nbut either way, feel free to close this PR if you don't like it.\r\n\r\nBTW - are test failures related to the change in this PR, or caused by something else?",
" > BTW - are test failures related to the change in this PR, or caused by something else?\r\n\r\nNo, they aren't. An issue with a dependency. 😅 (I also asked about this earlier today)\r\n\r\n",
"I merged. Thanks for reporting this. My view is that this is a trivial thing to support and there is no reason why we can't keep the `get_string = get_str` line. I am a practical person. Code cleanliness exists to support functionality, not to hamper it.",
"I don't quite understand why the test suite is installing monty 2024.4.*. The pinned dependency says monty==2024.2.26",
"@Andrew-S-Rosen Can you investigate the serialization issue? Seems related to the latest msonable changes.",
"@shyuep: I'm unavailable until the weekend so can't look at it until then, unfortunately (I'm just posting from phone).\n\nI can't see the test fail from GitHub Mobile but my guess is it's linked to https://github.com/materialsvirtuallab/monty/pull/654. ",
"Ah, I see the fail now. @matthewcarbone: at first glance, this looks similar to https://github.com/materialsvirtuallab/monty/issues/659 (just as a heads up!). ",
"@Andrew-S-Rosen this one can't be my fault right? monty from February is well before I broke MSONable 😁\r\n\r\nHappy to help look into this if you'd like though!",
"@matthewcarbone There are two fails here:\r\n1. The CI is installing 2024.4.x monty, which includes your changes. This is not what the CI is supposed to do. Not sure what is happening. I have no idea what `micromamba` is. This needs to be fixed by @janosh .\r\n2. Monty 2024.4.x itself has a bug which broke serialization. This needs to be fixed asap. ",
"@shyuep I absolutely am going to fix this and add new test cases to try and deal with it, but why was monty 2024.4 released when we knew it had this bug? If you're on a schedule here we should simply roll back my changes (which only affected `monty.json`) and hotfix until I can get to it. ",
"@matthewcarbone I didn't know the bug existed when 2024.4.* was released. I will roll back the changes for now.",
"@shyuep you beat me to it! I was just about to open a PR to do this. Thanks! \r\n\r\nIn the meantime I'll work on implementing the changes back in monty in a backwards compatible way. ",
"@shyuep @janosh the issue with the wrong install version of monty might be in `setup.py`.\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/7f96ef2c6c4e753a5dafbac4fde6f5a136c0aec0/setup.py#L32\r\n\r\nLooks like the version there is different than that pinned in `requirements.txt`. Even if this isn't the issue the `setup.py` file should probably read from `requirements.txt` so there's only one source of truth. Thoughts?\r\n\r\nBtw a new version of monty which rolls back my bug was just released and should fix this issue. Apologies!",
"You generally do not pin setup.py. The CI should install from the requirements.txt file. For some reason, it is not.",
"Could be this maybe?\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/7f96ef2c6c4e753a5dafbac4fde6f5a136c0aec0/.github/workflows/test.yml#L83\r\n\r\nThis would appear to install the package itself likely from `setup.py`?\r\n\r\nThat said, why would the CI install requirements from a different file than what's being deployed? That could lead to bugs due to dependency mismatches, right?",
"I have no idea what uv is though 😁",
"> I have no idea what uv is though 😁\r\n\r\nJust a software to make pip install faster. (https://pypi.org/project/uv/)"
] | 2024-04-16T20:29:59
| 2024-05-01T18:44:11
|
2024-04-17T17:09:21Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Minor changes:
- add `get_string` alias for `get_str` function in Poscar class for convenience/compatibility purposes with earlier implementation(s)
Major changes:
- none
## Checklist
```bash
(.venv) ➜ pymatgen git:(chore/add-poscar-get-string-alias) pre-commit run --all-files
ruff.....................................................................Passed
ruff-format..............................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
mypy.....................................................................Passed
codespell................................................................Passed
cython-lint..............................................................Passed
double-quote Cython strings..............................................Passed
blacken-docs.............................................................Passed
markdownlint.............................................................Passed
nbstripout...............................................................Passed
```
and
```bash
(.venv) ➜ pymatgen git:(chore/add-poscar-get-string-alias) pip list
Package Version
------------------ -----------
beautifulsoup4 4.12.2
certifi 2024.2.2
cfgv 3.4.0
charset-normalizer 3.3.2
contourpy 1.2.1
cycler 0.12.1
Cython 3.0.2
distlib 0.3.8
filelock 3.13.4
fonttools 4.51.0
future 1.0.0
identify 2.5.35
idna 3.7
joblib 1.3.2
kiwisolver 1.4.5
latexcodec 3.0.0
matplotlib 3.8.0
monty 2024.2.26
mpmath 1.3.0
networkx 3.1
nodeenv 1.8.0
numpy 1.26.0
packaging 24.0
palettable 3.3.3
pandas 2.1.1
pillow 10.3.0
pip 24.0
platformdirs 4.2.0
plotly 5.17.0
pre-commit 3.7.0
pybtex 0.24.0
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pytz 2024.1
PyYAML 6.0.1
requests 2.31.0
ruamel.yaml 0.18.6
ruamel.yaml.clib 0.2.8
scipy 1.11.3
setuptools 69.2.0
six 1.16.0
soupsieve 2.5
spglib 2.1.0
sympy 1.12
tabulate 0.9.0
tenacity 8.2.3
tqdm 4.66.2
tzdata 2024.1
uncertainties 3.1.7
urllib3 2.2.1
virtualenv 20.25.1
wheel 0.43.0
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced a new method alias `get_string` for enhanced usability in accessing string representations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "shyuep",
"id": 577107,
"node_id": "MDQ6VXNlcjU3NzEwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/577107?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/shyuep",
"html_url": "https://github.com/shyuep",
"followers_url": "https://api.github.com/users/shyuep/followers",
"following_url": "https://api.github.com/users/shyuep/following{/other_user}",
"gists_url": "https://api.github.com/users/shyuep/gists{/gist_id}",
"starred_url": "https://api.github.com/users/shyuep/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/shyuep/subscriptions",
"organizations_url": "https://api.github.com/users/shyuep/orgs",
"repos_url": "https://api.github.com/users/shyuep/repos",
"events_url": "https://api.github.com/users/shyuep/events{/privacy}",
"received_events_url": "https://api.github.com/users/shyuep/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3763/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3763/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3763",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3763",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3763.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3763.patch",
"merged_at": "2024-04-17T17:09:21Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3764
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3764/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3764/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3764/events
|
https://github.com/materialsproject/pymatgen/pull/3764
| 2,248,003,675
|
PR_kwDOACgets5s6GUk
| 3,764
|
Add note to documentation for usage of CrystalNN
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5456916296,
"node_id": "LA_kwDOACgets8AAAABRUHvSA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/docs",
"name": "docs",
"color": "35B067",
"default": false,
"description": "Documentation, examples, user guides"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe update to `pymatgen/analysis/local_env.py` includes a note on default weights optimized for inorganic crystal structures and introduces an initialization example for Metal-Organic Frameworks (MOFs) using `CrystalNN`. This change aims to enhance the functionality and applicability of the `CrystalNN` class for different types of crystal structures.\n\n## Changes\n\n| File | Change Summary |\n|-----------------------------|-------------------------------------------------------------------------------------|\n| `local_env.py` | Added note on default weights for inorganic structures; added MOF initialization example using `CrystalNN`. |\n\n## Assessment against linked issues\n\n| Objective | Addressed | Explanation |\n|------------------------------------------------|-----------|--------------------------------------------------|\n| CrystalNN gives incorrect result for simple aromatic ring (#3762) | ❌ | The changes do not address the issue of incorrect neighbor detection in aromatic rings. |\n\n> 🐇✨\n> In the code where atoms lay,\n> A rabbit hopped by, fixing away.\n> With a tweak and a hop, structures align,\n> Now MOFs and crystals, perfectly fine.\n> Cheers to the code, let's celebrate,\n> For every atom finds its accurate mate!\n> 🎉🐰\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/analysis/local_env.py: ## Short summary\n\nAdded a note about default weights being benchmarked for inorganic crystal structures and provided an initialization example for MOFs using `CrystalNN`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3764, aims to resolve issue #3762, which highlights an error in the `CrystalNN` function within Pymatgen. Specifically, it addresses the incorrect identification of neighboring atoms in aromatic rings, such as benzene, where certain carbon atoms are misclassified as having two neighbors instead of the correct three. The PR includes additional documentation to guide users on using `CrystalNN`, particularly emphasizing the need for caution when analyzing structures like Metal-Organic Frameworks (MOFs) and other organic compounds. It introduces a note about the default weights in `CrystalNN`, optimized for inorganic crystal structures, and provides an example of initializing `CrystalNN` for improved results with MOFs to prevent similar issues in the future. The PR also encourages contributions and suggestions from developers, with a specific mention of @Andrew-S-Rosen for potential input.\n\n### Comments Summary\n\nIn the PR discussion, @Andrew-S-Rosen advises against specific parameter recommendations for MOFs in the docstring due to the lack of formal benchmarking. Instead, a more general statement is recommended, suggesting that modifications to `x_diff_weight` and `search_cutoff` may be necessary for organic and hybrid metal-organic materials. This advice aims to provide a more flexible and adaptable approach for users working with different types of crystal structures.\n\n### AI-generated summary of generated summaries\n\nThe PR addresses an issue with `CrystalNN` misidentifying neighboring atoms in aromatic rings and adds documentation cautioning against specific parameter recommendations for MOFs. It suggests a more general approach for organic compounds to enhance the flexibility of `CrystalNN` for various crystal structures, particularly organic and hybrid materials.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- b1261e9e6348e4f0fa8186b4a22ed630ee33b0e2 -->\n<!-- c212ba95a53708d54b0dab8d1f6814535f477534 -->\n<!-- c0fec395f438d9308cc67a164c68d726fedf478f -->\n<!-- e4a956ef5c66896f7cd0d3680ec60c753cbfa3ab -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Test failures are unrelated, @janosh ... Not sure qhy they suddenly showed up",
"failing tests were discussed here https://github.com/materialsproject/pymatgen/pull/3763#issuecomment-2060314507",
"> failing tests were discussed here [#3763 (comment)](https://github.com/materialsproject/pymatgen/pull/3763#issuecomment-2060314507)\r\n\r\nThanks!",
"Personally, I'd avoid the recommendation for specific parameters for MOFs in the docstring. There was no formal benchmarking on this (was quite literally whatever we thought looked nice when visualized on MP). I would recommend a more general statement that, for organic and hybrid metal-organic materials one may need to modify `x_diff_weight` and `search_cutoff`. ",
"> Personally, I'd avoid the recommendation for specific parameters for MOFs in the docstring. There was no formal benchmarking on this (was quite literally whatever we thought looked nice when visualized on MP). I would recommend a more general statement that, for organic and hybrid metal-organic materials one may need to modify `x_diff_weight` and `search_cutoff`.\r\n\r\nOkay, I will adapt. However, a starting point for testing might be helpful.",
"@janosh could be merged if you are happy",
"Merged this now, as it is only a tiny documentation change and all tests are passing."
] | 2024-04-17T10:58:19
| 2024-05-01T18:43:06
|
2024-04-18T06:36:40Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Closes #3762 with additional information provided in the documentation.
If you want to add something (e.g., a citation), @Andrew-S-Rosen , please feel free.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Documentation**
- Enhanced documentation for `CrystalNN` with details on default weights for inorganic crystal structures and added initialization examples for MOFs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3764/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3764/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3764",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3764",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3764.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3764.patch",
"merged_at": "2024-04-18T06:36:40Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3765
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3765/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3765/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3765/events
|
https://github.com/materialsproject/pymatgen/pull/3765
| 2,249,477,155
|
PR_kwDOACgets5s_H0Y
| 3,765
|
Update `vasprun.converged_ionic` logic when `EDIFFG=0`
|
{
"login": "matthewkuner",
"id": 82329282,
"node_id": "MDQ6VXNlcjgyMzI5Mjgy",
"avatar_url": "https://avatars.githubusercontent.com/u/82329282?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/matthewkuner",
"html_url": "https://github.com/matthewkuner",
"followers_url": "https://api.github.com/users/matthewkuner/followers",
"following_url": "https://api.github.com/users/matthewkuner/following{/other_user}",
"gists_url": "https://api.github.com/users/matthewkuner/gists{/gist_id}",
"starred_url": "https://api.github.com/users/matthewkuner/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/matthewkuner/subscriptions",
"organizations_url": "https://api.github.com/users/matthewkuner/orgs",
"repos_url": "https://api.github.com/users/matthewkuner/repos",
"events_url": "https://api.github.com/users/matthewkuner/events{/privacy}",
"received_events_url": "https://api.github.com/users/matthewkuner/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 6157350943,
"node_id": "LA_kwDOACgets8AAAABbwG4Hw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/ecosystem",
"name": "ecosystem",
"color": "83A7A8",
"default": false,
"description": "Concerning the larger pymatgen ecosystem"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Auto Review Skipped\n> \n> Review was skipped due to path filters\n> \n> <details>\n> <summary>Files ignored due to path filters (1)</summary>\n> \n> * `tests/files/vasp/outputs/vasprun.ediffg_set_to_0.xml.gz` is excluded by `!**/*.gz`\n> \n> </details>\n> \n> You can disable this status message by setting the `reviews.review_status` to `false` in the CodeRabbit configuration file.\n\n<!-- end of auto-generated comment: skip review by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates in the pymatgen library refine the logic for determining the convergence of ionic steps in VASP simulations. These changes incorporate handling `EDIFFG=0` alongside existing criteria for `IBRION=1` or `IBRION=2`, ensuring accurate convergence assessment in relaxation runs. A new test method validates these adjustments by checking ionic steps, final energy, and convergence status in a specific scenario.\n\n## Changes\n\n| File Path | Change Summary |\n|---------------------------------|------------------------------------------------------------------------------------------------------|\n| `pymatgen/io/vasp/outputs.py` | Updated logic in `converged_ionic` method to consider `EDIFFG=0` alongside `IBRION` for convergence. |\n| `tests/io/vasp/test_outputs.py` | Added `test_vasprun_ediffg_set_to_0` to validate a VaspRun scenario with specific convergence criteria.|\n\n> 🐇🌟\n> In the code's woven maze, a rabbit hopped,\n> Tweaking lines where numbers stopped.\n> With a hop, skip, and a code-laced leap,\n> Ensured the atoms peacefully sleep.\n> Now in the realm where electrons play,\n> Our rabbit ensures they sway the right way.\n> 🌟🐇\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/vasp/outputs.py: In the `converged_ionic` method, updated logic to consider `EDIFFG=0` alongside existing conditions for `IBRION=1` or `IBRION=2` for determining return value. This change now incorporates handling of `EDIFFG=0` in relaxation runs. The logic now also considers the maximum ionic steps reached during a relaxation run. ## Short summary\n\ntests/io/vasp/test_outputs.py: Added a new test method `test_vasprun_ediffg_set_to_0` to validate a specific scenario in VaspRun, checking ionic steps, final energy, and convergence. ## Short summary\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nPull Request #3765 enhances the `converged_ionic` method in `pymatgen`'s `vasprun` module to handle `EDIFFG=0` scenarios in VASP simulations. This update ensures accurate tracking of ionic step convergence when a fixed number of steps (`NSW`) is specified, focusing on relaxation trajectories without force or energy convergence concerns. The PR includes a new test to validate this behavior under the specified conditions.\n\n### Comments Summary\n\n`esoteric-ephemera` clarifies that setting `EDIFFG = 0` guarantees a relaxation run for a fixed number of steps (`NSW`) in DFT, irrespective of physical convergence, particularly useful for non-AIMD relaxation trajectories. The revised logic in `Vasprun.converged_ionic` prevents unnecessary custodian interventions. However, `janosh` highlights an issue with the new test file, suggesting a potential integration challenge.\n\n### AI-Generated Summary of Generated Summaries\n\nIn `pymatgen/io/vasp/outputs.py`, the `converged_ionic` method now handles `EDIFFG=0` scenarios, ensuring accurate ionic step convergence tracking during relaxation runs with fixed steps (`NSW`). The return value logic incorporates considerations for reaching the maximum ionic steps alongside existing checks for `IBRION=1` or `IBRION=2`. Additionally, a new test method, `test_vasprun_ediffg_set_to_0`, in `tests/io/vasp/test_outputs.py` validates the updated `converged_ionic` behavior under `EDIFFG=0`, examining ionic steps, final energy, and convergence status for this specific scenario.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 2c3a925fe469c441d3972ee184d2f9dbf0dc1898 -->\n<!-- d471345a1402443f5959a02253279ada758abb77 -->\n<!-- 799c69f2e2eeb6562711f30a3a666381b482f306 -->\n<!-- 4ae223411495fe6cc892431b66ad2812c45622e2 -->\n<!-- 7d2899bc931946b1addae04eaa2d5bbba05453cf -->\n<!-- c07a55a869bd231db467cf8ff43141536c822882 -->\n<!-- 60e8a981565bb6057c8e8575dd30300bea97535c -->\n<!-- 2330adb6f8aacf2d66afe70aab3f979a0328d91f -->\n<!-- f1e92976134fdad1d7d33bf16194642579a38c3d -->\n<!-- 3d695bd97b4db549df3be4cbfe148f3474d00208 -->\n<!-- 0ba1b9cfd70fb56d72d552ea30ca751468cab96b -->\n<!-- eb7132d064da2c36bdda9d0ac1e94e2303824f13 -->\n<!-- e10c93d27405e52690e1db1af7490908d8d8f1e7 -->\n<!-- 0f05ed2a4b42e6a9ae669f7634fe73187ff3f22f -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@janosh this is ready for merging",
"Just for context / documentation: the specific use case for `EDIFFG = 0` is to ensure that a relaxation runs for `NSW` steps. In this case, the user isn't really worried about convergence wrt forces or energy differences, and @matthewkuner's solution prevents custodian from trying to correct the calc because `Vasprun.converged_ionic = False`. You can think about this as the non-AIMD way to generate a relaxation trajectory with DFT",
"something wrong with the new test file it seems. can't be found for unknown reasons",
"closed in favor of #3783 "
] | 2024-04-18T00:05:31
| 2024-04-23T22:06:33
|
2024-04-23T22:06:33Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
a new test for this has been added as well.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Enhanced the convergence detection logic in relaxation runs to include scenarios where `EDIFFG=0`.
- **Tests**
- Added a new test to ensure accurate handling of specific convergence scenarios in VASP simulations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "matthewkuner",
"id": 82329282,
"node_id": "MDQ6VXNlcjgyMzI5Mjgy",
"avatar_url": "https://avatars.githubusercontent.com/u/82329282?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/matthewkuner",
"html_url": "https://github.com/matthewkuner",
"followers_url": "https://api.github.com/users/matthewkuner/followers",
"following_url": "https://api.github.com/users/matthewkuner/following{/other_user}",
"gists_url": "https://api.github.com/users/matthewkuner/gists{/gist_id}",
"starred_url": "https://api.github.com/users/matthewkuner/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/matthewkuner/subscriptions",
"organizations_url": "https://api.github.com/users/matthewkuner/orgs",
"repos_url": "https://api.github.com/users/matthewkuner/repos",
"events_url": "https://api.github.com/users/matthewkuner/events{/privacy}",
"received_events_url": "https://api.github.com/users/matthewkuner/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3765/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3765/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3765",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3765",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3765.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3765.patch",
"merged_at": null
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3766
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3766/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3766/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3766/events
|
https://github.com/materialsproject/pymatgen/issues/3766
| 2,249,890,499
|
I_kwDOACgets6GGprD
| 3,766
|
ChemEnv unable to identify the environments of supercell
|
{
"login": "Atefeh-Yadegarifard",
"id": 141133743,
"node_id": "U_kgDOCGmHrw",
"avatar_url": "https://avatars.githubusercontent.com/u/141133743?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Atefeh-Yadegarifard",
"html_url": "https://github.com/Atefeh-Yadegarifard",
"followers_url": "https://api.github.com/users/Atefeh-Yadegarifard/followers",
"following_url": "https://api.github.com/users/Atefeh-Yadegarifard/following{/other_user}",
"gists_url": "https://api.github.com/users/Atefeh-Yadegarifard/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Atefeh-Yadegarifard/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Atefeh-Yadegarifard/subscriptions",
"organizations_url": "https://api.github.com/users/Atefeh-Yadegarifard/orgs",
"repos_url": "https://api.github.com/users/Atefeh-Yadegarifard/repos",
"events_url": "https://api.github.com/users/Atefeh-Yadegarifard/events{/privacy}",
"received_events_url": "https://api.github.com/users/Atefeh-Yadegarifard/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"Thanks for reporting it. I will look into it. ",
"Hey @davidwaroquiers , could you also have a look? ",
"I think i solved it:\r\nChemEnv is typically refining the structure with the help of the symmetry analysis module. For some reason (I did not check the details), this fails for your structure or produces a different refined structure. If you switch this off, it seems to work (`lgf.setup_parameters(centering_type=\"centroid\", include_central_site_in_centroid=True, structure_refinement=\"none\")`).\r\n\r\n```py\r\nfrom pymatgen.core.structure import Structure\r\nfrom pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import LocalGeometryFinder\r\nfrom pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import SimplestChemenvStrategy, \\\r\n MultiWeightsChemenvStrategy\r\nfrom pymatgen.analysis.chemenv.coordination_environments.structure_environments import LightStructureEnvironments\r\nfrom pymatgen.analysis.bond_valence import BVAnalyzer\r\nimport pandas as pd\r\n\r\n#cif_file_path = './mp-2228265.cif'\r\ncif_file_path = './mp-578604.cif'\r\n#cif_file_path = './mp-2228265-supercell.cif'\r\n\r\nstructure = Structure.from_file(cif_file_path)\r\nlgf = LocalGeometryFinder()\r\nlgf.setup_parameters(centering_type=\"centroid\", include_central_site_in_centroid=True, structure_refinement=\"none\")\r\nlgf.setup_structure(structure=structure)\r\n\r\ntry:\r\n bva = BVAnalyzer()\r\n valences = bva.get_valences(structure)\r\n structure_env = lgf.compute_structure_environments(only_cations=False, valences=valences)\r\n valence = \"Used\"\r\nexcept Exception as valence_error:\r\n structure_env = lgf.compute_structure_environments(only_cations=False)\r\n valence = \"Not_Used\"\r\n\r\nmulti_strategy = MultiWeightsChemenvStrategy.stats_article_weights_parameters()\r\nmulti_lse = LightStructureEnvironments.from_structure_environments(strategy=multi_strategy,\r\n structure_environments=structure_env)\r\n\r\nsimple_strategy = SimplestChemenvStrategy()\r\nsimple_lse = LightStructureEnvironments.from_structure_environments(strategy=simple_strategy,\r\n structure_environments=structure_env)\r\n\r\nfor ce in simple_lse.coordination_environments:\r\n print(ce)\r\nprint(multi_lse.coordination_environments)\r\nprint(simple_lse.coordination_environments)\r\n```\r\nLet me know if this solves your issue.",
"Hi @JaGeo ,\r\n\r\nThanks, you went faster than me ;) I was in a meeting and was planning to look at that just after. No idea why the refinement leads to a problem there but indeed, one of the things that can be done is to set the structure_refinement to none. In that case of course, it computes the environments for \"more\" atoms that it should actually need (as some of these atoms are just symmetrical to other atoms, so the environment should be exactly the same).\r\n\r\n@Atefeh-Yadegarifard I hope what Janine proposes indeed solves your issue\r\n\r\nBest,",
"Yes, I think we typically also set the parameters in the init and they don't need to be set again. \r\nhttps://github.com/materialsproject/pymatgen/blob/9b7fbcb7a461e27adbccbca4f81d700e1957661d/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.py#L409\r\n\r\nFor the refined structures: it will generate a conventional cell out of your cells. This is why these issues show up.",
"Dear @JaGeo and @davidwaroquiers, \r\nThank you for your help, my problem is solved. \r\n ",
"Awesome! I will close the issue then 😃"
] | 2024-04-18T06:46:14
| 2024-04-19T06:15:11
|
2024-04-19T06:15:11Z
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.11.5
### Pymatgen version
2024.3.1
### Operating system version
(wsl) Ubuntu 22.04
### Current behavior
Hello. I would like to ask a question and raise an issue about pymatgen.analysis.chemenv.
Question:
Why does chemenv expand the sites of a some cif files but keeps the structure of some other cif files?
for example, mp-578604 has 4 sites in the structure, however, chemenv identifies environments for 12 sites. but for the case of mp-2228265, the environments are identified for the sites in the cif file only.


Issue:
chemenv is unable to identify the environments for sites in a super cell. if a supercell is made from a structure, chemenv produces either empty or non environments.
### Expected Behavior
generating environments for all of the sites in a super cell
### Minimal example
```Python
from pymatgen.core.structure import Structure
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import LocalGeometryFinder
from pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import SimplestChemenvStrategy, MultiWeightsChemenvStrategy
from pymatgen.analysis.chemenv.coordination_environments.structure_environments import LightStructureEnvironments
from pymatgen.analysis.bond_valence import BVAnalyzer
import pandas as pd
#cif_file_path = './mp-2228265.cif'
cif_file_path = './mp-2228265-supercell.cif'
structure = Structure.from_file(cif_file_path)
lgf = LocalGeometryFinder()
lgf.setup_parameters(centering_type="centroid", include_central_site_in_centroid=True)
lgf.setup_structure(structure=structure)
try:
bva = BVAnalyzer()
valences = bva.get_valences(structure)
structure_env = lgf.compute_structure_environments(only_cations=False,valences=valences)
valence ="Used"
except Exception as valence_error:
structure_env = lgf.compute_structure_environments(only_cations=False)
valence = "Not_Used"
multi_strategy = MultiWeightsChemenvStrategy.stats_article_weights_parameters()
multi_lse = LightStructureEnvironments.from_structure_environments(strategy=multi_strategy, structure_environments=structure_env)
simple_strategy = SimplestChemenvStrategy()
simple_lse= LightStructureEnvironments.from_structure_environments(strategy=simple_strategy, structure_environments=structure_env)
print (multi_lse.coordination_environments)
print (simple_lse.coordination_environments)
```
### Relevant files to reproduce this bug
[cif files .zip](https://github.com/materialsproject/pymatgen/files/15020876/cif.files.zip)
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3766/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3766/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3767
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3767/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3767/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3767/events
|
https://github.com/materialsproject/pymatgen/pull/3767
| 2,250,092,128
|
PR_kwDOACgets5tBLh5
| 3,767
|
Fix for writing non-unique site labels in `CifWriter`
|
{
"login": "stefsmeets",
"id": 873520,
"node_id": "MDQ6VXNlcjg3MzUyMA==",
"avatar_url": "https://avatars.githubusercontent.com/u/873520?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stefsmeets",
"html_url": "https://github.com/stefsmeets",
"followers_url": "https://api.github.com/users/stefsmeets/followers",
"following_url": "https://api.github.com/users/stefsmeets/following{/other_user}",
"gists_url": "https://api.github.com/users/stefsmeets/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stefsmeets/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stefsmeets/subscriptions",
"organizations_url": "https://api.github.com/users/stefsmeets/orgs",
"repos_url": "https://api.github.com/users/stefsmeets/repos",
"events_url": "https://api.github.com/users/stefsmeets/events{/privacy}",
"received_events_url": "https://api.github.com/users/stefsmeets/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 6072177337,
"node_id": "LA_kwDOACgets8AAAABae4SuQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/cif",
"name": "cif",
"color": "B04CCD",
"default": false,
"description": "Crystallographic information file"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->\n\n> [!WARNING]\n> ## Rate Limit Exceeded\n> \n> @janosh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **35 minutes and 34 seconds** before requesting another review.\n> \n> <details>\n> \n> <summary>How to resolve this issue?</summary>\n> \n> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.\n> \n> We recommend that you space out your commits to avoid hitting the rate limit.\n> \n> </details>\n> \n> <details>\n> \n> <summary>How do rate limits work?</summary>\n> \n> CodeRabbit enforces hourly rate limits for each developer per organization.\n> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.\n> Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.\n> \n> </details>\n> \n> <details>\n> <summary>Commits</summary>\n> Files that changed from the base of the PR and between d2257a54bcf3c21b14dd5cff8672974af34b95e5 and 3201e04e194db479f4ca171c422f16bd36c70b41.\n> </details>\n\n<!-- end of auto-generated comment: rate limited by coderabbit.ai --><!-- walkthrough_start -->\n\n## Walkthrough\nThe recent updates in `pymatgen` involve modifications to the `CifWriter` to ensure unique atom site labels in CIF files, addressing issues with non-unique and incorrectly rewritten labels. This includes a method update in `cif.py` for checking and conditionally updating site labels, alongside a new test in `test_cif.py` to validate these changes.\n\n## Changes\n\n| File | Change Summary |\n|------|----------------|\n| `pymatgen/io/cif.py`, `tests/io/test_cif.py` | Updated `__init__` in `cif.py` to ensure unique `atom_site_label`. Added `test_cif_writer_non_unique_labels` in `test_cif.py`. |\n| `pymatgen/core/structure.py` | Added `relabel_sites` method to `Structure` class for ensuring unique site labels. |\n| `tests/core/test_structure.py` | Added `test_relabel_sites` to test the `relabel_sites` function. |\n\n## Assessment against linked issues\n\n| Objective | Addressed | Explanation |\n|-----------|-----------|-------------|\n| Ensure unique `atom_site_label` in CIF files (#3761) | ✅ | The addition of `relabel_sites` method in `Structure` class ensures unique labels, addressing the issue of non-unique labels in CIF files. |\n| Prevent `CifWriter` from rewriting unique atom labels (#3772) | ✅ | The update in `CifWriter` to ensure label uniqueness now prevents the issue of rewriting unique atom labels, aligning with the expected behavior. |\n\n## Possibly related issues\n- **Issue #3772**: This issue describes a problem where `CifWriter` was rewriting unique atom labels, which should now be addressed by the updated handling of label uniqueness in the `CifWriter` class. This ensures that already unique labels are not altered unnecessarily.\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/core/structure.py: Added a new method `relabel_sites` to the `Structure` class in `pymatgen/core/structure.py` that relabels sites to ensure uniqueness by suffixing duplicates with `_1`, `_2`, etc.\n\ntests/core/test_structure.py: Added a new test method `test_relabel_sites` in the `test_structure.py` file to test the `relabel_sites` function that relabels sites in a structure.\n\ntests/io/test_cif.py: Added a new test `test_cif_writer_non_unique_labels` to `test_cif.py` that examines the behavior of `CifWriter` with structures containing non-unique labels.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis PR (#3767) addresses the issue in Pymatgen where the `CifWriter` class produces non-unique `atom_site_label` entries in CIF files, as highlighted in issue #3761. To ensure CIF format compliance, numerical suffixes are now added to duplicate labels for uniqueness. The changes aim to enhance the writing process by ensuring unique labels in the output CIF files, accompanied by new tests to validate the updated behavior.\n\n### Comments Summary\n\nReviewer `stefsmeets` noted a test failure due to a missing file (`garnet.cif`), signaling a need for resolution before final approval and merging of the PR.\n\n### AI-Generated Summary of Generated Summaries\n\nThe `CifWriter` class in `pymatgen/io/cif.py` was updated to append numerical suffixes to duplicate `atom_site_label` entries, ensuring uniqueness. This modification involves a conditional check during initialization to handle non-unique labels effectively.\n\nFurthermore, a new test (`test_cif_writer_non_unique_labels`) in `tests/io/test_cif.py` validates the revised `CifWriter` behavior, confirming proper handling of structures with non-unique labels. The PR focuses on improving label uniqueness in CIF files, with code adjustments and a dedicated test to verify the correct operation of the updated `CifWriter`.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 7b59c286940b5ec1d3831e4868227090761e1141 -->\n<!-- 0eed6a0a20798772213aeb51d9b78bac45dda7e1 -->\n<!-- 8aeac7a2dbb35f81c8dfe4aa99e68d1dcafea424 -->\n<!-- d2257a54bcf3c21b14dd5cff8672974af34b95e5 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"This PR is ready. I'm a bit puzzled why the test fails...:\r\n```\r\nE FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/pymatgen/pymatgen/tests/files/garnet.cif'\r\n```",
"Wondering: why make the situation asymmetric? i.e. in the case of your four `Ca1` atoms, one will remain `Ca1` while the others will become `Ca1_1`, `Ca1_2`, …",
"i think @fxcoudert has a point. in case of relabeling, let's sequentially suffix all duplicate site labels for consistency. \r\n\r\n> How about an option to CifWriter to make labels unique.\r\n\r\n[this also sounds sensible](https://github.com/materialsproject/pymatgen/issues/3761#issuecomment-2063472135) to give the user control over relabeling behavior",
"A matter of taste I presume :-)\r\n\r\nAdding an option and making sure the first atom is also labeled may be a bit more involved. I will have a go at tackling #3772 as well in this PR then.\r\n\r\n",
"> A matter of taste I presume :-)\r\n\r\nvery true! hopefully, adding an option can make everyone happy. maybe make it `deduplicate_site_labels: Literal[\"sequential\", None] = \"sequential\"` so it's easy to add additional options in the future.\r\n",
"> maybe make it `deduplicate_site_labels: Literal[\"sequential\", None] = \"sequential\"`\r\n\r\nIn that case I think this would be better as a method on `Structure` to make it generally available, together with a warning in `CifWriter` (one of the other suggestions in the issue). The label duplication happens *only* if the user passed a structure with custom labels *and* does not specify `symprec` which avoids this path.",
"> In that case I think this would be better as a method on `Structure` to make it generally available\r\n\r\nsure\r\n\r\n> together with a warning in CifWriter (one of the other suggestions in the issue).\r\n\r\ndefinitely. a warning that the labels were suffixed with a link to the spec to explain why this was done would be great!"
] | 2024-04-18T08:38:47
| 2024-04-26T06:28:16
|
2024-04-25T18:35:59Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
This PR addresses an issue where the Structure contains non-unique user-defined labels causing duplicate labels in the cif file. It achieves this by adding a warning when writing such a cif file. There is also a new method that helps circumvent the issue by relabeling sites, suffixing `_1`, `_2`, ..., `_n` for duplicates.
Closes #3761
## Summary
Major changes:
- feature 1: Add `SiteCollection.relabel_sites()` method that suffixes `_$NUM` for duplicate labels
- fix 1: Warn user when writing non-unique atom site labels in `CifWriter`
## Todos
- [x] Check written labels make sense in tests
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
- [x] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3767/reactions",
"total_count": 2,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 1,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3767/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3767",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3767",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3767.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3767.patch",
"merged_at": "2024-04-25T18:35:59Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3768
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3768/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3768/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3768/events
|
https://github.com/materialsproject/pymatgen/pull/3768
| 2,250,374,533
|
PR_kwDOACgets5tCJQ7
| 3,768
|
WIP: Adding support for reading vaspwave.h5 in Wavecar and Chgcar class
|
{
"login": "Shibu778",
"id": 56470750,
"node_id": "MDQ6VXNlcjU2NDcwNzUw",
"avatar_url": "https://avatars.githubusercontent.com/u/56470750?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Shibu778",
"html_url": "https://github.com/Shibu778",
"followers_url": "https://api.github.com/users/Shibu778/followers",
"following_url": "https://api.github.com/users/Shibu778/following{/other_user}",
"gists_url": "https://api.github.com/users/Shibu778/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Shibu778/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Shibu778/subscriptions",
"organizations_url": "https://api.github.com/users/Shibu778/orgs",
"repos_url": "https://api.github.com/users/Shibu778/repos",
"events_url": "https://api.github.com/users/Shibu778/events{/privacy}",
"received_events_url": "https://api.github.com/users/Shibu778/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1427867026,
"node_id": "MDU6TGFiZWwxNDI3ODY3MDI2",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/enhancement",
"name": "enhancement",
"color": "c5e06d",
"default": true,
"description": "A new feature or improvement to an existing one"
},
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent changes across the `pymatgen/io/vasp/outputs.py` and `tests/io/vasp/test_outputs.py` files focus on improving code readability and maintainability. These modifications include importing `h5py`, enhancing tuple unpacking, refining code formatting, updating function signatures with type annotations, and enriching documentation through comments and docstrings.\n\n## Changes\n\n| File Path | Changes Summary |\n|-------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| `pymatgen/io/vasp/outputs.py` | Added `h5py` import, refactored tuple unpacking, improved formatting, updated function signatures, and enriched documentation. |\n| `tests/io/vasp/test_outputs.py` | Restructured code for readability and maintainability, improved code organization without altering core functionality. |\n\n> 🐰✨\n> A hop of joy for cleaner code, \n> With tuples unpacked along the road. \n> Type hints and docs, now clear as day, \n> In `outputs.py`, improvements stay. \n> Cheers to the devs, with ears so long, \n> For making the code both swift and strong. \n> 🌟📄\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/vasp/outputs.py: ## Short summary\n\n- Added an import statement for `h5py`.\n- Refactored assignment statements to unpack tuples for better readability.\n- Improved formatting by adjusting indentation and line breaks in various functions.\n- Updated function signatures with explicit type annotations and parameter formatting.\n- Enhanced readability by adding comments and docstrings in some functions.\n\ntests/io/vasp/test_outputs.py: ## Short summary\n\nThe changes in the `test_outputs.py` file involve restructuring the code for better readability and maintainability. The modifications include breaking long lines into multiple lines for improved code formatting and clarity. These changes do not alter the core functionality but enhance code organization and readability.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3768, titled \"WIP: Adding support for reading vaspwave.h5 in Wavecar and Chgcar class,\" represents the contributor's inaugural contribution to the `pymatgen` project. The primary aim is to enhance the `Wavecar` and `Chgcar` classes in `pymatgen` to handle `vaspwave.h5` files, crucial for VASP output analysis.\n\nThe key highlights and upcoming tasks are:\n1. **Feature Enhancements**:\n - Addition of `read_from_hdf5` method in `Wavecar` for processing `vaspwave.h5` data.\n - Legacy `WAVECAR` format handling in `Wavecar` with `zopen` usage for zipped files.\n - Code refinement with comments, doc-strings, and formatting via black.\n2. **Future Plans**:\n - Extending `read_from_hdf5` functionality to the `Chgcar` class.\n - Pending task: Writing tests to validate `Wavecar` and `Chgcar` class functionality.\n\nThe pre-commit check results indicate compliance with coding standards, with completed checklist items like Google format doc strings and type annotations, while pending tasks include adding tests for the new features.\n\n### AI-Generated Summary of Generated Summaries\n\nIn `pymatgen/io/vasp/outputs.py`:\n- Introduced `h5py` import for HDF5 file handling.\n- Refactored code for improved readability, including unpacking tuples and enhancing function signatures with type annotations.\n- Enhanced code formatting by adjusting indentation, line breaks, and adding comments and docstrings for clarity and maintainability.\n\nIn `tests/io/vasp/test_outputs.py`:\n- Restructured code for better readability and maintainability.\n- Improved code organization by breaking long lines into multiple lines without altering core functionality, enhancing code clarity and organization.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- bfb1c25cc9d5e55294e9856fe0ac8737797fdd6f -->\n<!-- cdb32a15bae109d5a7210e2133f6d0dec2267fd9 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Thanks for the PR @Shibu778! My sincere apologies there was no attention given to this PR before now.\r\n\r\nCould you resolve the current merge conflicts and ensure the automated CI checks still pass? The pymatgen code has now been moved into `/src` directory, so the changes may just need to be moved.\r\n\r\nOther than this, I notice a lot of code is duplicated between `read_from_hdf5` and `read_from_legacy`. I wonder if maybe the duplicated code can be merged into a single function?\r\n\r\nIt should also be possible to detect the filetype automatically: use the existing logical if the filename is `*WAVECAR*`, and use the new logic if the filename is `*h5*`.",
"Dear @janosh\r\nThanks for your suggestion. Currently, I am trying to fix the merge conflict. I tried different approaches, and it's becoming complicated day by day. I am 8 commit ahead of the original repository and 304 commits behind. My effort in resolving the conflict first is polluting this pull request. What do you suggest I should do? Should we close this pull request and start a new one?",
"Now I have synced the forked repository properly. I will start adding the feature reading WAVECAR and CHGCAR in hdf5 format soon."
] | 2024-04-18T10:50:11
| 2025-04-14T04:30:53
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
Dear Maintainers,
This is my first contribution to `pymatgen`. I am relatively new to opensource and would appreciate your feedback and guidance in improving the added features and this PR. In further commits, I will add `read_from_hdf5` functionality to `Chgcar` and write all the tests.
## Summary
Major changes:
- feature 1: Added a method `read_from_hdf5` in `Wavecar` class to read `WAVECAR` related information from `vaspwave.h5` file (refer to [vaspwiki](https://www.vasp.at/wiki/index.php/Vaspwave.h5)).
- fix 1: made a function to read the legacy `WAVECAR` format that was previously implemented in `Wavecar` class.
- fix 2: added appropriate comments and doc-string
- fix 3: Some part of the `pymatgen/io/vasp/outputs.py` file got formatted by black formatter
## Todos
This is work in progress, following needs to be done
- feature 2: Add the same feature in `Chgcar` class
- fix 4: Write appropriate test to read the `hdf5` files in using `Wavecar` and `Chgcar` class
## Pre-commit result
`pre-commit run --all-files` passed all everything
```shell
~\Github\pymatgen> pre-commit run --all-files
ruff.....................................................................Passed
ruff-format..............................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
mypy.....................................................................Passed
codespell................................................................Passed
cython-lint..............................................................Passed
double-quote Cython strings..............................................Passed
blacken-docs.............................................................Passed
markdownlint.............................................................Passed
nbstripout...............................................................Passed
```
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] The tests for fixes in `Wavecar` class remains unchanged to read legacy `WAVECAR` file
- [x] Tests added for new features.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Improved code readability and formatting in various functions.
- Updated function signatures for clarity.
- **Documentation**
- Enhanced function descriptions with new comments and docstrings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3768/reactions",
"total_count": 2,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 1,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3768/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3768",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3768",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3768.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3768.patch",
"merged_at": null
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3771
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3771/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3771/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3771/events
|
https://github.com/materialsproject/pymatgen/pull/3771
| 2,252,640,591
|
PR_kwDOACgets5tJ1pG
| 3,771
|
Fix LobsterSet
|
{
"login": "naik-aakash",
"id": 91958822,
"node_id": "U_kgDOBXsuJg",
"avatar_url": "https://avatars.githubusercontent.com/u/91958822?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/naik-aakash",
"html_url": "https://github.com/naik-aakash",
"followers_url": "https://api.github.com/users/naik-aakash/followers",
"following_url": "https://api.github.com/users/naik-aakash/following{/other_user}",
"gists_url": "https://api.github.com/users/naik-aakash/gists{/gist_id}",
"starred_url": "https://api.github.com/users/naik-aakash/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/naik-aakash/subscriptions",
"organizations_url": "https://api.github.com/users/naik-aakash/orgs",
"repos_url": "https://api.github.com/users/naik-aakash/repos",
"events_url": "https://api.github.com/users/naik-aakash/events{/privacy}",
"received_events_url": "https://api.github.com/users/naik-aakash/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe modification updates the source of `potcar_symbols` in the `incar_updates` method, transitioning from using `self.poscar.site_symbols` to `self.potcar_symbols`. This change centralizes the definition of potential model symbols, potentially enhancing consistency and maintainability of the code.\n\n## Changes\n\n| File Path | Change Summary |\n|------------------------------|-----------------------------------------------------------------------------------------------------|\n| `pymatgen/io/vasp/sets.py` | Updated variable assignment for `potcar_symbols` in `incar_updates` from `self.poscar.site_symbols` to `self.potcar_symbols`. |\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/vasp/sets.py: ## Short Summary\n\nThe change in functionality involves updating the variable assignment from `self.poscar.site_symbols` to `self.potcar_symbols` in the `incar_updates` method, affecting the source of `potcar_symbols`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request (PR) titled \"Fix LobsterSet\" (Number 3771) addresses an issue with the incorrect usage of POTCAR files in the generation of input sets for VASP (Vienna Ab initio Simulation Package). The core problem identified is that the `potcar_symbols` variable, which is intended to store element symbols, is being incorrectly used. This results in the input set attempting to match POTCARs based solely on element symbols, which does not ensure the correct functional-specific POTCARs are used.\n\nThe proposed fix involves a modification in the handling of the `potcar_symbols` within the `LobsterSet` class, a derivative of the `VaspInputSet`. The change ensures that the `potcar_symbols` property correctly references the appropriate POTCARs based on the specified functional, leveraging the base class's functionality. This adjustment ensures that the correct POTCAR files are used in accordance with the `PBE_54` functional, aligning the practice with standard requirements and improving the accuracy of the simulations conducted using these input sets.\n\n### AI-Generated Summary of Generated Summaries\n\nThe modification in the `pymatgen/io/vasp/sets.py` file involves updating the source from which `potcar_symbols` are derived in the `incar_updates` method of the `LobsterSet` class. Previously, the source was `self.poscar.site_symbols`, but with the new changes, it correctly references `self.potcar_symbols`. This change ensures that the `potcar_symbols` are accurately fetched based on the specified functional, rather than merely matching element symbols, thus aligning with the correct usage of functional-specific POTCAR files in VASP input sets.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 9e762164bce1db4ef78b00387f851e674243d0b4 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"> is there a way to test this change with the scrambled POTCARs added by @esoteric-ephemera?\r\n\r\nOh, yeah, we definitely need a test 😅",
"Thanks @janosh ,for the suggestion, I was indeed planning to do that 😃 , will add the test in sometime",
"Hi @janosh , I have added two tests for checking if the potcar symbols are consistent with `PBE_54`. Thus, PR could be merged incase there are no further comments on it. 😄 ",
"thanks @naik-aakash 👍 "
] | 2024-04-19T10:30:11
| 2024-04-23T02:18:33
|
2024-04-23T02:17:29Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
# Issue
The POTCARs used to generate the input set are incorrect and do not match `PBE_54` POTCARs. Currently, the `potcar_symbols` variable stores element symbols, which leads to the input set trying to find potcars matching element symbols only.
# Fix
Correctly refer to potcars that should be used based on specified functional using `potcar_symbols` property of its base `VaspInputSet` class
# Todo
- [x] Write a test to avoid such issues in future
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3771/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3771/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3771",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3771",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3771.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3771.patch",
"merged_at": "2024-04-23T02:17:29Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3772
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3772/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3772/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3772/events
|
https://github.com/materialsproject/pymatgen/issues/3772
| 2,252,851,490
|
I_kwDOACgets6GR8ki
| 3,772
|
Atom labels in CIF file are silently rewritten by CifWriter
|
{
"login": "fxcoudert",
"id": 1980544,
"node_id": "MDQ6VXNlcjE5ODA1NDQ=",
"avatar_url": "https://avatars.githubusercontent.com/u/1980544?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/fxcoudert",
"html_url": "https://github.com/fxcoudert",
"followers_url": "https://api.github.com/users/fxcoudert/followers",
"following_url": "https://api.github.com/users/fxcoudert/following{/other_user}",
"gists_url": "https://api.github.com/users/fxcoudert/gists{/gist_id}",
"starred_url": "https://api.github.com/users/fxcoudert/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/fxcoudert/subscriptions",
"organizations_url": "https://api.github.com/users/fxcoudert/orgs",
"repos_url": "https://api.github.com/users/fxcoudert/repos",
"events_url": "https://api.github.com/users/fxcoudert/events{/privacy}",
"received_events_url": "https://api.github.com/users/fxcoudert/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 19613987,
"node_id": "MDU6TGFiZWwxOTYxMzk4Nw==",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/bug",
"name": "bug",
"color": "9222c1",
"default": true,
"description": ""
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"This is because `if \"magmom\" in site.properties` is true for this structure at https://github.com/materialsproject/pymatgen/blame/2d008e0dd5c430692e8dcac2505340a6bdff1642/pymatgen/io/cif.py#L1516C21-L1516C51\r\n\r\nBut I am not writing magnetic moments, and I do not know why that should override labels.",
"@fxcoudert thanks for reporting. I assume a pull-request to fix this issue would be very welcome.",
"I confirm that removing the magnetic moments with `structure.remove_site_property(\"magmom\")` does fix the issue.\r\n\r\nRegarding a PR, my own understanding of what the code tries to do for magnetic moments is insufficient to handle it well. I wouldn't want to break another use case…",
"> I confirm that removing the magnetic moments with `structure.remove_site_property(\"magmom\")` does fix the issue.\r\n> \r\n> Regarding a PR, my own understanding of what the code tries to do for magnetic moments is insufficient to handle it well. I wouldn't want to break another use case…\r\n\r\nI see! I also don't know that functionality. Should I leave it open to see if someone else can fix it?",
"@mkhorton , maybe you now more about this.",
"This also struck me as odd. I'm currently working on #3767 which touches this bit of the code and happy to fix this if someone tells me the expected behaviour for magnetic moments. "
] | 2024-04-19T12:26:39
| 2024-04-22T12:54:44
|
NONE
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
### Python version
Python 3.11.6
### Pymatgen version
2024.4.13
### Operating system version
macOS 14.4.1
### Current behavior
This is related to https://github.com/materialsproject/pymatgen/issues/3761 but different. I have upgraded my pymatgen from 2023.10.4 and 2024.4.13 and I have workflows that fail as a result of the update. This is because `CifWriter` now silently replaces atom labels, even when they were unique! This seems very unnatural (and makes my current code fail, because I am writing bond specifications for the labels in the structure, and they don't match in the CIF file).
```
with MPRester("c3OruwLchURd4NLeENE40ziu8cNOGgyx") as m:
structure = m.get_structure_by_material_id("mp-1234")
print(structure.labels)
make_labels_unique(structure)
print(structure.labels)
print(str(CifWriter(structure)))
```
- `structure.labels` is originally `['Lu', 'Lu', 'Al', 'Al', 'Al', 'Al']`
- after the `make_labels_unique` call (my function, code below), they are `['Lu0', 'Lu1', 'Al0', 'Al1', 'Al2', 'Al3']`
- but in the CIF file, alas:
```
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Lu Lu0 1 0.87500000 0.87500000 0.87500000 1
Lu Lu1 1 0.12500000 0.12500000 0.12500000 1
Al Al2 1 0.50000000 0.50000000 0.50000000 1
Al Al3 1 0.50000000 0.50000000 0.00000000 1
Al Al4 1 0.00000000 0.50000000 0.50000000 1
Al Al5 1 0.50000000 -0.00000000 0.50000000 1
```
Al atoms have been renamed from `Al0..Al3` to `Al2..Al5`
### Expected Behavior
When labels are conformant to the CIF format (which they are in this case) they should not be altered.
### Minimal example
See code above. The function `make_labels_unique` is:
```
def make_labels_unique(struct):
from collections import Counter
labels = [site.label for site in struct.sites]
if len(labels) == len(set(labels)):
# All labels are unique, nothing to do
return
labels = Counter(labels)
counter = {}
for i, site in enumerate(struct.sites):
label = site.label
if labels[label] > 1:
c = counter.get(label, 0)
site.label = f"{label}{c}" if label.isalpha() else f"{label}_{c}"
c = c + 1
counter[label] = c
```
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3772/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3772/timeline
| null | false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3773
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3773/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3773/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3773/events
|
https://github.com/materialsproject/pymatgen/pull/3773
| 2,252,851,602
|
PR_kwDOACgets5tKkFx
| 3,773
|
Update to average Grüneisen documentation
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5456916296,
"node_id": "LA_kwDOACgets8AAAABRUHvSA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/docs",
"name": "docs",
"color": "35B067",
"default": false,
"description": "Documentation, examples, user guides"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent update enhances the documentation in the `pymatgen` library, particularly focusing on the `average_gruneisen` function in the phonon module. This improvement involves adding a specific reference source for definitions related to negative frequencies, aiming to enhance clarity and usefulness for users.\n\n## Changes\n\n| File Path | Change Summary |\n|----------------------------|------------------------------------------------------------------------------------------------------|\n| `pymatgen/.../gruneisen.py`| Updated documentation to include a reference for definitions related to negative frequencies in the `average_gruneisen` function. |\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/phonon/gruneisen.py: The change in functionality involves updating the documentation to reference a specific source for definitions related to negative frequencies in the `average_gruneisen` function.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe main goal of Pull Request (PR) number 3773 is to improve the documentation for the `average_gruneisen` function in `pymatgen/phonon/gruneisen.py`. The update focuses on providing a clearer description of the average Grüneisen parameter by referencing a specific source for definitions related to negative frequencies. This clarification enhances the documentation's comprehensibility and accuracy.\n\n### AI-generated Summary of Generated Summaries\n\nThe PR involves updating the documentation for the `average_gruneisen` function in `pymatgen/phonon/gruneisen.py` to include a reference source explaining definitions related to negative frequencies. This change aims to enhance the understanding of the average Grüneisen parameter.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: .coderabbit.yaml**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between 9662575b2c33cb762545d2775b4e6dd01d6b7aec and 6f35223f4969fe8ae0c43648422f56950eae6475.\n</details>\n\n\n<details>\n<summary>Files selected for processing (1)</summary>\n\n* pymatgen/phonon/gruneisen.py (1 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (1)</summary>\n\n* pymatgen/phonon/gruneisen.py\n\n</details>\n\n\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 9662575b2c33cb762545d2775b4e6dd01d6b7aec -->\n<!-- 6f35223f4969fe8ae0c43648422f56950eae6475 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@janosh I have merged as it is a tiny change to the docu and the tests pass"
] | 2024-04-19T12:26:42
| 2024-05-01T18:42:54
|
2024-04-19T12:41:08Z
|
MEMBER
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
I have clarified the description of the average Grüneisen paramter.
|
{
"login": "JaGeo",
"id": 22094846,
"node_id": "MDQ6VXNlcjIyMDk0ODQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/22094846?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JaGeo",
"html_url": "https://github.com/JaGeo",
"followers_url": "https://api.github.com/users/JaGeo/followers",
"following_url": "https://api.github.com/users/JaGeo/following{/other_user}",
"gists_url": "https://api.github.com/users/JaGeo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JaGeo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JaGeo/subscriptions",
"organizations_url": "https://api.github.com/users/JaGeo/orgs",
"repos_url": "https://api.github.com/users/JaGeo/repos",
"events_url": "https://api.github.com/users/JaGeo/events{/privacy}",
"received_events_url": "https://api.github.com/users/JaGeo/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3773/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3773/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3773",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3773",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3773.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3773.patch",
"merged_at": "2024-04-19T12:41:08Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3774
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3774/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3774/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3774/events
|
https://github.com/materialsproject/pymatgen/pull/3774
| 2,253,003,834
|
PR_kwDOACgets5tLF-1
| 3,774
|
Make `Beautifulsoup` optional
|
{
"login": "ab5424",
"id": 57258530,
"node_id": "MDQ6VXNlcjU3MjU4NTMw",
"avatar_url": "https://avatars.githubusercontent.com/u/57258530?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ab5424",
"html_url": "https://github.com/ab5424",
"followers_url": "https://api.github.com/users/ab5424/followers",
"following_url": "https://api.github.com/users/ab5424/following{/other_user}",
"gists_url": "https://api.github.com/users/ab5424/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ab5424/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ab5424/subscriptions",
"organizations_url": "https://api.github.com/users/ab5424/orgs",
"repos_url": "https://api.github.com/users/ab5424/repos",
"events_url": "https://api.github.com/users/ab5424/events{/privacy}",
"received_events_url": "https://api.github.com/users/ab5424/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 1532985663,
"node_id": "MDU6TGFiZWwxNTMyOTg1NjYz",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/dependencies",
"name": "dependencies",
"color": "0366d6",
"default": false,
"description": "Dependency issues and PRs"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5509832055,
"node_id": "LA_kwDOACgets8AAAABSGlddw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/imports",
"name": "imports",
"color": "B52839",
"default": false,
"description": "Import changes and formatting"
},
{
"id": 5585018768,
"node_id": "LA_kwDOACgets8AAAABTOSfkA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/pkg",
"name": "pkg",
"color": "EFE8DB",
"default": false,
"description": "Package health and distribution related stuff"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThe recent update streamlines dependency management for `BeautifulSoup` in the project. Key scripts and classes now conditionally import `BeautifulSoup`, making it an optional dependency for enhanced flexibility. This change optimizes the project's core dependencies by moving `beautifulsoup4` from the main requirements to the optional requirements.\n\n## Changes\n\n| Files | Change Summary |\n|---------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| `dev_scripts/update_pt_data.py`<br>`pymatgen/io/vasp/help.py` | Conditionally import `BeautifulSoup` using `monty.dev.requires`. Decorators added for dependency checks. |\n| `requirements-optional.txt` | Added `beautifulsoup4==4.12.2` to optional requirements. |\n| `requirements.txt` | Removed `beautifulsoup4==4.12.2` from main requirements. |\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\ndev_scripts/update_pt_data.py: ## Short Summary\nThe `update_pt_data.py` script now includes a check for the availability of `BeautifulSoup` and uses `monty.dev.requires` for this check. The `add_electron_affinities` function is now decorated with `@requires` to ensure `BeautifulSoup` is installed for its use.\n\n## Alterations to the declarations of exported or public entities\n- Added import: `from monty.dev import requires`\n- Modified function decorator: `@requires(BeautifulSoup, \"BeautifulSoup must be installed to use this method.\")` for function `add_electron_affinities`\n\n---\n\npymatgen/io/vasp/help.py: ## Short Summary\n\nThe change in `pymatgen/io/vasp/help.py` involves handling the import of `BeautifulSoup` from `bs4` using a try-except block and adding a decorator `@requires` to the `__init__` method of the `VaspDoc` class.\n\n## Alterations to the declarations of exported or public entities\n\n- `from bs4 import BeautifulSoup` => `from monty.dev import requires` and `from bs4 import BeautifulSoup` (conditionally imported)\n- Added decorator `@requires(BeautifulSoup, \"BeautifulSoup must be installed to fetch from the VASP wiki.\")` to the `__init__` method of the `VaspDoc` class\n\n---\n\nrequirements-optional.txt: ## Short summary\n\nAdded `beautifulsoup4==4.12.2` to the list of optional requirements in `requirements-optional.txt`.\n\n---\n\nrequirements.txt: ## Short summary\n\nRemoved `beautifulsoup4==4.12.2` from the main requirements in `requirements.txt`.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe primary objective of Pull Request #3774 is to make the `BeautifulSoup` library an optional dependency for the `pymatgen` package. This decision was prompted by the discovery that `BeautifulSoup` was listed in the `requirements.txt` file but not in the `setup.py`, which could lead to an `ImportError` when installing `pymatgen` from PyPI. Given that `BeautifulSoup` is utilized in only two specific areas within the `pymatgen` codebase, the PR proposes to move it to `requirements-optional.txt`. This change involves modifying the import statements in the affected scripts and classes to conditionally import `BeautifulSoup` only if it is installed. The PR includes updates to the `update_pt_data.py` script and the `VaspDoc` class in `help.py`, ensuring that `BeautifulSoup` is checked for and imported only when necessary. Additionally, the PR updates the `requirements-optional.txt` by adding `beautifulsoup4==4.12.2` to it, while removing the same from the `requirements.txt` to reflect its new optional status.\n\n### AI-Generated Summary of Generated Summaries\n\nIn Pull Request #3774, the `BeautifulSoup` library has been transitioned from a mandatory to an optional dependency in the `pymatgen` project. This change is reflected by its removal from `requirements.txt` and addition to `requirements-optional.txt`. The code modifications include conditional imports of `BeautifulSoup` using the `monty.dev.requires` decorator in both the `update_pt_data.py` script and the `VaspDoc` class within `help.py`. These conditional imports ensure that `BeautifulSoup` is only required in the execution paths where it is explicitly needed, thereby not hindering the general functionality of `pymatgen` for users who do not have `BeautifulSoup` installed.\n\n### Alterations to the Declarations of Exported or Public Entities\n\n- **dev_scripts/update_pt_data.py**:\n - Added import: `from monty.dev import requires`\n - Modified function decorator: `@requires(BeautifulSoup, \"BeautifulSoup must be installed to use this method.\")` for function `add_electron_affinities`\n\n- **pymatgen/io/vasp/help.py**:\n - `from bs4 import BeautifulSoup` => `from monty.dev import requires` and `from bs4 import BeautifulSoup` (conditionally imported)\n - Added decorator `@requires(BeautifulSoup, \"BeautifulSoup must be installed to fetch from the VASP wiki.\")` to the `__init__` method of the `VaspDoc` class\n\n- **requirements-optional.txt**:\n - Added `beautifulsoup4==4.12.2` to the list of optional requirements in `requirements-optional.txt`\n\n- **requirements.txt**:\n - Removed `beautifulsoup4==4.12.2` from the main requirements in `requirements.txt`\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: .coderabbit.yaml**\n**Review profile: CHILL**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between cd69def09a2c91ee8a3218bc74e8d90086f3db25 and a69a10925fe92f9251ebf578731ba287b2eab86d.\n</details>\n\n\n<details>\n<summary>Files selected for processing (2)</summary>\n\n* dev_scripts/update_pt_data.py (2 hunks)\n* pymatgen/io/vasp/help.py (1 hunks)\n\n</details>\n\n\n\n\n\n\n\n<details><summary>Additional comments not posted (4)</summary><blockquote>\n<details><summary>pymatgen/io/vasp/help.py (2)</summary><blockquote>\n\n`8-13`: Ensure conditional import of `BeautifulSoup` is handled correctly.\n\nThe use of a try-except block to conditionally import `BeautifulSoup` and set it to `None` if not found is a good practice for optional dependencies. This pattern works well with the `requires` decorator used later in the class.\n\n---\n\n`19-19`: Validate the use of the `requires` decorator on the `__init__` method.\n\nThe application of the `@requires(BeautifulSoup, \"BeautifulSoup must be installed to fetch from the VASP wiki.\")` decorator on the `__init__` method is appropriate. It prevents the class from being used without the necessary `BeautifulSoup` dependency, aligning with the PR's goal to make this dependency optional.\n\n</blockquote></details>\n<details><summary>dev_scripts/update_pt_data.py (2)</summary><blockquote>\n\n`14-23`: Ensure conditional import of `BeautifulSoup` is handled correctly.\n\nThe use of a try-except block to conditionally import `BeautifulSoup` and set it to `None` if not found is a good practice for optional dependencies. This pattern works well with the `requires` decorator used later in the function.\n\n---\n\n`239-239`: Validate the use of the `requires` decorator on the `add_electron_affinities` function.\n\nThe application of the `@requires(BeautifulSoup, \"BeautifulSoup must be installed to use this method.\")` decorator on the `add_electron_affinities` function is appropriate. It ensures that the function cannot be executed without the necessary `BeautifulSoup` dependency, aligning with the PR's goal to make this dependency optional.\n\n</blockquote></details></blockquote></details>\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- cd69def09a2c91ee8a3218bc74e8d90086f3db25 -->\n<!-- a69a10925fe92f9251ebf578731ba287b2eab86d -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-19T13:22:44
| 2024-05-02T13:26:40
|
2024-05-02T12:36:03Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
Major changes:
- `BeautifulSoup` is listed in `requirements.txt` but not in `setup.py`, possibly leading to an `ImportError` when installing `pymatgen` from pypi. Since it is only used in two places anyway, I moved it to `requirements-optional.txt` and changed the imports.
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
- [x] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3774/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3774/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3774",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3774",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3774.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3774.patch",
"merged_at": "2024-05-02T12:36:03Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3775
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3775/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3775/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3775/events
|
https://github.com/materialsproject/pymatgen/issues/3775
| 2,254,345,652
|
I_kwDOACgets6GXpW0
| 3,775
|
Collect possible issues might come with Python 3.12
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[] | 2024-04-20T03:11:47
| 2024-05-01T01:42:19
|
2024-05-01T01:42:19Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Collect some Python 3.12 related issues
Might be good to collect some Python 3.12 related issues.
### 1. For `UserDict`, `d.get(key)` and `d[key]` return different values, as `.get` method don't call `__getitem__`
As previously noticed in https://github.com/materialsproject/pymatgen/pull/3757#issuecomment-2056802767.
### 2. `Vasprun`: Two unit tests might fail for the following additional warning:
`Testing an element's truth value will raise an exception in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.`
https://github.com/materialsproject/pymatgen/blob/666e1d78c2d42318bd3b848c9ffa430f8d03443f/tests/io/vasp/test_outputs.py#L302-L308
and
https://github.com/materialsproject/pymatgen/blob/666e1d78c2d42318bd3b848c9ffa430f8d03443f/tests/io/vasp/test_outputs.py#L647-L652
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3775/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3775/timeline
| null |
completed
| false
| false
|
{
"url": "",
"html_url": "",
"diff_url": "",
"patch_url": "",
"merged_at": ""
}
|
||
https://api.github.com/repos/materialsproject/pymatgen/issues/3776
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3776/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3776/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3776/events
|
https://github.com/materialsproject/pymatgen/pull/3776
| 2,255,042,903
|
PR_kwDOACgets5tRcYF
| 3,776
|
Add type annotations for `io.vasp.outputs`
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5457739150,
"node_id": "LA_kwDOACgets8AAAABRU59jg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/vasp",
"name": "vasp",
"color": "BF4B01",
"default": false,
"description": "Vienna Ab initio Simulation Package"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"@janosh While you are working on improving dcostrings, can you please skip this `io.vasp.outputs` part to avoid overlapping? I would help fixing some docstring issues while adding types. Thanks!",
"I'm now facing significant resistance from the \"default value as `None` behavior\" (most `mypy` errors are more or less related to possible default `None` values), similar to #3724.\r\n\r\n## Default values for `get` or similar methods\r\n\r\nFor the following example:\r\n```diff\r\nposcar_dict = {\"lattice\": Lattice, \"pos\": Position} # a terrible example dict\r\n\r\n- comment: str | None = poscar_dict.get(\"comment\", None)\r\n+ comment: str = poscar_dict.get(\"comment\", \"\")\r\n\r\n# More downstream operations that only works for `str`\r\nclean_comment = comment.strip()\r\n```\r\n\r\nUsing empty str `\"\"` could avoid the type being expanded to `str | None`.\r\n\r\nOr perhaps: https://github.com/materialsproject/pymatgen/blob/a16ac3926c61b2e12b14b2bceb475da70cc0d755/pymatgen/io/vasp/outputs.py#L3630-L3633\r\n\r\nSuch default values as `None` would expand the type from `float` to `float | None`, meaning all **downstream operations** (or child objects) need to explicitly check for `None`.\r\n\r\n## Default values for functions/methods\r\n\r\nFor example https://github.com/materialsproject/pymatgen/blob/a16ac3926c61b2e12b14b2bceb475da70cc0d755/pymatgen/io/vasp/outputs.py#L223-L235\r\n\r\nThe default `ionic_step_skip` is `None`, which would require all downstream methods to handle this case. Using a default `int` which will NOT normally happen during runtime could bypass this issue (for number of steps, `-1` might be a good choice).\r\n\r\n## Some preliminary thoughts\r\n\r\n- For sequence types, use an empty sequence might be quite straightforward (`\"\"` for `str`, `[]/()/{}` for `list/tuple/dict`). Certain not as a function default value with mutables.\r\n- For numbers, maybe use a number that would NOT happen during runtime (for example, `-1` for number of CPU cores).\r\n\r\n## Summary\r\n\r\nSuch cases are happening everywhere across the code base (for all kinds of types) and need to insert huge amount of checks `if var is None`. I'm not sure how to resolve this gracefully (I cannot even describe this issue properly because it's happening everywhere and in various forms). Any suggestion would be appreciated @janosh.\r\n",
"> Any suggestion would be appreciated @janosh.\r\n\r\ndefinitely feel free to homogenize types where it make sense and simplifies the code. there are cases where it's important to be explicit about accepting `None` and handling that case separately. but if an empty string/tuple/... works for the default case, by all means use that over `None`",
"@janosh Can you please revise this? \r\n\r\nFor most `xml.etree` or `re` related searches, I chose to suppress `mypy` error instead of check for `None` (for example 0346b92c3e61fb3ff540eb7d21d1a918d002bd78), because I think it's fairly safe to assume the source file is properly formatted and match should normally not return `None`.\r\n\r\nOnly change and need discussion is the change of default `IVDW` to agree with VASP in c990b018af9fd3aa19d63cbfec6f1889e947b40d and discussions in https://github.com/materialsproject/pymatgen/pull/3776#discussion_r1618544768.\r\n\r\nI notice [CI runs are cancelled randomly](https://github.com/materialsproject/pymatgen/actions/runs/9276409234/job/25523410105) from time to time (Update: very frequently for example in https://github.com/materialsproject/pymatgen/actions/runs/9303003521/job/25604368181)?\r\n\r\n"
] | 2024-04-21T12:08:57
| 2024-06-01T01:12:52
|
2024-05-31T19:06:12Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Add type annotations for `io.vasp.outputs`, a follow-up PR of #3740.
- Use `PathLike` as type over `str` for all paths.
- Add missing docstrings and clean up docstrings.
- Lazily import `Vasprun/Xdatcar` in `Trajectory` to be consistent with other part of the class.
|
{
"login": "shyuep",
"id": 577107,
"node_id": "MDQ6VXNlcjU3NzEwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/577107?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/shyuep",
"html_url": "https://github.com/shyuep",
"followers_url": "https://api.github.com/users/shyuep/followers",
"following_url": "https://api.github.com/users/shyuep/following{/other_user}",
"gists_url": "https://api.github.com/users/shyuep/gists{/gist_id}",
"starred_url": "https://api.github.com/users/shyuep/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/shyuep/subscriptions",
"organizations_url": "https://api.github.com/users/shyuep/orgs",
"repos_url": "https://api.github.com/users/shyuep/repos",
"events_url": "https://api.github.com/users/shyuep/events{/privacy}",
"received_events_url": "https://api.github.com/users/shyuep/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3776/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3776/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3776",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3776",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3776.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3776.patch",
"merged_at": "2024-05-31T19:06:12Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3777
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3777/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3777/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3777/events
|
https://github.com/materialsproject/pymatgen/pull/3777
| 2,255,055,612
|
PR_kwDOACgets5tRe3v
| 3,777
|
`pyright` fixes
|
{
"login": "DanielYang59",
"id": 80093591,
"node_id": "MDQ6VXNlcjgwMDkzNTkx",
"avatar_url": "https://avatars.githubusercontent.com/u/80093591?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielYang59",
"html_url": "https://github.com/DanielYang59",
"followers_url": "https://api.github.com/users/DanielYang59/followers",
"following_url": "https://api.github.com/users/DanielYang59/following{/other_user}",
"gists_url": "https://api.github.com/users/DanielYang59/gists{/gist_id}",
"starred_url": "https://api.github.com/users/DanielYang59/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/DanielYang59/subscriptions",
"organizations_url": "https://api.github.com/users/DanielYang59/orgs",
"repos_url": "https://api.github.com/users/DanielYang59/repos",
"events_url": "https://api.github.com/users/DanielYang59/events{/privacy}",
"received_events_url": "https://api.github.com/users/DanielYang59/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5318918309,
"node_id": "LA_kwDOACgets8AAAABPQhApQ",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/linting",
"name": "linting",
"color": "5DBC83",
"default": false,
"description": "Linting and quality assurance"
},
{
"id": 5509830160,
"node_id": "LA_kwDOACgets8AAAABSGlWEA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/types",
"name": "types",
"color": "7D66D9",
"default": false,
"description": "Type all the things"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\n\nThis update focuses on enhancing error handling, initializing variables before use, and refining logic in a Python project. Changes include adding or adjusting timeouts for HTTP requests, initializing variables to prevent bugs, and refining data handling in functions. The modifications aim to improve stability, readability, and maintainability of the codebase, ensuring smoother operations and clearer error reporting.\n\n## Changes\n\n| Files | Change Summary |\n|-------|----------------|\n| `.github/workflows/lint.yml`, `.pre-commit-config.yaml` | Updated linting configurations and pre-commit hooks. |\n| `pymatgen/analysis/...`, `pymatgen/command_line/...`, `pymatgen/core/...`, `pymatgen/electronic_structure/...` | Numerous updates across `pymatgen` submodules to initialize variables, handle exceptions, and refine logical flows. |\n| `pymatgen/ext/...`, `tests/ext/...` | Increased timeout values for HTTP requests in external interfaces and related tests. |\n| `pyproject.toml`, `tasks.py` | Added virtual environment configuration and adjusted timeout settings in task automation scripts. |\n| `dev_scripts/update_pt_data.py` | Increased timeout for HTTP requests in script for updating data. |\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\n.github/workflows/lint.yml: ## Short summary\n\nIn the `.github/workflows/lint.yml` file, the change involves adding the `pyright` package to the dependencies installation step and introducing a new job named `pyright` that runs the `pyright` tool.\n\n---\n\n.pre-commit-config.yaml: ## Short summary\n\nThe `.pre-commit-config.yaml` file has been updated to increment the revisions for `astral-sh/ruff-pre-commit`, `MarcoGorelli/cython-lint`, and `RobertCraigie/pyright-python` repositories used for pre-commit hooks.\n\n---\n\npymatgen/analysis/adsorption.py: ### Short Summary\n\nIn the `plot_slab` function of `adsorption.py`, a variable `n` is initialized to `None` before being used in a loop to draw circles at specific coordinates. This change introduces a potential issue as `n` is redefined within the loop, which may lead to unintended behavior.\n\n---\n\npymatgen/analysis/bond_dissociation.py: ## Short summary\n\nAdded the initialization of `fragments` as an empty list before attempting to split the molecule subgraphs based on the provided bonds.\n\n---\n\npymatgen/analysis/bond_valence.py: ### Short Summary\n\nIn the `bond_valence.py` file of `pymatgen`, the change introduces the initialization of the `attrib` variable before a conditional block and removes its previous initialization within another block, affecting the logic related to recursion and variable usage.\n\n---\n\npymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py: ### Short Summary\n\n- Removed `ClassVar` import from `typing`.\n- Added initialization for `isite`, `d_this_site2`, and `sym_trafo` variables.\n\n---\n\npymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py: ## Short summary\n\nIn the `coordination_geometries.py` file of `pymatgen`, a change was made to handle an additional case where an invalid input for edges is raised as a `RuntimeError`.\n\n---\n\npymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.py: ## Short summary\n\n- Added a new variable `cn` initialized to 0.\n- Modified the logic related to `separation_permutations` in two functions.\n- Added an empty string initialization for variable `algo`.\n\n---\n\npymatgen/analysis/chemenv/coordination_environments/structure_environments.py: ## Short summary\n\nAdded the initialization of `mp_symbol` variable to an empty string before the loop that iterates over `self.coord_geoms`.\n\n---\n\npymatgen/analysis/chemenv/utils/chemenv_config.py: ## Short summary\n\nIn the `setup` method of `chemenv_config.py`, the print statement for saving configuration has been moved within the `elif` block for the \"S\" test case, ensuring it only prints when the configuration is saved.\n\n---\n\npymatgen/analysis/chemenv/utils/scripts_utils.py: ## Short summary\n\n- Added `csm_suffix` and `perf_radius` variables.\n- Added `source_type` and `input_source` variables.\n- Added logic for different source types like CIF and materials project.\n- Modified logic for user input handling and structure setup.\n- Added `the_cg` variable.\n- Introduced a potential bug with `vis` variable initialization.\n\n---\n\npymatgen/analysis/chempot_diagram.py: ## Short summary\n\nIn the `pymatgen/analysis/chempot_diagram.py` file, the changes involve adding a conditional check to set `new_lims` to an empty list when `element_padding` is not provided in the `_get_2d_plot` and `_get_3d_plot` functions.\n\n---\n\npymatgen/analysis/diffraction/tem.py: ## Short summary\n\nIn the `get_positions` method of `tem.py`, the variables `first_point` and `first_d` are initialized to `(0, 0, 0)` and `0.0` respectively, and similarly, `second_point` and `second_d` are initialized to `(0, 0, 0)` and `0.0` respectively.\n\n---\n\npymatgen/analysis/elasticity/elastic.py: ### Short Summary\n\nIn the `get_strain_state_dict` function of `elastic.py`, a type hint `tol: float = 1e-10` has been added, and a type hint `# type: ignore[reportPossiblyUnboundVariable]` has been included for `veq_stress` in the line where `mstresses` is updated.\n\n---\n\npymatgen/analysis/functional_groups.py: ## Short summary\n\nIn the given diff, a new list `ring_group` is initialized within a loop, potentially affecting the handling of ring structures in the code.\n\n---\n\npymatgen/analysis/graphs.py: ## Short summary\n\nThe changes in `graphs.py` involve adjustments to the import statements, reordering of conditional statements, and addition of an exception raise for a specific condition in the `alter_edge` function. Additionally, a new exception raise and a comment have been added in the `get_subgraphs_as_molecules` function.\n\n---\n\npymatgen/analysis/local_env.py: ## Short summary\n\nIn the `local_env.py` file of `pymatgen/analysis`, the changes involve adjustments to the logic and control flow within the `get_order_parameters` method. Specifically, modifications include handling of `typ` variable assignments, updates to loop iterations, and adjustments to conditional checks related to different types of structures and calculations. These changes impact the computation and assignment of various parameters within the method.\n\n---\n\npymatgen/analysis/magnetism/heisenberg.py: ## Short summary\n\n- Added a variable `j_key` in the `_get_nn_dict` method.\n- Added variables `order`, `i_index`, `j_index`, `fm_e`, and `afm_e` in various methods.\n\n---\n\npymatgen/analysis/molecule_matcher.py: ## Short summary\n\nIn the `molecule_matcher.py` file of `pymatgen`, the changes involve initializing `openbabel` and `BabelMolAdaptor` to `None` and adding declarations for `p_inds`, `U`, `inds`, and `matches` within the `match` and `permutations` functions.\n\n---\n\npymatgen/analysis/phase_diagram.py: ## Short summary\n\n- Added a `return None` statement after an indented block.\n- Introduced new assignments and conditional logic within the `getmu_vertices_stability_phase` method.\n- Added a block of code setting variables and conditions within the `_create_plotly_element_annotations` method.\n- Introduced new variables `nameup`, `nameleft`, and `nameright` within the `order_phase_diagram` function.\n\n---\n\npymatgen/analysis/piezo_sensitivity.py: ## Short Summary\n\nIn the given diff for `pymatgen/analysis/piezo_sensitivity.py`, the change involves setting `Phonopy` and `dyntofc` to `None` in the `except ImportError` block.\n\n---\n\npymatgen/analysis/quasiharmonic.py: ## Short summary\n\nAdded initialization of `G_opt` and `V_opt` variables to `None` before the `try` block for each temperature iteration in the `optimize_gibbs_free_energy` function.\n\n---\n\npymatgen/analysis/structure_analyzer.py: ## Short summary\n\nThe changes in `structure_analyzer.py` involve adding an exception raise for an invalid element type and simplifying the logic around bond atom calculations. The code now raises a `TypeError` for an invalid element type and adjusts the bond atom calculation logic by removing an unnecessary exception handling block.\n\n---\n\npymatgen/analysis/structure_matcher.py: ## Short summary\n\nIn the `structure_matcher.py` file of `pymatgen`, a change was made to add the initialization of the variable `best` to `None` within a loop that iterates over matches.\n\n---\n\npymatgen/analysis/surface_analysis.py: ## Short summary\n\nIn `surface_analysis.py`, the changes include:\n- Addition of a variable `ref_el` initialized to `None`.\n- Initialization of `stable_u_range_dict` to an empty dictionary in a specific condition.\n- Addition of variables `ads_entry` and `clean_entry` initialized to `None.\n\n---\n\npymatgen/analysis/topological/spillage.py: ## Short Summary\n\nAdded initialization of variables `cup` and `cdn` to 0 before a loop iteration in the `overlap_so_spinpol` function. Changed the declaration of `nelec_list` to `n_elec_list` as a list of lists of integers.\n\n---\n\npymatgen/analysis/transition_state.py: ### Short Summary\n\nAdded new lists `neb1_structures`, `neb1_energies`, `neb1_forces`, and `neb1_r` to the function `combine_neb_plots` in `transition_state.py`.\n\n---\n\npymatgen/analysis/wulff.py: ## Short Summary\n\nIn the `get_line_in_facet` function of `wulff.py`, a new variable `line` is initialized to `None` alongside `prev`.\n\n---\n\npymatgen/analysis/xas/spectrum.py: ### Short Summary\n\nThe change in functionality involves importing `TYPE_CHECKING` from `typing` instead of `Literal`, and adding a conditional import for `Literal`. Additionally, a variable `xas` is initialized to `None` within the function `site_weighted_spectrum`.\n\n---\n\npymatgen/command_line/bader_caller.py: ## Short summary\n\nIn the given diff for `pymatgen/command_line/bader_caller.py`, the change involves modifying the logic related to handling the CHGCAR file path. Previously, the code checked if the CHGCAR file path was not None and then proceeded to create a Chgcar object from the file. In the updated version, if the CHGCAR file path is None, it raises a FileNotFoundError exception. This adjustment enhances the error handling for cases where the CHGCAR file is not found.\n\n---\n\npymatgen/command_line/chargemol_caller.py: ### Short Summary\n\n- Added import for `Literal` from `typing`.\n- Refactored `get_charge_transfer` method to simplify logic.\n- Updated `get_charge` and `get_partial_charge` methods to use `Literal` for `charge_type` parameter.\n- Modified file reading in `_get_bond_order_info` method to include encoding specification.\n\n---\n\npymatgen/command_line/critic2_caller.py: ### Short Summary\n\nIn the `pymatgen/command_line/critic2_caller.py` file, the changes include initializing `stderr` as an empty string and introducing new variables `start_i`, `end_i`, and `unique_idx` for parsing unique critical points in the `_parse_stdout` method.\n\n---\n\npymatgen/command_line/vampire_caller.py: ## Short Summary\n\nIn the `vampire_caller.py` file, the logic for determining the `spin` value based on `magmoms` has been updated to include a case where `magmoms[site]` is neither greater than nor less than 0. Now, if `magmoms[site]` is not greater than 0 or less than 0, `spin` is set to 0.\n\n---\n\npymatgen/core/interface.py: ## Short summary\n\nThe changes in `pymatgen/core/interface.py` involve adjustments to the logic and control flow within the `gb_from_parameters` and `get_trans_mat` functions. Specifically, modifications include handling different lattice types, setting parameters based on conditions, and raising errors for invalid cases. Additionally, there are updates related to matrix transformations and error handling for certain scenarios.\n\n---\n\npymatgen/core/structure.py: ## Short summary\n\n- The `_relax` method in the structure module now accepts a specific set of calculators.\n- The `is_ase_optimizer` function has been updated to handle different cases for `opt_class`.\n- The `get_symmetric_neighbor_list` method now allows `sg` to be `None` and handles compatibility checks.\n- Minor changes for type annotations and variable handling in various methods.\n\n---\n\npymatgen/core/surface.py: ## Short summary\n\n- Added a check and exception handling for a `None` case in `get_symmetric_site` function.\n- Introduced additional variables and exception handling for edge cases in `get_equi_sites` and `get_d` functions.\n- Modified the handling of `miller_index` in `get_symmetrically_equivalent_miller_indices` function.\n\n---\n\npymatgen/core/tensors.py: ## Short summary\n\nAdded a new variable `mask` initialized to `None` in the `populate` function.\n\n---\n\npymatgen/core/trajectory.py: ## Short summary\n\nIn the `trajectory.py` file of `pymatgen/core`, the changes introduce the initialization of `charge` and `spin` variables, and the addition of `molecules` and `structures` lists in the `from_file` method, affecting the creation of `Molecule` and `Structure` instances based on file types like XDATCAR, vasprun*.xml*, and *.traj.\n\n---\n\npymatgen/electronic_structure/boltztrap.py: ## Short summary\n\n- In the `write_struct` method, a type hint `# type: ignore[reportPossiblyUnboundVariable]` was added to two `file.write` calls.\n- In the `get_average_eff_mass` method, a new variable `cond_inv` was introduced.\n- The `get_complexity_factor` method now has a revised signature with a new argument `output` of type `Literal[\"average\", \"tensor\"]`.\n- The logic in the `get_complexity_factor` method was updated to handle different cases for the `output` argument.\n- In the `get_complete_dos` method, a new variable `spin_2` was added and its assignment was modified.\n- The `read_cube_file` function now opens the file with encoding specified as `utf-8` and includes a new `else` block with a `RuntimeError` exception.\n\n---\n\npymatgen/electronic_structure/boltztrap2.py: ## Short summary\n\n- Added `energies` initialization before a loop.\n- Renamed `t` to `bar` for progress tracking.\n- Added `doping_all` initialization before a conditional check.\n\n---\n\npymatgen/electronic_structure/cohp.py: ## Short Summary\n\nAdded the declaration of `avg_cohp` as `None` in the `from_dict` method.\n\n---\n\npyproject.toml: ## Short summary\n\nAdded configuration for a virtual environment in `pyproject.toml`.\n\n---\n\ndev_scripts/update_pt_data.py: ## Short summary\n\nIn the `update_pt_data.py` script, the timeout for the HTTP request to retrieve electron affinities data from a Wikipedia page was increased from 60 seconds to 600 seconds.\n\n---\n\npymatgen/ext/cod.py: ## Short summary\n\nIn the `pymatgen/ext/cod.py` file, the changes involve modifying the `get_cod_ids` method to return a list of integers, specifying the `cod_id` parameter in `get_structure_by_id` as an integer, adding a `timeout` parameter with a default value of 600 seconds to `get_structure_by_id`, and updating the timeout value in the HTTP request of `get_structure_by_id` and `get_structure_by_formula` methods to 600 seconds.\n\n---\n\npymatgen/ext/matproj_legacy.py: ## Short Summary\n\nIn the `matproj_legacy.py` file, the timeout value for the `requests.get` call has been increased from 60 to 600 seconds.\n\n---\n\npymatgen/io/vasp/help.py: ## Short summary\n\nThe change in functionality involves increasing the timeout value for HTTP requests from 60 to 600 seconds in the `get_help` and `get_incar_tags` functions in the `help.py` module.\n\n---\n\ntasks.py: ## Short summary\n\nIn the `update_changelog` function in `tasks.py`, the timeout value for the GitHub API request has been changed from 60 seconds to 600 seconds.\n\n---\n\ntests/ext/test_cod.py: ## Short summary\n\nIn the given diff for `tests/ext/test_cod.py`, the change involves increasing the timeout value for the HTTP request from 60 seconds to 600 seconds when checking the status of a website. This modification aims to adjust the timeout duration for the request operation.\n\n---\n\ntests/ext/test_matproj.py: ## Short summary\n\nThe change in functionality involves increasing the timeout value for requests to the Materials Project website from 60 to 600 seconds, affecting tests related to MPRester functionality.\n\n---\n\ntests/ext/test_optimade.py: ## Short summary\n\nThe change in functionality involves increasing the timeout for requests made to specific URLs related to Optimade providers from 60 seconds to 600 seconds, potentially to handle slower responses or network conditions.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThe pull request titled \"pyright fixes\" (PR #3777) is a follow-up to PR #3757, aiming to resolve `pyright` errors and integrate `pyright` into the linting workflow and pre-commit hooks. This integration seeks to enhance code quality by detecting type errors early in the development process. The PR also addresses a `pre-commit` failure issue in the CI environment, not reproducible locally, by skipping `pyright` in pre-commit CI to avoid manual dependency management.\n\n### Comments Summary\n\nThe PR comments focus on troubleshooting the `pre-commit` failure in the CI environment. DanielYang59 initially suspects a version issue, referencing a similar unresolved GitHub problem. Janosh clarifies that the failure is due to missing dependencies in the pre-commit CI container, suggesting skipping `pyright` in pre-commit CI to avoid manual dependency management. Njzjz highlights that `pyright-python` fails due to network restrictions in pre-commit.ci, preventing dynamic downloads. Consequently, it is decided to skip `pyright` in pre-commit CI. Additionally, a timeout issue in a test function is addressed by increasing the timeout from 60 to 600 seconds.\n\n### AI-Generated Summary of Generated Summaries\n\nThe PR introduces various enhancements across `pymatgen` files, focusing on initializing variables, refining error handling, and improving code robustness. Key changes include:\n\n1. **Initialization and Error Handling**: Files now initialize variables before use to prevent reference errors. For instance, `frags`, `attrib`, and `mp_symbol` are initialized in their modules for proper usage.\n\n2. **Timeout Adjustments**: HTTP request timeouts are increased from 60 to 600 seconds in modules like `cod.py` and `matproj_legacy.py` to handle slower network responses.\n\n3. **Type Annotations and Error Handling**: Updates include type hints and error handling improvements. For example, `elastic.py` adds a tolerance parameter type hint, and `structure.py` enhances calculator type handling.\n\n4. **Refactoring and Simplification**: Some files see logic simplification and refactoring for clarity and efficiency. For instance, `bader_caller.py` improves error handling for missing files, and `interface.py` adjusts logic for different lattice types and matrix transformations.\n\n5. **Dependency and Configuration Updates**: `.pre-commit-config.yaml` and `lint.yml` files are updated for new revisions and configurations, integrating `pyright` deeper into CI processes.\n\nThese changes aim to boost `pymatgen` library maintainability, reliability, and performance by addressing bugs, enhancing clarity, and ensuring robustness through improved initialization and error handling.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 48f87f5d3aa0e08e5404f5f9f9e56da803492877 -->\n<!-- 54818d129261de0124ccf884f491ab7ed8f3911e -->\n<!-- f9a3aeb3e595c878c3848be27999f915fcfafb84 -->\n<!-- 381f43035e2a958b3549a6570a501f5fbbe5058f -->\n<!-- 34be0ff22392c0221b03b31b5a39767d92698c88 -->\n<!-- bca91fe1adf6b36f3bbd3d7bdda00ee750cc46f5 -->\n<!-- 34aaa2c56d91649c8f24cdc28fd890c914ca4586 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"@janosh Please review this, all `pyright` errors are fixed :) \r\n\r\nNot sure why `pre-commit` is failing though (passing locally), also tried to downgrade to previous but still no luck. Noticed a similar report https://github.com/RobertCraigie/pyright-python/issues/173, but not replied.",
"Thanks for the input. I'll have a try. \r\n\r\nJust tried to install `micromamba` locally, this path seems correct.\r\n\r\nhttps://github.com/materialsproject/pymatgen/pull/3777#discussion_r1574080211 This has to be confirmed :) ",
"sorry, actually this was a stupid suggestion. i thought `pyright` was failing in GitHub action but actually it's only failing in pre-commit CI which runs in a completely different container where `pymatgen` deps are not installed anyway. we could [manually install all of them](https://pre-commit.com/#config-additional_dependencies) but that would be tedious to maintain as deps change. better to only run `pyright` in GitHub Action and `skip` it in pre-commit CI imo",
"It's weird, `pyright` still failed. But I think `pyright` worked fine in #3757? Back that time we already have `micromamba` installed in #3729?\r\n",
"> Not sure why `pre-commit` is failing though (passing locally), also tried to downgrade to previous but still no luck. Noticed a similar report [RobertCraigie/pyright-python#173](https://github.com/RobertCraigie/pyright-python/issues/173), but not replied.\r\n\r\nI think the reason is that pre-commit.ci disallows the network at the runtime (see https://github.com/pre-commit-ci/issues/issues/196#issuecomment-1810937079), but pyright-python only downloads pyright at the first runtime (see https://github.com/RobertCraigie/pyright-python/issues/225).",
"thanks @njzjz! that's good to know. more reason to skip it in pre-commit CI.\r\n\r\n@DanielYang59 could you add `pyright` here?\r\n\r\nhttps://github.com/materialsproject/pymatgen/blob/ad6eafee2474718813cba57aa8e1752f1181b639/.pre-commit-config.yaml#L5",
"Thanks @njzjz! It's very helpful.",
"@janosh. Yes it makes sense, we may not need `pyright` on both CI and pre-commit. Skipped in pre-commit, thanks!",
"Ah, wait! I'm pretty sure I added a timeout of 60 seconds for `request` to prevent it from hanging forever, but it seems 60 seconds is insufficient?\r\n\r\n```py\r\nself = <ext.test_cod.TestCOD testMethod=test_get_structure_by_id>\r\n\r\n def test_get_structure_by_id(self):\r\n> struct = COD().get_structure_by_id(2002926)\r\n\r\ntests/ext/test_cod.py:31: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\npymatgen/ext/cod.py:93: in get_structure_by_id\r\n response = requests.get(f\"http://{self.url}/cod/{cod_id}.cif\", timeout=60)\r\n../../../micromamba/envs/pmg/lib/python3.11/site-packages/requests/api.py:73: in get\r\n return request(\"get\", url, params=params, **kwargs)\r\n../../../micromamba/envs/pmg/lib/python3.11/site-packages/requests/api.py:59: in request\r\n return session.request(method=method, url=url, **kwargs)\r\n../../../micromamba/envs/pmg/lib/python3.11/site-packages/requests/sessions.py:589: in request\r\n resp = self.send(prep, **send_kwargs)\r\n../../../micromamba/envs/pmg/lib/python3.11/site-packages/requests/sessions.py:703: in send\r\n r = adapter.send(request, **kwargs)\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\nself = <requests.adapters.HTTPAdapter object at 0x7f3737f1e250>\r\nrequest = <PreparedRequest [GET]>, stream = False\r\ntimeout = Timeout(connect=60, read=60, total=None), verify = True, cert = None\r\nproxies = OrderedDict()\r\n```",
"feel free to skip the COD test as well. pinging live APIs in CI is bad practice anyway",
"Thanks for reviewing @janosh.\r\n\r\nAlso ping @ml-evs: all `pyright` errors have been fixed :)",
"@janosh. I notice [CI is failing](https://github.com/materialsproject/pymatgen/actions/runs/8793843655/job/24132330303) after this PR (more specifically after the merge master commit a297ef8354a8b1fdbc8f336f639e98156022ff8a). It's also failing locally. Did we actually break anything?\r\n\r\nUPDATE: I just opened #3781 to fix this. Seems like a typo in #3771? \r\n",
"thanks for the quick fix!",
"btw, very happy that we can enable `pyright`'s possibly unbound variable detection across the code base thanks to this PR. that will really help automated code quality assurance",
"> btw, very happy that we can enable `pyright`'s possibly unbound variable detection across the code base thanks to this PR. that will really help automated code quality assurance\r\n\r\nGreat to know that! And very glad I could help :)\r\n"
] | 2024-04-21T12:41:21
| 2024-04-23T13:43:21
|
2024-04-23T02:18:57Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- `pyright` fixes, a follow up PR of #3757.
- Enable `pyright` in linting workflow and `pre-commit`.
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3777/reactions",
"total_count": 2,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 1,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3777/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3777",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3777",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3777.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3777.patch",
"merged_at": "2024-04-23T02:18:57Z"
}
|
|||
https://api.github.com/repos/materialsproject/pymatgen/issues/3778
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3778/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3778/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3778/events
|
https://github.com/materialsproject/pymatgen/pull/3778
| 2,255,275,614
|
PR_kwDOACgets5tSLBO
| 3,778
|
bugfix: chargemol runtime directory and `os.path.exists` fix
|
{
"login": "chiang-yuan",
"id": 41962462,
"node_id": "MDQ6VXNlcjQxOTYyNDYy",
"avatar_url": "https://avatars.githubusercontent.com/u/41962462?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/chiang-yuan",
"html_url": "https://github.com/chiang-yuan",
"followers_url": "https://api.github.com/users/chiang-yuan/followers",
"following_url": "https://api.github.com/users/chiang-yuan/following{/other_user}",
"gists_url": "https://api.github.com/users/chiang-yuan/gists{/gist_id}",
"starred_url": "https://api.github.com/users/chiang-yuan/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/chiang-yuan/subscriptions",
"organizations_url": "https://api.github.com/users/chiang-yuan/orgs",
"repos_url": "https://api.github.com/users/chiang-yuan/repos",
"events_url": "https://api.github.com/users/chiang-yuan/events{/privacy}",
"received_events_url": "https://api.github.com/users/chiang-yuan/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 2414169365,
"node_id": "MDU6TGFiZWwyNDE0MTY5MzY1",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/needs%20testing",
"name": "needs testing",
"color": "66ddab",
"default": false,
"description": "PRs that are not ready to merge due to lacking tests"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
},
{
"id": 5525608888,
"node_id": "LA_kwDOACgets8AAAABSVoZuA",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/analysis",
"name": "analysis",
"color": "7E50AA",
"default": false,
"description": "Concerning pymatgen.analysis"
},
{
"id": 6605952379,
"node_id": "LA_kwDOACgets8AAAABib7Vew",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/charge",
"name": "charge",
"color": "084665",
"default": false,
"description": "Electric charge analysis, partitioning, integrations, etc."
}
] |
open
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent changes in `chargemol_caller.py` and related files refine Chargemol script execution, improve error handling for missing files, and enhance overall script robustness. These updates aim to streamline Chargemol analysis and strengthen code reliability.\n\n## Changes\n\n| File | Summary of Changes |\n|------|--------------------|\n| `.../chargemol_caller.py`<br>`.../test_chargemol_caller.py` | \n - `chargemol_caller.py`: Added `Pathlib` import, updated path handling, refined temporary directory management, and enhanced error checks.<br>\n - `test_chargemol_caller.py`: Renamed instances, added `test_missing_exe_error`, adjusted assertions, and introduced error handling patch. |\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/command_line/chargemol_caller.py: \n- Added `from pathlib import Path`.\n- Modified initialization of `path`.\n- Adjusted internal function `_execute_chargemol` for handling temporary directories.\n- Updated `_write_jobscript_for_chargemol` to include `chgcar_path` parameter.\n- Changed error handling for file existence checks.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request, numbered 3778 and titled \"bugfix: chargemol runtime directory and `os.path.exists` fix,\" aims to enhance the Chargemol module within the pymatgen library by addressing key issues:\n\n1. **Path Logic Improvement**: The PR focuses on refining path handling to enable Chargemol to operate seamlessly in different directories, rectifying a previously dysfunctional feature.\n\n2. **File Existence Check Fix**: By replacing `os.path.isfile` with `os.path.exists`, the PR resolves bugs related to file existence checks, ensuring accurate validation regardless of file type.\n\n3. **Documentation and Typing Enhancements**: Updates to Google format doc strings and type annotations enhance code clarity and maintainability, verified using tools like `ruff` and `mypy`.\n\n4. **Testing**: While tests for new features and fixes are pending, the PR emphasizes the importance of incorporating tests to validate the changes.\n\nThe overarching goal is to bolster the reliability of Chargemol, particularly in diverse runtime environments, and elevate code quality through improved documentation and type safety.\n\n### AI-Generated Summary of Generated Summaries\n\nKey modifications in this PR focus on enhancing functionality and addressing bugs in `chargemol_caller.py`:\n\n- **Path Handling Enhancement**: Importing `Path` from `pathlib` and adjusting the `path` variable initialization improve path management for increased robustness.\n\n- **Execution Function Update**: Refinements in `_execute_chargemol` cater to handling temporary directories effectively, facilitating Chargemol's operation in varied directory setups.\n\n- **Job Script Writing Update**: Updates in `_write_jobscript_for_chargemol`, including the addition of a `chgcar_path` parameter, enhance job script generation flexibility and accuracy.\n\n- **Error Handling Improvement**: Replacing `os.path.isfile` with `os.path.exists` for file existence checks rectifies bugs and ensures precise validation for files and directories.\n\nThese changes collectively aim to boost Chargemol's reliability and adaptability in pymatgen, tackling runtime challenges and enhancing code quality through improved error handling and path management.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai -->\n\n---\n\n<details>\n\n<summary>Recent Review Details</summary>\n\n**Configuration used: .coderabbit.yaml**\n**Review profile: CHILL**\n\n<details>\n<summary>Commits</summary>\nFiles that changed from the base of the PR and between e4ccad6223403e92e17e8038cb5c502dbc185e01 and 8be153adcd4b25029d84cba12593ebc97a064916.\n</details>\n\n\n<details>\n<summary>Files selected for processing (1)</summary>\n\n* pymatgen/command_line/chargemol_caller.py (11 hunks)\n\n</details>\n\n\n\n\n\n<details>\n<summary>Files skipped from review as they are similar to previous changes (1)</summary>\n\n* pymatgen/command_line/chargemol_caller.py\n\n</details>\n\n\n\n\n\n</details><!-- commit_ids_reviewed_start -->\n\n<!-- 637501ad87e3e55aeea5cab2b454d2fc3b9f5a49 -->\n<!-- 01f0283c1ec0d3302a6336a9ab6d3b8b48cb1687 -->\n<!-- 3f3a43882f584444ad3ea0a084864cb7e48f4f5a -->\n<!-- e4ccad6223403e92e17e8038cb5c502dbc185e01 -->\n<!-- 8be153adcd4b25029d84cba12593ebc97a064916 -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->",
"Try to fix the missing `command_line` in the test file paths but pre-commit keeps failing due to the pyright issue. \r\nI will leave it a bit until the problem is solved globally or just drop the usage of pyright #3777 "
] | 2024-04-21T21:38:46
| 2024-08-03T19:01:57
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
## Summary
- Improve path logic
- Allow Chargemol to run in different directory (previously the code has implemented but is not working)
- Fix `os.path.isfile` bug. Change it into `os.path.exists`
## Todos
- add test
- Download chargemol and run real chargemol analysis. This should close #3474
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [ ] Tests added for new features/fixes.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Improved file handling and error checking in the charge calculation module.
- Renamed instances for clarity and added new test methods for enhanced error handling.
- Modified assertions and introduced patches for improved structure handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3778/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3778/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3778",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3778",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3778.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3778.patch",
"merged_at": null
}
|
||||
https://api.github.com/repos/materialsproject/pymatgen/issues/3779
|
https://api.github.com/repos/materialsproject/pymatgen
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3779/labels{/name}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3779/comments
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3779/events
|
https://github.com/materialsproject/pymatgen/pull/3779
| 2,256,572,020
|
PR_kwDOACgets5tWkth
| 3,779
|
Add fix for SFAC writer
|
{
"login": "stefsmeets",
"id": 873520,
"node_id": "MDQ6VXNlcjg3MzUyMA==",
"avatar_url": "https://avatars.githubusercontent.com/u/873520?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/stefsmeets",
"html_url": "https://github.com/stefsmeets",
"followers_url": "https://api.github.com/users/stefsmeets/followers",
"following_url": "https://api.github.com/users/stefsmeets/following{/other_user}",
"gists_url": "https://api.github.com/users/stefsmeets/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stefsmeets/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stefsmeets/subscriptions",
"organizations_url": "https://api.github.com/users/stefsmeets/orgs",
"repos_url": "https://api.github.com/users/stefsmeets/repos",
"events_url": "https://api.github.com/users/stefsmeets/events{/privacy}",
"received_events_url": "https://api.github.com/users/stefsmeets/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
[
{
"id": 5304335471,
"node_id": "LA_kwDOACgets8AAAABPCm8bw",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/io",
"name": "io",
"color": "c2e0c6",
"default": false,
"description": "Input/output functionality"
},
{
"id": 5318590534,
"node_id": "LA_kwDOACgets8AAAABPQNARg",
"url": "https://api.github.com/repos/materialsproject/pymatgen/labels/fix",
"name": "fix",
"color": "40DE1F",
"default": false,
"description": "Bug fix PRs"
}
] |
closed
| false
|
{
"login": "",
"id": 0,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "",
"user_view_type": "",
"site_admin": false
}
|
[] | null |
[
"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n## Walkthrough\nThe recent update in pymatgen's `io.res` module involves a significant change from using a set to a list for handling species in the `ResSFAC` class. This adjustment enhances the consistency and functionality of species indexing across the module. Additionally, a new test has been added to ensure that species are correctly handled and indexed, addressing a specific bug related to species indexing in the `ResWriter._ions_from_sites` method.\n\n## Changes\n\n| File Path | Change Summary |\n|--------------------------|------------------------------------------------------------------------------------------------------|\n| `pymatgen/io/res.py` | - Changed `species` attribute in `ResSFAC` from set to list<br>- Updated and refactored methods dealing with species handling |\n| `tests/io/test_res.py` | - Added `test_sfac_writer` to validate species indexing and string handling in `ResWriter._sfac_from_sites` |\n\n## Assessment against linked issues\n\n| Objective | Addressed | Explanation |\n|---------------------------------------------------------------------------|-----------|-------------|\n| Ensure species index matches the order in SFAC line, not atomic index (#3677) | ✅ | |\n\n## Poem\n\n> 🐇 Hop, hop, hooray! A change is here today! \n> 📜 From sets to lists, our code now twists, \n> 🐾 With careful tweaks and new technique, \n> 🌟 Ensuring all species are unique. \n> 🎉 Celebrate, for bugs we mitigate!\n\n<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->\n<!--\n\n\npymatgen/io/res.py: \n- Convert the `species` attribute in `ResSFAC` from a set to a list.\n- Update the `_parse_sfac` method to use a list for `species`.\n- Refactor the `_sfac_from_sites` method to handle species indexing and appending to a list for enhanced consistency and functionality in handling species information within the codebase.\n\ntests/io/test_res.py: \n- Add a new test method `test_sfac_writer` in the `test_res.py` file to test the `ResWriter._sfac_from_sites` method, checking specie numbers and species strings.\n\n-->\n<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->\n<!--\n\n\n### PR Objectives\n\nThis pull request (PR #3779) addresses a critical bug identified in issue #3677 related to the `ResWriter` class within the `pymatgen.io.res` module. The bug involves incorrect species indices in the sites listing, which do not match the SFAC listing as expected. This mismatch can lead to errors in applications relying on the correct ordering of species indices, such as in crystallographic and materials science computations.\n\nThe PR introduces several major changes to resolve this issue:\n1. **Fix for Species Indices**: The core of the fix ensures that the species indices in the sites listing correctly correspond to the order of elements in the SFAC line, rather than using the atomic index. This change is crucial for compatibility with other systems and standards in crystallography.\n\n2. **Code Refinements**:\n - The `species` attribute in `ResSFAC` has been changed from a set to a list to maintain a consistent order of species.\n - The `_parse_sfac` method has been updated to handle species as a list.\n - The `_sfac_from_sites` method has been refactored for better handling and consistency of species information.\n\n3. **Testing and Documentation**:\n - New tests have been added to ensure that the fixes work as expected and to prevent future regressions.\n - Documentation has been updated, including Google format doc strings and type annotations to improve code readability and maintainability.\n\nAdditionally, the PR includes instructions for setting up `pre-commit` hooks to help maintain code quality standards through automated checks for formatting and type annotations.\n\nThis PR not only fixes the reported bug but also enhances the overall functionality and reliability of the `ResWriter` class by ensuring that species indices are handled correctly and consistently throughout the module.\n\n### AI-Generated Summary of Generated Summaries\n\nThe modifications in the `pymatgen/io/res.py` file primarily focus on enhancing the handling and consistency of species information within the `ResWriter` class. Key changes include transitioning the `species` attribute in `ResSFAC` from a set to a list and refining the `_parse_sfac` and `_sfac_from_sites` methods to ensure accurate species indexing. These changes are complemented by the addition of a new test in `tests/io/test_res.py` to verify the correct functionality of the updated `_sfac_from_sites` method, particularly checking the specie numbers and species strings. This comprehensive update ensures that the species indices in the sites listing accurately reflect the SFAC listing, addressing the core issue reported in the linked bug.\n\n-->\n<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->\n\n<!-- 25071a7b6fed23afa92a537b330f40fd3fd4b0df -->\n\n<!-- commit_ids_reviewed_end --><!-- tips_start -->\n\n---\n\nThank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?\n\n<details>\n<summary>Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<details>\n<summary>Tips</summary>\n\n### Chat\n\nThere are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):\n\n- Review comments: Directly reply to a review comment made by CodeRabbit. Example:\n\t- `I pushed a fix in commit <commit_id>.`\n\t- `Generate unit testing code for this file.`\n\t- `Open a follow-up GitHub issue for this discussion.`\n- Files and specific lines of code (under the \"Files changed\" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:\n\t- `@coderabbitai generate unit testing code for this file.`\n\t-\t`@coderabbitai modularize this function.`\n- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:\n\t- `@coderabbitai generate interesting stats about this repository and render them as a table.`\n\t- `@coderabbitai show all the console.log statements in this repository.`\n\t- `@coderabbitai read src/utils.ts and generate unit testing code.`\n\t- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`\n\nNote: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.\n\n### CodeRabbit Commands (invoked as PR comments)\n\n- `@coderabbitai pause` to pause the reviews on a PR.\n- `@coderabbitai resume` to resume the paused reviews.\n- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.\n- `@coderabbitai resolve` resolve all the CodeRabbit review comments.\n- `@coderabbitai help` to get help.\n\n\nAdditionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.\n\n### CodeRabbit Configration File (`.coderabbit.yaml`)\n\n- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.\n- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.\n- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`\n\n### Documentation and Community\n\n- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.\n- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.\n- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.\n\n</details>\n\n<!-- tips_end -->"
] | 2024-04-22T13:40:15
| 2024-04-22T18:12:38
|
2024-04-22T16:10:54Z
|
CONTRIBUTOR
|
{
"total": 0,
"completed": 0,
"percent_completed": 0
}
|
This PR fixes a bug in the `ResWriter`.
Closes #3677
## Summary
Major changes:
- fix 1: Fixes an issue where the species indices in the sites listing did not match the SFAC listing
## Checklist
- [x] Google format doc strings added. Check with `ruff`.
- [x] Type annotations included. Check with `mypy`.
- [x] Tests added for new features/fixes.
- [x] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172))
Tip: Install `pre-commit` hooks to auto-check types and linting before every commit:
```sh
pip install -U pre-commit
pre-commit install
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Refactor**
- Enhanced handling of species information in the application for improved consistency and functionality.
- **Tests**
- Added new tests to ensure reliable species data management.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
{
"login": "janosh",
"id": 30958850,
"node_id": "MDQ6VXNlcjMwOTU4ODUw",
"avatar_url": "https://avatars.githubusercontent.com/u/30958850?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/janosh",
"html_url": "https://github.com/janosh",
"followers_url": "https://api.github.com/users/janosh/followers",
"following_url": "https://api.github.com/users/janosh/following{/other_user}",
"gists_url": "https://api.github.com/users/janosh/gists{/gist_id}",
"starred_url": "https://api.github.com/users/janosh/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janosh/subscriptions",
"organizations_url": "https://api.github.com/users/janosh/orgs",
"repos_url": "https://api.github.com/users/janosh/repos",
"events_url": "https://api.github.com/users/janosh/events{/privacy}",
"received_events_url": "https://api.github.com/users/janosh/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
}
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/issues/3779/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
}
|
https://api.github.com/repos/materialsproject/pymatgen/issues/3779/timeline
| null | true
| false
|
{
"url": "https://api.github.com/repos/materialsproject/pymatgen/pulls/3779",
"html_url": "https://github.com/materialsproject/pymatgen/pull/3779",
"diff_url": "https://github.com/materialsproject/pymatgen/pull/3779.diff",
"patch_url": "https://github.com/materialsproject/pymatgen/pull/3779.patch",
"merged_at": "2024-04-22T16:10:54Z"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.