Example #1
0
    def setUp(self):
        from pele.potentials.rigid_bodies.molecule import Molecule, setupLWOTP
        from pele.potentials.rigid_bodies.sandbox import RBSandbox
        from pele.potentials.lj import LJ
        from pele.optimize import lbfgs_py as quench

        # set up system
        nmol = 5
        self.nmol = nmol
        otp = setupLWOTP()
        # set up a list of molecules
        mols = [otp for i in range(nmol)]
        # define the interaction matrix for the system.
        # for LWOTP there is only one atom type, so this is trivial
        lj = LJ()
        interaction_matrix = [[lj]]
        # set up the RBSandbox object
        mysys = RBSandbox(mols, interaction_matrix)
        self.pot = mysys
        self.nsites = mysys.nsites

        self.permlist = [range(nmol)]

        self.coords1 = testmindist.randomCoordsAA(nmol)
        ret = quench(self.coords1, self.pot.getEnergyGradient)
        self.coords1 = ret[0]
Example #2
0
def test_LWOTP(nmol=5):
    from pele.potentials.rigid_bodies.molecule import Molecule, setupLWOTP
    from pele.potentials.rigid_bodies.sandbox import RBSandbox
    from pele.potentials.lj import LJ
    from pele.optimize import lbfgs_py as quench

    printlist = []

    # set up system
    otp = setupLWOTP()
    # set up a list of molecules
    mols = [otp for i in range(nmol)]
    # define the interaction matrix for the system.
    # for LWOTP there is only one atom type, so this is trivial
    lj = LJ()
    interaction_matrix = [[lj]]
    # set up the RBSandbox object
    mysys = RBSandbox(mols, interaction_matrix)
    nsites = mysys.nsites

    permlist = [range(nmol)]

    # define initial coords
    coords1 = randomCoords(nmol)
    printlist.append((coords1.copy(), "very first"))
    # quench X1
    ret = quench(coords1, mysys.getEnergyGradient)
    coords1 = ret[0]

    # define initial coords2
    coords2 = randomCoords(nmol)
    printlist.append((coords2.copy(), "very first"))
    # quench X2
    ret = quench(coords2, mysys.getEnergyGradient)
    coords2 = ret[0]
    coords2in = coords2.copy()

    printlist.append((coords1.copy(), "after quench"))
    printlist.append((coords2.copy(), "after quench"))

    print "******************************"
    print "testing for OTP not isomer"
    print "******************************"
    d, c1new, c2new = test(coords1, coords2, mysys, permlist)

    print "******************************"
    print "testing for OTP ISOMER"
    print "******************************"
    coords1 = coords2in.copy()
    coords2 = c2new.copy()
    # try to reverse the permutations and symmetry operations we just applied
    test(coords1, coords2, mysys, permlist)