AtomicSystem.add_structure#
- AtomicSystem.add_structure(structure_to_add, distance=2.0, axis='z', vacuum=10.0)[source]#
Add a structure on top of this system.
This method adds any structure (droplet, liquid layer, molecule, etc.) on top of the current system along the specified axis. The structure is aligned by center of mass in the transverse directions and placed at the specified distance from the surface.
- Parameters:
- structure_to_addAtomicSystem or str
The structure to add. Can be an AtomicSystem object or a path to a file that can be loaded by AtomicSystem.from_file().
- distancefloat, default=2.0
Distance between the current system surface and the structure in Ångströms.
- axisstr, default=’z’
Axis along which to add the structure (‘x’, ‘y’, or ‘z’).
- vacuumfloat, default=10.0
Vacuum space added above the structure in Ångströms.
- Returns:
- Self
The updated system with the structure added.
Examples
>>> from cemd import AtomicSystem >>> >>> # Add a droplet from a file >>> surface = AtomicSystem.from_file("surface.lmp") >>> droplet = AtomicSystem.from_file("droplet.lmp") >>> system = surface.add_structure(droplet, distance=2.0, vacuum=10.0) >>> >>> # Add a structure from a file path (auto-loads) >>> system = surface.add_structure("droplet.lmp", distance=2.0) >>> >>> # Add a custom structure with different axis >>> system = surface.add_structure(molecule, axis='y', distance=3.0)