Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in Periodic.py? #34

Open
mkrompiec opened this issue Jul 6, 2018 · 1 comment
Open

bug in Periodic.py? #34

mkrompiec opened this issue Jul 6, 2018 · 1 comment

Comments

@mkrompiec
Copy link

mkrompiec commented Jul 6, 2018

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
traj.Prop()
File "/mainfs/scratch/mk1a18/TensorMol/TensorMol/Simulations/PeriodicMD.py", line 144, in Prop
LOGGER.info("Step: %i time: %.1f(fs) (kJ/mol): %.5f <|a|>(m/s2): %.5f (Eh): %.5f (kJ/mol): %.5f Rho(g/cm**3): %.5f Teff(K): %.5f", step, self.t, self.KE/1000.0, np.linalg.norm(self.a) , self.EPot, self.KE/1000.0+self.EPot*KJPERHARTREE,self.Density(), Teff)
File "/mainfs/scratch/mk1a18/TensorMol/TensorMol/Simulations/PeriodicMD.py", line 106, in Density
return self.PForce.Density()
File "/mainfs/scratch/mk1a18/TensorMol/TensorMol/ForceModifiers/Periodic.py", line 309, in Density
m = np.array(map(lambda x: ATOMICMASSES[x-1], self.mol0.atoms))*1000.0
TypeError: unsupported operand type(s) for *: 'map' and 'float'

@mkrompiec
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant