def test(X1, X2, lj, atomtypes=None, fname="lj.xyz", minPermDist=MinPermDistCluster()): # pragma: no cover if not atomtypes: atomtypes = ["LA"] import copy natoms = len(X1) / 3 X1i = copy.copy(X1) X2i = copy.copy(X2) printlist = [] printlist.append((X2.copy(), "X2 initial")) printlist.append((X1.copy(), "X1 initial")) distinit = np.linalg.norm(X1-X2) print "distinit", distinit (dist, X1, X2) = minPermDist(X1,X2) distfinal = np.linalg.norm(X1-X2) print "dist returned ", dist print "dist from coords ", distfinal print "initial energies (post quench)", lj.getEnergy(X1i), lj.getEnergy(X2i) print "final energies ", lj.getEnergy(X1), lj.getEnergy(X2) printlist.append((X1.copy(), "X1 final")) printlist.append((X2.copy(), "X2 final")) import pele.printing.print_atoms_xyz as printxyz with open(fname, "w") as fout: for xyz, line2 in printlist: printxyz.printAtomsXYZ(fout, xyz, line2=line2 +" "+ str(lj.getEnergy(xyz)))
def test(X1, X2, lj, atomtypes=["LA"], permlist = None, fname = "lj.xyz", minPermDist=minPermDistStochastic): import copy natoms = len(X1) / 3 if permlist == None: permlist = [range(natoms)] X1i = copy.copy(X1) X2i = copy.copy(X2) printlist = [] printlist.append((X2.copy(), "X2 initial")) printlist.append((X1.copy(), "X1 initial")) distinit = np.linalg.norm(X1-X2) print "distinit", distinit (dist, X1, X2) = minPermDist(X1,X2, permlist=permlist) distfinal = np.linalg.norm(X1-X2) print "dist returned ", dist print "dist from coords ", distfinal print "initial energies (post quench)", lj.getEnergy(X1i), lj.getEnergy(X2i) print "final energies ", lj.getEnergy(X1), lj.getEnergy(X2) printlist.append((X1.copy(), "X1 final")) printlist.append((X2.copy(), "X2 final")) import pele.printing.print_atoms_xyz as printxyz with open(fname, "w") as fout: for xyz, line2 in printlist: printxyz.printAtomsXYZ(fout, xyz, line2=line2 +" "+ str(lj.getEnergy(xyz)))
def test(coords1, coords2, mysys, permlist): printlist = [] printlist.append((coords1.copy(), "after quench")) printlist.append((coords2.copy(), "after quench")) coords2in = coords2.copy() coords1in = coords1.copy() distinit = getDistaa(coords1, coords2, mysys) print "distinit", distinit (dist, coords1, coords2) = minPermDistRBMol(coords1, coords2, mysys, permlist=permlist) distfinal = getDistaa(coords1, coords2, mysys) print "dist returned ", dist print "dist from coords ", distfinal print "coords2 initial energy", mysys.getEnergy(coords2in) print "coords2 final energy ", mysys.getEnergy(coords2) print "coords1 initial energy", mysys.getEnergy(coords1in) print "coords1 final energy ", mysys.getEnergy(coords1) printlist.append((coords1.copy(), "coords1 after mindist")) printlist.append((coords2.copy(), "coords2 after mindist")) import pele.printing.print_atoms_xyz as printxyz with open("otp.xyz", "w") as fout: for coords, line2 in printlist: xyz = mysys.getxyz(coords) printxyz.printAtomsXYZ(fout, xyz, line2=line2, atom_type=["N", "O", "O"]) return dist, coords1, coords2
def main(): natoms = 9 X1 = np.random.uniform(-1,1,[natoms*3])*(float(natoms))**(1./3) X2 = np.random.uniform(-1,1,[natoms*3])*(float(natoms))**(1./3) #X1 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 0., 1.,] ) #X2 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 1., 0.,] ) import copy X1i = copy.copy(X1) X2i = copy.copy(X2) distinit = np.linalg.norm(X1-X2) print "distinit", distinit (dist, X1, X2) = minPermDistLong(X1,X2) distfinal = np.linalg.norm(X1-X2) print "dist returned ", dist print "dist from coords ", distfinal import pele.printing.print_atoms_xyz as printxyz with open("out.xyz", "w") as fout: CoMToOrigin(X1i) CoMToOrigin(X2i) printxyz.printAtomsXYZ(fout, X1i ) printxyz.printAtomsXYZ(fout, X2i ) printxyz.printAtomsXYZ(fout, X1 ) printxyz.printAtomsXYZ(fout, X2 )
def test(X1, X2, lj, atomtypes=None, fname="lj.xyz", minPermDist=MinPermDistCluster()): # pragma: no cover if not atomtypes: atomtypes = ["LA"] import copy natoms = len(X1) / 3 X1i = copy.copy(X1) X2i = copy.copy(X2) printlist = [] printlist.append((X2.copy(), "X2 initial")) printlist.append((X1.copy(), "X1 initial")) distinit = np.linalg.norm(X1 - X2) print("distinit", distinit) (dist, X1, X2) = minPermDist(X1, X2) distfinal = np.linalg.norm(X1 - X2) print("dist returned ", dist) print("dist from coords ", distfinal) print("initial energies (post quench)", lj.getEnergy(X1i), lj.getEnergy(X2i)) print("final energies ", lj.getEnergy(X1), lj.getEnergy(X2)) printlist.append((X1.copy(), "X1 final")) printlist.append((X2.copy(), "X2 final")) import pele.printing.print_atoms_xyz as printxyz with open(fname, "w") as fout: for xyz, line2 in printlist: printxyz.printAtomsXYZ(fout, xyz, line2=line2 + " " + str(lj.getEnergy(xyz)))