本文整理汇总了Python中htmd.molecule.molecule.Molecule.center方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.center方法的具体用法?Python Molecule.center怎么用?Python Molecule.center使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmd.molecule.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.center方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _prep_and_run
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import center [as 别名]
def _prep_and_run(self, mol, rtf, prm, outdir, solvated):
from htmd.builder.solvate import solvate
from htmd.apps.acemdlocal import AcemdLocal
# Do a simple solvation then run for 50ns
ionize = True
mol = Molecule(mol)
mol.center()
mol.set("segid", "L")
d = maxDistance(mol, 'all') + 6
if solvated:
mol = solvate(mol, minmax=[[-d, -d, -d], [d, d, d]])
if not solvated:
ionize = False
build_dir = os.path.join(outdir, "build")
equil_dir = os.path.join(outdir, "equil")
rtfs = ['top/top_water_ions.rtf', rtf]
prms = ['par/par_water_ions.prm', prm]
charmm.build(mol, topo=rtfs, param=prms, outdir=build_dir, ionize=ionize)
md = Equilibration()
md.runtime = 50
md.timeunits = 'ns'
md.temperature = 300
md.write(build_dir, equil_dir)
mdx = AcemdLocal()
mdx.submit(equil_dir)
mdx.wait()
示例2: buildMembrane
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import center [as 别名]
def buildMembrane(xysize, ratioupper, ratiolower, waterbuff=20, equilibrate=True, outdir='./buildmemb/', lipidf=None):
""" Construct a membrane containing arbitrary lipids and ratios of them.
Parameters
----------
xysize : list
A list containing the size in x and y dimensions of the membrane in Angstroms
ratioupper : list of lists
A list containing sublists indicating the molecule name and the ratio of that molecule for the upper layer
ratiolower : list of lists
Same as ratioupper but for the lower layer
waterbuff : float
The z-dimension size of the water box above and below the membrane
equilibrate : bool
If True it equilibrates the membrane
outdir : str
A folder in which to store the psf and pdb files
lipidf : str
The path to the starting lipid conformations
Returns
-------
mol : :class:`Molecule <htmd.molecule.molecule.Molecule`
The resulting membrane including surrounding waters
Examples
--------
>>> lipidratioupper = [['popc', 10], ['chl1', 1]]
>>> lipidratiolower = [['popc', 8], ['chl1', 2]]
>>> width = [50, 100]
>>> res = buildMembrane(width, lipidratioupper, lipidratiolower)
"""
from htmd.membranebuilder.ringpenetration import resolveRingPenetrations
from htmd.builder.solvate import solvate
from htmd.builder.charmm import build
from htmd.util import tempname
from htmd.molecule.molecule import Molecule
from htmd.home import home
import os
import pandas as pd
if lipidf is None:
lipidf = os.path.join(home(), 'membranebuilder', 'lipids')
lipiddb = pd.read_csv(os.path.join(home(), 'membranebuilder', 'lipiddb.csv'), index_col='Name')
uqlip = np.unique([x[0] for x in ratioupper] + [x[0] for x in ratiolower])
files = _locateLipidFiles(lipidf, uqlip)
area = np.prod(xysize)
lipids = _createLipids(ratioupper, area, lipiddb, files, leaflet='upper')
lipids += _createLipids(ratiolower, area, lipiddb, files, leaflet='lower')
_setPositionsLJSim(xysize, [l for l in lipids if l.xyz[2] > 0])
_setPositionsLJSim(xysize, [l for l in lipids if l.xyz[2] < 0])
_findNeighbours(lipids, xysize)
_loadMolecules(lipids, files)
resolveRingPenetrations(lipids, xysize)
memb = _createMembraneMolecule(lipids)
# from globalminimization import minimize
# newpos, newrot = minimize(lipids, xysize + [100], stepxy=0.5, steprot=50, contactthresh=1)
# for i in range(len(lipids)):
# lipids[i].xyz[:2] = newpos[i]
# lipids[i].rot = newrot[i]
#
# resolveRingPenetrations(lipids, xysize)
# endmemb = _createMembraneMolecule(lipids)
minc = memb.get('coords', 'name P').min(axis=0) - 5
maxc = memb.get('coords', 'name P').max(axis=0) + 5
mm = [[0, 0, maxc[2] - 2], [xysize[0], xysize[1], maxc[2] + waterbuff]]
smemb = solvate(memb, minmax=mm)
mm = [[0, 0, minc[2] - waterbuff], [xysize[0], xysize[1], minc[2] + 2]]
smemb = solvate(smemb, minmax=mm)
smemb.moveBy([0, 0, -smemb.coords[:, 2, 0].min()])
if outdir is None:
outdir = tempname()
print('Outdir ', outdir)
res = build(smemb, ionize=False, stream=['str/lipid/toppar_all36_lipid_cholesterol_model_1.str'], outdir=outdir)
if equilibrate:
from htmd.membranebuilder.simulate_openmm import equilibrateSystem
from shutil import copy, move
outpdb = tempname(suffix='.pdb')
charmmf = os.path.join(home(), 'membranebuilder', 'charmm-toppar')
equilibrateSystem(os.path.join(outdir, 'structure.pdb'), os.path.join(outdir, 'structure.psf'), outpdb, charmmfolder=charmmf)
res = Molecule(outpdb)
res.center()
move(os.path.join(outdir, 'structure.pdb'), os.path.join(outdir, 'starting_structure.pdb'))
copy(outpdb, os.path.join(outdir, 'structure.pdb'))
return res