('Co', 'O', 1.7), ('Mn', 'Mn', 2.00), ('Mn', 'Li', 2.00), ('Mn', 'Ni', 2.00), ('Mn', 'O', 1.7), ('Ni', 'Ni', 2.00), ('Ni', 'Li', 2.00), ('Ni', 'O', 1.7), ('Li', 'Li', 2.40), ('Li', 'O', 1.8), ('O', 'O', 1.20), ]) ## save engine ENGINE.save() else: ENGINE = ENGINE.load(engineSavePath) ## unpack constraints before fitting in case tweaking is needed PDF_CONSTRAINT, EMD_CONSTRAINT = ENGINE.constraints # #################################################################################### # # ############################### DEFINE DIFFERENT RUNS ############################## # def normal_run(numberOfSteps=100000, saveFrequency=10000): ## reset groups as atoms ENGINE.set_groups_as_atoms() ## run engine ENGINE.run(numberOfSteps=numberOfSteps, saveFrequency=saveFrequency) def swaps_run(numberOfSteps=100000, saveFrequency=10000): ## reset groups as atoms
INTER_STYLES = [r[0] + r[1]for r in itertools.product(markers, INTER_STYLES)] # dirname DIR_PATH = os.path.dirname( os.path.realpath(__file__) ) engineFilePath = os.path.join(DIR_PATH, "CO2.rmc") # load ENGINE = Engine(path=None) result, mes = ENGINE.is_engine(engineFilePath, mes=True) if not result: print mes exit() # load engine and get pdf constraint engine ENGINE = ENGINE.load(engineFilePath) PDF_CONSTRAINT = ENGINE.constraints[0] def create_figure(PDF): # get output output = PDF.get_constraint_value() # create figure FIG = plt.figure() FIG.patch.set_facecolor('white') grid = gridspec.GridSpec(nrows=2, ncols=2) grid.update(left=0.05, right=0.95, wspace=0.05) totalAx = plt.subplot(grid[0, :]) lowRAx = plt.subplot(grid[1, 0]) highRAx = plt.subplot(grid[1, 1]) # set axis ticks highRAx.get_yaxis().set_ticks([])
B_CONSTRAINT = BondConstraint() BA_CONSTRAINT = BondsAngleConstraint() # add constraints ENGINE.add_constraints( [PDF_CONSTRAINT, IMD_CONSTRAINT, B_CONSTRAINT, BA_CONSTRAINT]) B_CONSTRAINT.create_bonds_by_definition(bondsDefinition={ "CO2": [('C', 'O1', 0.52, 1.4), ('C', 'O2', 0.52, 1.4)] }) BA_CONSTRAINT.create_angles_by_definition( anglesDefinition={"CO2": [('C', 'O1', 'O2', 170, 180)]}) # initialize constraints data ENGINE.initialize_used_constraints() # save engine ENGINE.save() else: ENGINE = ENGINE.load(enginePath) # unpack constraints before fitting in case tweaking is needed PDF_CONSTRAINT, IMD_CONSTRAINT, B_CONSTRAINT, BA_CONSTRAINT = ENGINE.constraints # set all constraints as used. Used value is True by default! # Now you know you can deactivate any constraint at any time though. PDF_CONSTRAINT.set_used(True) IMD_CONSTRAINT.set_used(True) B_CONSTRAINT.set_used(True) BA_CONSTRAINT.set_used(True) ########################################################################################## ##################################### DIFFERENT RUNS ################################### def run_atoms(ENGINE, rang=None, recur=None, xyzFrequency=500): ENGINE.set_groups(None)