Skip to content

Commit

Permalink
ClexulatorWriter dump files quietly, because they are listed in gener…
Browse files Browse the repository at this point in the history
…ated_files later; Add validation warnings
  • Loading branch information
bpuchala committed Aug 28, 2024
1 parent 76a8ff0 commit e1569a2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
12 changes: 6 additions & 6 deletions casm/bset/clexwriter/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def write(

path = self.bset_dir / "cluster_functions.json.gz"
generated_files.append(path)
dump(builder.to_dict(), path, force=True, gz=True)
dump(builder.to_dict(), path, quiet=True, force=True, gz=True)

if verbose:
print("Building cluster functions DONE")
Expand Down Expand Up @@ -971,19 +971,19 @@ def write(
data = builder.basis_dict(
clex_basis_specs=clex_basis_specs, coordinate_mode="frac"
)
dump(data, path, force=True)
dump(data, path, quiet=True, force=True)

# write all template variables
path = self.bset_dir / "variables.json.gz"
generated_files.append(path)
dump(writer.variables(), path, force=True, gz=True)
dump(writer.variables(), path, quiet=True, force=True, gz=True)

## if local clexulators
if phenomenal is not None:
# write equivalents_info.json
path = self.bset_dir / "equivalents_info.json"
generated_files.append(path)
dump(builder.equivalents_info_dict(), path, force=True)
dump(builder.equivalents_info_dict(), path, quiet=True, force=True)

# write each local clexulator
self.local_src_path = []
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def write(
# write all template variables
path = local_dir / "variables.json"
generated_files.append(path)
dump(writer.variables(), path, force=True)
dump(writer.variables(), path, quiet=True, force=True)

# write generated_files.json (includes itself)
path = self.bset_dir / "generated_files.json"
Expand All @@ -1034,5 +1034,5 @@ def write(
data["local_src_path"] = [
str(p.relative_to(self.bset_dir)) for p in self.local_src_path
]
dump(data, path, force=True)
dump(data, path, quiet=True, force=True)
return None
30 changes: 28 additions & 2 deletions casm/bset/cluster_functions/_cluster_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,32 @@ class used is :class:`~casm.bset.cluster_functions.MakeVariableName`.

only_discrete = len(global_dof) + len(local_continuous_dof) == 0

# Validation
if len(local_discrete_dof) == 0:
if occ_site_basis_functions_specs is not None:
print(
"\n"
"****************************************************************\n"
"** Warning in ClusterFunctionsBuilder: **\n"
"** No local discrete DoF, but: **\n"
"** - occ_site_basis_functions_specs is not None **\n"
"** Will use occ_site_basis_functions_specs=None **\n"
"****************************************************************\n"
)
occ_site_basis_functions_specs = None
if len(global_dof + local_continuous_dof) > 0:
if global_max_poly_order is None and len(orbit_branch_max_poly_order) == 0:
print(
"\n"
"****************************************************************\n"
"** Warning in ClusterFunctionsBuilder: **\n"
"** Continuous DoF included, but: **\n"
"** - global_max_poly_order is None, and **\n"
"** - len(orbit_branch_max_poly_order) == 0 **\n"
"** Did you forget to set global_max_poly_order?? **\n"
"****************************************************************\n"
)

# Data
self._prim = prim
"""libcasm.configuration.Prim: The Prim, with symmetry information"""
Expand Down Expand Up @@ -931,12 +957,12 @@ class used is :class:`MakeVariableName`. Custom classes should have
`i_func`-th function on the cluster given by `clusters[i_orbit][i_equiv]`.
"""

n_functions = 0
n_functions = 1
for orbit_basis_set in orbit_basis_sets:
n_functions += len(orbit_basis_set[0])
self.n_functions = n_functions
"""int: The total number of symmetrically distinct cluster functions generated
for all clusters in all orbits."""
for all clusters in all orbits plus one (for the constant term)."""

self.clusters = orbit_clusters
"""list[list[libcasm.clusterography.Cluster]]: The clusters for which
Expand Down

0 comments on commit e1569a2

Please sign in to comment.