Molecule

open class Molecule(name: String, type: String?, netCharge: Int?)

A collection of atoms (possibly) connected together by covalent bonds.

This representation prioritizes flexibility over efficiency.

Constructors

Link copied to clipboard
fun Molecule(name: String, type: String? = null, netCharge: Int? = null)

Types

Link copied to clipboard
inner class Atoms : List<Atom>
Link copied to clipboard
inner class Bonds
Link copied to clipboard
object Companion
Link copied to clipboard
class DuplicateAtomNameException(id: String) : IllegalArgumentException
Link copied to clipboard
data class Searched(atom: Atom, dist: Int)

Functions

Link copied to clipboard
fun bfs(source: Atom, visitSource: Boolean = false, shouldVisit: (fromAtom: Atom, toAtom: Atom, dist: Int) -> Boolean = { _, _, _ -> true }): Iterable<Molecule.Searched>

Crawl the bond network in breadth-first order starting at the source atom.

Link copied to clipboard
open fun copy(): Molecule
Link copied to clipboard
fun copyTo(dst: Molecule): MoleculeMaps
Link copied to clipboard
open fun copyWithMaps(): Pair<Molecule, MoleculeMaps>

Copies the molecule and returns a map between the copied atoms, where A is this molecule and B is the copy.

Link copied to clipboard
fun dfs(source: Atom, visitSource: Boolean = false, shouldVisit: (fromAtom: Atom, toAtom: Atom, dist: Int) -> Boolean = { _, _, _ -> true }): Iterable<Molecule.Searched>

Crawl the bond network in depth-first order starting at the source atom.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun mapAtomsByNameTo(other: Molecule): AtomMap

Creates an atom map from this molecule to another molecule, assuming each atom name is unique. If the molecules are polymers, atom names need only be unique within a single residue.

Link copied to clipboard
fun mapAtomsByValueTo(other: Molecule): AtomMap

Creates an atom map from this molecule to another molecule, for only the atoms with identical values (ie, name, element, coordinates). Non-matching atoms will not be mapped.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val atoms: Molecule.Atoms
Link copied to clipboard
val bonds: Molecule.Bonds
Link copied to clipboard
var name: String

A human-readable description for the molecule.

Link copied to clipboard
var netCharge: Int? = null

a formal net charge for the molecule, used by some forcefields to parameterize small molecules

Link copied to clipboard
var type: String? = null

A machine-readable descrition for the molecule, often 3 characters long.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
suspend fun Molecule.calcModsAmber(types: AmberTypes, atomIndex: AtomIndex): String?
Link copied to clipboard
suspend fun Molecule.calcTypesAmber(molType: MoleculeType, atomIndex: AtomIndex, ffname: ForcefieldName = molType.defaultForcefieldNameOrThrow, generateCharges: AmberChargeGeneration? = null): AmberTypes

Calculate Amber types for atoms and bonds. Pass values to chargeMethod and netCharge to calculate partial charges for small molecules as well.

Link copied to clipboard
fun Molecule.deprotonate(atom: Atom)

Removes all bonded hydrogen atoms from the atom.

fun Molecule.deprotonate()

Removes all hydrogen atoms from the molecule.

Link copied to clipboard
fun Molecule.findProtonation(atom: Atom, numH: Int, hybridization: Hybridization): Protonation?
Link copied to clipboard
fun Molecule.findTypeOrThrow(): MoleculeType

Returns the type of the molecule based on AMBER rules for residue classification, or throws an exception.

Link copied to clipboard
fun Molecule.findTypes(): Set<MoleculeType>

Returns the types of the molecules in the Molecule instance based on AMBER rules for residue classification.

Link copied to clipboard
fun Molecule.guessBonds(guesser: BondGuesser = BondGuesser(), searchDist: Double = 5.0): List<BondGuesser.Bond>

Attempts to guess where the bonds should be based on known elemental valences and covalent bond lengths.

Link copied to clipboard
suspend fun Molecule.inferBondsAmber(): List<AtomPair>

Uses Amber forcefields to infer atom connectivity, but not bond order.

Link copied to clipboard
fun Molecule.inferBondsAmberBlocking(): List<AtomPair>
Link copied to clipboard
suspend fun Molecule.inferMissingAtomsAmber(): List<MissingAtom>

Uses Amber forcefields to infer missing heavy atoms and their positions.

Link copied to clipboard
fun Molecule.inferMissingAtomsAmberBlocking(): List<MissingAtom>
Link copied to clipboard
suspend fun Molecule.inferProtonation(): List<ProtonatedAtom>

Returns a list of heavy-hydrogen atom pairs based on inferred forcefield atom and bond types.

Link copied to clipboard
fun Molecule.inferProtonationBlocking(): List<ProtonatedAtom>
Link copied to clipboard
fun Molecule.mapTo(dst: Molecule): MoleculeMapper
Link copied to clipboard
fun Molecule.partition(combineSolvent: Boolean = true): List<Pair<MoleculeType, Molecule>>
Link copied to clipboard
fun Molecule.partitionAndAtomMap(combineSolvent: Boolean = true): Pair<List<Pair<MoleculeType, Molecule>>, AtomMap>

Partition a single Molecule into a list of Molecules based on AMBER rules for residue classification.

Link copied to clipboard
suspend fun Molecule.protonate(atom: Atom, protonation: Protonation)

Adds hydrogens atoms to the atom in the supplied protonation state.

Link copied to clipboard
fun Molecule.protonateBlocking(atom: Atom, protonation: Protonation)
Link copied to clipboard
fun Molecule.protonations(atom: Atom): List<Protonation>

Get all the supported protonation states for the specified atom.

Link copied to clipboard
fun Molecule.show(focusAtom: Atom? = null, wait: Boolean = false)
Link copied to clipboard
fun Molecule.toMol2(metadata: Mol2Metadata? = null): String

Save the molecule to the Mol2 format.

Link copied to clipboard
fun Molecule.toOMOL(): String
Link copied to clipboard
fun Molecule.toOspreyMol(throwOnNonChainPolymerAtoms: Boolean = false, translateSSasCYX: Boolean = false, translateHIStoEDP: Boolean = false): <ERROR CLASS>

Convert a Molscope molecule to an OSPREY molecule.

Link copied to clipboard
fun Molecule.toPDB(throwOnNonChainPolymerAtoms: Boolean = false, translateSSasCYX: Boolean = false, comment: String? = null, energy: Double? = null, includeTer: Boolean = false, includeSSBondConect: Boolean = false, translateHIStoEDP: Boolean = false): String

Save the molecule to PDB format.