AtomicSystem#
- class AtomicSystem(system_dict)[source]#
Bases:
EditMixin,IOMixin,TopologyMixin,ForceFieldMixinContainer storing the complete atomic system representation.
The class stores atomic coordinates, topology information (bonds, angles, dihedrals and impropers), simulation box parameters, atomic masses and charges, and force field parameters.
It is designed to represent the content of a LAMMPS data file and provides utilities for editing, analyzing and exporting atomistic systems.
- Parameters:
- system_dictdict[str, Any]
Dictionary containing the complete system data. See
cemd.core._format.SYSTEM_DICT_FORMATfor the authoritative, machine-checked list of required and optional keys; in summary:- Required keys:
- atomspandas.DataFrame
Per-atom data (type, charge, x, y, z), indexed by atom id.
- boxsequence
Simulation box, in any format accepted by
set_box().
- masses, chargesdict
Per-atom-type masses and charges.
- Optional keys:
- bonds, angles, dihedrals, improperspandas.DataFrame or None
Topology tables (atom_1..atom_N columns plus a “type” column).
- velocitiespandas.DataFrame or None
Atomic velocities (vx, vy, vz).
- atom_stylestr
LAMMPS atom style (default “full”).
Force-field keys/params, as produced by
ForceFieldKeys.to_system_dict()andForceFieldParams.to_system_dict().
Attributes
atoms
(pandas.DataFrame) Atomic information including coordinates, atom types and charges.
bonds
(pandas.DataFrame or None) Bond topology information.
angles
(pandas.DataFrame or None) Angle topology information.
dihedrals
(pandas.DataFrame or None) Dihedral topology information.
impropers
(pandas.DataFrame or None) Improper topology information.
velocities
(pandas.DataFrame or None) Atomic velocities when available.
forcefield_keys
(ForceFieldKeys) Centralized mapping between system types (atoms, bonds, etc.) and database keys.
forcefield_params
(ForceFieldParams) Centralized storage for all force field parameters (pair, bond, angle, dihedral, improper).
Properties#
Lattice parameters [a, b, c, alpha, beta, gamma]. |
|
Return the volume of the simulation box. |
|
Return the system density. |
|
Return the total system charge. |
|
Return the total system mass. |
|
Return atomic masses associated with atom types (read-only). |
|
Return atomic charges associated with atom types (read-only). |
|
Return a mapping of atom types to their elemental symbols (read-only). |
|
Return force-field keys for active topology types. |
|
Return force-field parameters for active topology types. |
|
Return the number of atoms. |
|
Return the number of bonds. |
|
Return the number of angles. |
|
Return the number of dihedrals. |
|
Return the number of impropers. |
|
Return the number of atom types. |
|
Return the number of bond types. |
|
Return the number of angle types. |
|
Return the number of dihedral types. |
|
Return the number of improper types. |
|
Return the list of unique atom types. |
|
Return the list of unique bond types. |
|
Return the list of unique angle types. |
|
Return the list of unique dihedral types. |
|
Return the list of unique improper types. |
Inspection#
Print a complete summary of the AtomicSystem. |
|
Calculate the exact number of atoms for a specific type. |
|
Calculates the center of mass (COM) of the system. |
|
Create an independent deep copy of the atomic system. |
|
Visualize the current system in VMD, with an optional trajectory. |
Input/Output#
Load a system from a file. |
|
Create from SMILES string. |
|
Load a structure from the Crystallography Open Database. |
|
Load a molecule from PubChem. |
|
Create from MDAnalysis Universe or AtomGroup. |
|
Create from Pymatgen Structure. |
|
Convert this AtomicSystem instance to an MDAnalysis Universe. |
|
Convert to Pymatgen Structure. |
|
Write the system to a file. |
Topology#
Assign new types to atoms via a mapping {old_type: new_type}. |
|
Assign a new type to a specific subset of atoms. |
|
Reset atom types to their corresponding chemical elements, inferred from mass. |
|
Apply a predefined style or custom rule(s) to the system. |
|
Remove all bonds, angles, dihedrals and impropers from the system. |
|
Remove specific connection types from the system. |
|
Keep only the specified connection types and remove all others. |
|
Guess angles, dihedrals and/or impropers directly from existing bonds. |
|
Guess only angles from existing bonds. |
|
Guess only dihedrals from existing bonds. |
|
Guess only impropers from existing bonds. |
|
Add a bond between two atoms. |
|
Add an angle between three atoms. |
|
Add a dihedral between four atoms. |
|
Add an improper between four atoms. |
Force Field#
Set or update the atomic masses for the system and the atoms DataFrame. |
|
Set or update the charges for the atomic system and the atoms DataFrame. |
|
Neutralize the system by spreading its excess charge over atom types. |
|
Interactive Forcefield Explorer using the prompt_toolkit UI pattern. |
|
Set pair-interaction parameters for two atom types. |
|
Calculate missing cross-interaction parameters. |
|
Set or update force-field keys for atom and connectivity types. |
|
Modifiers#
Add a structure on top of this system. |
|
Add a liquid layer on top of this system. |
|
Add a hemispherical liquid droplet on top of this system. |
|
Add a single atom. |
|
Add multiple atoms to the system in a single operation. |
|
Add a proton to a single atom. |
|
Add protons to multiple atoms in a single operation. |
|
Remove a single atom. |
|
Remove specified atoms from the system and update topology accordingly. |
|
Modify the coordinates of a single atom using a vector (x, y, z). |
|
Assign a new box to the system and compute all representations. |
|
Attempt to transform a triclinic (skewed) box into an orthogonal one. |
|
Unskew the box if the non-diagonal parameters of the box matrix \(|H_{i,j}| > H_{j,j}\) for \(i \neq j\) by adding \(\pm H_{j,:}\) to \(H_{i,:}\) while \(|H_{i,j}| > H_{j,j}\). |
|
Replicate the system by integer factors along the lattice vectors (a, b, c). |
|
Wraps all atoms back into the simulation box [0, L] using Periodic Boundary Conditions. |
|
Translates the system so its center of mass is at the center of the box. |