File: test.py

package info (click to toggle)
mmtk 2.7.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,788 kB
  • ctags: 6,600
  • sloc: python: 18,050; ansic: 12,400; makefile: 129; csh: 3
file content (20 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from MMTK import *
from ElectricField import ElectricField
from MMTK.ForceFields.ForceFieldTest import gradientTest

universe = InfiniteUniverse()
universe.atom1 = Atom('C', position=Vector(0., 0., 1.))
universe.atom1.test_charge = 1.
universe.atom2 = Atom('C', position=Vector(0., 0., 0.))
universe.atom2.test_charge = -0.2

universe.setForceField(ElectricField(0.5*(Units.V/Units.m)
                                     * Vector(0., 0., 1.),
                                     'test_charge'))

print universe.energyTerms()
e, g = universe.energyAndGradients()
print g[universe.atom1]
print g[universe.atom2]

gradientTest(universe)