本文整理汇总了Python中Sire.System.add方法的典型用法代码示例。如果您正苦于以下问题:Python System.add方法的具体用法?Python System.add怎么用?Python System.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sire.System
的用法示例。
在下文中一共展示了System.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addRDF
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def addRDF(rdf, pdbfile, xscfile=None):
"""Add to the RDF 'rdf' the distances calculated using the coordinates
from the PDB file 'pdbfile', using the xscfile 'xscfile' to get the
dimensions of the periodic box. If 'xscfile' is None, then
no periodic boundary conditions are used."""
#first get the space in which to calculate intermolecular distances
space = Cartesian()
if xscfile:
lines = open(xscfile,"r").readlines()
words = lines[0].split()
mincoords = Vector( float(words[0]), float(words[1]), float(words[2]) )
maxcoords = Vector( float(words[3]), float(words[4]), float(words[5]) )
space = PeriodicBox(mincoords, maxcoords)
#now load all of the molecules
mols = PDB().read(pdbfile)
#create a system to hold the molecules, and add them
system = System()
system.add( MoleculeGroup("molecules", mols) )
#give the space to the system
system.add( InterCLJFF() ) # bug! need to add InterCLJFF so
# that the system has a space property. This
# is fixed in new version of Sire, but is broken
# in your version
system.setProperty("space", space)
#add the RDF - this calculates the RDF for this PDB file and adds it to 'rdf'
rdf.monitor(system)
示例2: buildSystem
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def buildSystem(forcefields):
system = System()
for forcefield in forcefields:
system.add(forcefield)
system.setProperty("space", space)
system.setProperty("switchingFunction", HarmonicSwitchingFunction(8*angstrom, 7.5*angstrom))
system.setProperty("shiftDelta", VariantProperty(2.0))
system.setProperty("coulombPower", VariantProperty(0))
return system
示例3: createSystem
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def createSystem(molecules):
moleculeNumbers = molecules.molNums()
moleculeList = []
for moleculeNumber in moleculeNumbers:
molecule = molecules.molecule(moleculeNumber).molecule()
moleculeList.append(molecule)
all = MoleculeGroup("all")
for molecule in moleculeList[0:]:
all.add(molecule)
gridwater = MoleculeGroup("gridwater")
otherwater = MoleculeGroup("otherwater")
solutes = MoleculeGroup("solutes")
# Add these groups to the System
system = System()
system.add(all)
system.add(gridwater)
system.add(otherwater)
system.add(solutes)
return system
示例4: createSystem
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def createSystem(molecules):
# print("Applying flexibility and zmatrix templates...")
print("Creating the system...")
moleculeNumbers = molecules.molNums()
moleculeList = []
for moleculeNumber in moleculeNumbers:
molecule = molecules.molecule(moleculeNumber).molecule()
moleculeList.append(molecule)
molecules = MoleculeGroup("molecules")
ions = MoleculeGroup("ions")
for molecule in moleculeList:
natoms = molecule.nAtoms()
if natoms == 1:
ions.add(molecule)
else:
molecules.add(molecule)
all = MoleculeGroup("all")
all.add(molecules)
all.add(ions)
# Add these groups to the System
system = System()
system.add(all)
system.add(molecules)
system.add(ions)
return system
示例5: test_fixed_center
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def test_fixed_center(verbose = False):
ligand = Sire.Stream.load("../io/osel.s3")
ligand = ligand.edit().setProperty("center", wrap(ligand.evaluate().center())).commit()
old_center = ligand.property("center")
intraff = InternalFF("intraff")
intraff.add(ligand)
intraclj = IntraCLJFF("intraclj")
intraclj.add(ligand)
system = System()
system.add(intraff)
system.add(intraclj)
mols = MoleculeGroup("mols")
mols.add(ligand)
system.add(mols)
intramove = InternalMove(mols)
rbmove = RigidBodyMC(mols)
rbmove.setMaximumTranslation(0*angstrom)
moves = WeightedMoves()
moves.add(intramove, 1)
moves.add(rbmove, 1)
for i in range(0,10):
system = moves.move(system, 25, False)
if verbose:
print("Completed 25 moves...")
ligand = system[ligand.number()].molecule()
new_center = ligand.property("center")
if verbose:
print("Old center = %s" % old_center)
print("New center = %s" % new_center)
assert_almost_equal( old_center.x(), new_center.x(), 1 )
assert_almost_equal( old_center.y(), new_center.y(), 1 )
assert_almost_equal( old_center.z(), new_center.z(), 1 )
示例6: HarmonicSwitchingFunction
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
atom_cljff.setUseAtomisticCutoff(True)
group_coul = group_cljff.components().coulomb()
shift_coul = shift_cljff.components().coulomb()
field_coul = field_cljff.components().coulomb()
atom_coul = atom_cljff.components().coulomb()
forcefields = [ group_cljff, shift_cljff, field_cljff, atom_cljff ]
switchfunc = HarmonicSwitchingFunction(10*angstrom, 9.5*angstrom)
system = System()
for forcefield in forcefields:
forcefield.add(waters)
system.add(forcefield)
def printEnergies(nrgs):
keys = list(nrgs.keys())
keys.sort()
for key in keys:
print("%25s : %12.8f" % (key, nrgs[key]))
system.setProperty("space", space)
system.setProperty("switchingFunction", switchfunc)
printEnergies(system.energies())
print("\nEnergy with respect to cutoff length\n")
print(" Distance Group Shifted ReactionField Atomistic")
示例7: loadQMMMSystem
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def loadQMMMSystem():
"""This function is called to set up the system. It sets everything
up, then returns a System object that holds the configured system"""
print("Loading the system...")
t = QTime()
if os.path.exists(s3file.val):
print("Loading existing s3 file %s..." % s3file.val)
loadsys = Sire.Stream.load(s3file.val)
else:
print("Loading from Amber files %s / %s..." % (topfile.val, crdfile.val))
# Add the name of the ligand to the list of solute molecules
sys_scheme = NamingScheme()
sys_scheme.addSoluteResidueName(ligand_name.val)
# Load up the system. This will automatically find the protein, solute, water, solvent
# and ion molecules and assign them to different groups
loadsys = createSystem(topfile.val, crdfile.val, sys_scheme)
ligand_mol = findMolecule(loadsys, ligand_name.val)
if ligand_mol is None:
print("Cannot find the ligand (%s) in the set of loaded molecules!" % ligand_name.val)
sys.exit(-1)
# Center the system with the ligand at (0,0,0)
loadsys = centerSystem(loadsys, ligand_mol)
ligand_mol = loadsys[ligand_mol.number()].molecule()
if reflection_radius.val is None:
loadsys = addFlexibility(loadsys, naming_scheme=sys_scheme )
else:
loadsys = addFlexibility(loadsys, Vector(0), reflection_radius.val, naming_scheme=sys_scheme)
Sire.Stream.save(loadsys, s3file.val)
ligand_mol = findMolecule(loadsys, ligand_name.val)
if ligand_mol is None:
print("Cannot find the ligand (%s) in the set of loaded molecules!" % ligand_name.val)
sys.exit(-1)
# Now build the QM/MM system
system = System("QMMM system")
if loadsys.containsProperty("reflection center"):
reflect_center = loadsys.property("reflection center").toVector()[0]
reflect_radius = float(str(loadsys.property("reflection sphere radius")))
system.setProperty("reflection center", AtomCoords(CoordGroup(1,reflect_center)))
system.setProperty("reflection sphere radius", VariantProperty(reflect_radius))
space = Cartesian()
else:
space = loadsys.property("space")
if loadsys.containsProperty("average solute translation delta"):
system.setProperty("average solute translation delta", \
loadsys.property("average solute translation delta"))
if loadsys.containsProperty("average solute rotation delta"):
system.setProperty("average solute rotation delta", \
loadsys.property("average solute rotation delta"))
# create a molecule group to hold all molecules
all_group = MoleculeGroup("all")
# create a molecule group for the ligand
ligand_group = MoleculeGroup("ligand")
ligand_group.add(ligand_mol)
all_group.add(ligand_mol)
groups = []
groups.append(ligand_group)
# pull out the groups that we want from the two systems
# create a group to hold all of the fixed molecules in the bound leg
fixed_group = MoleculeGroup("fixed_molecules")
if MGName("fixed_molecules") in loadsys.mgNames():
fixed_group.add( loadsys[ MGName("fixed_molecules") ] )
if save_pdb.val:
# write a PDB of the fixed atoms in the bound and free legs
if not os.path.exists(outdir.val):
os.makedirs(outdir.val)
PDB().write(fixed_group, "%s/fixed.pdb" % outdir.val)
# create a group to hold all of the mobile solute molecules
mobile_solutes_group = MoleculeGroup("mobile_solutes")
if MGName("mobile_solutes") in loadsys.mgNames():
mobile_solutes_group.add( loadsys[MGName("mobile_solutes")] )
mobile_solutes_group.remove(ligand_mol)
if mobile_solutes_group.nMolecules() > 0:
all_group.add(mobile_solutes_group)
groups.append(mobile_solutes_group)
#.........这里部分代码省略.........
示例8: Amber
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
(mols, space) = Amber().readCrdTop("l7n.crd", "l7n.top")
# extract the protein molecule (molecule with residue called "ALA")
protein_mol = mols[ MolWithResID("ALA") ].molecule()
# Create the 'protein' molecule group
protein = MoleculeGroup("protein")
# add the protein molecule to this group
protein.add( protein_mol )
# Create a system to hold the system to be simulated
system = System()
# Add the protein to the system
system.add(protein)
# create a forcefield to calculate the intramolecular
# Coulomb and Lennard-Jones energies of the protein (CLJ)
cljff = IntraFF("cljff")
# Use a shift-electrostatics with a 10 angstrom cutoff
cljff.setCLJFunction( CLJIntraShiftFunction(10*angstrom) )
# Add the protein
cljff.add(protein)
# Now also add a forcefield to calculate the intramolecular
# bond, angle and dihedral energy of the protein
intraff = InternalFF("intraff")
示例9: test_props
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
def test_props(verbose=False):
sys = System()
box0 = PeriodicBox( Vector(10.0,10.0,10.0) )
box1 = PeriodicBox( Vector(20.0,20.0,20.0) )
if verbose:
print(box0)
print(box0.volume())
print(box1.volume())
assert(not sys.containsProperty("space"))
sys.add( InterCLJFF("cljff") )
if verbose:
print(sys)
print(sys.property("space"))
print(sys.userProperties().propertyKeys())
print(sys.builtinProperties().propertyKeys())
assert(sys.containsProperty("space"))
assert_equal( sys.property("space"), Cartesian() )
sys.setProperty( "space0", LinkToProperty("space", FFIdx(0)) )
if verbose:
print(sys.property("space0"))
assert(sys.containsProperty("space0"))
sys.setProperty("space0", box0)
if verbose:
print(sys.property("space"))
assert_equal(sys.property("space0"), box0)
sys.setProperty("space1", box1)
sys.setProperty("combined_space", CombineSpaces("space0", "space1"))
assert_equal(sys.property("space1"), box1)
if verbose:
print(sys.properties().propertyKeys())
print(sys.property("combined_space"))
print(sys.property("combined_space").volume())
assert_almost_equal( sys.property("combined_space").volume().value(),
sys.property("space0").volume().value() + sys.property("space1").volume().value(), 5 )
space3 = PeriodicBox( Vector(5,5,5) )
sys.setProperty("space0", space3)
assert_equal( sys.property("space0"), space3 )
if verbose:
print(sys.property("combined_space"))
print(sys.property("combined_space").volume())
assert_almost_equal( sys.property("combined_space").volume().value(),
sys.property("space0").volume().value() + sys.property("space1").volume().value(), 5 )
sys.removeProperty("space0")
if verbose:
print(sys.properties().propertyKeys())
assert( not sys.containsProperty("space0") )
示例10: print
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
.setProperty("LJ", ljs) \
.commit()
cljff.add(mol)
if i > 3:
free_mols.add(mol)
else:
sync_mols.add(mol)
ms = t.elapsed()
print("Parameterised all of the water molecules (in %d ms)!" % ms)
system = System()
system.add(cljff)
print("Initial energy = %s" % system.energy())
mc = RigidBodyMC(free_mols)
sync_mc = RigidBodyMC(sync_mols)
sync_mc.setSynchronisedTranslation(True)
sync_mc.setSynchronisedRotation(True)
nodes = Cluster.getNode()
this_thread = nodes.borrowThisThread()
moves = WeightedMoves()
moves.add(mc, 2)
moves.add(sync_mc, 1)
示例11: GridFF
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
swapwaters.add(center_water)
center_point = center_water.evaluate().center()
for molnum in molnums:
if molnum != center_water.number():
water = molecules[molnum].molecule()
if Vector.distance(center_point, water.evaluate().center()) < 7.5:
water = water.residue().edit().setProperty("PDB-residue-name", "SWP").commit()
swapwaters.add(water)
else:
waters.add(water)
system.add(swapwaters)
system.add(waters)
gridff = GridFF("gridff")
gridff.setCombiningRules("arithmetic")
print("Combining rules are %s" % gridff.combiningRules())
gridff.setBuffer(2 * angstrom)
gridff.setGridSpacing( 0.5 * angstrom )
gridff.setLJCutoff(lj_cutoff)
gridff.setCoulombCutoff(coul_cutoff)
gridff.setShiftElectrostatics(True)
#gridff.setUseAtomisticCutoff(True)
#gridff.setUseReactionField(True)
cljgridff = CLJGrid()
cljgridff.setCLJFunction( CLJShiftFunction(coul_cutoff,lj_cutoff) )
示例12: range
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
cljff.add(mol)
for i in range(1, mols.nMolecules()):
mol = mols.moleculeAt(i).molecule()
mol = mol.edit().rename("T4P") \
.setProperty("charge", charges) \
.setProperty("LJ", ljs) \
.commit()
cljff.add(mol)
mols.update(mol)
system = System()
system.add(cljff)
print("System energy equals...")
print(system.energy())
group0 = MoleculeGroup("group0")
group1 = MoleculeGroup("group1")
group0.add( mols.moleculeAt(100) )
group0.add( mols.moleculeAt(101) )
group1.add( mols.moleculeAt(102) )
group1.add( mols.moleculeAt(103) )
group1.add( mols.moleculeAt(104) )
cljff2 = InterGroupCLJFF("group_energy")
示例13: print
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
cljff.add(mol)
ms = t.elapsed()
print("Parameterised all of the water molecules (in %d ms)!" % ms)
system = System()
rdf = RDFMonitor( 0*angstrom, 10*angstrom, 0.05*angstrom )
rdf.add( MolIdx(0) + AtomName("O00"), AtomName("O00") )
rdf2 = RDFMonitor( 0*angstrom, 10*angstrom, 0.05*angstrom )
rdf2.add( MolIdx(0) + AtomName("O00"), AtomName("H01") )
rdf2.add( MolIdx(0) + AtomName("O00"), AtomName("H02") )
system.add(cljff)
system.add("O-O RDF", rdf)
system.add("O-H RDF", rdf2)
t.start()
system.collectStats()
ms = t.elapsed()
print("Collecting stats took %d ms" % ms)
rdf = system.monitor( MonitorName("O-O RDF") )
print("\nO-O RDF")
for i in range(0,rdf.nBins()):
示例14: print
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
mol = mol.edit().rename("SB2").commit()
mol = protoms.parameterise(mol, ProtoMS.SOLUTE)
perturbations = mol.property("perturbations")
print(perturbations)
print(perturbations.requiredSymbols())
print(perturbations.requiredProperties())
lam = perturbations.symbols().Lambda()
system = System()
solute = MoleculeGroup("solute", mol)
system.add(solute)
system.setConstant(lam, 0.0)
system.add( PerturbationConstraint(solute) )
print(system.constraintsSatisfied())
for i in range(0,101,10):
system.setConstant(lam, 0.01 * i)
PDB().write(system.molecules(), "test_%003d.pdb" % i)
示例15: IntraCLJFF
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import add [as 别名]
intraclj = IntraCLJFF("IntraCLJ")
intraclj.add(mol)
print(intraff.energy())
print(intraclj.energy())
print(intraff.energy() + intraclj.energy())
print(qmff.energy())
solute = MoleculeGroup("solute")
solute.add(mol)
system = System()
system.add(qmff)
system.add(intraff)
system.add(intraclj)
system.add(solute)
print(system.energy())
chg_constraint = QMChargeConstraint(solute)
chg_constraint.setChargeCalculator( AM1BCC() )
system.add(chg_constraint)
print(system.constraintsSatisfied())
print(system.energy())