Comments (5)
@bpuchala Would you be able to submit a fix for this that implements the type promotion so we can see if there are any unintended downstream implications?
Sorry, I'm just a user here :)
from pymatgen.
Oh dear, loss of symmetry in __eq__
is pretty serious, esp. in the core Structure
class.
@bpuchala Thanks for reporting and thanks for finding the root cause! 🙏
I'm in favor of making Structure.__eq__
more discriminative by promoting Elements
to Species
with oxi state 0 so that
element_structure == species_structure
>>> False
# and
species_structure == element_structure
>>> False
but I'm interested to hear @shyuep and @mkhorton's opinions.
@bpuchala Would you be able to submit a fix for this that implements the type promotion so we can see if there are any unintended downstream implications?
from pymatgen.
I would just fix Element such that it only equates equal to Element and not Specie. I dislike the ElementBase implementation. I think it overcomplicates matters relative to just a straight Enum.
from pymatgen.
I would just fix Element such that it only equates equal to Element and not Specie.
That's already the case.
from pymatgen.core import Element, Species
Element('O') == Species('O')
>>> False
I dislike the
ElementBase
implementation. I think it overcomplicates matters relative to just a straight Enum.
I've said the same thing in the past. IIRC @mkhorton had some reservations about that.
from pymatgen.
@janosh No, that wasn't the case. Species("Fe", 0) == Element("Fe") but Element("Fe") != Species("Fe", 0). That was the whole crux of the issue reported. I already pushed a fix.
from pymatgen.
Related Issues (20)
- how to load an MD from LAMMPS into a Trajectory object?
- VASP noncollinear Wavecar read error HOT 1
- Is it possible to reduce the size of `tests` directory? HOT 6
- Importing Trajectory from pymatgen.core.trajectory gives an NameError on latest release (2024.2.20) HOT 2
- Can no longer import some modules without having ASE installed HOT 2
- broken BSPlotterProjected.get_projected_plots_dots_patom_pmorb
- [Dev] Tests for `Bader` not running properly HOT 12
- `Structure.replace_species` leaves label intact resulting in confusing/misleading label HOT 1
- My kernel keeps dying when importing CifParser HOT 8
- Robustness of `Poscar` parser should be further improved HOT 4
- Improper parsing of `METAGGA` flag in `Vasprun` parser HOT 3
- `MSONAtoms` may not serialize appropriately if the `.info` flag is populated HOT 1
- POTCAR setting problem HOT 1
- Bug in `ResWriter._ions_from_sites` in `pymatgen.io.res` HOT 5
- get_pmg_structure returns magnetic moments under site_properties key "magnetic_moments" instead of "magmom" HOT 2
- Create monolayer MoS2 from the bulk.
- Has the `CoherentInterfaceBuilder` class considered the issue of deduplication for equivalent structures?
- [Dev] Multiple dependencies for CI missing HOT 5
- Fatband plot with lobster: not only vasp should be supported
- Ion.oxi_state_guesses fails for 'Br' or 'Br(aq)'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymatgen.