In [1]:
import numpy as np
import pyfaunus as mc
Create Space from an already existing .json
input file:
In [2]:
jsoninput = mc.InputMap('../src/examples/minimal.json')
space = mc.Space(jsoninput)
print(space.info())
print 'system volume = ',space.geo.getVolume()
Probe group information and get particle index:
In [3]:
groups = space.groupList()
for group in groups:
print group.name
print len(group)
print group.range()
Extract positions etc from a group
In [4]:
positions = [ np.array((space.p[i].x, space.p[i].y, space.p[i].z)) for i in groups[0].range()]
charges = [ space.p[i].charge for i in groups[0].range()]
print 'position of first atom =', positions[0]
print 'total charge =', sum(charges)
Calculate center of mass for a group
In [5]:
saltgroup = space.groupList()[0]
cm = mc.massCenter(space.geo, space.p, saltgroup)
print "center of mass = ", np.array(cm)
This part is purely experimental and merely to illustrate how the interface could look like
In [ ]:
spc = mc.Space(...)
spc.addAtomType(name='OW', weight=18, charge=-0.3, epsilon=0.03, sigma=0.3)
spc.addMoleculeType(name='water', atoms=['HW HW OW'], rigid=True)
spc.addMoleculeType(name='salt', atoms=['Na Cl'], atomic=True)
spc.addMolecules(type='water', N=100)
potential = mc.potentials.Coulomb(epsr=80, cutoff=10) +
mc.potentials.LennardJones(combinationrule='LB')