Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions activelearning/al_conf_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

h5stor = root_dir + 'h5files/'# h5store location

strucsfolder = root_dir + 'strucs/'# strucs location

optlfile = root_dir + 'optimized_input_files.dat'

#Comet
Expand Down Expand Up @@ -73,6 +75,10 @@
'sig' : M,
}

strucsparams = {'N': 40, # number of maximum structures to select before QBC from each XYZ file
'sig': M,
}

mdsparams = {'N': 2, # trajectories to run
'T1': 300,
'T2': 1000,
Expand All @@ -91,7 +97,7 @@
'tsfiles': ['/home/jsmith48/scratch/auto_rxn_al/rxns/'],
'nmfile':None, #path to gaussian log file containing the data
'nm':0, #id of normal mode
'perc':0, #Move the molecules initial coordiantes along the mode by this amount. Negative numbers are ok.
'perc':0, #Move the molecules initial coordiantes along the mode by this amount. Negative numbers are ok.
}

dhparams = { 'Nmol': 100,
Expand All @@ -106,9 +112,9 @@
dmrparams = {#'mdselect' : [(400,0),(60,2),(40,3),(5,4)],
'mdselect' : [(10,0), (1,11)],
'N' : 20,
'T' : 400.0, # running temp
'T' : 400.0, # running temp
'L' : 25.0, # box length
'V' : 0.04, # Random init velocities
'V' : 0.04, # Random init velocities
'dt' : 0.5, # MD time step
'Nm' : 140, # Molecules to embed
#'Nm' : 160, # Molecules to embed
Expand Down Expand Up @@ -186,10 +192,11 @@
os.mkdir(root_dir + datdir + str(i+1).zfill(2))

## Run active learning sampling ##
acs = alt.alconformationalsampler(ldtdir, datdir + str(i+1).zfill(2), optlfile, fpatoms, netdict)
acs = alt.alconformationalsampler(ldtdir, datdir + str(i+1).zfill(2), optlfile, strucsfolder, fpatoms, netdict)
#acs.run_sampling_cluster(gcmddict, GPU)
#acs.run_sampling_dimer(dmrparams, GPU)
#acs.run_sampling_nms(nmsparams, GPU)
#acs.run_sampling_strucs(strucsparams, GPU)
#acs.run_sampling_md(mdsparams, perc=0.5, gpus=GPU)
#acs.run_sampling_TS(tsparams, gpus=[2])
acs.run_sampling_dhl(dhparams, gpus=GPU+GPU)
Expand All @@ -199,5 +206,3 @@

## Submit jobs, return and pack data
ast.generateQMdata(hostname, username, swkdir, ldtdir, datdir + str(i+1).zfill(2), h5stor, mae, jtime)


80 changes: 67 additions & 13 deletions activelearning/al_ions_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

h5stor = root_dir + 'h5files/'# h5store location

strucsfolder = root_dir + 'strucs/'# strucs locations

optlfile = root_dir + 'optimized_input_files.dat'

#Comet
Expand Down Expand Up @@ -58,10 +60,59 @@
root = '/home/jsmith48/scratch/auto_ion_al'

wkdir = root+'/modelions/ANI-AL-smallions/'
iptfile = root+'/modelions/inputtrain.ipt'
#iptfile = root+'/modelions/inputtrain.ipt'
saefile = root+'/modelions/sae_linfit.dat'
cstfile = root+'/modelions/rHCNOSFCl-5.2R_16-3.8A_a4-8.params'

ipt = alt.anitrainerinputdesigner()

ipt.set_parameter('atomEnergyFile','sae_linfit.dat')
ipt.set_parameter('sflparamsfile','rHCNOSFCl-5.2R_16-3.8A_a4-8.params')
ipt.set_parameter('eta','0.001')
ipt.set_parameter('energy','1')
ipt.set_parameter('force','0')
ipt.set_parameter('fmult','1.0')
ipt.set_parameter('feps','0.001')
ipt.set_parameter('dipole','0')
ipt.set_parameter('charge','0')
ipt.set_parameter('cdweight','2.0')
ipt.set_parameter('tolr','100')
ipt.set_parameter('tbtchsz','2560')
ipt.set_parameter('vbtchsz','2560')
ipt.set_parameter('nkde','2')


# Set network layers
ipt.add_layer('H',{"nodes":320,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('H',{"nodes":64 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('H',{"nodes":128,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.add_layer('C',{"nodes":288,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('C',{"nodes":96 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('C',{"nodes":128,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.add_layer('N',{"nodes":256,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('N',{"nodes":48 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('N',{"nodes":96 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.add_layer('O',{"nodes":256,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('O',{"nodes":48 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('O',{"nodes":48 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.add_layer('S',{"nodes":192,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('S',{"nodes":48 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('S',{"nodes":80 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.add_layer('F',{"nodes":192,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('F',{"nodes":48 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('F',{"nodes":80 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.add_layer('Cl',{"nodes":192,"activation":9,"type":0,"l2norm":1,"l2valu":5.000e-3})
ipt.add_layer('Cl',{"nodes":48 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})
ipt.add_layer('Cl',{"nodes":80 ,"activation":9,"type":0,"l2norm":1,"l2valu":1.000e-6})

ipt.print_layer_parameters()

#-----------0---------

# Training varibles
Expand All @@ -74,6 +125,10 @@
'sig' : M,
}

strucsparams = {'N': 40, # number of maximum structures to select before QBC from each XYZ file
'sig': M,
}

mdsparams = {'N': 1, # trajectories to run
'T1': 300,
'T2': 1000,
Expand All @@ -92,7 +147,7 @@
'tsfiles': ['/home/jsmith48/scratch/auto_rxn_al/rxns/'],
'nmfile':None, #path to gaussian log file containing the data
'nm':0, #id of normal mode
'perc':0, #Move the molecules initial coordiantes along the mode by this amount. Negative numbers are ok.
'perc':0, #Move the molecules initial coordiantes along the mode by this amount. Negative numbers are ok.
}

dhparams = { 'Nmol': 250,
Expand All @@ -109,9 +164,9 @@
#'mdselect' : [(10,0), (1,11)],
#'N' : 20,
'maxNa' : 15, # Largest molecule to consider (for dimers max size is 2x maxNa)
'T' : 400.0, # running temp
'T' : 400.0, # running temp
'L' : 25.0, # box length
'V' : 0.04, # Random init velocities
'V' : 0.04, # Random init velocities
'dt' : 0.25, # MD time step
'Nm' : 100, # Molecules to embed
#'Nm' : 160, # Molecules to embed
Expand Down Expand Up @@ -144,7 +199,7 @@

### BEGIN CONFORMATIONAL REFINEMENT LOOP HERE ###
#N = [20]
N = [1]
N = [2]

for i in N:
#netdir = wkdir+'ANI-1x-RXN-0000.00'+str(i).zfill(2)+'/'
Expand All @@ -156,33 +211,32 @@

nnfprefix = netdir + 'train'

netdict = {'iptfile' : iptfile,
'cnstfile' : cstfile,
netdict = {'cnstfile' : cstfile,
'saefile': saefile,
'iptsize': 1008,
'nnfprefix': netdir+'train',
'aevsize': aevsize,
'num_nets': Nnets,
'atomtyp' : ['H','C','N','O','S','F','Cl']
}

## Train the ensemble ##
aln = att.alaniensembletrainer(netdir, netdict, h5stor, Nnets)
aln.build_strided_training_cache(Nblock,Nbvald,Nbtest,False)
aln = att.alaniensembletrainer(netdir, netdict, ipt, h5stor, Nnets)
aln.build_strided_training_cache(Nblock,Nbvald,Nbtest,Ekey='energy',forces=False,dipole=False,rmhighe=True)
aln.train_ensemble(GPU)

if not os.path.exists(root_dir + datdir + str(i+1).zfill(2)):
os.mkdir(root_dir + datdir + str(i+1).zfill(2))

## Run active learning sampling ##
acs = alt.alconformationalsampler(ldtdir, datdir + str(i+1).zfill(2), optlfile, fpatoms+['H'], netdict)
acs = alt.alconformationalsampler(ldtdir, datdir + str(i+1).zfill(2), optlfile, strucsfolder, fpatoms+['H'], netdict)
#acs.run_sampling_cluster(gcmddict, GPU)
#acs.run_sampling_dimer(dmrparams, GPU)
acs.run_sampling_nms(nmsparams, GPU)
#acs.run_sampling_md(mdsparams, perc=0.25, gpus=GPU+GPU+GPU)
#acs.run_sampling_strucs(strucsparams, GPU)
acs.run_sampling_md(mdsparams, perc=0.25, gpus=GPU+GPU+GPU)
#acs.run_sampling_dhl(dhparams, gpus=GPU+GPU)
#acs.run_sampling_TS(tsparams, gpus=GPU)

## Submit jobs, return and pack data
ast.generateQMdata(hostname, username, swkdir, ldtdir, datdir + str(i+1).zfill(2), h5stor, mae, jtime,max_jobs=50)


Loading