Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
For a structure with decorated atomic charges, I would expect LammpsData.from_structure(structure, atom_style='charge') to read the atom charges from the structure. However, this is not the case and the charges are all assigned zero.
To Reproduce
from pymatgen.core import Structure
from pymatgen.io.lammps.data import LammpsData
cif = "# generated using pymatgen\ndata_NaCl\n_symmetry_space_group_name_H-M 'P 1'\n_cell_length_a 2.66700000\n_cell_length_b 2.66700000\n_cell_length_c 2.66700000\n_cell_angle_alpha 90.00000000\n_cell_angle_beta 90.00000000\n_cell_angle_gamma 90.00000000\n_symmetry_Int_Tables_number 1\n_chemical_formula_structural NaCl\n_chemical_formula_sum 'Na1 Cl1'\n_cell_volume 18.97007496\n_cell_formula_units_Z 1\nloop_\n _symmetry_equiv_pos_site_id\n _symmetry_equiv_pos_as_xyz\n 1 'x, y, z'\nloop_\n _atom_type_symbol\n _atom_type_oxidation_number\n Na+ 1.0\n Cl- -1.0\nloop_\n _atom_site_type_symbol\n _atom_site_label\n _atom_site_symmetry_multiplicity\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n _atom_site_occupancy\n Na+ Na0 1 0.00000000 0.00000000 0.00000000 1.0\n Cl- Cl1 1 0.50000000 0.50000000 0.50000000 1.0\n"
s = Structure.from_str(cif, fmt='cif')
print(s) ## each atom has charges
ld = LammpsData.from_structure(s, atom_style='charge')
ld.write_file('data.static')
Describe the bug
For a
structure
with decorated atomic charges, I would expectLammpsData.from_structure(structure, atom_style='charge')
to read the atom charges from thestructure
. However, this is not the case and the charges are all assigned zero.To Reproduce
The
data.static
file is as followsyou can see that the atom charges (the third column in
Atoms
) are all zeros.Expected behavior
Atom charges should not be zero if
structure
is decorated with atom charges.Desktop (please complete the following information):