LAMMPS driver¶
MaxwellLink ships a C++ fix mxl for LAMMPS so classical molecular dynamics
jobs can exchange electric fields and dipole currents with the EM solver. The
sources live in maxwelllink.mxl_drivers.lammps alongside a convenience
installer.
Note
During the run the fix mxl connects to the SocketHub, receives the electric field,
applies
and returns
where \(Q_i\) and \(\mathbf{v}_i\) are the partial charge and velocity of atom \(i\).
Requirements¶
POSIX-like environment (the fix uses BSD sockets).
A LAMMPS build with atom IDs enabled and non-LJ units (such as
units realormetal).
Usage¶
Socket preparation¶
On the MaxwellLink side create a socket hub, for example in Meep:
hub = mxl.SocketHub(host="0.0.0.0", port=31415, timeout=60.0)
LAMMPS build helper¶
Use the bundled script to build a LAMMPS executable that contains the fix:
mxl_install_lammps
The script clones LAMMPS, copies fix_maxwelllink.cpp/.h into src/MISC,
and compiles an lmp_mxl binary placed on PATH. Advanced users may copy
the fix into an existing source tree and rebuild manually.
LAMMPS input¶
Add the fix to the group of atoms to be coupled:
fix 1 all mxl localhost 31415
Parameters¶
Name |
Description |
|---|---|
|
Hostname or IP address of the MaxwellLink process (third argument in the
|
|
TCP port exposed by |
|
Optional flag (append |
|
Optional flag (append |
Returned data¶
time_au– Simulation time in atomic units.mux_au,muy_au,muz_au– Molecular dipole components in atomic units at half a time step after the force evaluation time.mux_m_au,muy_m_au,muz_m_au– Molecular dipole components in atomic units at the force evaluation time.energy_au– Sum of kinetic and potential energy in atomic units.temp_K– Instantaneous temperature in Kelvin.pe_au– Potential energy contribution in atomic units (currently zero with pairwise-only setups).ke_au– Kinetic energy contribution in atomic units.
Notes¶
Ensure every atom has a charge (
Q) defined; otherwise the external force is zero.The fix forces neighbor-list rebuilds every step, matching the requirement of exchanging fields at the FDTD cadence.
See
maxwelllink.mxl_drivers.lammps.installfor scripting helpers that manage download and compilation.