Force field

Force field

The ff submodule includes functions to patch an existing force field with fluorophore and linker parameters. Functions prefixed with pymol should be executed from the PyMOL command line.

class fretlabel.ff.Molecule(moleculetype, atoms, bonds, angles, propers, impropers, atomtypes_molecule=None)[source]
change_type(name, new_type)[source]

Change atom type

Parameters
  • name (str)

  • new_type (str)

classmethod read_molecule(filename, comment=None)[source]

Alternative constructor of the Molecule class which parses an molecule itp file

Parameters
  • filename (str)

  • comment (str) – comment string to be added at the end of each line

remove_atom(name)[source]

Remove an atom from a molecule

Parameters

name (str)

save_rtp(filename)[source]
class fretlabel.ff.Parameters(atomtypes, bondtypes, constrainttypes, angletypes, propertypes, impropertypes)[source]
add2ff(ff_folder, outputdir='./')[source]

Update the forcefield parameter files ffnonbonded.itp and ffbonded.itp with a new parameter set Writes a copy of the forcefield files with the updated parameters to the current working directory

Parameters
  • ff_folder (str or path object) – folder where the original ffnonbonded.itp and ffbonded.itp are located

  • outputdir (str or path object) – directory

append(parameters)[source]
classmethod read_amberdyes(filelist)[source]
classmethod read_ff(filelist)[source]
classmethod read_frcmod(filename, atomtypes_molecule=None)[source]

# Note: units in AMBER frcmod are different from those in Gromacs! # frcmod: A, kcal/mol # Gromacs: nm, kJ/mol

classmethod read_specialbond(amberdyes, atoms_amberdyes, atoms_other, ff_name='AMBER-DYES')[source]

Alternative constructor of the Parameters class which creates bondtypes, angletypes and propertypes by similarity to existing parameters

Parameters
  • amberdyes (fretlabel.ff.Parameters instance)

  • atoms_amberdyes (dict) – dictionary with keys ‘bondtypes’, ‘angletypes’ and ‘propertypes’ and values defining the

  • comment (str) – comment string to be added at the end of each line

write_atp(filename)[source]

Write a atomtype force field file

Parameters

filename (str, optional)

fretlabel.ff.check_charge(filename, charge)[source]

Check the net charge of a mol2 file

Parameters
  • filename (str)

  • charge (float)

fretlabel.ff.pandasMol2_replace(from_df, to_df, replace_name, subst_value=None, match_name='atom_name')[source]

Replace columns from one dataframe to another

Parameters
  • from_df (pandas.Dataframe) – DataFrame to take values from

  • to_df (pandas.Dataframe) – DataFrame to replace with values

  • replace_name (str) – name of the column to be replaced

  • subst_value (str) – only replace rows having “subst_value” in the column “subst_name”

  • match_name (str) – column to be used as index for dataframe comparison

fretlabel.ff.pymol_couple_dye2baselinker(dye, baselinker, carbonylC_dye, align_baselinker_atoms, remove_baselinker_atoms, atom_dye='C99', atom_baselinker='N99')[source]

Couple a dye to an existing base-linker fragment

Parameters
  • dye (str)

  • baselinker (str)

  • remove_names (list) – list of atom names to remove

  • align_baselinker_atoms (list) – list of atom names of the dye to be used for alignment

  • align_baselinker_atoms (list) – list of atom names of the base-linker to be used for alignment

  • remove_baselinker_atoms (list) – list of atom names of the base-linker to be removed (i.e. capping group)

fretlabel.ff.pymol_save_molecule(filename, selection, fmt='mol2', state=- 1, overwrite=False)[source]

Save the molecule

Parameters
  • filename (str)

  • fmt (str) – format of the file (pdb or mol2)

  • state (int, optional) – current state = -1

  • overwrite (bool)

fretlabel.ff.pymol_savemol2(filename, molecule, pc_decimals=6, overwrite=False, state=- 1)[source]

Export the selection to a mol2 file with user-defined partial charge precision. The PyMOL built-in save function truncates the string to 3 decimals.

Parameters

pc_decimals (int) – number of decimals for partial charge

fretlabel.ff.update_dye_library(dye_entry, inputfile='dye_library.json', outputfile='dye_library.json', overwrite=False)[source]

Add new dye-linker fragment to the FRETlabel library

Parameters
  • dye_entry (dict) – dictionary of a dye entry such as: “filename”:”C3W_DTM”, “dye”:”sCy3”, “base”:”DT+RU”, “position”:”internal”

  • inputfile (str or path object, optional)

  • outputfile (str or path object, optional)

  • overwrite (bool)

fretlabel.ff.update_residuetypes(residuetypes_string, inputfile='residuetypes.dat', outputfile='residuetypes.dat', overwrite=False)[source]

Add new residue type

Parameters
  • residuetypes_string (str) – space-delimited string of following format: ‘residue type’

  • inputfile (str or path object, optional)

  • outputfile (str or path object, optional)

  • overwrite (bool)

fretlabel.ff.update_specbond(specbond_string, inputfile='specbond.dat', outputfile='specbond.dat', overwrite=False)[source]

Add new special bonds

Parameters
  • specbond_string (str) – space-delimited string of following format: ‘resA atomA nbondsA resB atomB nbondsB length newresA newresB’

  • inputfile (str or path object, optional)

  • outputfile (str or path object, optional)

  • overwrite (bool)

fretlabel.ff.update_valency(pandasMol2, bonds_atomNames)[source]

Update the valency of a set of bonds in a biopandas.mol2.pandas_mol2.PandasMol2 object

Parameters
  • pandasMol2 (biopandas.mol2.pandas_mol2.PandasMol2 instance)

  • bonds_atomNames (pandas.DataFrame) – Dataframe with columns ‘name1’, ‘resn1’, ‘name2’, ‘resn2’

Returns

pandasMol2 (biopandas.mol2.pandas_mol2.PandasMol2 instance)

fretlabel.ff.write_mol2(pandasMol2, filename=None, overwrite=False)[source]

Write a molecule in the TRIPOS mol2 format

Parameters
  • pandasMol2 (biopandas.mol2.pandas_mol2.PandasMol2 instance)

  • filename (str, optional)

fretlabel.ff.write_rtp(filename, molecules)[source]

Write a residue topology parameter (rtp) file

Parameters
  • filename (str)

  • molecule (list of ff.Molecule instances)