PoreMS 0.3
  • API
  • Molecule
  • Pore
  • Workflow
  • Pore shape examples
  • Site
    • Page
        • Molecule
          • Molecule
    • Molecule
      • Molecule
    Source

    Molecule¶

    class porems.molecule.Molecule(name='molecule', short='MOL', inp=None)¶

    This class defines a molecule object, which is basically a list of Atom objects. Each atom object has a specific cartesian position and atom type, creating the construct of a molecule.

    Functions have been provided for editing, moving and transforming the atom objects, either as a collective or specific part of the molecule.

    Parameters:
    namestring, optional

    Molecule name

    shortstring, optional

    Molecule short name

    inpNone, string, list, optional

    None for empty Molecule, string to read a molecule from a specified file link or a list of either molecules to concatenate these into one object, or a list of atom objects

    Examples

    Following example generates a benzene molecule without hydrogen atoms

    import porems as pms
    
    mol = pms.Molecule("benzene", "BEN")
    mol.add("C", [0,0,0])
    mol.add("C", 0, r=0.1375, theta= 60)
    mol.add("C", 1, r=0.1375, theta=120)
    mol.add("C", 2, r=0.1375, theta=180)
    mol.add("C", 3, r=0.1375, theta=240)
    mol.add("C", 4, r=0.1375, theta=300)
    

    Methods

    _box_size()

    Calculate the box size of the current molecule.

    _concat(mol_list)

    Concatenate a molecule list into one molecule object.

    _read(file_path, file_type)

    Read a molecule from a file.

    _temp(atoms)

    Create a temporary molecule of specified atom ids.

    _vector(pos_a, pos_b)

    Calculate the vector between to two positions as defined in porems.geometry.vector with the addition to define the inputs as atom indices.

    add(atom_type, pos[, bond, r, theta, phi, ...])

    Add a new atom in polar coordinates.

    append(mol)

    Append a given molecule to the current object.

    bond(inp_a, inp_b)

    Return the bond vector of a specified bond.

    centroid()

    Calculate the geometrical center of mass

    column_pos()

    Create column list of atom positions

    com()

    Calculate the center of mass

    delete(atoms)

    Delete specified atom from the molecule.

    get_atom_list()

    Return the atoms list.

    get_atom_type(atom)

    Return the atom type of the given atom id.

    get_box()

    Return the box size of the molecule.

    get_charge()

    Return the total charge of the molecule.

    get_mass()

    Return the molar mass of the molecule.

    get_masses()

    Return a list of masses of the atoms.

    get_name()

    Return the molecule name.

    get_num()

    Return the number of atoms.

    get_short()

    Return the molecule short name.

    move(atom, pos)

    Move whole the molecule to a new position, where the dragging point is a given atom that is moved to a specified position.

    overlap([error])

    Search for overlapping atoms.

    part_angle(bond_a, bond_b, atoms, angle, zero)

    Change the bond angle of two bond vectors.

    part_move(bond, atoms, length[, vec])

    Change the length of a specified bond.

    part_rotate(bond, atoms, angle, zero)

    Rotate a set of specified atoms around a given bond as the rotation axis.

    pos(atom)

    Get the position of an atom.

    put(atom, pos)

    Change the position of an atom to a given position vector \(\boldsymbol{a}\in\mathbb{R}^n\).

    rotate(axis, angle[, is_deg])

    Rotate data matrix \(\boldsymbol{D}\) around an axis \(\boldsymbol{a}\in\mathbb{R}^3\) with angle \(\alpha\in\mathbb{R}\) using rotation function porems.geometry.rotate().

    set_atom_name(atom, name)

    Change the atom name of a specified atom.

    set_atom_residue(atom, residue)

    Change the residue index of a specified atom.

    set_atom_type(atom, atom_type)

    Change the atom type of a specified atom.

    set_box(box)

    Set the box size.

    set_charge(charge)

    Set the total charge of the molecule.

    set_mass([mass])

    Set the molar mass of the molecule.

    set_masses([masses])

    Set the molar masses of the atoms.

    set_name(name)

    Set the molecule name.

    set_short(short)

    Set the molecule short name.

    switch_atom_order(atom_a, atom_b)

    Switch atom order of two atoms.

    translate(vec)

    Translate the atoms data matrix \(\boldsymbol{D}\) along a vector \(\boldsymbol{a}\in\mathbb{R}^n\).

    zero([pos])

    Move whole the molecule, so that the minimal coordinate between all atoms is zero in all dimensions, or rather the values of the position variable pos.

    Back to top

    © Copyright 2021, Hamzeh Kraus.
    Created using Sphinx 7.4.6.