# SPDX-FileCopyrightText: 2026 Daru András # SPDX-License-Identifier: MIT """Exploratory cubic-symmetry fit to BCC lattice simulations.""" from pathlib import Path from rend import ( PostSearchChecks, ConstitutiveChecks, DeformationRange as Range, GroupWeighting, MaterialProfile, MaterialRegressor, StressUnit, ValidationRanges, ) CSV = "bcc.csv" if __name__ == "__main__": regressor = MaterialRegressor( csv_path=Path(__file__).with_name(CSV), name="BCC beam lattice – cubic surrogate", profile=MaterialProfile.COMPRESSIBLE_CUBIC, material_directions=((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)), stress_unit=StressUnit.KPA, max_generations=5000, # Use 500 for a first exploratory run. live_plot=False, # Set True to watch the search progress. verbose=True, target_mse=1e-3, validation_ranges=ValidationRanges( uniaxial=Range(0.74, 1.50), biaxial=Range(0.63, 1.30), planar=Range(0.935, 1.50), shear=Range(0.0, 0.50), volumetric=None, ), post_search_checks=PostSearchChecks( constitutive=ConstitutiveChecks( stress=True, tangent=False, objectivity=True, stress_covariance=False, material_symmetry=True, reference=False, domain=True, max_states=50, ), ), group_weighting=GroupWeighting(balance_tags=True), export_json=True, export_uhyper=False, ) result = regressor.run() if result.error: raise RuntimeError(result.error) if result.cancelled: raise SystemExit(130) print("Report:", result.report_path)