-
Notifications
You must be signed in to change notification settings - Fork 1
Reax ff #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Reax ff #122
Changes from all commits
032f99d
2c432f9
fa1d2e0
9ff2164
466e616
f8321be
2b01115
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,4 +17,7 @@ log.lammps | |
|
|
||
| crates.d/config.toml | ||
|
|
||
| log.cite | ||
| etc/profile.d/lammps.csh | ||
|
|
||
| venv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| extern crate vergen; | ||
|
|
||
| use vergen::{ConstantsFlags, Result, Vergen}; | ||
|
|
||
| fn main() { | ||
| gen_constants().expect("Unable to generate vergen constants!"); | ||
| } | ||
|
|
||
| fn gen_constants() -> Result<()> { | ||
| let vergen = Vergen::new(ConstantsFlags::all())?; | ||
|
|
||
| for (k, v) in vergen.build_info() { | ||
| println!("cargo:rustc-env={}={}", k.name(), v); | ||
| } | ||
|
|
||
| Ok(()) | ||
| } | ||
| extern crate vergen; | ||
| use vergen::{ConstantsFlags, Result, Vergen}; | ||
| fn main() { | ||
| gen_constants().expect("Unable to generate vergen constants!"); | ||
| } | ||
| fn gen_constants() -> Result<()> { | ||
| let vergen = Vergen::new(ConstantsFlags::all())?; | ||
| for (k, v) in vergen.build_info() { | ||
| println!("cargo:rustc-env={}={}", k.name(), v); | ||
| } | ||
| Ok(()) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # set environment for LAMMPS and msi2lmp executables | ||
| # to find potential and force field files | ||
| if ( "$?LAMMPS_POTENTIALS" == 0 ) setenv LAMMPS_POTENTIALS /home/brandon/.local/share/lammps/potentials | ||
| if ( "$?MSI2LMP_LIBRARY" == 0 ) setenv MSI2LMP_LIBRARY /home/brandon/.local/share/lammps/frc_files | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personal files such as these can be added to |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # set environment for LAMMPS and msi2lmp executables | ||
| # to find potential and force field files | ||
| LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS-/home/brandon/.local/share/lammps/potentials} | ||
| MSI2LMP_LIBRARY=${MSI2LMP_LIBRARY-/home/brandon/.local/share/lammps/frc_files} | ||
| export LAMMPS_POTENTIALS MSI2LMP_LIBRARY |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| This LAMMPS simulation made specific use of work described in the | ||
| following references. See http://lammps.sandia.gov/cite.html | ||
| for details. | ||
|
|
||
| pair reax/c command: | ||
|
|
||
| @Article{Aktulga12, | ||
| author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, | ||
| title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, | ||
| journal = {Parallel Computing}, | ||
| year = 2012, | ||
| volume = 38, | ||
| pages = {245--259} | ||
| } | ||
|
|
||
| fix qeq/reax command: | ||
|
|
||
| @Article{Aktulga12, | ||
| author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, | ||
| title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, | ||
| journal = {Parallel Computing}, | ||
| year = 2012, | ||
| volume = 38, | ||
| pages = {245--259} | ||
| } | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Files like this which may be accidentally created could be added to |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| numpy==1.20.1 | ||
| scipy==1.6.1 | ||
| numpy==1.19.5 | ||
| scipy==1.3.0 | ||
| networkx==2.5 | ||
| spglib==1.16.1 | ||
| pymatgen==2021.2.16 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -621,6 +621,8 @@ impl<P: Potential> Lammps<P> | |
| )?; | ||
| } | ||
|
|
||
| let InitInfo { masses, pair_style, pair_coeffs } = init_info; | ||
|
|
||
| lmp.command(format!("package omp {}", builder.openmp_threads.unwrap_or(0)))?; | ||
| lmp.command(format!("processors {}", { | ||
| builder.processors.iter() | ||
|
|
@@ -631,14 +633,27 @@ impl<P: Potential> Lammps<P> | |
| .collect::<Vec<_>>().join(" ") | ||
| }))?; | ||
|
|
||
| lmp.commands(&[ | ||
| "units metal", // Angstroms, picoseconds, eV | ||
| "neigh_modify delay 0", // disable delay for a safer `run pre no` | ||
| "atom_style atomic", // attributes to store per-atom | ||
| "thermo_modify lost error", // don't let atoms disappear without telling us | ||
| "atom_modify map array", // store all positions in an array | ||
| "atom_modify sort 0 0.0", // don't reorder atoms during simulation | ||
| ])?; | ||
| if &(pair_style.to_string())[..17] == "pair_style reax/c"{ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be simplified to if pair_style.to_string().starts_with("pair_style reax/c") {More importantly, however, rather than checking these things here, it would be preferrable to make it possible to handle these changes by adding methods to abstract over this to the |
||
| lmp.commands(&[ | ||
| "units real", // Angstroms, picoseconds, Kcal/mol | ||
| "neigh_modify delay 0", // disable delay for a safer `run pre no` | ||
| "atom_style charge", // attributes to store per-atom and required q value | ||
| "thermo_modify lost error", // don't let atoms disappear without telling us | ||
| "atom_modify map array", // store all positions in an array | ||
| "atom_modify sort 0 0.0", // don't reorder atoms during simulation | ||
| "neighbor 6 bin" // give more room to the neighbor lists for dynamic charge equalibriations | ||
| ])?; | ||
| } | ||
| else{ | ||
| lmp.commands(&[ | ||
| "units metal", // Angstroms, picoseconds, eV | ||
| "neigh_modify delay 0", // disable delay for a safer `run pre no` | ||
| "atom_style atomic", // attributes to store per-atom | ||
| "thermo_modify lost error", // don't let atoms disappear without telling us | ||
| "atom_modify map array", // store all positions in an array | ||
| "atom_modify sort 0 0.0", // don't reorder atoms during simulation | ||
| ])?; | ||
| } | ||
|
|
||
| if let Some(_) = molecule_ids { | ||
| lmp.commands(&["fix RSP2_HasMolIds all property/atom mol ghost yes"])?; | ||
|
|
@@ -652,7 +667,6 @@ impl<P: Potential> Lammps<P> | |
| ])?; | ||
|
|
||
| { | ||
| let InitInfo { masses, pair_style, pair_coeffs } = init_info; | ||
|
|
||
| lmp.command(format!("create_box {} sim", masses.len()))?; | ||
| for (i, mass) in (1..).zip(masses) { | ||
|
|
@@ -661,6 +675,9 @@ impl<P: Potential> Lammps<P> | |
|
|
||
| lmp.command(pair_style.to_string())?; | ||
| lmp.commands(pair_coeffs)?; | ||
| if &(pair_style.to_string())[..17] == "pair_style reax/c"{ | ||
| lmp.command("compute reax all pair reax/c".to_string())?; | ||
| } | ||
| } | ||
|
|
||
| // HACK: | ||
|
|
@@ -699,12 +716,20 @@ impl<P: Potential> Lammps<P> | |
| } | ||
| } | ||
|
|
||
| // FIXME: the charges of 4 and -2 are only valid for TMD's. | ||
| // If other ReaxFF approaches are used in the future, these will need to be read element-wise. | ||
| if &(pair_style.to_string())[..17] == "pair_style reax/c"{ | ||
| lmp.command("set type 1 charge 4".to_string())?; | ||
| lmp.command("set type 2 charge -2".to_string())?; | ||
| lmp.command("fix 1 all qeq/reax 1 0 10 1.0e-6 reax/c".to_string())?; | ||
| } | ||
|
|
||
| // set up computes | ||
| lmp.commands(&[ | ||
| &format!("compute RSP2_PE all pe"), | ||
| &format!("compute RSP2_Pressure all pressure NULL virial"), | ||
| ])?; | ||
|
|
||
| lmp | ||
| })} | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| use crate::{FailResult, FailOk}; | ||
| use crate::assemble::{RawAssemble, Assemble}; | ||
|
|
||
| use rsp2_structure::{CoordsKind, Lattice, Coords}; | ||
| use rsp2_structure::{CoordsKind, Lattice, Coords, Element}; | ||
| use std::io::Read; | ||
|
|
||
| use rsp2_array_types::{M22, M33, mat, V2, V3, inv, Unvee}; | ||
|
|
@@ -79,6 +79,7 @@ mod cereal { | |
| // Number of unique images to generate along each layer lattice vector | ||
| #[serde(default = "defaults::layer::repeat")] | ||
| pub repeat: [u32; 2], | ||
| pub elements: Vec<String>, | ||
| // Common translation for all positions in layer. | ||
| // NOTE: units of layer lattice | ||
| #[serde(default = "defaults::layer::shift")] | ||
|
|
@@ -90,7 +91,7 @@ mod cereal { | |
|
|
||
| pub fn a() -> f64 { 1.0 } | ||
| pub fn vacuum_sep() -> f64 { 10.0 } | ||
| pub fn layer_sep() -> Either<f64, Vec<f64>> { Either::A(1.0) } | ||
| pub fn layer_sep() -> Either<f64, Vec<f64>> { Either::A(1.5) } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try and see if adding |
||
|
|
||
| pub mod layer { | ||
| use super::*; | ||
|
|
@@ -123,6 +124,7 @@ mod middle { | |
| pub transform: M33, | ||
| pub repeat: [u32; 3], | ||
| pub shift: V3, | ||
| pub elements: Vec<Element>, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -148,7 +150,7 @@ fn interpret_cereal(cereal: self::cereal::Root) -> FailResult<middle::Layers> | |
| let self::cereal::Layer { | ||
| frac_lattice, frac_sites, | ||
| cart_lattice, cart_sites, | ||
| transform, repeat, shift, | ||
| transform, repeat, shift, elements | ||
| } = layer; | ||
|
|
||
| #[derive(Debug, Copy, Clone, PartialEq, Eq)] | ||
|
|
@@ -181,11 +183,15 @@ fn interpret_cereal(cereal: self::cereal::Root) -> FailResult<middle::Layers> | |
| } | ||
| } | ||
| }; | ||
|
|
||
| let mut els = vec![]; | ||
| for atom in elements{ | ||
| els.push(Element::from_symbol(&atom).unwrap()); | ||
| } | ||
| let elements = els; | ||
| let transform = m22_to_m33(&transform); | ||
| let shift = V3([shift[0], shift[1], 0.0]); | ||
| let repeat = [repeat[0], repeat[1], 1]; | ||
| middle::Layer { cart_lattice, frac_lattice, cart_sites, transform, repeat, shift } | ||
| middle::Layer { cart_lattice, frac_lattice, cart_sites, transform, repeat, elements, shift } | ||
| })}).collect::<FailResult<Vec<_>>>()?; | ||
|
|
||
| middle::Layers { lattice_a, full_lattice, layers, layer_seps, vacuum_sep } | ||
|
|
@@ -199,9 +205,12 @@ fn assemble_from_cereal(cereal: self::cereal::Root) -> FailResult<Assemble> | |
| } = interpret_cereal(cereal)?; | ||
|
|
||
| let mut fracs_in_plane = vec![]; | ||
| let mut elements = vec![]; | ||
|
|
||
| for layer in layers.into_iter() { | ||
| let lattice = layer.cart_lattice.clone(); | ||
| let sites = layer.cart_sites.clone(); | ||
| let atoms = layer.elements.clone(); | ||
|
|
||
| let mut structure = Coords::new(lattice, CoordsKind::Carts(sites)); | ||
| structure.translate_frac(&layer.shift); | ||
|
|
@@ -217,18 +226,21 @@ fn assemble_from_cereal(cereal: self::cereal::Root) -> FailResult<Assemble> | |
| // to get the integer sc matrices, and somehow verify that the 'repeat' field | ||
| // is correct. Or just ignore the 'repeat' field and do HNF reduction to find | ||
| // a set of periods (but that feels wasteful). | ||
| let (superstructure, _) = rsp2_structure::supercell::diagonal(layer.repeat).build(&structure); | ||
| let (superstructure, sc) = rsp2_structure::supercell::diagonal(layer.repeat).build(&structure); | ||
|
|
||
| // put them in frac coords for the full lattice | ||
| let mut superstructure = Coords::new( | ||
| Lattice::new(&full_lattice), | ||
| CoordsKind::Carts(superstructure.to_carts()), | ||
| ); | ||
|
|
||
| // FIXME this reduction is just a bandaid for the above-mentioned issue. | ||
| // (taking unique positions in the diagonal layer supercells and mapping | ||
| // them into the cell that we generally use for the structure) | ||
| superstructure.reduce_positions(); | ||
| fracs_in_plane.push(superstructure.to_fracs()); | ||
| elements.extend(sc.replicate(&atoms)); | ||
|
|
||
| } | ||
|
|
||
| let carts_along_normal = { | ||
|
|
@@ -247,6 +259,7 @@ fn assemble_from_cereal(cereal: self::cereal::Root) -> FailResult<Assemble> | |
| initial_vacuum_sep: vacuum_sep, | ||
| check_intralayer_distance: None, | ||
| part: None, | ||
| elements: elements, | ||
| }; | ||
|
|
||
| // FIXME: some of the possible errors produced by `from_raw` here are | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'll have to try and recall what the deal with this was, but I'd like to avoid just deleting this...