-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_perf.py
More file actions
executable file
·59 lines (45 loc) · 1.81 KB
/
test_perf.py
File metadata and controls
executable file
·59 lines (45 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
from simtk import openmm as mm
from simtk.openmm import app
from simtk import unit as u
import sys
RNG_SEED = 42
prm = app.AmberPrmtopFile('system.top')
crd = app.AmberInpcrdFile('system.mdcrd')
system = prm.createSystem(
nonbondedMethod=app.CutoffPeriodic,
nonbondedCutoff=1.0*u.nanometer,
constraints=app.HBonds,
rigidWater=True)
integrator = mm.LangevinIntegrator(300.*u.kelvin, 1.0/u.picosecond,
1.0*u.femtosecond)
integrator.setRandomNumberSeed(RNG_SEED)
baro = mm.MonteCarloBarostat(1.0*u.atmosphere, 300.*u.kelvin, 25)
baro.setRandomNumberSeed(RNG_SEED)
system.addForce(baro)
platform = mm.Platform.getPlatformByName('CUDA')
properties = {'CudaPrecision': 'mixed'}
simulation = app.Simulation(prm.topology,
system,
integrator,
platform,
properties)
simulation.context.setPositions(crd.getPositions())
bv = crd.getBoxVectors()
simulation.context.setPeriodicBoxVectors(bv[0], bv[1], bv[2])
# print >>sys.stderr, 'minimizing'
# simulation.minimizeEnergy()
# print >>sys.stderr, 'done'
simulation.reporters.append(app.PDBReporter('traj.pdb', 1000))
simulation.reporters.append(app.StateDataReporter(
sys.stderr, 1000, step=True, potentialEnergy=True,
speed=True, separator='\t'))
for i in range(100):
simulation.step(100)
# state = simulation.context.getState(getPositions=True,
# getVelocities=True,
# getEnergy=True,
# enforcePeriodicBox=True)
# simulation.context.setPositions(state.getPositions())
# bv = state.getPeriodicBoxVectors()
# simulation.context.setPeriodicBoxVectors(bv[0], bv[1], bv[2])