4.2. ligandparam.stages.charge

class ligandparam.stages.charge.StageNormalizeCharge(stage_name: str, main_input: Path | str, cwd: Path | str, *args, **kwargs)[source]

Bases: AbstractStage

This class normalizes the charges to the net charge.

This class works by calculating the charge difference, and then normalizing the charges based on the overall precision that you select, by adjusting each atom charge by the precision until the charge difference is zero.

Methods

add_required(filename)

Add a required file to the stage.

check_charge(charges)

This function checks the total charge and the charge difference.

execute([dry_run, nproc, mem])

Execute the stage.

list_files_in_directory(directory)

List all the files in a directory.

normalize(charges, charge_difference)

This function normalizes the charges to the net charge.

append_stage

clean

check_charge(charges)[source]

This function checks the total charge and the charge difference.

Parameters:

charges (np.array) – The charges

Returns:

  • total_charge (float) – The total charge

  • charge_difference (float) – The charge difference

execute(dry_run=False, nproc: int | None = None, mem: int | None = None) Any[source]

Execute the stage.

Raises:
  • ValueError – If the charge normalization fails

  • TODO – Check what happens when netcharge is nonzero:

  • TODO – Check what happens when charge difference is larger than the number of atoms:

normalize(charges, charge_difference)[source]

This function normalizes the charges to the net charge.

Parameters:
  • charges (np.array) – The charges

  • charge_difference (float) – The charge difference

Returns:

charges – The normalized charges

Return type:

np.array

class ligandparam.stages.charge.StageUpdateCharge(stage_name: str, main_input: Path | str, cwd: Path | str, *args, **kwargs)[source]

Bases: AbstractStage

This class creates a new mol2 file with updated charges.

Methods

add_required(filename)

Add a required file to the stage.

list_files_in_directory(directory)

List all the files in a directory.

append_stage

clean

execute

execute(dry_run=False, nproc: int | None = None, mem: int | None = None) Any[source]