Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printing labels from PeriodicSite in cif file #3701

Open
AndresOrtegaGuerrero opened this issue Mar 22, 2024 · 0 comments
Open

printing labels from PeriodicSite in cif file #3701

AndresOrtegaGuerrero opened this issue Mar 22, 2024 · 0 comments
Labels

Comments

@AndresOrtegaGuerrero
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant