def create_sol(o, struct, top, posres, box=None): # make a top if we don't have one # topology returns: # {'top': '/home/andy/tmp/Au/top/system.top', # 'dirname': 'top', # 'posres': 'protein_posres.itp', # 'struct': '/home/andy/tmp/Au/top/protein.pdb'} # convert Angstrom to Nm, GROMACS works in Nm, and # we use MDAnalysis which uses Angstroms print("attempting auto solvation...") if box is None: universe = MDAnalysis.Universe(struct) box=universe.trajectory.ts.dimensions[:3] else: # box could be anything, fine as long as we can convert to an array box = array(box) print("user specified periodic boundary conditions: {}".format(box)) sol = md.solvate(dirname=o,struct=struct,top=top,box=box/10.0) # solvate returns # {'ndx': '/home/andy/tmp/Au/solvate/main.ndx', # 'mainselection': '"Protein"', # 'struct': '/home/andy/tmp/Au/solvate/solvated.pdb', # 'qtot': 0}) print("auto solvation successfull") print(sol)
def create_sol(o, struct, top, posres, box=None): # make a top if we don't have one # topology returns: # {'top': '/home/andy/tmp/Au/top/system.top', # 'dirname': 'top', # 'posres': 'protein_posres.itp', # 'struct': '/home/andy/tmp/Au/top/protein.pdb'} # convert Angstrom to Nm, GROMACS works in Nm, and # we use MDAnalysis which uses Angstroms print("attempting auto solvation...") if box is None: universe = MDAnalysis.Universe(struct) box = universe.trajectory.ts.dimensions[:3] else: # box could be anything, fine as long as we can convert to an array box = array(box) print("user specified periodic boundary conditions: {}".format(box)) sol = md.solvate(dirname=o, struct=struct, top=top, box=box / 10.0) # solvate returns # {'ndx': '/home/andy/tmp/Au/solvate/main.ndx', # 'mainselection': '"Protein"', # 'struct': '/home/andy/tmp/Au/solvate/solvated.pdb', # 'qtot': 0}) print("auto solvation successfull") print(sol)
def solvate(self): """ Solvate the current structure (self.universe) Neither the universe, nor the contents of the universe are harmed by this operation. @return: A MDManager context manager which contains the solvated structure and topology files, as well as a 'sub' index which will be used to later pick out the original unsolvated atoms. """ return md.solvate(struct=self.universe, top=self.top, top_includes = self.top_includes, mainselection=self.mainselection)
def solvate(self): """ Solvate the current structure (self.universe) Neither the universe, nor the contents of the universe are harmed by this operation. @return: A MDManager context manager which contains the solvated structure and topology files, as well as a 'sub' index which will be used to later pick out the original unsolvated atoms. """ return md.solvate(struct=self.universe, top=self.top, top_includes=self.top_includes, mainselection=self.mainselection)
print("succesfully auto-generated topology") print('pwd', os.getcwd()) print('top', top) filedata_fromfile(TOPOL_TOP, top["top"]) filedata_fromfile(STRUCT_PDB, top["struct"]) include_dirs = [os.path.abspath(top.dirname)] read_includes(top["top"]) # check to see if solvation is possible if should_solvate: # convert Angstrom to Nm, GROMACS works in Nm, and # we use MDAnalysis which uses Angstroms print("attempting auto solvation...") with md.solvate(top_includes=top_includes.values(), box=box/10.0, **top): # solvate returns # {'ndx': '/home/andy/tmp/Au/solvate/main.ndx', # 'mainselection': '"Protein"', # 'struct': '/home/andy/tmp/Au/solvate/solvated.pdb', # 'qtot': 0}) print("auto solvation successfull") else: # use user specified top print("using user specified topology file {}".format(top)) filedata_fromfile(TOPOL_TOP, top) filedata_fromfile(STRUCT_PDB, struct) read_includes(top)
print('pwd', os.getcwd()) print('top', top) filedata_fromfile(TOPOL_TOP, top["top"]) filedata_fromfile(STRUCT_PDB, top["struct"]) include_dirs = [os.path.abspath(top.dirname)] read_includes(top["top"]) # check to see if solvation is possible if should_solvate: # convert Angstrom to Nm, GROMACS works in Nm, and # we use MDAnalysis which uses Angstroms print("attempting auto solvation...") with md.solvate(top_includes=top_includes.values(), box=box / 10.0, **top): # solvate returns # {'ndx': '/home/andy/tmp/Au/solvate/main.ndx', # 'mainselection': '"Protein"', # 'struct': '/home/andy/tmp/Au/solvate/solvated.pdb', # 'qtot': 0}) print("auto solvation successfull") else: # use user specified top print("using user specified topology file {}".format(top)) filedata_fromfile(TOPOL_TOP, top) filedata_fromfile(STRUCT_PDB, struct) read_includes(top)