예제 #1
0
    def detetminePrimaryAmine(self, nitrogenIndex):
        """ Return primary amine Molecule object with proper ring classification, if it exists on a ring
            Return false if nitrogen is not a primary amine

            nitrogenIndex (int) : The index of the nitrogen in the smiles code to be analyzed for being a primary amine

        """

        nitrogenBonds = self.bondData[
            nitrogenIndex]  # Get bonds connected to nitrogen

        if (len(nitrogenBonds) == 1  # Primary amines have one bond
                and not self.BOND_REGEX.findall(
                    nitrogenBonds[0].symbol)  # That must be a single bond
            ):  # Otherwise, nitrogen is not a primary amine

            bondedIndex = nitrogenBonds[0].index

            primaryAmine = Molecule(
                "RN", "PrimaryAmine")  # Create primary amine Molecule object

            primaryAmine.atomData[
                0].index = bondedIndex  # Set the R group index to the smiles bonded nitrogen index
            primaryAmine.atomData[
                1].index = nitrogenIndex  # Set the nitrogen index to the smiles code nitrogen index

            if bondedIndex in self.AROMATICINDICES:  # Add aromatic nomenclature if necessary
                primaryAmine.NAME = "AromaticPrimaryAmine"

            elif bondedIndex in self.CYCLICINDICES:  # Or cyclic nomenclature
                primaryAmine.NAME = "CyclicPrimaryAmine"

            return primaryAmine  # Return the primary amine object if true

        return False  # Otherwise return false
예제 #2
0
def trj2xyz(fname, start = 0.0, end=float("inf")):
    f = open(fname, "r") 
    line = f.readline() 
    txt = "" 
    check_1st = True 
    atoms = [] 
    while line: 
        regexp = re.search(r" Time = (\d+.\d+) ",line)
        if regexp:
            time = float(regexp.group(1))  
            if start <= time and time < end: 
                positions, velocities = [], [] 
                line = f.readline() 
                natom = int(line.split()[0]) 
                line = f.readline() 
                if check_1st:
                    for i in xrange(natom):  
                        aline = f.readline().split()
                        atoms.append(aline[0]) 
                        positions.append(map(float,aline[1:]))      
                    mol = Molecule(atoms) 
                    check_1st = False 
                else:
                    positions = np.array([map(float,f.readline().split()[1:]) for _ in xrange(natom)])       
                mol.set_positions(positions) 
                txt += mol.get_positions_formated(unit="ang",message = "Times={}".format(time)) 
                line = f.readline() 
                line = f.readline() 
        line = f.readline()
    return txt
예제 #3
0
파일: CI.py 프로젝트: berquist/PyQuante
def test():
    from hartree_fock import rhf
    from Molecule import Molecule

    # Make a test molecule for the calculation
    h2 = Molecule('h2',[(1,(1.,0,0)),(1,(-1.,0,0))])

    # Get a basis set and compute the integrals.
    # normally the routine will do this automatically, but we
    # do it explicitly here so that we can pass the same set
    # of integrals into the CI code and thus not recompute them.
    bfs = getbasis(h2)
    S,h,Ints = getints(bfs,h2)

    # Compute the HF wave function for our molecule
    en,orbe,orbs = rhf(h2,
                       integrals=(S,h,Ints)
                       )
    print "SCF completed, E = ",en
    print " orbital energies ",orbe

    # Compute the occupied and unoccupied orbitals, used in the
    # CIS program to generate the excitations
    nclosed,nopen = h2.get_closedopen()
    nbf = len(bfs)
    nocc = nclosed+nopen
    nvirt = nbf-nocc

    # Call the CI program:
    Ecis = CIS(Ints,orbs,orbe,nocc,nvirt,en)
    print "Ecis = ",Ecis
예제 #4
0
def trj2xyz(fname, start=0.0, end=float("inf")):
    f = open(fname, "r")
    line = f.readline()
    txt = ""
    check_1st = True
    atoms = []
    while line:
        regexp = re.search(r" Time = (\d+.\d+) ", line)
        if regexp:
            time = float(regexp.group(1))
            if start <= time and time < end:
                positions, velocities = [], []
                line = f.readline()
                natom = int(line.split()[0])
                line = f.readline()
                if check_1st:
                    for i in xrange(natom):
                        aline = f.readline().split()
                        atoms.append(aline[0])
                        positions.append(map(float, aline[1:]))
                    mol = Molecule(atoms)
                    check_1st = False
                else:
                    positions = np.array([map(float, f.readline().split()[1:]) for _ in xrange(natom)])
                mol.set_positions(positions)
                txt += mol.get_positions_formated(unit="ang", message="Times={}".format(time))
                line = f.readline()
                line = f.readline()
        line = f.readline()
    return txt
예제 #5
0
def test_fci():
    """ test FCI calculation"""
    from Molecule import Molecule
    from PyQuante import SCF

    nel = 2
    mult = 1
    m_s = 0
    k = 10

    # h2 = Molecule('h2',[(1,(0,0,0)),(1,(1.4,0,0))], multiplicity = mult)
    h2 = Molecule('h2', [(1, (0, 0, 0)), (1, (1.4, 0, 0))])

    Solver = SCF(h2, method="HF")
    Solver.iterate()
    print "orbital energies ", Solver.solver.orbe
    print "HF energy = ", Solver.energy

    # FCIInst = FCISolver(Solver.h, Solver.ERI, Solver.solver.orbs, nel, mult, m_s, k=k, sigma_eigs=None)
    # eva, eve = FCIInst.iterate()

    FCIInst = FCIExactSolver(Solver.h, Solver.ERI, h2.get_enuke(),
                             Solver.solver.orbs, nel, mult, m_s)
    eva, eve = FCIInst.diagonalize()

    print "eva = ", eva
    # print "eve = ",eve
    print "correlation energy = ", eva[0] - Solver.energy
    print "correlation energy should be (with 6-31g**) -0.03387 a.u."
예제 #6
0
def test():
    from Ints import getbasis, getints
    from hartree_fock import rhf
    from Molecule import Molecule

    # Make a test molecule for the calculation
    h2 = Molecule('h2', [(1, (1., 0, 0)), (1, (-1., 0, 0))])

    # Get a basis set and compute the integrals.
    # normally the routine will do this automatically, but we
    # do it explicitly here so that we can pass the same set
    # of integrals into the CI code and thus not recompute them.
    bfs = getbasis(h2)
    S, h, Ints = getints(bfs, h2)

    # Compute the HF wave function for our molecule
    en, orbe, orbs = rhf(h2, integrals=(S, h, Ints))
    print "SCF completed, E = ", en
    print " orbital energies ", orbe

    # Compute the occupied and unoccupied orbitals, used in the
    # CIS program to generate the excitations
    nclosed, nopen = h2.get_closedopen()
    nbf = len(bfs)
    nocc = nclosed + nopen
    nvirt = nbf - nocc

    # Call the CI program:
    Ecis = CIS(Ints, orbs, orbe, nocc, nvirt, en)
    print "Ecis = ", Ecis
예제 #7
0
파일: FullCI.py 프로젝트: berquist/PyQuante
def test_fci():
    """ test FCI calculation"""
    from Molecule import Molecule
    from PyQuante import SCF


    nel = 2
    mult = 1
    m_s = 0
    k=10
    
    # h2 = Molecule('h2',[(1,(0,0,0)),(1,(1.4,0,0))], multiplicity = mult)
    h2 = Molecule('h2',[(1,(0,0,0)),(1,(1.4,0,0))])

    Solver = SCF(h2,method = "HF")
    Solver.iterate()
    print "orbital energies ",Solver.solver.orbe
    print "HF energy = ",Solver.energy
    
    # FCIInst = FCISolver(Solver.h, Solver.ERI, Solver.solver.orbs, nel, mult, m_s, k=k, sigma_eigs=None)
    # eva, eve = FCIInst.iterate()    

    FCIInst = FCIExactSolver(Solver.h, Solver.ERI, h2.get_enuke(), Solver.solver.orbs, nel, mult, m_s)
    eva,eve = FCIInst.diagonalize()

    print "eva = ", eva
    # print "eve = ",eve
    print "correlation energy = ", eva[0] - Solver.energy
    print "correlation energy should be (with 6-31g**) -0.03387 a.u."
예제 #8
0
    def determineAlcoholGroups(self, functionalGroups):
        """ Appends the functional groups created from alocholic oxygens, with ring classifications, to the functionalGroups list passed in.

            functionalGroups (list) : List of Molecule obejects that represent the functional groups of a SMILES code

            Notes:
                This function looks to see if the alcoholic oxygen is attached within an aromatic, non-aromatic ring strucutres, or no at all
                Build upon alochol indices found in the molecule
        """

        for index in self.ALCOHOLICINDICES:

            alohcolBond = self.bondData[index]
            alochol = Molecule("RO", "Alcohol")
            alochol.atomData[0].index = alohcolBond[0].index
            alochol.atomData[1].index = index

            if alohcolBond[0].index in self.AROMATICINDICES:
                alochol.NAME = "AromaticAlcohol"
            elif alohcolBond[0].index in self.CYCLICINDICES:
                alochol.NAME = "CyclicAlcohol"

            functionalGroups.append(alochol)

        return
def load_system(psfFile, coorFile):
    """
    Load the main system.
    """

    mol = Molecule()
    mol.load(psfFile, "parm7")						
    mol.load(coorFile, "namdbin")
    return mol
예제 #10
0
def get_ts_ifreq(xcc, gcc, Fcc, E, tcommon):
    ch, mtp, atonums, masses, mu = tcommon
    ts = Molecule()
    ts.set(xcc, atonums, ch, mtp, E, gcc, Fcc, masses)
    ts.prep()
    ts.setup(mu)
    ts.ana_freqs()
    [(ifreq, evec)] = ts._ccimag
    return ifreq, mu
예제 #11
0
 def __init__(self, howtofold=None):
     #       pointless summary of class members
     self.__donor = Molecule()
     self.__acceptor = Molecule()
     self.__donatingatom = Atom()
     self.__acceptingatom = Atom()
     self.__donorid = 0
     self.__acceptorid = 0
     self.energy = 1
     if howtofold is None:
         self.howtofold = lambda a: a
     else:
         self.howtofold = howtofold
예제 #12
0
파일: CMAP.py 프로젝트: ferbachega/pepdice
 def import_contact_map_from_pdb (self           , 
                                  pdb    = None  , 
                                  cutoff = 6.0   ,
                                  log    = False):
     
     """ Gera o mapa de contato a patir de um PDB (estrutura de referencia) """
     
    
     system = Molecule() 
     system.load_PDB_to_system (filename = pdb   )   
     cmap = 0*np.random.rand(len(system.residues),len(system.residues))
     
     self.number_of_contacts =  0
     
     for index_i in range(0, len(system.residues)):
         for index_j in range(index_i+2, len(system.residues)):
             
             name_i = system.residues[index_i].name
             
             for atom in system.residues[index_i].atoms:
                 if atom.name == 'CA':
                     atom_i    = atom  
             name_j = system.residues[index_j].name
             
             for atom in system.residues[index_j].atoms:
                 if atom.name == 'CA':
                     atom_j = atom  
             R_ab = distance_ab (atom_i, atom_j)
             
             
             if R_ab <= cutoff:
                 cmap[index_i][index_j] = 1
                 self.number_of_contacts += 1
                 if log:
                     print index_i, name_i, index_j, name_j, R_ab, 'contact'
             else:
                 pass
     
     if log:
         print '\ncmap matrix:'
         print cmap
         
         print '\n---------------------------------------------'
         print 'total number of residues = ', len(system.residues)
         print 'Cutoff size              = ', cutoff
         print 'number of contacts       = ', self.number_of_contacts
         print '---------------------------------------------\n'
     
     self.cmap   = cmap
     self.cutoff = cutoff
예제 #13
0
def put_in_mols(atoms):
    """
    assume water and thus group every three atoms
    :param atoms: a regular atomlist that make up molecules of one type
    :type: list
    :return: a list of molecules
    :rtype: list
    """
    assert (len(atoms) % 3 == 0)
    molecules = []
    for i in range(0, len(atoms), 3):
        mol = Molecule()
        for j in range(0, 3, 1):
            mol.append(atoms[i + j])
        molecules.append(mol)
    return molecules
예제 #14
0
def main():
    from Molecule import Molecule
    import sys
    mol = Molecule.from_xyz(sys.argv[1])
    method = {'charge': 0, 'multiplicity': 1, 'scftype': 'rhf'}
    geometry = Psi4(mol, method)
    geometry.optimize()
예제 #15
0
def test():
    from Ints import getbasis, getints, get2JmK
    from hartree_fock import get_nel, get_enuke, get_energy
    from LA2 import geigh, mkdens
    from IO import mtx2file
    from Molecule import Molecule

    ConvCriteria = 0.00001
    MaxIt = 30
    h2o = Molecule('h2o', [(8, (0, 0, 0)), (1, (1., 0, 0)), (1, (0, 1., 0))],
                   units='Angstrom')
    bfs = getbasis(h2o)
    S, h, Ints = getints(bfs, h2o)
    orbe, orbs = geigh(h, S)
    nel = get_nel(h2o)
    nocc = int(nel / 2)
    enuke = get_enuke(h2o)
    eold = 0.
    avg = DIIS2(S)
    for i in xrange(30):
        D = mkdens(orbs, 0, nocc)
        mtx2file(D)
        G = get2JmK(Ints, D)
        F = h + G
        F = avg.getF(F, D)  # do the DIIS extrapolation
        orbe, orbs = geigh(F, S)
        energy = get_energy(h, F, D, enuke)
        print i + 1, energy
        if abs(energy - eold) < ConvCriteria: break
        eold = energy

    return
    def get_molecules(a_itpmolecObj, a_grofile):
        '''
        AdditionalFunctions.get_molecules is a method that returns a dictionary
        that has all the molecules of the same species present in the a_grofile
        provided.
        Example of dictionary:
            molecs_in_system = {[Mol0]: {Molecule Object}, [Mol1]: {Molecule Object},
                                [Mol2]: {Molecule Object}, .....}
        where Mol0 to MolN belong to the same molecule species (same itp file description).
        '''

        molecs_in_system = {}
        number_molecs = a_itpmolecObj.number_molecs
        atoms_per_molec = a_itpmolecObj.atoms_per_molec
        count = 0

        for i in range(0, number_molecs):
            molec_start = i * atoms_per_molec
            molec_end = molec_start + atoms_per_molec
            indexes_slice = a_itpmolecObj.lines_in_grofile[
                molec_start:molec_end]

            molec_id = a_itpmolecObj.residue + '_' + str(count)
            molecOb = Molecule.fromList(indexes_slice, a_grofile[2:-1])
            molecOb.fromToplogy(a_itpmolecObj.atomTypeList)

            molecs_in_system[molec_id] = molecOb
            count += 1

        delattr(a_itpmolecObj,
                'lines_in_grofile')  # this attribute is not needed anymore
        delattr(a_itpmolecObj,
                'atomTypeList')  # this attribute is not needed anymore

        return molecs_in_system
예제 #17
0
def main():
    from Molecule import Molecule
    logger = logging.getLogger('pyar')
    handler = logging.FileHandler('clustering.log', 'w')
    formatter = logging.Formatter('%(message)s')
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)

    input_files = sys.argv[1:]

    if len(input_files) < 2:
        print('Not enough files to cluster')
        sys.exit(0)

    mols = []
    for each_file in input_files:
        mol = Molecule.from_xyz(each_file)
        mol.energy = read_energy_from_xyz_file(each_file)
        mols.append(mol)
    plot_energy_histogram(mols)
    selected = choose_geometries(mols)
    cmd = ['/home/anoop/bin/molden']
    fls = []
    for one in selected:
        fls.append(one.name+'.xyz')
    print(' '.join(cmd+fls))
    # subp.check_call(cmd)
    return
예제 #18
0
	def __init__(self, elements):
		super(EditorWindow, self).__init__()

		self.molecule = Molecule()
		self.results = []
		self.elements = elements
		self.table_image = cairo.ImageSurface.create_from_png("table.png")

		self.gladefile = "LewisStructure.glade"
		self.glade = gtk.Builder()
		self.glade.add_from_file(self.gladefile)
		self.glade.connect_signals(self)

		self.window1 = self.glade.get_object("window1")
		self.winPreferences = self.glade.get_object("winPreferences")
		self.viewport = self.glade.get_object("viewport1")
		self.drawing = self.glade.get_object("drawingarea1")
		self.buttonbox = self.glade.get_object("hbuttonbox2")
		self.lblNumConfigurations = self.glade.get_object("lblNumConfigurations")
		self.tableDialog = self.glade.get_object("dlgPeriodicTable")
		self.periodicTable = self.glade.get_object("drawingarea2")
		self.buttonBox = self.glade.get_object("dialog-action_area2")
		self.btnSelect = self.glade.get_object("btnSelect")
		self.btnAdd = self.glade.get_object("btnAdd")
		self.btnRemove = self.glade.get_object("btnRemove")
		self.btnBond = self.glade.get_object("btnBond")
		self.menuSnap = self.glade.get_object("menuSnap")

		self.buttonbox.set_visible(False)
		self.lblNumConfigurations.set_visible(False)
		self.drawing.set_events(gtk.gdk.EXPOSURE_MASK)
		self.window1.show_all()
예제 #19
0
def test_contr():
    from basis_sto3g import basis_data
    from Molecule import Molecule
    from Ints import getbasis
    from time import time

    r = 1 / 0.52918
    atoms = Molecule('h2o',
                     atomlist=[(8, (0, 0, 0)), (1, (r, 0, 0)), (1, (0, 0, r))])
    bfs = getbasis(atoms, basis_data)

    o_1s = bfs[0]
    o_2s = bfs[1]
    o_px = bfs[2]
    o_py = bfs[3]
    o_pz = bfs[4]
    h1_s = bfs[5]
    h2_s = bfs[6]

    t0 = time()
    val = \
        contr_coulomb(h2_s.pexps,h2_s.pcoefs,h2_s.pnorms,
                      h2_s.origin,h2_s.powers,
                      h2_s.pexps,h2_s.pcoefs,h2_s.pnorms,
                      h2_s.origin,h2_s.powers,
                      h2_s.pexps,h2_s.pcoefs,h2_s.pnorms,
                      h2_s.origin,h2_s.powers,
                      o_pz.pexps,o_pz.pcoefs,o_pz.pnorms,
                      o_pz.origin,o_pz.powers)
    t1 = time()
    print val, t1 - t0
예제 #20
0
def create_Molecule(block):
    try:
        mol = Molecule(block)
    except ValueError as e:
        print(str(e))
        return None

    return mol
예제 #21
0
def test():
    from Atom import Atom
    from Molecule import Molecule 
    from IO_MOLPRO import InputMOLPRO 
    at1 = Atom(symbol='H', position=[2,0,0])
    at2 = Atom(symbol='H', position=[0,0,0])
    mol = Molecule([at1,at2])
    inp = InputMOLPRO()
    pot = Potential_QM(mol,inp)
    pot.calc()
예제 #22
0
def main():
    from Molecule import Molecule
    mol = Molecule.from_xyz(sys.argv[1])
    geometry = Turbomole(mol)
    if len(sys.argv) == 2:
        geometry.optimize()
    elif len(sys.argv) == 3:
        gamma_force = sys.argv[2]
        geometry.optimize(gamma=gamma_force)
    else:
        sys.exit()
    return
예제 #23
0
def test3():
    from Atom import Atom
    from Molecule import Molecule
    from VelocityVerlet import VelocityVerlet
    from Constants import fs2tau

    at1 = Atom(symbol='Ar', position=[5,0,0])
    at2 = Atom(symbol='Ar', position=[0,0,0])
    at3 = Atom(symbol='Ar', position=[0,5,0])
    mol = Molecule([at1,at2,at3])
    pot = Potential_MM(mol)
    md = VelocityVerlet(mol,pot,deltat=0.5*fs2tau ,nstep=200)
    md.run() 
예제 #24
0
파일: PyAR.py 프로젝트: RivuDebankur/pyar
def setup_molecules(input_files):

    molecules = []
    for each_file in input_files:
        try:
            mol = Molecule.from_xyz(each_file)
            print(each_file)
            molecules.append(mol)
        except IOError:
            print("File {} does not exist".format(each_file))
            sys.exit()
    print("I've parsed these molecules as input: {}".format(
        [i.name for i in molecules]))
    return molecules
예제 #25
0
def main():
    import sys
    input_files = sys.argv[1:]
    from Molecule import Molecule
    method = {
        'charge': 0,
        'multiplicity': 1,
        'scftype': 'rhf',
        'software': 'orca'
    }
    gamma = 0.0

    for m in input_files:
        mol = Molecule.from_xyz(m)
        if optimise(mol, method=method, gamma=gamma): print(mol.energy)
예제 #26
0
def ReadRestartMC(fname): 
    with open(fname) as f:
        line = f.readline()
        sym, coord = [], []  
        while line:
            if "#Coordinates [" in line:
                aline = line.split() 
                natom = int(aline[0]) 
                unit = aline[2][1:-1]
                line = f.readline()
                for i in xrange(natom): 
                    aline = f.readline().split() 
                    sym.append(aline[0])
                    coord.append(map(float, aline[1:]))
                return Molecule(atomnames = sym, positions = coord)  
            line = f.readline()
예제 #27
0
파일: MP.py 프로젝트: svn2github/pyquante
def test():
    # Jaguar gets -0.0276516 h for this:
    from Ints import getbasis, getints
    from hartree_fock import scf
    from IO import mtx2file
    from Molecule import Molecule

    atoms = Molecule('h2', [(1, (1., 0, 0)), (1, (-1., 0, 0))])
    bfs = getbasis(atoms)
    S, h, Ints = getints(bfs, atoms)
    en, orbe, orbs = scf(atoms, S, h, Ints, 0, 0.0001, 10)
    print "SCF completed, E = ", en

    emp2 = MP2(Ints, orbs, orbe, 1, 9)
    print "MP2 correction = ", emp2
    print "Final energy = ", en + emp2
    return
예제 #28
0
파일: xtb.py 프로젝트: GunjanRR/pyar-1
def main():

    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('--charge', type=int, default=0, help='charge')
    parser.add_argument('-m',
                        '--multiplicity',
                        type=int,
                        default=1,
                        help='multiplicity')
    parser.add_argument('--scftype',
                        type=str,
                        default='rhf',
                        choices=['rhf', 'uhf'],
                        help='SCF type (rhf/uhf)')
    parser.add_argument("input_file",
                        metavar='file',
                        type=str,
                        help='input coordinate file')
    parser.add_argument('--scan',
                        type=int,
                        nargs=2,
                        help='scan between two atoms')
    parser.add_argument('--cycle',
                        type=int,
                        default=350,
                        help='maximum number of optimization cycles')
    args = parser.parse_args()

    from Molecule import Molecule
    mol = Molecule.from_xyz(args.input_file)
    method_args = {
        'charge': args.charge,
        'multiplicity': args.multiplicity,
        'scftype': args.scftype,
        'software': 'xtb'
    }
    Xtb(mol, method_args)

    import optimiser

    print('optimising')
    optimiser.optimise(mol, method_args)

    if args.scan:
        pass
예제 #29
0
def main():

    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('--charge', type=int, default=0,
                        help='charge')
    parser.add_argument('-m', '--multiplicity', type=int, default=1,
                        help='multiplicity')
    parser.add_argument('--scftype', type=str, default='rhf',
                        choices=['rhf', 'uhf'],
                        help='SCF type (rhf/uhf)')
    parser.add_argument("input_file", metavar='file',
                        type=str,
                        help='input coordinate file')
    parser.add_argument('-o', '--opt', action='store_true',
                        help='optimize')
    parser.add_argument('-g', '--gamma', type=float, default=0.0,
                        help='optimize')
    parser.add_argument('--cycle', type=int, default=350,
                        help='maximum number of optimization cycles')
    parser.add_argument('-f1', nargs='+', type=int,
                        help='atoms in the first fragment')
    parser.add_argument('-f2', nargs='+', type=int,
                        help='atoms in the second fragment')
    args = parser.parse_args()

    from Molecule import Molecule
    mol = Molecule.from_xyz(args.input_file)
    mol.fragments = [args.f1, args.f2]
    method_args = {
        'charge': args.charge,
        'multiplicity': args.multiplicity,
        'scftype': args.scftype,
        'software': 'turbomole'
    }
    Turbomole(mol, method_args)
    if args.opt:
        import optimiser

        turbomole_logger.info('optimising')
        optimiser.optimise(mol, method_args, args.gamma)
    else:
        make_coord(mol.atoms_list, mol.coordinates)
        prepare_control(charge=method_args['charge'], multiplicity=method_args['multiplicity'])
        turbomole_logger.info('created input file')
def load_Coor(psfFile, coorFile):
    """
    Load the binary coor file and extract coors.
    """

    mol = Molecule()
    mol.load(psfFile, "parm7")
    mol.load(coorFile, "namdbin")

    allCoors = atomsel('all')
    xCor = allCoors.get('x')
    yCor = allCoors.get('y')
    zCor = allCoors.get('z')

    mol.delete()
    return xCor, yCor, zCor
예제 #31
0
파일: acbn0.py 프로젝트: wwmeng/AFLOWpi
def read_basis_unitcell(fpath,latvects,coords,atlabels):
    #nx range of cells in x axis. example nx=range(-2,3)

    #convert from numpy arrays to PyQuante list of tuples
    myatomlist = []
    for i,atomcoords in enumerate(coords):
        myatomlist.append( (atlabels[i].strip(),(atomcoords[0],atomcoords[1],atomcoords[2])) )
        

    atoms=Molecule('unitcell',atomlist = myatomlist,units = 'Angstrom')
    
    #inttol = 1e-6 # Tolerance to which integrals must be equal
    
    basis_file_path = fpath
    bfs = integs.my_getbasis(atoms,basis_file_path)
    if rank==0:
        print("Done generating bfs")
    return bfs
예제 #32
0
def main():
    from Molecule import Molecule
    try:
        input_files = sys.argv[1:]
    except:
        print('usage: cluster.;y <xyz-file(s)>')
        sys.exit(1)

    if len(input_files) < 2:
        print('Not enough files to cluster')
        sys.exit(0)
    mols = {}
    for each_file in input_files:
        mol = Molecule.from_xyz(each_file)
        mol.energy = read_energy_from_xyz_file(each_file)
        mols[mol.name] = mol
    choose_geometries(mols)
    return
예제 #33
0
 def get_mol_info(self):
     f = open(self.wfile)
     symbols, coords = [], []  
     l = f.readline()
     ele = re.compile("(\D+)")
     while l:
         if l.find("ATOMIC COORDINATES") > -1:
             for _ in xrange(4): 
                 l = f.readline()
             while True: 
                 atom = l.split()  
                 if atom == []: break 
                 sym, coord = ele.match(atom[1]).group() ,map(float, atom[3:6])
                 symbols.append(sym)  
                 coords.append(coord)  
                 #alist.append(Atom(symbol=sym, position=coord)) 
                 l = f.readline()
             return Molecule(atomnames = symbols, positions = coords)
         l = f.readline()
예제 #34
0
def main():
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('-s', type=int, required=True, nargs=2,
                        help='scan between two atoms')
    parser.add_argument('-c', '--charge', type=int, default=0,
                        help='charge')
    parser.add_argument('-m', '--multiplicity', type=int, default=1,
                        help='multiplicity')
    parser.add_argument('--scftype', type=str, default= 'rhf', choices= ['rhf', 'uhf'],
                        help='SCF type (rhf/uhf)')
    parser.add_argument("input_file", metavar='file',
                        type=str,
                        help='input coordinate file')
    parser.add_argument('-o', '--opt', action='store_true',
                        help='optimize')
    args = parser.parse_args()
    from Molecule import Molecule
    mol = Molecule.from_xyz(args.input_file)

    method_args = {
        'charge': args.charge,
        'multiplicity': args.multiplicity,
        'scftype': args.scftype,
        'software': 'orca'
    }
    a, b = args.s
    coordinates = mol.coordinates
    import numpy as np
    start_dist = np.linalg.norm(coordinates[a] - coordinates[b])
    final_distance = mol.covalent_radius[a] + mol.covalent_radius[b]
    step = int(abs(final_distance - start_dist)*10)
    c_k = '\n!ScanTS\n% geom scan B '+str(a)+' '+str(b)+ '= '+ str(start_dist)\
          + ', ' + str(final_distance) + ', ' + str(step) + ' end end\n'
    geometry = Orca(mol, method_args, custom_keyword=c_k)
    if args.opt:
        import optimiser
        print('optimising')
        optimiser.optimise(mol, method_args, 0.0, custom_keyword=c_k)
    else:
        print('created input file')
예제 #35
0
def test1():
    from Atom import Atom
    from Molecule import Molecule 
    from TullySurfaceHopping2 import TullySurfaceHopping 
    from Constants import fs2tau, tau2fs 

    at1 = Atom(symbol='X',mass=2000)
    mol1 = Molecule([at1])
    mol1.set_velocities([4.0]) 
    mol1.set_positions([-10]) 
    pot = Potential_for_tully(mol1,now_state=0,nrange=2)
    tsh = TullySurfaceHopping(mol1,pot,dt=0.5*fs2tau,nstep=100,\
            tsh_times=5)  # These are special fort TSH

    tsh.judge_tsh()
예제 #36
0
def test():
    #from PyQuante.Basis.sto3g import basis_data
    #from PyQuante.Basis.p631ss import basis_data
    #r = 1/0.52918
    #http://cccbdb.nist.gov/exp2.asp?casno=12597352
    #atoms=Molecule('si_dimer',atomlist = [('Si',(0,0,0)),('Si',(0,0,2.246))],units = 'Angstrom')
    #atoms=Molecule('si_atom',atomlist = [('Si',(0,0,0))],units = 'Angstrom')
    atoms = Molecule('li_atom', atomlist=[('Li', (0, 0, 0))], units='Angstrom')

    inttol = 1e-6  # Tolerance to which integrals must be equal

    basis_files_path = '/Users/believe/Google Drive/unt2/xintegrals'
    bfs = my_getbasis(atoms, basis_files_path)

    t0 = time()
    int0 = get2ints(bfs, pycc)
    t1 = time()
    print("time:    ", t1 - t0, ' s')
    print('Calculationg 2e integrals')
    mesg = """Store integrals in a long array in the form (ij|kl) (chemists
    notation. We only need i>=j, k>=l, and ij <= kl"""
    print(mesg)
    from array import array
    nbf = len(bfs)
    totlen = nbf * (nbf + 1) * (nbf * nbf + nbf + 2) / 8
    Ints = array('d', [0] * totlen)
    for i in range(nbf):
        for j in range(i + 1):
            ij = i * (i + 1) / 2 + j
            for k in range(nbf):
                for l in range(k + 1):
                    kl = k * (k + 1) / 2 + l
                    if ij >= kl:
                        intval = int0[ijkl2intindex(i, j, k, l)]
                        if intval >= 1E-6:
                            print('I= %d  J= %d  K= %d  L= %d  Int= %f' %
                                  (i + 1, j + 1, k + 1, l + 1, intval))
    return int0, bfs
def load_velocities(psfFile, velFile):
    """
    Load the binary velocity file and extract velocities.
    """

    mol = Molecule()
    mol.load(psfFile, "parm7")
    mol.load(velFile, "namdbin")

    allVelocities = atomsel('all')
    xVel = allVelocities.get('x')
    yVel = allVelocities.get('y')
    zVel = allVelocities.get('z')

    # conversion from binvel units to A/ps
#    convFactor = 20.4582651391 
#    xVel = [v * convFactor for v in xVel]
#    yVel = [v * convFactor for v in yVel]
#    zVel = [v * convFactor for v in zVel]

    mol.delete()
    return xVel, yVel, zVel
예제 #38
0
            # ------------------------------------------------------------------
            logtext.append(code + ' wget_pdb......Ok\n')
        except Exception as error:
            print 'failed wget pdb'
            print error
            logtext.append(code + ' wget_pdb......failed\n')

        try:
            # ------------------------------------------------------------------
            build_AMBER_system_from_PDB(
                pdbin=code+'_A.pdb',
                basename=code+'_A_AMBER',
                force_field='ff03ua.labio',
                overwrite=True
            )
            system = Molecule()
            system.load_PDB_to_system(filename=code + '_A_AMBER.pdb')
            system.import_AMBER_parameters(
                top=code + '_A_AMBER.top',
                torsions=os.path.join(
                    PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat'),
            )
            save_PDB_to_file(system, code+'_A.pdb')
            logtext.append(code + ' tleap......Ok\n')

        except:
            print 'failed wget pdb'
            logtext.append(code + ' tleap......failed\n')

        try:
            minimize(
예제 #39
0
import  matplotlib.pyplot as plt
import re
import numpy as np
from Constants import hartree2kj, hartree2ev
from AnalyzeTrj import get_data 
from Molecule import Molecule
from math import pi
import sys

gen = get_data("md_tsh_qmmm.trj", start=0.0)
mol = Molecule(["C","H","O","O","H"]) 
t_ary = []
l_ary = []
l2_ary = []
l3_ary = []

lim = 1200 

for a in gen: 
    t, x, v = a
    if t > lim: break
    mol.set_positions(x,unit="bohr")
    #print t, mol.get_bond_length(1,2,unit="ang") 
    t_ary.append(t)
    l_ary.append(mol.get_bond_length(3,4,unit="ang"))
    l2_ary.append(mol.get_bond_length(0,1,unit="ang"))
    l3_ary.append(mol.get_bond_length(1,4,unit="ang"))
    #l_ary.append(mol.get_dihedral(1,0,2,4)*180/pi)

f, (ax1, ax2) = plt.subplots(2, sharex=True)



# building a contact map - required for Contact model calculations
#-------------------------------------------------------------------------------
#from CMAP import CMAP
#cmap = CMAP(pdb = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'), cutoff = 6.5, log = True)
#-------------------------------------------------------------------------------


PDB      = '1GAB'
sequence = 'TIDQWLLKNAKEDAIAELKKAGITSDFYFNAINKAKTVEEVNALKNEILKAHA'

# creating a new system 
system = Molecule()
system.name = PDB+'-from_sequence' 
system.build_peptide_from_sequence (
                                     sequence    = sequence,
                                     _type       = 'amber'       ,
                                     force_field = 'ff03ua.labio',
                                     overwrite   = True          ,
                                     )
system.set_energy_model('RAW')


minimize(molecule = system,
               imin  = 1          ,
               maxcyc= 1000       ,
               ncyc  = 100        ,
               cut   = 10         ,
                                                     #
#----------------------------------------------------#
from SideChainRefine import optimize_side_chain
#----------------------------------------------------#
import random
random.seed(1234)


#-------------------------------------------------------------------------------
PEPDICE = os.environ.get('PEPDICE')
PEPDICE_EXAMPLES = os.path.join(PEPDICE, 'Examples')
PEPDICE_PARAMETER= os.path.join(PEPDICE, 'Parameters')
#-------------------------------------------------------------------------------
#/home/farminf/Programas/PepDice/Examples/outputs/1gab_amber_example04_extended.pdb

system = Molecule()
name = 'poliALa_1GAB_from_sequence_CMAP_SSrest_restraints'
TRAJECTORY = name+'_traj'
system.name = name
system.build_peptide_from_sequence (
                                     sequence    = 'TIDQWLLKNAKEDAIAELKKAGITSDFYFNAINKAKTVEEVNALKNEILKAHA',
                                     _type       = 'amber'       ,
                                     force_field = 'ff03ua.labio',
                                     overwrite   = True          ,
                                     )
system.set_energy_model('RAW')

                                                    #AAAAAAAA
system.import_SS_restraints_from_string (      ss = 'CCHHHHHHHHHHHHHHHHHHCCCCCHHHHHHHHHCCCHHHHHHHHHHHHHHCC', 
                                            w_ss  = '00023456788888654320000000034565400000023456789654000', log= True)
print system.compute_SS_energy(log = True)
예제 #42
0
                                                     #
#----------------------------------------------------#
from SideChainRefine import optimize_side_chain
#----------------------------------------------------#
import random
random.seed(1234)


#-------------------------------------------------------------------------------
PEPDICE = os.environ.get('PEPDICE')
PEPDICE_EXAMPLES = os.path.join(PEPDICE, 'Examples')
PEPDICE_PARAMETER= os.path.join(PEPDICE, 'Parameters')
#-------------------------------------------------------------------------------
#/home/farminf/Programas/PepDice/Examples/outputs/1gab_amber_example04_extended.pdb

system = Molecule()
system.name = '1gab_from_sequence'
system.build_peptide_from_sequence (
                                     sequence    = 'TIDQWLLKNAKEDAIAELKKAGITSDFYFNAINKAKTVEEVNALKNEILKAHA',
                                     _type       = 'amber'       ,
                                     force_field = 'ff03ua.labio',
                                     overwrite   = True          ,
                                     )
system.set_energy_model('RAW')


system.import_SS_restraints_from_string (      ss = 'CCHHHHHHHHHHHHHHHHHHCCCCCHHHHHHHHHCCCHHHHHHHHHHHHHHCC', 
                                            w_ss  = '00000123345553221111000000001234432100012342335556110', log= True)
print system.compute_SS_energy(log = True)

system.energy_components['SS_RESTRAINT'][1] = 0.01 
예제 #43
0
                                                     #
#----------------------------------------------------#
from SideChainRefine import optimize_side_chain
#----------------------------------------------------#
import random
random.seed(1234)


#-------------------------------------------------------------------------------
PEPDICE = os.environ.get('PEPDICE')
PEPDICE_EXAMPLES = os.path.join(PEPDICE, 'Examples')
PEPDICE_PARAMETER= os.path.join(PEPDICE, 'Parameters')
#-------------------------------------------------------------------------------
#/home/farminf/Programas/PepDice/Examples/outputs/1gab_amber_example04_extended.pdb

system = Molecule()
name = 'poliALa_from_sequence'
TRAJECTORY = name+'_traj'
system.name = name
system.build_peptide_from_sequence (
                                     sequence    = 'AAAAAAAA',
                                     _type       = 'amber'       ,
                                     force_field = 'ff03ua.labio',
                                     overwrite   = True          ,
                                     )
system.set_energy_model('RAW')

                                                    #AAAAAAAA
system.import_SS_restraints_from_string (      ss = 'HHHHHHHH', 
                                            w_ss  = '99999999', log= True)
print system.compute_SS_energy(log = True)
예제 #44
0
            'decoy69_12_A_AMBER_minimized.pdb':        5.69,
            'decoy69_37_A_AMBER_minimized.pdb':        6.89,
            'decoy69_75_A_AMBER_minimized.pdb':        7.20,
            'decoy69_131_A_AMBER_minimized.pdb':       8.64,
            'decoy69_202_A_AMBER_minimized.pdb':       9.08,
            'decoy69_218_A_AMBER_minimized.pdb':      10.06,
            }

#print system.energy(log       = True,
#  




# creating a new system 
system = Molecule()
system.name = '1I6C - LABIO dataset' 

# - setup energy model
system.set_energy_model('amber')

# importing coordinates and amber parameters
system.load_PDB_to_system      (filename = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'   )   )   
system.import_AMBER_parameters (top      = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER.top')   ,   
                                torsions = os.path.join(PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat') )   

system.set_energy_model('FULL')



energy_models = ['LABIO']
예제 #45
0
import cmath

# Opening and reading in hessian matrix
with open('hessian.dat','r') as my_file:
	data = my_file.read()
	data = data.split('\n')
	hessian = []
	data = data[:-1]
	for i in range(len(data)):
		temp = data[i].split()
		temp = map(float,temp)
		hessian.append(temp)
hessian = np.array(hessian)

# Reading in molecule and converting units to Angstrom
Mol = Molecule('molecule.xyz')
Mol.to_angstrom()

# Frequency calculation function
def frequencies(Mol,hessian):
	# defining mass weighted hessian
	mwhessian = hessian
	# defining length variable
	h = len(hessian)
	n = h/3
	# defining and populating diagonal mass matrix
	M = np.identity(len(hessian))
	for i in range(n):
		for k in range(3):
			M[3*i+k] = M[3*i+k] / math.sqrt(Mol.masses[i])
	# Computing the mass weighted Hessian
                                                     #
#----------------------------------------------------#
from SideChainRefine import optimize_side_chain
#----------------------------------------------------#
import random
random.seed(1234)


#-------------------------------------------------------------------------------
PEPDICE = os.environ.get('PEPDICE')
PEPDICE_EXAMPLES = os.path.join(PEPDICE, 'Examples')
PEPDICE_PARAMETER= os.path.join(PEPDICE, 'Parameters')
#-------------------------------------------------------------------------------
#/home/farminf/Programas/PepDice/Examples/outputs/1gab_amber_example04_extended.pdb

system = Molecule()
system.build_peptide_from_sequence (
                                     sequence    = 'KLPPGWEKRMSRSSGRVYYFNHITNASQWERPSGNSSSG',
                                     _type       = 'amber'       ,
                                     force_field = 'ff03ua.labio',
                                     overwrite   = True          ,
                                     )
system.set_energy_model('iLABIO')
'''

minimize(
        molecule=system,
        imin  =   1,
        maxcyc=1000,
        ncyc  = 100,
        cut   =  10,
textlines.append(text)

logfile =  open('logfile.txt', 'w')
logfile.writelines(text)
logfile.write('\n')

print text


for folder in folders:
    path = os.path.join(cwd, folder)
    
    os.chdir(os.path.join(cwd, folder))
    
    RMSD_list = import_rmsd_from_file ( filein = 'list.txt')
    system = Molecule()
    system.set_energy_model('amber')
    system.import_AMBER_parameters (top      = 'native_A_AMBER.top'                ,   
                                    torsions = os.path.join(PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat') )       
    
    cmap = CMAP(pdb = 'native_A_AMBER_minimized.pdb', cutoff = 6.5, log = False)
    
    
    
    
    for pdb in RMSD_list:
        if pdb == 'NAME':
            pass
        
        else:
            filename =  pdb.replace('.', '_A_AMBER_minimized.')
예제 #48
0
from Potential_MM_f2py import potential_mm_f2py, potential_mm_f2py_mc, potential_qmmm_f2py
from Molecule import Molecule 
import  numpy as np 
natom = 3
ndims = 3
atomnumbers = [18]*natom
#positions=np.array([[5.,0.,0.],[-5.,0.,0.],[0., 5., 0.],[0., -5., 0.]])  
positions=np.array([[105.,0.,0.],[-105.,0.,0.],[0., 105., 0.]])  
#positions = list(positions)

mol = Molecule(['C', 'Ar','H'],positions= [[0.,5.,0.],[5.,0.,0.],[-5.,0.,0.]]) 
positions = mol.get_positions() 
atomnumbers = mol.get_atomnumbers() 
ind = 0
rlimit = 30 

#print  potential_mm_f2py.__doc__ 
print  potential_qmmm_f2py.__doc__ 
sys.exit() 
print  potential_mm_f2py_mc.__doc__ 
energy = potential_mm_f2py_mc(ind, atomnumbers, positions.T, rlimit) 
print energy 
ind = 1
energy = potential_mm_f2py_mc(ind, atomnumbers, positions.T, rlimit) 
#energy, forces = potential_mm_f2py(atomnumbers, positions.T, rlimit) 
#energy, forces1, forces2 = potential_qmmm_f2py(atomnumbers1,atomnumbers2, positions1.T, positions2.T,rlimit) 
print energy 
       ]







for pdb in pdbs:


    PDB        = pdb
    sequence   = get_sequence_from_segFile(seqFile = os.path.join(PEPDICE_EXAMPLES , '') )
    TRAJECTORY = PDB+'trajectory'
    # creating a new system 
    system = Molecule()
    system.name = PDB+'-from_sequence' 
    system.build_peptide_from_sequence (
                                         sequence    = sequence,
                                         _type       = 'amber'       ,
                                         force_field = 'ff03ua.labio',
                                         overwrite   = True          ,
                                         )
    system.set_energy_model('RAW')
    system.load_PDB_to_system       (filename =  os.path.join(PEPDICE_EXAMPLES , 'new_method_example02.1_fragments_extended_min.pdb'))



    '''
    minimize(molecule = system,
                   imin  = 1          ,
예제 #50
0
#-------------------------------------------------------------------------------



# building a contact map - required for Contact model calculations
#-------------------------------------------------------------------------------
from CMAP import CMAP
cmap = CMAP(pdb = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1GAB/1GAB_A_AMBER_minimized.pdb'), cutoff = 6.5, log = True)
#-------------------------------------------------------------------------------





# creating a new system 
system = Molecule()
system.name = '1GAB - LABIO dataset' 

# - setup energy model
system.set_energy_model('amber')

# importing coordinates and amber parameters
system.load_PDB_to_system      (filename = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1GAB/1GAB_A_AMBER_minimized.pdb'   )   )   
system.import_AMBER_parameters (top      = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1GAB/1GAB_A_AMBER.top')   ,   
                                torsions = os.path.join(PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat') )   



print system.compute_R_gy_Calpha()
#print system.compute_SS_energy(log = True)
#cmap = CMAP(pdb = os.path.join(PEPDICE_EXAMPLES ,  'Itasser_set/IT1af7__/native_A_AMBER_minimized.pdb'), cutoff = 6.5, log = True)
예제 #51
0
    def dv12(self,x):
        return -2 * x * self.c * self.d * exp(-self.d*x*x)


#pot = Test_Pot_Tully()
#x = np.linspace(-10,10,100)
#p_ary = np.array([ pot.get_nacme([[i]]) for i in x]) / 50
#plt.plot(x,p_ary[:])
#p_ary = np.array([ pot.v12(i) for i in x])
#plt.plot(x,p_ary[:])
#p_ary = np.array([ pot.get_pot([[i]]) for i in x])
#plt.plot(x,p_ary[:,0])
#plt.plot(x,p_ary[:,1])
#plt.show()
#sys.exit()
#

x = Molecule(["X"])
x.set_masses([2000])
x.set_positions([[-5.0,0,0]])
x.set_velocities([[0.0180,0,0]])
#print x.get_masses()
#print x.get_kinetic_energy()
print x.get_momentum()
#sys.exit()
func = Test_Pot_Tully()
pot = Potential_TEST(x,func,0,2)
#md = VelocityVerlet(x,pot,dt=0.2*fs2tau,nstep=5000) 
md = TullySurfaceHopping(x,pot,dt=0.2*fs2tau,nstep=1500) 
md.run() 
예제 #52
0



# building a contact map - required for Contact model calculations
#-------------------------------------------------------------------------------
from CMAP import CMAP
cmap = CMAP(pdb = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'), cutoff = 6.5, log = True)
#-------------------------------------------------------------------------------





# creating a new system 
system = Molecule()
system.name = '1I6C - LABIO dataset' 

# - setup energy model
system.set_energy_model('amber')

# importing coordinates and amber parameters
system.load_PDB_to_system      (filename = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'   )   )   
system.import_AMBER_parameters (top      = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER.top')   ,   
                                torsions = os.path.join(PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat') )  


pdbs          = [
                    os.path.join( PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'     ),
                    os.path.join( PEPDICE_EXAMPLES , 'LABIO_set/1I6C/decoy0_1_A_AMBER_minimized.pdb' ),
                    os.path.join( PEPDICE_EXAMPLES , 'LABIO_set/1I6C/decoy1_1_A_AMBER_minimized.pdb' ),
예제 #53
0
def get_vcom(atoms):
    "Compute the Center of Mass Velocity"
    vcom = zeros(3,Float)
    totm = 0
    for atom in atoms:
        m = atom.mass()
        vcom += m*atom.v
        totm += m
    return vcom/totm

if __name__ == '__main__':
    from Molecule import Molecule
    dmn = Molecule('DMN',
                   [(6,( 0.886026, 2.385603, 2.381127)),
                    (7,( 0.886026, 1.002738, 0.000000)),
                    (6,( 0.886026, 2.385603,-2.381127)),
                    (7,(-0.495094,-1.265835, 0.000000)),
                    (8,(-1.007426,-2.190039, 2.093021)),
                    (8,(-1.007426,-2.190039,-2.093021)),
                    (1,( 1.335454, 1.081991, 3.923211)),
                    (1,( 2.353665, 3.846988, 2.256411)),
                    (1,( 1.335454, 1.081991,-3.923211)),
                    (1,( 2.353665, 3.846988,-2.256411)),
                    (1,(-0.953450, 3.291993, 2.778406)),
                    (1,(-0.953450, 3.291993,-2.778406))])
    T = 20.
    set_boltzmann_velocities(dmn,T)
    EF = HarmForce(dmn.atuples())
    Dynamics(dmn,100,1000,0.1,T,EF)
                                                     #
#----------------------------------------------------#
from SideChainRefine import optimize_side_chain
#----------------------------------------------------#
import random
random.seed(1234)


#-------------------------------------------------------------------------------
PEPDICE = os.environ.get('PEPDICE')
PEPDICE_EXAMPLES = os.path.join(PEPDICE, 'Examples')
PEPDICE_PARAMETER= os.path.join(PEPDICE, 'Parameters')
#-------------------------------------------------------------------------------
#/home/farminf/Programas/PepDice/Examples/outputs/1gab_amber_example04_extended.pdb

system = Molecule()

system.build_peptide_from_sequence (
                                     sequence    = 'AADD',
                                     _type       = 'amber'       ,
                                     force_field = 'ff03ua.labio',
                                     overwrite   = True          ,
                                     )
system.set_energy_model('FULL')

#system.energy(log = True)


hydropathic_table_AB = {
                            'ARG' : 'B', #-4.5,  
                            'LYS' : 'B', #-3.9,
예제 #55
0
#-------------------------------------------------------------------------------



# building a contact map - required for Contact model calculations
#-------------------------------------------------------------------------------
from CMAP import CMAP
cmap = CMAP(pdb = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'), cutoff = 6.5, log = True)
#-------------------------------------------------------------------------------





# creating a new system 
system = Molecule()
system.name = '1I6C - LABIO dataset' 

# - setup energy model
system.set_energy_model('amber')

# importing coordinates and amber parameters
system.load_PDB_to_system      (filename = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER_minimized.pdb'   )   )   
system.import_AMBER_parameters (top      = os.path.join(PEPDICE_EXAMPLES , 'LABIO_set/1I6C/1I6C_A_AMBER.top')   ,   
                                torsions = os.path.join(PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat') )   



print system.compute_R_gy_Calpha()
print system.compute_SS_energy(log = True)
#cmap = CMAP(pdb = os.path.join(PEPDICE_EXAMPLES ,  'Itasser_set/IT1af7__/native_A_AMBER_minimized.pdb'), cutoff = 6.5, log = True)
예제 #56
0
textlines = []
textlines.append(text)
logfile =  open('logfile.txt', 'w')
logfile.writelines(text)
logfile.write('\n')

print text


for folder in folders:
    path = os.path.join(cwd, folder)
    
    os.chdir(os.path.join(cwd, folder))
    #/home/fernando/programs/pepdice/Examples/LABIO_set/1I6C/1I6C_A_AMBER.top
    RMSD_list = import_rmsd_from_file ( filein = 'list.txt')
    system = Molecule()
    system.set_energy_model('FULL')
    system.import_AMBER_parameters (top      = folder+'_A_AMBER.top'                ,   
                                    torsions = os.path.join(PEPDICE_PARAMETER, 'amber/AMBER_rotamers.dat') )       
    
    
    
    
    
    
    for pdb in RMSD_list:
        if pdb == 'NAME':
            pass
        
        else:
            filename =  pdb.replace('.', '_A_AMBER_minimized.')