(CHARGES-target)= # CHARGES Exchange atomic charge information. ## >CHARGES Send atomic charges. **Datatype:** `MDI_DOUBLE` **Quantity**: `NATOMS` **Units:** elementary charge ({math}`e`) **Format:** Sequentially ascending order of atomic index The driver sends a set of atomic charges to the engine, which replaces its atomic charges with those sent by the driver. ### Examples ::::{tab-set} :::{tab-item} Python :sync: python ```python import mdi import numpy as np # connect to the engine mdi_engine = mdi.MDI_Accept_Communicator() # retrieve the number of atoms mdi.MDI_Send_Command("CHARGES", mdi_engine) mdi.MDI_Send(charges, natoms, mdi.MDI_DOUBLE, mdi_engine) ``` ::: :::{tab-item} Python (NumPy) :sync: python (numpy) ```python import mdi import numpy as np # connect to the engine mdi_engine = mdi.MDI_Accept_Communicator() # retrieve the number of atoms mdi.MDI_Send_Command("CHARGES", mdi_engine) mdi.MDI_Send(charges, natoms, mdi.MDI_DOUBLE, mdi_engine) ``` ::: :::{tab-item} C++ :sync: cpp ```cpp #include "mdi.h" #include // connect to the engine MDI_Comm mdi_engine = MDI_Accept_Communicator(); // retrieve the number of atoms int natoms; MDI_Send_Command(" charges(natoms); // fill the array with charges. // send the atomic charges to the engine MDI_Send_Command(">CHARGES", mdi_engine); MDI_Send(charges.data(), natoms, MDI_DOUBLE, mdi_engine); ``` ::: :::: ## // connect to the engine MDI_Comm mdi_engine = MDI_Accept_Communicator(); // retrieve the number of atoms int natoms; MDI_Send_Command(" charges(natoms); // receive the atomic charges from the engine MDI_Send_Command("