当前位置: 首页>>代码示例>>Python>>正文


Python System.property方法代码示例

本文整理汇总了Python中Sire.System.property方法的典型用法代码示例。如果您正苦于以下问题:Python System.property方法的具体用法?Python System.property怎么用?Python System.property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sire.System的用法示例。


在下文中一共展示了System.property方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MGName

# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import property [as 别名]
    system = sim.system()
    moves = sim.moves()

    # Print out the energy of the system - note that you must explicitly
    # state the units you want the energy to be output it, using .to(), 
    # in this case we are using kcal mol-1, so we have .to(kcal_per_mol)
    print "Block %3d: Energy = %f kcal mol-1" % (i+1, system.energy().to(kcal_per_mol))

    # Now print out a new PDB of the waters - note that MGName("waters") selects
    # the molecule group with name 'waters' 
    PDB().write( system[MGName("waters")], "montecarlo_output/output%003d.pdb" % (i+1) )

    # Now write out the new XSC file for the simulation box
    xscfile = open("montecarlo_output/output%003d.xsc" % (i+1), "w")
 
    # the volume is held in the "space" property of the system
    vol = system.property("space")

    print "Simulation box: %s" % vol

    mincoords = vol.minCoords()
    maxcoords = vol.maxCoords()

    print >>xscfile,"%f %f %f  %f %f %f" % (mincoords[0], mincoords[1], mincoords[2], 
                                            maxcoords[0], maxcoords[1], maxcoords[2])

    xscfile.close()

print "Simulation complete!"

开发者ID:Alwnikrotikz,项目名称:sire,代码行数:31,代码来源:montecarlo.py

示例2: test_props

# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import property [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") )
开发者ID:michellab,项目名称:SireUnitTests,代码行数:73,代码来源:test_sysprops.py

示例3: System

# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import property [as 别名]
sys = System()

from Sire.Maths import *

box0 = PeriodicBox( Vector(10.0,10.0,10.0) )
box1 = PeriodicBox( Vector(20.0,20.0,20.0) )

print(box0)
print(box0.volume())
print(box1.volume())

from Sire.MM import *
sys.add( InterCLJFF("cljff") )

print(sys)
print(sys.property("space"))
print(sys.userProperties().propertyKeys())
print(sys.builtinProperties().propertyKeys())

sys.setProperty( "space0", LinkToProperty("space", FFIdx(0)) )

print(sys.property("space0"))

sys.setProperty("space0", box0)

print(sys.property("space"))

sys.setProperty("space1", box1)

sys.setProperty("combined_space", CombineSpaces("space0", "space1"))
开发者ID:Alwnikrotikz,项目名称:sire,代码行数:32,代码来源:testsysproperties.py

示例4: InternalMove

# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import property [as 别名]
do_mc = False

intra_mcmove = InternalMove(salt)
inter_mcmove = RigidBodyMC(salt)

mcmove = WeightedMoves()
mcmove.add(intra_mcmove)
mcmove.add(inter_mcmove)

do_mc = False

hmcmove = HybridMC(salt, 4*femtosecond, 20)
do_hmc = True
do_hmc = False

print(system.property("space"))

print("\nMove 0")
print(system.energy())
print(mdmove.kineticEnergy())
print(system.energy() + mdmove.kineticEnergy())
PDB().write(system.molecules(), "test%0004d.pdb" % 0)

if do_mc:
    for i in range(1,1000):
        system = mcmove.move(system, 20, False)

        print(i, system.energy())

        PDB().write(system.molecules(), "test%0004d.pdb" % i)
开发者ID:michellab,项目名称:SireTests,代码行数:32,代码来源:rbdynamics.py

示例5: print

# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import property [as 别名]
    solvent.add(mol)

    cljff.add(mol)

ms = t.elapsed()
print("Parameterised all of the water molecules (in %d ms)!" % ms)

system = System()
system.add(solvent)
system.add(cljff)

t.start()
print("Initial energy = %s" % system.energy())
print("(took %d ms)" % t.elapsed())
print(system.property("space"))
print(system.property("switchingFunction"))

print(system.groupNumbers())
print(system.groupNames())
print(system.energies())

mc = RigidBodyMC(solvent)

moves = SameMoves(mc)

moves.setGenerator( RanGenerator(42) )

print("Running 10000 moves without saving the trajectory...")
t.start()
system = moves.move(system, 10000, True)
开发者ID:Alwnikrotikz,项目名称:sire,代码行数:32,代码来源:trajectory.py

示例6: makeSim

# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import property [as 别名]
def makeSim(system, ligand_mol, watersys):
    """Create simulation systems with and without the ligand and return those systems together
       with the moves"""

    stage1 = System("with_ligand")
    stage2 = System("without_ligand")

    if system.containsProperty("reflection center"):
        reflection_center = system.property("reflection center").toVector()[0]
        reflection_radius = float(str(system.property("reflection sphere radius")))

        stage1.setProperty("reflection center", AtomCoords(CoordGroup(1,reflection_center)))
        stage1.setProperty("reflection sphere radius", VariantProperty(reflection_radius))

        stage2.setProperty("reflection center", AtomCoords(CoordGroup(1,reflection_center)))
        stage2.setProperty("reflection sphere radius", VariantProperty(reflection_radius))

    # create a molecule group for fixed atoms (everything except the mobile water)
    fixed_group = MoleculeGroup("fixed")

    if MGName("fixed_molecules") in system.mgNames():
        fixed_group.add( system[ MGName("fixed_molecules") ] )

    if MGName("mobile_solutes") in system.mgNames():
        fixed_group.add( system[MGName("mobile_solutes")] )

    if MGName("protein_sidechains") in system.mgNames() or \
       MGName("protein_backbones") in system.mgNames():

        all_proteins = Molecules()

        try:
            protein_sidechains = system[MGName("protein_sidechains")]
            all_proteins.add(protein_sidechains.molecules())
        except:
            pass

        try:
            protein_backbones = system[MGName("protein_backbones")]
            all_proteins.add(protein_backbones.molecules())
        except:
            pass

        try:
            boundary_molecules = system[MGName("boundary_molecules")]
            all_proteins.add(boundary_molecules.molecules())
        except:
            pass

        for molnum in all_proteins.molNums():
            protein_mol = all_proteins[molnum].join()
            fixed_group.add(protein_mol)

    stage1_fixed_group = MoleculeGroup(fixed_group)
    stage2_fixed_group = MoleculeGroup(fixed_group)

    stage1_fixed_group.add(ligand_mol)
    stage2_fixed_group.remove(ligand_mol)

    mobile_group = MoleculeGroup("mobile_group")
    if MGName("mobile_solvents") in system.mgNames():
        mobile_group.add( system[MGName("mobile_solvents")] )

    stage1_mobile_group = MoleculeGroup(mobile_group)
    stage2_mobile_group = MoleculeGroup(mobile_group)

    # now find water molecules from the water system that can be substituted for the ligand
    watermols = findOverlappingWaters(ligand_mol, watersys)

    stage2_mobile_group.add(watermols)

    print("The number of stage 1 fixed non-solvent molecules is %d." % stage1_fixed_group.nMolecules())
    print("The number of stage 1 mobile solvent molecules is %d." % stage1_mobile_group.nMolecules())

    print("The number of stage 2 fixed non-solvent molecules is %d." % stage2_fixed_group.nMolecules())
    print("The number of stage 2 mobile solvent molecules is %d." % stage2_mobile_group.nMolecules())

    # write a PDB of all of the fixed molecules
    PDB().write(stage1_mobile_group, "stage1_mobile_atoms.pdb")
    PDB().write(stage2_mobile_group, "stage2_mobile_atoms.pdb")
    PDB().write(stage1_fixed_group, "stage1_fixed_atoms.pdb")
    PDB().write(stage2_fixed_group, "stage2_fixed_atoms.pdb")

    # create the forcefields

    if use_fast_ff.val:
        stage1_ff = InterFF("ff")
        stage2_ff = InterFF("ff")
        stage1_ff.setCLJFunction( CLJShiftFunction(Cartesian(), coul_cutoff.val, lj_cutoff.val) )
        stage2_ff.setCLJFunction( CLJShiftFunction(Cartesian(), coul_cutoff.val, lj_cutoff.val) )
        
        if disable_grid.val:
            stage1_ff.disableGrid()
            stage2_ff.disableGrid()
        else:
            stage1_ff.enableGrid()
            stage1_ff.setGridSpacing(grid_spacing.val)
            stage1_ff.setGridBuffer(grid_buffer.val)
            stage2_ff.enableGrid()
            stage2_ff.setGridSpacing(grid_spacing.val)
#.........这里部分代码省略.........
开发者ID:Alwnikrotikz,项目名称:sire,代码行数:103,代码来源:WaterView.py


注:本文中的Sire.System.property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。