Ejemplo n.º 1
0
def create_engine():
    # create engine
    ENGINE = Engine(path=None)
    ENGINE.set_pdb(pdbPath)
    # initialize constraints
    B_CONSTRAINT   = BondConstraint()
    BA_CONSTRAINT  = BondsAngleConstraint()
    IA_CONSTRAINT  = ImproperAngleConstraint()
    # add constraints
    ENGINE.add_constraints([B_CONSTRAINT])
    B_CONSTRAINT.create_bonds_by_definition( bondsDefinition={"THF": [('O' ,'C1' , 1.20, 1.70),
                                                                      ('O' ,'C4' , 1.20, 1.70),
                                                                      ('C1','C2' , 1.25, 1.90),
                                                                      ('C2','C3' , 1.25, 1.90),
                                                                      ('C3','C4' , 1.25, 1.90),
                                                                      ('C1','H11', 0.88, 1.16),('C1','H12', 0.88, 1.16),
                                                                      ('C2','H21', 0.88, 1.16),('C2','H22', 0.88, 1.16),
                                                                      ('C3','H31', 0.88, 1.16),('C3','H32', 0.88, 1.16),
                                                                      ('C4','H41', 0.88, 1.16),('C4','H42', 0.88, 1.16)] })
    ENGINE.add_constraints([BA_CONSTRAINT])
    BA_CONSTRAINT.create_angles_by_definition( anglesDefinition={"THF": [ ('O'  ,'C1' ,'C4' , 105, 125),
                                                                          ('C1' ,'O'  ,'C2' , 100, 120),
                                                                          ('C4' ,'O'  ,'C3' , 100, 120),
                                                                          ('C2' ,'C1' ,'C3' , 95 , 115),
                                                                          ('C3' ,'C2' ,'C4' , 95 , 115),
                                                                          # H-C-H angle
                                                                          ('C1' ,'H11','H12', 98 , 118),
                                                                          ('C2' ,'H21','H22', 98 , 118),
                                                                          ('C3' ,'H31','H32', 98 , 118),
                                                                          ('C4' ,'H41','H42', 98 , 118),
                                                                          # H-C-O angle
                                                                          ('C1' ,'H11','O'  , 100, 120),
                                                                          ('C1' ,'H12','O'  , 100, 120),
                                                                          ('C4' ,'H41','O'  , 100, 120),
                                                                          ('C4' ,'H42','O'  , 100, 120),                                                                           
                                                                          # H-C-C
                                                                          ('C1' ,'H11','C2' , 103, 123),
                                                                          ('C1' ,'H12','C2' , 103, 123),
                                                                          ('C2' ,'H21','C1' , 103, 123),
                                                                          ('C2' ,'H21','C3' , 103, 123),
                                                                          ('C2' ,'H22','C1' , 103, 123),
                                                                          ('C2' ,'H22','C3' , 103, 123),
                                                                          ('C3' ,'H31','C2' , 103, 123),
                                                                          ('C3' ,'H31','C4' , 103, 123),
                                                                          ('C3' ,'H32','C2' , 103, 123),
                                                                          ('C3' ,'H32','C4' , 103, 123),
                                                                          ('C4' ,'H41','C3' , 103, 123),
                                                                          ('C4' ,'H42','C3' , 103, 123) ] })
    ENGINE.add_constraints([IA_CONSTRAINT])
    IA_CONSTRAINT.create_angles_by_definition( anglesDefinition={"THF": [ ('C2','O','C1','C4', -15, 15),
                                                                          ('C3','O','C1','C4', -15, 15) ] })
    # initialize constraints data
    ENGINE.initialize_used_constraints()
    # set moves generators
    # set all move generators to Translation with a maximum amplutide of 0.3 A
    [g.set_move_generator(TranslationGenerator(amplitude=0.3)) for g in ENGINE.groups]
    # set randomly 25% of the translation amplitude to 10A
    [g.set_move_generator(TranslationGenerator(amplitude=10.)) for g in ENGINE.groups if np.random.random()>0.25]
    # return engine
    return ENGINE
Ejemplo n.º 2
0
LOGGER.set_minimum_level(sys.maxint, stdoutFlag=True, fileFlag=True)

##########################################################################################
#####################################  CREATE ENGINE  ####################################
pdbPath = "system.pdb"
ENGINE = Engine(path=None)
ENGINE.set_pdb(pdbPath)

# add constraints
B_CONSTRAINT = BondConstraint()
BA_CONSTRAINT = BondsAngleConstraint()
ENGINE.add_constraints([B_CONSTRAINT, BA_CONSTRAINT])
B_CONSTRAINT.create_bonds_by_definition(bondsDefinition={
    "TIP": [('OH2', 'H1', 0.8, 1.1), ('OH2', 'H2', 0.8, 1.1)]
})
BA_CONSTRAINT.create_angles_by_definition(
    anglesDefinition={"TIP": [('OH2', 'H1', 'H2', 80, 120)]})

# set TranslationGenerator move generators amplitude
[g.moveGenerator.set_amplitude(0.025) for g in ENGINE.groups]


##########################################################################################
####################################  DIFFERENT RUNS  ####################################
def run_normal(nsteps, xyzPath):
    B_CONSTRAINT.create_bonds_by_definition(bondsDefinition={
        "TIP": [('OH2', 'H1', 0.8, 1.1), ('OH2', 'H2', 0.8, 1.1)]
    })
    ENGINE.run(numberOfSteps=nsteps,
               saveFrequency=nsteps * 2,
               xyzFrequency=1,
               xyzPath=xyzPath,
Ejemplo n.º 3
0
BA_CONSTRAINT.create_angles_by_definition(
    anglesDefinition={
        "THF": [
            ('O', 'C1', 'C4', 105, 125),
            ('C1', 'O', 'C2', 100, 120),
            ('C4', 'O', 'C3', 100, 120),
            ('C2', 'C1', 'C3', 95, 115),
            ('C3', 'C2', 'C4', 95, 115),
            # H-C-H angle
            ('C1', 'H11', 'H12', 98, 118),
            ('C2', 'H21', 'H22', 98, 118),
            ('C3', 'H31', 'H32', 98, 118),
            ('C4', 'H41', 'H42', 98, 118),
            # H-C-O angle
            ('C1', 'H11', 'O', 100, 120),
            ('C1', 'H12', 'O', 100, 120),
            ('C4', 'H41', 'O', 100, 120),
            ('C4', 'H42', 'O', 100, 120),
            # H-C-C
            ('C1', 'H11', 'C2', 103, 123),
            ('C1', 'H12', 'C2', 103, 123),
            ('C2', 'H21', 'C1', 103, 123),
            ('C2', 'H21', 'C3', 103, 123),
            ('C2', 'H22', 'C1', 103, 123),
            ('C2', 'H22', 'C3', 103, 123),
            ('C3', 'H31', 'C2', 103, 123),
            ('C3', 'H31', 'C4', 103, 123),
            ('C3', 'H32', 'C2', 103, 123),
            ('C3', 'H32', 'C4', 103, 123),
            ('C4', 'H41', 'C3', 103, 123),
            ('C4', 'H42', 'C3', 103, 123)
        ]
    })
Ejemplo n.º 4
0
ENGINE.add_constraints([B_CONSTRAINT, BA_CONSTRAINT, IA_CONSTRAINT])
B_CONSTRAINT.create_bonds_by_definition(
    bondsDefinition={
        "PFT": [
            ('Xe', 'F1', 1.9, 2.1),
            ('Xe', 'F2', 1.9, 2.1),
            ('Xe', 'F3', 1.9, 2.1),
            ('Xe', 'F4', 1.9, 2.1),
            ('Xe', 'F5', 1.9, 2.1),
        ]
    })
BA_CONSTRAINT.create_angles_by_definition(
    anglesDefinition={
        "PFT": [
            ('Xe', 'F1', 'F2', 60, 80),
            ('Xe', 'F2', 'F3', 60, 80),
            ('Xe', 'F3', 'F4', 60, 80),
            ('Xe', 'F4', 'F5', 60, 80),
            ('Xe', 'F5', 'F1', 60, 80),
        ]
    })

IA_CONSTRAINT.create_angles_by_definition(
    anglesDefinition={
        "PFT": [('F4', 'F2', 'F1', 'F3', -2,
                 2), ('F5', 'F2', 'F1', 'F3', -2,
                      2), ('Xe', 'F2', 'F1', 'F3', -2, 2)]
    })

# set TranslationGenerator move generators amplitude
[g.moveGenerator.set_amplitude(0.1) for g in ENGINE.groups]
Ejemplo n.º 5
0
if not ENGINE.is_engine(enginePath) or FRESH_START:
    # initialize engine
    ENGINE = Engine(path=enginePath, freshStart=True)
    ENGINE.set_pdb(pdbPath)
    PDF_CONSTRAINT = PairDistributionConstraint(experimentalData=expDataPath,
                                                weighting="atomicNumber")
    IMD_CONSTRAINT = InterMolecularDistanceConstraint(defaultDistance=1.4)
    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)
Ejemplo n.º 6
0
Archivo: run.py Proyecto: zizai/fullrmc
                                                                  ('H31','H21', 2.0, 100),
                                                                  ('H31','H22', 2.0, 100),
                                                                  ('H32','H21', 2.0, 100),
                                                                  ('H32','H22', 2.0, 100),] })
BA_CONSTRAINT.create_angles_by_definition( anglesDefinition={"BUT": [ # C-C-C angles
                                                                      ('C2' ,'C1' ,'C3' , 99 , 119),
                                                                      ('C3' ,'C1' ,'C4' , 99 , 119),
                                                                      # C-H3 angles
                                                                      ('C1' ,'H11','H12', 99 , 119),
                                                                      ('C1' ,'H11','H13', 99 , 119),
                                                                      ('C1' ,'H12','H13', 99 , 119),
                                                                      ('C4' ,'H41','H42', 99 , 119),
                                                                      ('C4' ,'H41','H43', 99 , 119),
                                                                      ('C4' ,'H42','H43', 99 , 119),
                                                                      # C-H2 angles
                                                                      ('C2' ,'H21','H22', 99 , 119),
                                                                      ('C3' ,'H31','H32', 99 , 119),
                                                                      # C-C-H angles
                                                                      ('C1' ,'C2' ,'H11', 101, 121),
                                                                      ('C1' ,'C2' ,'H12', 101, 121),
                                                                      ('C1' ,'C2' ,'H13', 101, 121),
                                                                      ('C4' ,'C3' ,'H41', 101, 121),
                                                                      ('C4' ,'C3' ,'H42', 101, 121),
                                                                      ('C4' ,'C3' ,'H43', 101, 121),
                                                                      ('C2' ,'C1' ,'H21', 97 , 117),
                                                                      ('C2' ,'C3' ,'H22', 97 , 117),
                                                                      ('C3' ,'C2' ,'H31', 97 , 117),
                                                                      ('C3' ,'C4' ,'H32', 97 , 117)] })
DA_CONSTRAINT.create_angles_by_definition( anglesDefinition={"BUT": [ ('C1','C2','C3','C4', 30,90, 150,210, 270,330)] })


# set TranslationGenerator move generators amplitude