Beispiel #1
0
################################################################################
###################### CREATE SOFTGRID WORKERS MANAGEMENT ######################
WM = MultiframeUtils.WorkersManagement()
WM.start(engine=ENGINE, multiframe='size_distribution', orchestrator=None)


################################################################################
######################## OPTIMIZE OXYGEN ATOMS POSITION ########################
for sf in ENGINE.frames[multiframe]['frames_name']:
    fname = os.path.join(multiframe, sf)
    ENGINE.set_used_frame(fname)
    # set groups as oxygen atoms only
    elements = ENGINE.get_original_data('allElements')
    groups   = [[idx] for idx, el in enumerate(elements) if el=='O']
    ENGINE.set_groups(groups)
    LOGGER.info("@%s Setting oxygen atoms groups (%i)"%(fname, len(groups),))

# run all frames independantly to optimize and fix oxygen atom positions
WM.run_independant(nCycle=10, numberOfSteps=10000, saveFrequency=1, cycleTimeout=3600)




################################################################################
######################### OPTIMIZE ALL ATOMS POSITION ##########################
for sf in ENGINE.frames[multiframe]['frames_name']:
    fname = os.path.join(multiframe, sf)
    ENGINE.set_used_frame(fname)
    # set groups as oxygen atoms only
    ENGINE.set_groups_as_atoms()
Beispiel #2
0
##########################################################################################
#####################################  CREATE ENGINE  ####################################
pdbPath = "system.pdb"
ENGINE = Engine(path=None)
ENGINE.set_pdb(pdbPath)
# add constraints
ACN_CONSTRAINT = AtomicCoordinationNumberConstraint()
ENGINE.add_constraints([ACN_CONSTRAINT])
ACN_CONSTRAINT.set_coordination_number_definition([
    ('Al', 'Cl', 1.5, 2.5, 2, 2), ('Al', 'S', 2.5, 3.0, 2, 2)
])
# add inter-molecular distance constraint
EMD_CONSTRAINT = InterMolecularDistanceConstraint(defaultDistance=1.0)
ENGINE.add_constraints([EMD_CONSTRAINT])
# set TranslationGenerator move generators amplitude
ENGINE.set_groups([[idx] for idx, el in enumerate(ENGINE.allElements)
                   if el != 'Al'])
[
    g.set_move_generator(XYTranslationGenerator(g, amplitude=0.1))
    for g in ENGINE.groups
]


##########################################################################################
####################################  DIFFERENT RUNS  ####################################
def run_normal(nsteps, xyzPath):
    ACN_CONSTRAINT.set_coordination_number_definition([
        ('Al', 'Cl', 1.5, 2.5, 2, 2), ('Al', 'S', 2.5, 3.0, 2, 2)
    ])
    ENGINE.run(numberOfSteps=nsteps,
               saveFrequency=nsteps * 2,
               xyzFrequency=1,