4.3. ligandparam.stages.gaussian

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

Bases: AbstractStage

Run a basic Gaussian calculation on the ligand, including minimization and ESP calculation for RESP charges.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – Path to the input mol2 file.

  • cwd (Union[Path, str]) – Current working directory.

  • out_gaussian_log (str) – Path to the output Gaussian log file.

  • opt_theory (str, optional) – Theory for optimization (default: ‘PBE1PBE/6-31G*’).

  • resp_theory (str, optional) – Theory for RESP calculation (default: ‘HF/6-31G*’).

  • net_charge (float, optional) – Net charge for the molecule (default: 0.0).

  • force_gaussian_rerun (bool, optional) – Whether to force rerun of Gaussian (default: False).

  • minimize (bool, optional) – Whether to perform minimization (default: True).

in_mol2

Path to the input mol2 file.

Type:

Path

out_gaussian_log

Path to the output Gaussian log file.

Type:

Path

opt_theory

Theory for optimization.

Type:

str

resp_theory

Theory for RESP calculation.

Type:

str

net_charge

Net charge for the molecule.

Type:

float

force_gaussian_rerun

Whether to force rerun of Gaussian.

Type:

bool

gaussian_cwd

Directory for Gaussian calculations.

Type:

Path

minimize

Whether to perform minimization.

Type:

bool

label

Label for the calculation.

Type:

str

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian calculations.

list_files_in_directory(directory)

List all the files in a directory.

setup(name_template)

Set up Gaussian input and output files for the calculation.

Initialize the AbstractStage.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – The main input file for the stage.

  • cwd (Union[Path, str]) – The current working directory for the stage.

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian calculations.

list_files_in_directory(directory)

List all the files in a directory.

setup(name_template)

Set up Gaussian input and output files for the calculation.

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

Execute the Gaussian calculations.

Parameters:

dry_run (bool, optional) – If True, the stage will not be executed, but the function will print the commands that would

Return type:

None

setup(name_template: str) bool[source]

Set up Gaussian input and output files for the calculation.

Parameters:

name_template (str) – Template name for input/output files.

Returns:

True if Gaussian calculation is already complete, False otherwise.

Return type:

bool

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

Bases: AbstractStage

Run a basic Gaussian calculation on the ligand (RESP calculation only).

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – Path to the input mol2 file.

  • cwd (Union[Path, str]) – Current working directory.

  • out_gaussian_log (str) – Path to the output Gaussian log file.

  • resp_theory (str, optional) – Theory for RESP calculation (default: ‘HF/6-31G*’).

  • net_charge (float, optional) – Net charge for the molecule (default: 0.0).

  • force_gaussian_rerun (bool, optional) – Whether to force rerun of Gaussian (default: False).

in_mol2

Path to the input mol2 file.

Type:

Path

out_gaussian_log

Path to the output Gaussian log file.

Type:

Path

resp_theory

Theory for RESP calculation.

Type:

str

net_charge

Net charge for the molecule.

Type:

float

force_gaussian_rerun

Whether to force rerun of Gaussian.

Type:

bool

gaussian_cwd

Directory for Gaussian calculations.

Type:

Path

label

Label for the calculation.

Type:

str

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian calculations.

list_files_in_directory(directory)

List all the files in a directory.

setup(name_template)

Set up Gaussian input and output files for the RESP calculation.

Initialize the AbstractStage.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – The main input file for the stage.

  • cwd (Union[Path, str]) – The current working directory for the stage.

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian calculations.

list_files_in_directory(directory)

List all the files in a directory.

setup(name_template)

Set up Gaussian input and output files for the RESP calculation.

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

Execute the Gaussian calculations.

Parameters:

dry_run (bool, optional) – If True, the stage will not be executed, but the function will print the commands that would

Return type:

None

setup(name_template: str) bool[source]

Set up Gaussian input and output files for the RESP calculation.

Parameters:

name_template (str) – Template name for input/output files.

Returns:

True if Gaussian calculation is already complete, False otherwise.

Return type:

bool

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

Bases: AbstractStage

Rotate the ligand and run Gaussian calculations of the RESP charges for each rotated ligand.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – Path to the input mol2 file.

  • cwd (Union[Path, str]) – Current working directory.

  • out_gaussian_label (str) – Label for the output Gaussian files.

  • alpha (list) – List of alpha angles to rotate the ligand.

  • beta (list) – List of beta angles to rotate the ligand.

  • gamma (list) – List of gamma angles to rotate the ligand.

  • opt_theory (str, optional) – Theory for optimization (default: ‘HF/6-31G*’).

  • resp_theory (str, optional) – Theory for RESP calculation (default: ‘HF/6-31G*’).

  • net_charge (float, optional) – Net charge for the molecule (default: 0.0).

  • force_gaussian_rerun (bool, optional) – Whether to force rerun of Gaussian (default: False).

in_mol2

Path to the input mol2 file.

Type:

Path

out_gaussian_label

Label for the output Gaussian files.

Type:

str

alpha

List of alpha angles to rotate the ligand.

Type:

list

beta

List of beta angles to rotate the ligand.

Type:

list

gamma

List of gamma angles to rotate the ligand.

Type:

list

opt_theory

Theory for optimization.

Type:

str

resp_theory

Theory for RESP calculation.

Type:

str

net_charge

Net charge for the molecule.

Type:

float

force_gaussian_rerun

Whether to force rerun of Gaussian.

Type:

bool

gaussian_cwd

Directory for Gaussian calculations.

Type:

Path

in_com_template

Template for input Gaussian .com files.

Type:

Path

xyz

Path to the output XYZ file for rotations.

Type:

Path

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian calculations for the rotated ligands.

list_files_in_directory(directory)

List all the files in a directory.

setup(name_template)

Set up Gaussian input and output files for the rotation calculations.

write_rotation(coords, name_template)

Write the rotated coordinates to a trajectory file.

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

Execute the Gaussian calculations for the rotated ligands.

Parameters:

dry_run (bool, optional) – If True, the stage will not be executed, but the function will print the commands that would

setup(name_template: str) bool[source]

Set up Gaussian input and output files for the rotation calculations.

Parameters:

name_template (str) – Template name for input/output files.

Returns:

Always returns False (rotation calculations are not pre-completed).

Return type:

bool

write_rotation(coords, name_template: str)[source]

Write the rotated coordinates to a trajectory file.

Parameters:
  • coords (list) – List of rotated coordinates.

  • name_template (str) – Template name for the output file.

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

Bases: AbstractStage

Convert Gaussian output to mol2 format and assign charges to the mol2 file.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – Path to the input Gaussian log file.

  • cwd (Union[Path, str]) – Current working directory.

  • template_mol2 (str) – Path to the template mol2 file.

  • out_mol2 (str) – Path to the output mol2 file.

  • net_charge (float, optional) – Net charge for the molecule (default: 0.0).

  • atom_type (str, optional) – Atom type (default: ‘gaff2’).

  • force_gaussian_rerun (bool, optional) – Whether to force rerun of Gaussian (default: False).

in_log

Path to the input Gaussian log file.

Type:

Path

template_mol2

Path to the template mol2 file.

Type:

Path

out_mol2

Path to the output mol2 file.

Type:

Path

temp1_mol2

Path to the first temporary mol2 file.

Type:

Path

temp2_mol2

Path to the second temporary mol2 file.

Type:

Path

net_charge

Net charge for the molecule.

Type:

float

atom_type

Atom type.

Type:

str

force_gaussian_rerun

Whether to force rerun of Gaussian.

Type:

bool

gaussian_cwd

Directory for Gaussian calculations.

Type:

Path

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian to mol2 conversion.

list_files_in_directory(directory)

List all the files in a directory.

remove_blank_lines(file_path)

Remove blank lines from a file.

setup(name_template)

Set up required files and headers for Gaussian to mol2 conversion.

Initialize the AbstractStage.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – The main input file for the stage.

  • cwd (Union[Path, str]) – The current working directory for the stage.

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the Gaussian to mol2 conversion.

list_files_in_directory(directory)

List all the files in a directory.

remove_blank_lines(file_path)

Remove blank lines from a file.

setup(name_template)

Set up required files and headers for Gaussian to mol2 conversion.

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

Execute the Gaussian to mol2 conversion.

Parameters:

dry_run (bool, optional) – If True, the stage will not be executed, but the function will print the commands that would

Return type:

None

remove_blank_lines(file_path)[source]

Remove blank lines from a file.

Parameters:

file_path (str) – The path to the file to remove blank lines from

Return type:

None

setup(name_template: str) bool[source]

Set up required files and headers for Gaussian to mol2 conversion.

Parameters:

name_template (str) – Template name for input/output files.

Returns:

Always returns None (setup does not check completion).

Return type:

bool