[gpaw-users] external potential for Langevin molecular dynamics

Francisco Cano Marchal fcanomar at gmail.com
Sat Aug 11 17:44:30 CEST 2018


Dear GPAW users

I am trying to run a Langevin molecular dynamics simulation of a water
dimer in a confining potential, which I define using the
'ExternalPotential' class and include in the calculator through the
'external' parameter. I can calculate the energy of the system. When I try
to run the Langevin dynamics I get the following error. I am using Anaconda
1.7.0 on Mac OS X 10.10.5 and Python 2.7.

*TypeError: <__main__.WellTubePotential instance at 0x1166fa710> is not
JSON serializable*

I would like to know if the 'external' parameter for the GPAW calculator
can be used with Langevin dynamics or if you can give me a hint on where
the problem could be. I enclose my code.

Kind regards,

Francisco






































*from ase.units import Bohrfrom gpaw import GPAW, PWfrom gpaw.external
import ExternalPotentialfrom ase.data import s22from ase.md import
Langevinfrom ase.io.trajectory import Trajectoryimport ase.units as unitsa
= 4.0atoms =
s22.create_s22_system('Water_dimer')atoms.set_cell((2*a,a,a))atoms.center()d
= 4 # diameter of the tubeh = 200 # well depth      class
WellTubePotential(ExternalPotential):    def calculate_potential(self,
gd):        r_vg = gd.get_grid_point_coordinates()        self.vext_g =
(((r_vg[1] - a / Bohr / 2)**2 + (r_vg[2] - a / Bohr / 2)**2)**.5 >
d/2)*h       calc = GPAW(external=WellTubePotential(),
mode=PW(200))atoms.calc = calcatoms.get_potential_energy()# Langevin
Dynamicstag = 'dimer-in-tubewell'md = Langevin(atoms, 1 * units.fs,
temperature=300 * units.kB,              friction=0.01, logfile=tag +
'.log')traj = Trajectory(tag + '.traj', 'w', atoms)md.attach(traj.write,
interval=1)md.run(4000)*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20180811/d1fcdee0/attachment.html>


More information about the gpaw-users mailing list