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

it_coordinate_system_code fix #153

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions easydiffraction/Interfaces/cryspyV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ def create(self, model: B) -> List[ItemContainer]:
)
# Interface with Spacegroup
elif issubclass(t_, SpaceGroup):
s_key = self.calculator.createSpaceGroup(key=model_key, name_hm_alt="P 1")
keys = {"hermann_mauguin": "name_hm_alt"}
name = model.name_hm_alt.raw_value
s_key = self.calculator.createSpaceGroup(key=model_key, name_hm_alt=name)
keys = {"hermann_mauguin": "name_hm_alt", "coordinate-code": "it_code"}

r_list.append(
ItemContainer(
s_key,
Expand Down
28 changes: 27 additions & 1 deletion easydiffraction/calculators/cryspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def __init__(self):
self._first_experiment_name = ""
self.exp_obj = None
self.chisq = None
self.hm_symbol = ""
self.it_code = ""
self.excluded_points = []
self._cryspyData = Data() # {phase_name: CryspyPhase, exp_name: CryspyExperiment}
self._cryspyObject = self._cryspyData._cryspyObj
Expand Down Expand Up @@ -218,8 +220,25 @@ def assignCell_toCrystal(self, cell_name: str, crystal_name: str):
crystal.cell = cell

def createSpaceGroup(
self, key: str = "spacegroup", name_hm_alt: str = "P 1"
self, key: str = "spacegroup", name_hm_alt: str = "", it_code: Optional[str] = ""
) -> str:
if not name_hm_alt and not self.hm_symbol:
rozyczko marked this conversation as resolved.
Show resolved Hide resolved
self.hm_symbol = "P 1"
if not name_hm_alt:
name_hm_alt = self.hm_symbol
else:
self.hm_symbol = name_hm_alt

if not it_code and not self.it_code:
self.it_code = "1"
rozyczko marked this conversation as resolved.
Show resolved Hide resolved
if not it_code:
it_code = self.it_code
else:
self.it_code = it_code

if it_code:
name_hm_alt += ":" + it_code

sg_split = name_hm_alt.split(":")
opts = {"name_hm_alt": sg_split[0]}
if len(sg_split) > 1:
Expand Down Expand Up @@ -262,6 +281,13 @@ def updateSpacegroup(self, sg_key: str, **kwargs):
break
sg_key = self.createSpaceGroup(key=sg_key, **kwargs)
self.assignSpaceGroup_toCrystal(sg_key, previous_key)
# here, the CIF has the new group, so reload
if not self.current_crystal:
return
if 'it_code' in kwargs:
cif = self.cif_str
self.updateModelCif(cif)
pass

def createAtom(self, atom_name: str, **kwargs) -> str:
atom = cryspy.AtomSite(**kwargs)
Expand Down