PoreMS 0.2
  • API
  • Process
  • Molecule
  • Pore
  • Workflow
  • Site
    • Page
        • Molecule

    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:
    name : string, optional

    Molecule name

    short : string, optional

    Molecule short name

    inp : None, 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)
    

    Representation

    __repr__(self) Create a pandas table of the molecule data.

    Management

    _concat(self, mol_list) Concatenate a molecule list into one molecule object.
    _read(self, file_path, file_type) Read a molecule from a file.
    _temp(self, atoms) Create a temporary molecule of specified atom ids.
    append(self, mol) Append a given molecule to the current object.
    column_pos(self) Create column list of atom positions

    Geometry

    _box_size(self) Calculate the box size of the current molecule.
    _vector(self, 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.

    Properties

    bond(self, inp_a, inp_b) Return the bond vector of a specified bond.
    centroid(self) Calculate the geometrical center of mass
    com(self) Calculate the center of mass
    pos(self, atom) Get the position of an atom.

    Editing

    move(self, 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.
    put(self, atom, pos) Change the position of an atom to a given position vector \(\boldsymbol{a}\in\mathbb{R}^n\).
    rotate(self, 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().
    translate(self, vec) Translate the atoms data matrix \(\boldsymbol{D}\) along a vector \(\boldsymbol{a}\in\mathbb{R}^n\).
    zero(self[, 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.
    part_angle(self, bond_a, bond_b, atoms, …) Change the bond angle of two bond vectors.
    part_move(self, bond, atoms, length[, vec]) Change the length of a specified bond.
    part_rotate(self, bond, atoms, angle, zero) Rotate a set of specified atoms around a given bond as the rotation axis.

    Atoms

    add(self, atom_type, pos[, bond, r, theta, …]) Add a new atom in polar coordinates.
    delete(self, atoms) Delete specified atom from the molecule.
    overlap(self[, error]) Search for overlapping atoms.
    switch_atom_order(self, atom_a, atom_b) Switch atom order of two atoms.
    set_atom_name(self, atom, name) Change the atom name of a specified atom.
    get_atom_list(self) Return the atoms list.
    set_atom_residue(self, atom, residue) Change the residue index of a specified atom.
    set_atom_type(self, atom, atom_type) Change the atom type of a specified atom.
    get_atom_type(self, atom) Return the atom type of the given atom id.

    Setter Methods

    set_box(self, box) Set the box size.
    set_charge(self, charge) Set the total charge of the molecule.
    set_mass(self[, mass]) Set the molar mass of the molecule.
    set_masses(self[, masses]) Set the molar masses of the atoms.
    set_name(self, name) Set the molecule name.
    set_short(self, short) Set the molecule short name.

    Getter Methods

    get_box(self) Return the box size of the molecule.
    get_charge(self) Return the total charge of the molecule.
    get_mass(self) Return the molar mass of the molecule.
    get_masses(self) Return a list of masses of the atoms.
    get_name(self) Return the molecule name.
    get_num(self) Return the number of atoms.
    get_short(self) Return the molecule short name.

    Back to top

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