TensorMol
TensorMol copied to clipboard
bug in Periodic.py?
I'm trying to run an MD simulation in PBC, using ChemSpider-trained network:
def EnAndForce(z_, x_, nreal_, DoForce = True): mtmp = Mol(z_,x_) en,f = manager.EvalBPDirectEEUpdateSinglePeriodic(mtmp, PARAMS["AN1_r_Rc"], PARAMS["AN1_a_Rc"], PARAMS["EECutoffOff"], nreal_,True) return en[0], f[0]
lat=Lattice(np.eye(3)*70) # 70 angstrom box m.properties["Lattice"]=lat PARAMS["MDThermostat"] = "Nose" PARAMS["MDTemp"] = 300 PARAMS["MDdt"] = 0.1 # fs PARAMS["RemoveInvariant"]=True PARAMS["MDV0"] = "Random" PARAMS["MDMaxStep"] = 10000 PF = PeriodicForce(m,np.eye(3)*70) #m.properties["Lattice"]) PF.BindForce(EnAndForce, 70.0) PARAMS["MDTemp"] = 300.0 PARAMS["MDdt"] = 0.05 # In fs. traj = PeriodicVelocityVerlet(PF,"sim_300K") traj.Prop()
Traceback (most recent call last):
File "runmd.py", line 79, in
I think this is a Python 2->3 bug. I changed line 309 in Periodic.py: m = np.array(map(lambda x: ATOMICMASSES[x-1], self.mol0.atoms))*1000.0 to: m = np.array(list(map(lambda x: ATOMICMASSES[x-1], self.mol0.atoms)))*1000.0 and it seems to be working