PartialCharges

class PartialCharges(configuration)

Class for calculating the partial charges of a configuration with an attached classical calculator.

Parameters:configuration (BulkConfiguration) – The configuration for which the partial charges should be calculated.
evaluate(atom_index=None)

Return the partial charges of the selected atom or all atoms.

Parameters:atom_index (int) – Index of the selected atom.
Default: All atoms.
Returns:A single float if atom_index is not None, otherwise a list of floats.
Return type:float | list of float
metatext()
Returns:The metatext of the object or None if no metatext is present.
Return type:str | unicode | None
nlprint(stream=None)

Print a string containing an ASCII table useful for plotting the AnalysisSpin object.

Parameters:stream (python stream) – The stream the table should be written to.
Default: NLPrintLogger()
potentialName()

Return the name of the TremoloX potential for which the partial charges have been calculated.

Returns:The name of the TemoloX potential.
Return type:str
setMetatext(metatext)

Set a given metatext string on the object.

Parameters:metatext (str | unicode | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.

Usage Examples

Analyze the partial charges of a quartz crystal that are used in the TremoloXCalculator with a ReaxFFPotential:

# -------------------------------------------------------------
# Set up a SiO2-quartz crystal.
# -------------------------------------------------------------
lattice = Hexagonal(4.916*Angstrom, 5.4054*Angstrom)
elements = [Silicon, Silicon, Silicon, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen,
            Oxygen]

fractional_coordinates = [[ 0.4697,  0.0000,  0.00000 ],
                          [ 0.0000,  0.4697,  0.66667 ],
                          [ 0.5303,  0.5303,  0.33333 ],
                          [ 0.4135,  0.2669,  0.11910 ],
                          [ 0.2669,  0.4135,  0.547567],
                          [ 0.7331,  0.1466,  0.785767],
                          [ 0.5865,  0.8534,  0.214233],
                          [ 0.8534,  0.5865,  0.452433],
                          [ 0.1466,  0.7331,  0.8809  ]]

bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )

# Define the TremoloX-calculator with a ReaxFF-potential.
potentialSet = ReaxFF_CHONSiPtZrYBaTi_2013()
calculator = TremoloXCalculator(parameters=potentialSet)

bulk_configuration.setCalculator(calculator)
bulk_configuration.update()

# Set up the PartialCharges analysis object.
partial_charges = PartialCharges(bulk_configuration)

# Print the partial charges to the log file.
nlprint(partial_charges)

# Extract and store the partial charges into an array.
q = partial_charges.evaluate().inUnitsOf(elementary_charge)

partial_charges.py

Notes

The PartialCharges analysis object can only be used with the TremoloXCalculator. It returns the partial charges that are used by the coulomb solver (e.g. the CoulombDSF method) of the selected TremoloXPotentialSet.

If a ReaxFFPotential is used, where the partial charges are calculated via the charge equilibriation (QEq) method, the QEq method is invoked when the PartialCharges object is initialized.