pub struct AtomCollectionBuilder<T, S>where
    T: ModelInfo,
    S: BuildState,
{ /* private fields */ }

Implementations§

Examples found in repository?
src/model_type/msi.rs (line 83)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 318)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }

Supply the element_symbols for an AtomCollection.

Errors

This function will return an error if the element_ids has a different vector size with the builder’s given size.

Examples found in repository?
src/model_type/msi.rs (line 85)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 322)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }

Supply the atomic_nums for an AtomCollection.

Errors

This function will return an error if the element_ids has a different vector size with the builder’s given size.

Examples found in repository?
src/model_type/msi.rs (line 87)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 324)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }

Supply the xyz_coords for an AtomCollection.

Errors

This function will return an error if the xyz_coords has a different vector size with the builder’s given size.

Examples found in repository?
src/model_type/msi.rs (line 89)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 326)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }

Supply the fractional_xyz for an AtomCollection.

Errors

This function will return an error if the fractional_xyz has a different vector size with the builder’s given size.

Examples found in repository?
src/model_type/msi.rs (line 91)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 328)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }

Supply the atom_ids for an AtomCollection.

Errors

This function will return an error if the atom_ids has a different vector size with the builder’s given size.

Examples found in repository?
src/model_type/msi.rs (line 93)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 320)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
Examples found in repository?
src/model_type/msi.rs (line 95)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 330)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
Examples found in repository?
src/model_type/msi.rs (line 97)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/parser/msi_parser/state_machine/mod.rs (line 332)
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
    fn parse_atoms(&self) -> AtomCollection<MsiModel> {
        let mut element_symbols: Vec<String> = Vec::with_capacity(self.num_atom);
        let mut atomic_numbers: Vec<u8> = Vec::with_capacity(self.num_atom);
        let mut xyz_coords: Vec<Point3<f64>> = Vec::with_capacity(self.num_atom);
        let mut atom_ids: Vec<u32> = Vec::with_capacity(self.num_atom);
        let frac_xyz: Vec<Option<Point3<f64>>> =
            (0..self.num_atom).into_iter().map(|_| None).collect();
        self.atoms.iter().for_each(|atom_fields| {
            let (_, atom_attrs) = many0(Self::take_attribute)(atom_fields).unwrap();
            atom_attrs.iter().for_each(|item| {
                if let Ok((_, acl)) = parse_acl(item) {
                    let (num, symbol) = acl;
                    atomic_numbers.push(num);
                    element_symbols.push(symbol.into());
                } else if let Ok((_, xyz)) = parse_xyz(item) {
                    xyz_coords.push(xyz);
                } else if let Ok((_, id)) = parse_id(item) {
                    atom_ids.push(id);
                } else {
                }
            })
        });
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(self.num_atom);
        builder
            .with_atom_ids(&atom_ids)
            .unwrap()
            .with_element_symbols(&element_symbols)
            .unwrap()
            .with_atomic_nums(&atomic_numbers)
            .unwrap()
            .with_xyz_coords(&xyz_coords)
            .unwrap()
            .with_fractional_xyz(&frac_xyz)
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.