Commit efce20c2 authored by Jason Swails's avatar Jason Swails
Browse files

Add a basic DCD file test. There's no DCD file _reader_, so without MDTraj we

can't validate the that this object does anything more than simply write without
exceptions (i.e., we can't tell if the DCD file is actually _valid_)
parent 842f295d
import unittest
import tempfile
import numpy as np
from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
from random import random
import os
class TestDCDFile(unittest.TestCase):
def test_dcd(self):
""" Test the DCD file """
pdbfile = app.PDBFile('systems/alanine-dipeptide-implicit.pdb')
natom = len(list(pdbfile.topology.atoms()))
dcd = app.DCDFile(open('test.dcd', 'w'), pdbfile.topology, 0.001)
for i in range(5):
dcd.writeModel([mm.Vec3(random(), random(), random()) for j in range(natom)]*unit.angstroms)
dcd._file.close()
os.remove('test.dcd')
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment