cemd.build.GlassBuilder#

class GlassBuilder(density=None, composition=<factory>, structures=<factory>)[source]#

Bases: object

Blueprint 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

Build a standalone glass system from this blueprint.

from_elements

Create a blueprint from elemental composition.

from_oxides

Create a blueprint from oxide composition (alias for from_stoichiometry).

from_stoichiometry

Create a blueprint from stoichiometric coefficients.

get_actual_density

Calculate actual density for a given volume.

get_coefficient

Get the stoichiometric coefficient for a specific formula.

get_components

Get list of components in the composition.

get_elemental_composition

Get the elemental composition from the blueprint.

get_mass_per_formula_unit

Calculate mass per formula unit.

get_num_formula_units

Calculate number of formula units for a given volume.

get_total_charge

Calculate the total formal charge of the composition.

is_pure

Check if the blueprint contains only one component.

normalize

Normalize the composition so that the sum of coefficients equals 1.

Attributes

density

composition

structures