예제 #1
0
def stm(config, inp: str, origin: int, partner: int, out: click.File):
    """Calculate sterimol descriptors using kallisto van der Waals radii."""

    # setup molecular structure
    mol = ksr.constructMolecule(geometry=inp, out=out)

    # calculate Sterimol descriptors: L, bmin, bmax
    from kallisto.sterics import getClassicalSterimol

    L, bmin, bmax = getClassicalSterimol(mol, origin, partner)

    if config.verbose:
        # print values in Bohr
        verbosePrinter(
            config.verbose,
            "L, Bmin, Bmax / au: {:5.2f} {:5.2f} {:5.2f}".format(
                L, bmin, bmax),
            out,
        )

        # print values in Angstrom
        from kallisto.units import Bohr

        verbosePrinter(
            config.verbose,
            "L, Bmin, Bmax / A: {:5.2f} {:5.2f} {:5.2f}".format(
                L * Bohr, bmin * Bohr, bmax * Bohr),
            out,
        )

    return L, bmin, bmax
예제 #2
0
def lig(config, inp: str, center: int, out: click.File):
    """Get all substructures (or ligands) that are bound to the center atom."""

    # setup reference molecular structure
    ref = ksr.constructMolecule(geometry=inp, out=out)
    nat = ref.get_number_of_atoms()

    # get all covalent bonding partner in reference complex
    covbonds = config.context.invoke(bonds, inp=inp)

    from kallisto.rmsd import recursiveGetSubstructures

    verbosePrinter(config.verbose,
                   "Write out substructures for {}".format(center), out)

    substructures = recursiveGetSubstructures(nat, covbonds, center)

    if config.verbose:
        k = 0
        for path in substructures:
            verbosePrinter(
                config.verbose,
                "Substructure {}: {}".format(k, path),
                out,
            )
            k += 1
예제 #3
0
def rms(config, compare: Tuple[str, str], out: click.File):
    """Calculate the root mean squared deviation between two structures using quaternions.
    Based on a Fortran implementation by Chaok Seok, Evangelos
    Coutsias, and Ken Dill."""

    from kallisto.rmsd import rmsd

    mol1 = ksr.constructMolecule(geometry=compare[0], out=out)
    nat1 = mol1.get_number_of_atoms()
    mol2 = ksr.constructMolecule(geometry=compare[1], out=out)
    nat2 = mol2.get_number_of_atoms()

    # for RMSD comparison both coordinates need the same atom count
    if nat1 != nat2:
        errorbye(
            "Error: number of atoms do not match in {} and in {}".format(
                compare[0], compare[1]),
            out,
        )

    coord1 = mol1.get_positions()
    coord2 = mol2.get_positions()

    # get RMSD error and rotation matrix u
    error, u = rmsd(nat1, coord1, coord2)

    verbosePrinter(config.verbose, "RMSD {} Angstrom".format(error), out)
    verbosePrinter(config.verbose, "Rotation Matrix", out)
    click.echo(u, file=out)  # type: ignore

    return error, u
예제 #4
0
def cns(config, inp: str, out: click.File, cntype: str):
    """Atomic coordination numbers."""

    molecule = ksr.constructMolecule(geometry=inp, out=out)
    cns = molecule.get_cns(cntype)
    verbosePrinter(config.verbose, cns, out)

    return cns
예제 #5
0
def cnsp(config, inp: str, out: click.File, cntype: str):
    """Atomic coordination number spheres."""

    molecule = ksr.constructMolecule(geometry=inp, out=out)
    nat = molecule.get_number_of_atoms()
    cnsp = molecule.get_cnspheres(cntype)
    for i in range(nat):
        verbosePrinter(config.verbose, cnsp[i], out)

    return cnsp
예제 #6
0
def eeq(config, inp: str, out: click.File, chrg: int):
    """Electronegativity equilibration atomic partial charges."""

    molecule = ksr.constructMolecule(geometry=inp, out=out)
    nat = molecule.get_number_of_atoms()
    eeq = molecule.get_eeq(chrg)
    for i in range(nat):
        verbosePrinter(config.verbose, eeq[i], out)

    return eeq
예제 #7
0
def alp(config, inp: str, out: click.File, chrg: int, molecular: bool):
    """Static atomic polarizabilities in Bohr^3."""

    molecule = ksr.constructMolecule(geometry=inp, out=out)
    nat = molecule.get_number_of_atoms()
    alp = molecule.get_alp(charge=chrg)
    if molecular:
        verbosePrinter(config.verbose, np.sum(alp), out)
    else:
        for i in range(nat):
            verbosePrinter(config.verbose, alp[i], out)

    return alp
예제 #8
0
def vdw(config, inp: str, out: click.File, chrg: int, vdwtype: str,
        angstrom: bool):
    """Charge-dependent atomic van der Waals radii in Bohr."""

    molecule = ksr.constructMolecule(geometry=inp, out=out)
    nat = molecule.get_number_of_atoms()

    if angstrom:
        from kallisto.units import Bohr

        scale = Bohr
    else:
        scale = 1.0

    vdw = molecule.get_vdw(chrg, vdwtype, scale)
    for i in range(nat):
        verbosePrinter(config.verbose, vdw[i], out)

    return vdw