repESP.resp_wrapper module

Wrappers for performing ESP fitting with the resp program

run_resp(esp_data: repESP.esp_util.EspData, respin: repESP.respin_format.Respin, initial_charges: Optional[List[repESP.charges.Charge]] = None, generate_esout: bool = False, save_intermediates_to: Optional[str] = None) → List[repESP.charges.Charge][source]

Run the resp program with the given “respin” instructions

Parameters:
  • esp_data (EspData) – Object containing the data normally provided in the .esp file i.e. atom coordinates and ESP field values at the points to be used in the fitting.
  • respin (Respin) – Instructions for the fitting in the resp program input format.
  • initial_charges (Optional[typing.List[Charge]], optional) – Initial charges to be used for the fitting, which may be required by the fitting method or may simply be provided as an initial guess for the fitting algorithm. ValueError will be raised if the respin argument specifies that initial charges are expected (iqopt not equal to 1) but this argument is not provided. Defaults to None.
  • generate_esout (bool, optional) – Whether to produce an “esout” file containing the ESP field values at the fitting points, reproduced from the fitted charges. This can also be achieved with the repESP library and thus shouldn’t be necessary. Defaults to False. If this option is set to True, the user should also set the save_intermediates_to option, otherwise the “esout” file will not be accessible.
  • save_intermediates_to (Optional[str], optional) – Which directory to save the resp program output to. The directory must not exist and will be created by the program. If the user does not require access to the files, this option should remain at the default of None. The calculation will then be run in the OS temporary directory.
Returns:

The charges fitted using the resp program according to the “respin” instructions.

Return type:

typing.List[Charge]

run_two_stage_resp(esp_data: repESP.esp_util.EspData, respin1: repESP.respin_format.Respin, respin2: repESP.respin_format.Respin, initial_charges: Optional[List[repESP.charges.Charge]] = None, generate_esout: bool = False, save_intermediates_to: Optional[str] = None) → List[repESP.charges.Charge][source]

Apply the two-stage procedure to fit RESP charges

This function takes the two “respin” files, as this is the simplest way to provide information about equivalence as well as methyl and methylene groups. Another interface is possible where this information is provided directly and may be provided in the future.

Parameters:
  • esp_data (EspData) – See run_resp function parameter
  • respin1 (Respin) – Instructions for 1st stage RESP fitting.
  • respin2 (Respin) – Instructions for 2nd stage RESP fitting.
  • initial_charges (Optional[typing.List[Charge]], optional) – See run_resp function parameter
  • generate_esout (bool, optional) – See run_resp function parameter
  • save_intermediates_to (Optional[str], optional) – See run_resp function parameter
Returns:

The fitted two-stage RESP charges.

Return type:

typing.List[Charge]

fit_with_equivalencing(esp_data: repESP.esp_util.EspData, equivalence: repESP.equivalence.Equivalence, molecule: repESP.types.Molecule[repESP.types.Atom][repESP.types.Atom], total_charge: int, initial_charges: Optional[List[repESP.charges.Charge]] = None, generate_esout: bool = False, save_intermediates_to: Optional[str] = None) → List[repESP.charges.Charge][source]

Fit charges to the provided ESP subject to equivalence relations

Parameters:
  • esp_data (EspData) – See run_resp function parameter
  • equivalence (Equivalence) – The chemical equivalence relations between atoms of the molecule.
  • molecule (Molecule[Atom]) – The molecule which charges are being fitted. Only atom identities are required.
  • total_charge (int) – The total charge of the molecule.
  • initial_charges (Optional[typing.List[Charge]], optional) – See run_resp function parameter
  • generate_esout (bool, optional) – See run_resp function parameter
  • save_intermediates_to (Optional[str], optional) – See run_resp function parameter
Returns:

The charges fitted to the provided ESP subject to equivalence relations.

Return type:

typing.List[Charge]

fit_hydrogens_only(esp_data: repESP.esp_util.EspData, equivalence: repESP.equivalence.Equivalence, molecule: repESP.types.Molecule[repESP.types.Atom][repESP.types.Atom], total_charge: int, initial_charges: List[repESP.charges.Charge], generate_esout: bool = False, save_intermediates_to: Optional[str] = None) → List[repESP.charges.Charge][source]

Fit hydrogen atom charges to the provided ESP subject to equivalence relations

Parameters:
  • esp_data (EspData) – See run_resp function parameter
  • equivalence (Equivalence) – The chemical equivalence relations between atoms of the molecule.
  • molecule (Molecule[Atom]) – The molecule which charges are being fitted. Only atom identities are required.
  • total_charge (int) – The total charge of the molecule.
  • initial_charges (typing.List[Charge]) – Initial charges to be used for the fitting. Charges on atoms other than hydrogen atoms will be fixed at the provided values.
  • generate_esout (bool, optional) – See run_resp function parameter
  • save_intermediates_to (Optional[str], optional) – See run_resp function parameter
Returns:

The hydrogen charges fitted to the provided ESP subject to equivalence relations. Other charges have values fixed at values from initial_charges.

Return type:

typing.List[Charge]

fit_with_frozen_atoms(esp_data: repESP.esp_util.EspData, equivalence: repESP.equivalence.Equivalence, molecule: repESP.types.Molecule[repESP.types.Atom][repESP.types.Atom], frozen_atoms: List[int], total_charge: int, initial_charges: List[repESP.charges.Charge], generate_esout: bool = False, save_intermediates_to: Optional[str] = None) → List[repESP.charges.Charge][source]

Fit hydrogen atom charges to the provided ESP subject to equivalence relations

Parameters:
  • esp_data (EspData) – See run_resp function parameter
  • equivalence (Equivalence) – The chemical equivalence relations between atoms of the molecule.
  • molecule (Molecule[Atom]) – The molecule which charges are being fitted. Only atom identities are required.
  • frozen_atoms (List[int]) – List of zero-based indices of atoms in the molecule which charges should not be fitted but fixed at the values provided in initial_charges argument.
  • total_charge (int) – The total charge of the molecule.
  • initial_charges (typing.List[Charge]) – Initial charges to be used for the fitting. Charges on atoms specified in the frozen_atoms arguments will be fixed at the provided values.
  • generate_esout (bool, optional) – See run_resp function parameter
  • save_intermediates_to (Optional[str], optional) – See run_resp function parameter
Returns:

The charges fitted to the provided ESP subject to equivalence relations, except where the charges were frozen at initial values.

Return type:

typing.List[Charge]