Exemple #1
0
    def __init__(self, files, cnstfile, saefile, nnfprefix, Nnet, gpuid=0, sinet=False):
        self.files=files                      #List of files containing the molecules to run md on
        self.coor_train=[]                    #Where the coordinates of the molecules with high standard deviation will be saved
        self.Na_train=[]                      #Where the number of atoms of the molecules with high standard deviation will be saved
        self.S_train=[]                       #Where the atomic species of the molecules with high standard deviation will be saved
        self.hstd=[]                          #Where the standard deviation of the molecules with high standard deviation will be saved

        #The path to the network
        self.net = ensemblemolecule(cnstfile, saefile, nnfprefix, Nnet, gpuid)            #Load the network
Exemple #2
0
    def __init__(self, netdict, storedir, smilefile, Nmol, Nsamp, sigma, rng, seed, gpuid=0):
        self.storedir = storedir
        self.Nmol = Nmol
        self.Nsamp = Nsamp
        self.sigma = sigma
        self.rng = rng

        smiles = [sm for sm in np.loadtxt(smilefile, dtype=np.str,comments=None)]
        np.random.seed(seed)
        np.random.shuffle(smiles)
        self.smiles = smiles[0:Nmol*20]

        self.ens = ensemblemolecule(netdict['cnstfile'], netdict['saefile'], netdict['nnfprefix'], netdict['num_nets'], gpuid)
Exemple #3
0
    def __init__(self,cnstfile,saefile,nnfprefix,Nnet,gpuid=0, sinet=False):
        self.Nbad = 0

        # Number of networks
        self.Nn = Nnet

        # Build ANI ensemble
        self.aens = ensemblemolecule(cnstfile, saefile, nnfprefix, Nnet, gpuid)

        # Construct pyNeuroChem class
        #self.ncl = [pync.molecule(cnstfile, saefile, nnfprefix+str(i)+'/networks/', gpuid, sinet) for i in range(self.Nn)]

        # Initalize PBC
        self.pbc = False
        self.pbl = 0.0
Exemple #4
0
    def __init__(self,
                 cnstfile,
                 saefile,
                 nnfprefix,
                 Nnet,
                 molecule_list,
                 gpuid=0,
                 sinet=False):
        # Molecules list
        self.mols = molecule_list

        # Number of networks
        self.Nn = Nnet

        # Build ANI ensemble
        self.aens = ensemblemolecule(cnstfile, saefile, nnfprefix, Nnet, gpuid)
Exemple #5
0
    def __init__(self):
        # Set locations of all required network files
        rootdir = os.environ.get('ANI_PATH')
        wkdir = rootdir + '/ANI-1x/'  # Note the relative path
        cnstfile = wkdir + 'rHCNO-4.6A_16-3.1A_a4-8.params'  # AEV parameters
        saefile = wkdir + 'sae_6-31gd.dat'  # Atomic shifts
        nnfdir = wkdir + '/train'  # network prefix
        Nn = 5  # Number of networks in the ensemble
        gpu = 0  # GPU ID -- this defaults to 0

        # Initilize network ensemble
        try:
            self.aens = ensemblemolecule(cnstfile, saefile, nnfdir, Nn, gpu)
        except RuntimeError:
            print('Couldn\'t load ASI network (GPU probably not available)!')
        return
Exemple #6
0
    def __init__(self,
                 cnstfile,
                 saefile,
                 nnfprefix,
                 Nnet,
                 solv_list,
                 solu_list,
                 gpuid=0,
                 sinet=False):
        # Molecules list
        self.solv_list = solv_list
        self.solu_list = solu_list

        # Number of networks
        self.Nn = Nnet

        # Build ANI ensemble
        self.aens = ensemblemolecule(cnstfile, saefile, nnfprefix, Nnet, gpuid)

        self.edgepad = 1.0
        self.mindist = 2.0
Exemple #7
0
    def __init__(self,cnstfile,saefile,nnfdir,Nn,gpuid=0, sinet=False):
        # Construct pyNeuroChem class
        #self.nc = [pync.molecule(cnstfile, saefile, nnfdir+str(i)+'/', gpuid, sinet) for i in range(Nn)]

        self.ens = ensemblemolecule(cnstfile,saefile,nnfdir,Nn,gpuid,sinet)
Exemple #8
0
Nn = 5
#nnfdir   = wkdir + 'networks/'

# Load molecule
mol = read(molfile)
#print('test')
L = 70.0
mol.set_cell(([[L, 0, 0], [0, L, 0], [0, 0, L]]))

mol.set_pbc((True, True, True))

#print(mol.get_chemical_symbols())

# Set NC
aens = ensemblemolecule(cnstfile, saefile, nnfdir, Nn, 5)

# Set ANI calculator
mol.set_calculator(ANIENS(aens, sdmx=20000000.0))

print(mol.get_potential_energy())
print(np.where(mol.get_forces() > 200.0))

print("size: ", len(mol.get_chemical_symbols()))

# Optimize molecule
start_time = time.time()
dyn = QuasiNewton(mol)
dyn.run(fmax=C)
print('[ANI Total time:', time.time() - start_time, 'seconds]')