本文整理汇总了Python中htmd.molecule.molecule.Molecule.bonds方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.bonds方法的具体用法?Python Molecule.bonds怎么用?Python Molecule.bonds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmd.molecule.molecule.Molecule
的用法示例。
在下文中一共展示了Molecule.bonds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import bonds [as 别名]
def build(mol, ff=None, topo=None, param=None, prefix='structure', outdir='./', caps=None, ionize=True, saltconc=0,
saltanion=None, saltcation=None, disulfide=None, tleap='tleap', execute=True):
""" Builds a system for AMBER
Uses tleap to build a system for AMBER. Additionally it allows the user to ionize and add disulfide bridges.
Parameters
----------
mol : :class:`Molecule <htmd.molecule.molecule.Molecule>` object
The Molecule object containing the system
ff : list of str
A list of leaprc forcefield files. Default: ['leaprc.lipid14', 'leaprc.ff14SB', 'leaprc.gaff']
topo : list of str
A list of topology `prepi` files.
param : list of str
A list of parameter `frcmod` files.
prefix : str
The prefix for the generated pdb and psf files
outdir : str
The path to the output directory
caps : dict
A dictionary with keys segids and values lists of strings describing the caps of that segment.
e.g. caps['P'] = ['ACE', 'NME']. Default: will apply ACE and NME caps to proteins and no caps
to the rest.
ionize : bool
Enable or disable ionization
saltconc : float
Salt concentration to add to the system after neutralization.
saltanion : {'Cl-'}
The anion type. Please use only AMBER ion atom names.
saltcation : {'Na+', 'K+', 'Cs+'}
The cation type. Please use only AMBER ion atom names.
disulfide : np.ndarray
If None it will guess disulfide bonds. Otherwise provide a 2D array where each row is a pair of atom indexes that makes a disulfide bond
tleap : str
Path to tleap executable used to build the system for AMBER
execute : bool
Disable building. Will only write out the input script needed by tleap. Does not include ionization.
Returns
-------
molbuilt : :class:`Molecule <htmd.molecule.molecule.Molecule>` object
The built system in a Molecule object
Example
-------
>>> ffs = ['leaprc.lipid14', 'leaprc.ff14SB', 'leaprc.gaff']
>>> molbuilt = amber.build(mol, ff=ffs, outdir='/tmp/build', saltconc=0.15)
"""
# Remove pdb bonds!
mol = mol.copy()
mol.bonds = []
if shutil.which(tleap) is None:
raise NameError('Could not find executable: `' + tleap + '` in the PATH. Cannot build for AMBER.')
if not os.path.isdir(outdir):
os.makedirs(outdir)
_cleanOutDir(outdir)
if ff is None:
ff = ['leaprc.lipid14', 'leaprc.ff14SB', 'leaprc.gaff']
if topo is None:
topo = []
if param is None:
param = []
if caps is None:
caps = _defaultCaps(mol)
_missingSegID(mol)
_checkMixedSegment(mol)
logger.info('Converting CHARMM membranes to AMBER.')
mol = _charmmLipid2Amber(mol)
#_checkProteinGaps(mol)
_applyCaps(mol, caps)
f = open(path.join(outdir, 'tleap.in'), 'w')
f.write('# tleap file generated by amber.build\n')
# Printing out the forcefields
for force in ff:
f.write('source ' + force + '\n')
f.write('\n')
# Loading TIP3P water parameters
f.write('# Loading ions and TIP3P water parameters\n')
f.write('loadamberparams frcmod.ionsjc_tip3p\n\n')
# Printing out topologies
logger.info('Writing prepi files.')
f.write('# Loading prepi topologies\n')
for t in topo:
shutil.copy(t, outdir)
f.write('loadamberprep ' + path.basename(t) + '\n')
f.write('\n')
# Printing and loading the PDB file. AMBER can work with a single PDB file if the segments are separate by TER
logger.info('Writing PDB file for input to tleap.')
pdbname = path.join(outdir, 'input.pdb')
mol.write(pdbname)
if not os.path.isfile(pdbname):
#.........这里部分代码省略.........
示例2: build
# 需要导入模块: from htmd.molecule.molecule import Molecule [as 别名]
# 或者: from htmd.molecule.molecule.Molecule import bonds [as 别名]
def build(mol, ff=None, topo=None, param=None, prefix='structure', outdir='./build', caps=None, ionize=True, saltconc=0,
saltanion=None, saltcation=None, disulfide=None, tleap=None, execute=True, atomtypes=None,
offlibraries=None, gbsa=False, igb=2):
""" Builds a system for AMBER
Uses tleap to build a system for AMBER. Additionally it allows the user to ionize and add disulfide bridges.
Parameters
----------
mol : :class:`Molecule <htmd.molecule.molecule.Molecule>` object
The Molecule object containing the system
ff : list of str
A list of leaprc forcefield files.
Use :func:`amber.listFiles <htmd.builder.amber.listFiles>` to get a list of available forcefield files.
Default: :func:`amber.defaultFf <htmd.builder.amber.defaultFf>`
topo : list of str
A list of topology `prepi/prep/in` files.
Use :func:`amber.listFiles <htmd.builder.amber.listFiles>` to get a list of available topology files.
Default: :func:`amber.defaultTopo <htmd.builder.amber.defaultTopo>`
param : list of str
A list of parameter `frcmod` files.
Use :func:`amber.listFiles <htmd.builder.amber.listFiles>` to get a list of available parameter files.
Default: :func:`amber.defaultParam <htmd.builder.amber.defaultParam>`
prefix : str
The prefix for the generated pdb and psf files
outdir : str
The path to the output directory
Default: './build'
caps : dict
A dictionary with keys segids and values lists of strings describing the caps for a particular protein segment.
e.g. caps['P'] = ['ACE', 'NME'] or caps['P'] = ['none', 'none']. Default: will apply ACE and NME caps to every
protein segment.
ionize : bool
Enable or disable ionization
saltconc : float
Salt concentration to add to the system after neutralization.
saltanion : {'Cl-'}
The anion type. Please use only AMBER ion atom names.
saltcation : {'Na+', 'K+', 'Cs+'}
The cation type. Please use only AMBER ion atom names.
disulfide : list of pairs of atomselection strings
If None it will guess disulfide bonds. Otherwise provide a list pairs of atomselection strings for each pair of
residues forming the disulfide bridge.
tleap : str
Path to tleap executable used to build the system for AMBER
execute : bool
Disable building. Will only write out the input script needed by tleap. Does not include ionization.
atomtypes : list of triplets
Custom atom types defined by the user as ('type', 'element', 'hybrid') triplets
e.g. (('C1', 'C', 'sp2'), ('CI', 'C', 'sp3')). Check `addAtomTypes` in AmberTools docs.
offlibraries : str or list
A path or a list of paths to OFF library files. Check `loadOFF` in AmberTools docs.
gbsa : bool
Modify radii for GBSA implicit water model
igb : int
GB model. Select: 1 for mbondi, 2 and 5 for mbondi2, 7 for bondi and 8 for mbondi3.
Check section 4. The Generalized Born/Surface Area Model of the AMBER manual.
Returns
-------
molbuilt : :class:`Molecule <htmd.molecule.molecule.Molecule>` object
The built system in a Molecule object
Example
-------
>>> from htmd.ui import * # doctest: +SKIP
>>> mol = Molecule("3PTB")
>>> molbuilt = amber.build(mol, outdir='/tmp/build') # doctest: +SKIP
>>> # More complex example
>>> disu = [['segid P and resid 157', 'segid P and resid 13'], ['segid K and resid 1', 'segid K and resid 25']]
>>> molbuilt = amber.build(mol, outdir='/tmp/build', saltconc=0.15, disulfide=disu) # doctest: +SKIP
"""
# Remove pdb protein bonds as they can be regenerated by tleap. Keep non-protein bonds i.e. for ligands
mol = mol.copy()
_removeProteinBonds(mol)
if tleap is None:
tleap = _findTleap()
else:
if shutil.which(tleap) is None:
raise NameError('Could not find executable: `{}` in the PATH. Cannot build for AMBER.'.format(tleap))
if not os.path.isdir(outdir):
os.makedirs(outdir)
_cleanOutDir(outdir)
if ff is None:
ff = defaultFf()
if topo is None:
topo = defaultTopo()
if param is None:
param = defaultParam()
if caps is None:
caps = _defaultProteinCaps(mol)
_missingSegID(mol)
_checkMixedSegment(mol)
mol = _charmmLipid2Amber(mol)
_applyProteinCaps(mol, caps)
#.........这里部分代码省略.........