Skip to content

ENH: Add support for database symmetry options #9

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions src/pycalphad_xml/CEF.rng
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@
</oneOrMore>
</element>
</optional>
<optional>
<element name="Symmetry">
<a:documentation>Specification of sublattice symmetry.</a:documentation>
<attribute name="type">
<choice>
<value>FCC_4SL</value>
<value>BCC_4SL</value>
</choice>
</attribute>
</element>
</optional>
</interleave>
</element>
<zeroOrMore>
Expand Down
5 changes: 4 additions & 1 deletion src/pycalphad_xml/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pycalphad.io.tdb import _sympify_string, _process_reference_state, to_interval
from pycalphad.io.tdb import _sympify_string, _process_reference_state, _symmetry_added_parameter, to_interval
from pycalphad import variables as v
from pycalphad import __version__ as pycalphad_version
from symengine import Piecewise, And, Symbol, S
Expand Down Expand Up @@ -360,6 +360,7 @@ def write_xml(dbf, fd, require_valid=True):
if ('symmetry_BCC_4SL' in model_hints.keys()):
if symmetry_node is not None:
raise ValueError('Multiple parameter symmetry options specified')
symmetry_node = objectify.SubElement(model_node, "Symmetry", type="BCC_4SL")
del model_hints['symmetry_BCC_4SL']
# ChemicalGroups
if "chemical_groups" in model_hints:
Expand All @@ -376,6 +377,8 @@ def write_xml(dbf, fd, require_valid=True):
raise ValueError('Not all model hints are supported: {}'.format(model_hints))

for param in dbf._parameters.all():
if _symmetry_added_parameter(dbf, param):
continue
phase_name = param['phase_name']
# Create phase implicitly if not defined
if phase_nodes.get(phase_name, None) is None:
Expand Down