Skip to content

Commit

Permalink
RELEASE: New two-level sampling and torsional/bending driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrille Lavigne committed Jun 4, 2020
2 parents 446f5ae + 2b08249 commit 3f62eb0
Show file tree
Hide file tree
Showing 19 changed files with 492 additions and 283 deletions.
15 changes: 15 additions & 0 deletions io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ def traj2smiles(filepath, index=None, chiral=False):
else:
return output[0], E[0]

def traj2mols(filepath, index=None):
"""Read an xyz file and convert to a list of OBMol objects."""
# Read the trajectory
strs, E = traj2str(filepath, index=index, as_list=True)
output = []

for s in strs:
# put string in lowercase to fix stupid openbabel bug
output+= [pybel.readstring("xyz", s.lower()).OBMol]

if index is None:
return output, E
else:
return output[0], E[0]

def traj2npy(filepath, index=None):
"""Read an xyz file and convert to numpy arrays."""
# Read the trajectory
Expand Down
5 changes: 2 additions & 3 deletions other-examples/ForbiddenHydrogenTransfer/user.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
atoms:
- 28
- 40
mtd_step: 8
mtd_step: 2
driving_limits: 3.0
xyz: |
48
energy: -77.825013781139 gnorm: 0.000034469795 xtb: 6.2.3 (830e466)
Expand Down Expand Up @@ -53,5 +54,3 @@ xyz: |
H -3.24131903093339 3.30718589157818 0.00785909392818
H -4.60460369591328 0.91794161109565 -1.35706948702982
H -3.66253435015823 0.59205099803872 0.11203431300208
5 changes: 2 additions & 3 deletions other-examples/HornerWadsworthEmmons/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ atoms:
- 4
- 8
chrg: '-1'
mtd_step: 3
mtd_step: 1
driving_limits: 5.00
xyz: |
48
energy: -75.854452608565 gnorm: 0.000431047396 xtb: 6.2.3 (830e466)
Expand Down Expand Up @@ -54,5 +55,3 @@ xyz: |
H 3.34561941914628 2.45517016878003 2.52760196396470
H 2.72712779707865 0.15596293603984 1.93326438202129
H 4.29591049903472 -1.69953020030290 2.39889109124377
2 changes: 1 addition & 1 deletion other-examples/KnorrPyrazole/user.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
atoms:
- 14
- 27
driving_limits: 3.0
xyz: |
28
Expand Down Expand Up @@ -32,4 +33,3 @@ xyz: |
H 4.11514743412232 2.39786397805493 -0.04905707127543
H 3.83060277215256 1.11350050461943 2.41184513116468
H 4.62352921882875 0.34790999739011 1.18855004933396
147 changes: 93 additions & 54 deletions parameters/default.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# ---------------------------------------------------------------------------#
# Parameters passed to xtb
gfn: '2' # gfn version
# Not setting the following = taking the xtb default
seed: # TODO: random seed for reproducibility

# xtb parameters
gfn: '2'
etemp:
solvent:
chrg:
uhf:

# ---------------------------------------------------------------------------#
# Optimization of stretched and unstretched structures.
optim: vtight
uhf: '0.0'

# Potential "wall" keeping molecules together. The following are just the
# lines of the wall group. This is needed mainly for the metadynamics portion,
Expand All @@ -19,62 +16,104 @@ wall:
- 'sphere: auto, all'

# ---------------------------------------------------------------------------#
# Parameters used by CREGEN to compare structures and decide if they are
# identical. These are more generous (significantly) than the CREST one
# because we want to really push diversity and limit similarity.
# Parameters related to the coordinate driving

# Atoms of driven coordinate. The number of atoms given defines the driving
# type:
# - 2 atoms -> distance driving
# - 3 atoms -> bend driving
# - 4 atoms -> torsional driving
atoms:

# Lower and upper limits applied to the driven coordinate. If a single number
# is given, the lower limit defaults to the value of the coordinate in the
# equilibrium geometry. driving_num sets the number of discretized values the
# driven coordinate takes.
driving_limits:
driving_num: 50

# Force of coordinate driving, in Hartree/bohr or Hartree/angle (?
# TODO:CHECK). If empty and a distance driving is applied, the force is
# determined the bond strength computed at starting geometry. For angles, the
# default value is 1.0.
force:

# Optimization level used during coordinate driving relaxed scans.
optim: normal

# ---------------------------------------------------------------------------#
# Metadynamics initial conformer seeding

# To get a good coverage of conformers, we initially perform (if imtd = true)
# a metadynamics run to generate a set of starting structures at the initial
# value of the driven coordinate.
imtd: true

# Time per atom of the initial mtd run.
imtd_time_per_atom: 0.5

# Metadynamics potential parameters (adapted from CREST mquick) for the
# $metadyn block in xtb.
imtd_metadyn: ["kpush=0.200", "alp=0.200"]

# MD parameters for the $md block in xtb. The initial metadynamics is
# performed with shake=2, a 5fs step and structures dumped every 100 fs.
imtd_md: ["shake=2","step=5","dump=100"]

# ---------------------------------------------------------------------------#
# Metadynamics transition structure search

# The following parameters set the points along the driven coordinate at which
# metadynamics searches are performed. By default, that is at every point
# (mtd_step=1) over the first half of the values of the driven coordinate
# (mtd_lims = [0.0, 0.5]).
mtd_step: 1
mtd_lims: [0.0, 0.5] # Start and end values of the driven
# coordinate where driving is performed, as
# fractions of total coordinate range.

# Alternatively, the indices at which the coordinate driving is performed can
# be set explicitly.
mtd_indices:

# The following parameters relate to the metadynamics propagations themselves.
# The defaults balance performance and exploration.

# Time per atom of metadynamics propagation, in ps.
tsmtd_time_per_atom: 0.1

# The remaining parameters are adapted from the CREST paper. We do four sample
# at each index, with variying kpush and alpha parameters (similar to CREST
# -mquick).
tsmtd_params:
- ["save=30", "kpush=0.200", "alp=0.800"]
- ["save=30", "kpush=0.200", "alp=0.200"]
- ["save=30", "kpush=0.050", "alp=0.800"]
- ["save=30", "kpush=0.050", "alp=0.200"]

# For the TS search, we turn SHAKE off
tsmtd_md: ["shake=0","step=2","dump=100"]

# ---------------------------------------------------------------------------#
# Reaction search parameters
# These parameters are related to the selection of metadynamics-derived
# transition structures for further coordinate driving. For this, we use the
# CREGEN routine from CREST. However, the parameters are significantly less
# strict than the CREST ones because we want to really push diversity and
# limit similarity.
ewin: 60.0 # maximum energy in kcal /mol above the energy
# of the initial structure E0.
rthr: 0.4 # RMSD threshold (in A)
ethr: 1.0 # energy threshold (in kcal/mol)
bthr: 2.0 # rotational const threshold

# Before we start CREGEN, we first optimize the structures obtained in
# metadynamics at the following optimization level,
optcregen: normal
# metadynamics at the following optimization level.
optcregen: tight

# ---------------------------------------------------------------------------#
# Parameters related to the atoms to be stretched. This will then be
# turned into constraints.
atoms:
stretch_limits: [1.0, 3.0] # Bond stretched between 1x and 3x eq. length
force: # Force of stretch, in Hartree/bohr. If empty,
# the force is determined from a Hessian
# calculation at the starting geometry.

# Only one of these two should be set.
stretch_num: 100 # Number of points for stretch

# ---------------------------------------------------------------------------#
# The following parameters determine where (in terms of bond stretch)
# metadynamics is performed.
mtd_only_reactant: true # Do metadynamics only for the reactant.
mtd_step: 4 # Metadynamics every x points of stretch. If
# null, do mtd only at TS and minima.
# We can also set those points explicitly.
mtdi:

# ---------------------------------------------------------------------------#
# The following parameters relate to the metadynamics portion. The defaults
# balance performance and exploration.
metadynamics:
# This is the number of structure to harvest from each metadynamics job
nmtd: 80
time_per_atom: 0.5 # total time / Natoms (ps) for each job

# The remaining parameters are adapted from the CREST paper (the nanoreactor
# part). We do four sample at each index, with variying kpush and alpha
# parameters (similar to CREST conformer search).
save: 80
jobs:
- ["kpush=0.200", "alp=0.800"]
- ["kpush=0.200", "alp=0.200"]
- ["kpush=0.050", "alp=0.800"]
- ["kpush=0.050", "alp=0.200"]
md:
- "shake=0" # shake off
- "step=2" # MD timestep, in fs

# Finally, the initial structure
# Finally, the initial molecular structure is given here.
xyz: |
3
Expand Down
Loading

0 comments on commit 3f62eb0

Please sign in to comment.