cemd.build.GlassBuilder#
- class GlassBuilder(density=None, composition=<factory>, structures=<factory>)[source]#
Bases:
objectBlueprint for creating a glass structure.
This blueprint defines WHAT the glass contains (composition), not HOW it is built (geometry). The geometry is determined by the builder or method that uses this blueprint.
- Parameters:
- densityfloat
Target density in g/cm³.
- compositiondict[str, float]
Dictionary mapping formula strings to stoichiometric coefficients. Can be elements (e.g., ‘Si’, ‘Al’), oxides (e.g., ‘SiO2’, ‘Al2O3’), or molecules (e.g., ‘H2O’).
- structuresdict, optional
Custom AtomicSystem structures for complex molecules.
Examples
>>> # Define a glass by elements >>> blueprint = GlassBuilder( ... density=2.3, ... composition={'Si': 3, 'Al': 4, 'Na': 4, 'O': 14} ... ) >>> glass = blueprint.build(box=[20, 20, 20]) >>> >>> # Define a glass by oxides >>> blueprint = GlassBuilder( ... density=2.3, ... composition={'SiO2': 3, 'Al2O3': 2, 'Na2O': 2} ... ) >>> glass = blueprint.build(box=[20, 20, 20]) >>> >>> # With water >>> blueprint = GlassBuilder( ... density=2.3, ... composition={'SiO2': 3, 'Al2O3': 2, 'Na2O': 2, 'H2O': 6} ... )
- __init__(density=None, composition=<factory>, structures=<factory>)#
Methods
Build a standalone glass system from this blueprint.
Create a blueprint from elemental composition.
Create a blueprint from oxide composition (alias for from_stoichiometry).
Create a blueprint from stoichiometric coefficients.
Calculate actual density for a given volume.
Get the stoichiometric coefficient for a specific formula.
Get list of components in the composition.
Get the elemental composition from the blueprint.
Calculate mass per formula unit.
Calculate number of formula units for a given volume.
Calculate the total formal charge of the composition.
Check if the blueprint contains only one component.
Normalize the composition so that the sum of coefficients equals 1.
Attributes
densitycompositionstructures