Beispiel #1
0
def along1(ENGINE, rang=5, recur=100, refine=False, explore=True):
    ENGINE.set_groups_as_molecules()
    [
        g.set_move_generator(
            TranslationAlongSymmetryAxisGenerator(axis=1, amplitude=0.1))
        for g in ENGINE.groups
    ]
    # set selector
    centers = [
        np.sum(ENGINE.realCoordinates[g.indexes], axis=0) / len(g)
        for g in ENGINE.groups
    ]
    distances = [np.sqrt(np.add.reduce(c**2)) for c in centers]
    order = np.argsort(distances)
    recur = 200
    gs = RecursiveGroupSelector(DefinedOrderSelector(ENGINE, order=order),
                                recur=recur,
                                refine=refine,
                                explore=explore)
    ENGINE.set_group_selector(gs)
    # number of steps
    nsteps = recur * len(ENGINE.groups)
    for stepIdx in range(rang):
        LOGGER.info("Running 'along1' mode step %i" % (stepIdx))
        ENGINE.run(numberOfSteps=nsteps, saveFrequency=nsteps)
Beispiel #2
0
def along_axis_2():
    # run engine translation along axis 2
    xyzPath="along2.xyz"
    if os.path.isfile(xyzPath): os.remove(xyzPath)
    _,_,_,_,X,Y,Z =get_principal_axis(ENGINE.realCoordinates)
    print("Translation along symmetry axis 2: ", Z)
    [g.set_move_generator(TranslationAlongSymmetryAxisGenerator(amplitude=0.5, axis=2)) for g in ENGINE.groups]
    ENGINE.run(numberOfSteps=nsteps, saveFrequency=2*nsteps, xyzFrequency=xyzFrequency, xyzPath=xyzPath, restartPdb=None)