Beispiel #1
0
 def variance_cost_function(x):
     x_sliced=np.split(x,slices[:-1])
     for i,k in enumerate(params):
         wf.parameters[k]=x_sliced[i].reshape(wf.parameters[k].shape)
     wf.recompute(coords)
     ke=kinetic(coords,wf)
     #Here we assume the ecp is fixed and only recompute
     #kinetic energy
     En=Enref['total']-Enref['ke']+ke
     return np.std(En)**2
Beispiel #2
0
 def compute_energy(mol, configs, wf, threshold):
     ee, ei, ii = self.ewald.energy(configs)
     ecp_val = energy.get_ecp(mol, configs, wf, threshold)
     ke = energy.kinetic(configs, wf)
     return {
         "ke": ke,
         "ee": ee,
         "ei": ei,
         "ecp": ecp_val,
         "total": ke + ee + ei + ecp_val + ii,
     }
Beispiel #3
0
 def __call__(self, configs, wf):
     ee, ei, ii = self.coulomb.energy(configs)
     ecp_val = eval_ecp.ecp(self.mol, configs, wf, self.threshold)
     ke, grad2 = energy.kinetic(configs, wf)
     return {
         "ke": ke,
         "ee": ee,
         "ei": ei,
         "ecp": ecp_val,
         "grad2": grad2,
         "total": ke + ee + ei + ecp_val + ii,
     }