libAtoms / QUIP

libAtoms/QUIP molecular dynamics framework: https://libatoms.github.io
349 stars 121 forks source link

QUIP/LAMMPS interface for potentials without local_virial #154

Open jameskermode opened 5 years ago

jameskermode commented 5 years ago

Is the QUIP LAMMPS interface expected to work for potentials which do not implement a local_virial? I'm trying to use the QUIP TS potential (which does not have local virials) from LAMMPS and I get the following:

root@051844fcec0c:~/machome# lmp_mpi < lammps.in
LAMMPS (12 Dec 2018)
Created triclinic box = (0 0 0) to (4.84038 4.19189 5.32852) with tilt (-2.42019 0 0)
 1 by 1 by 1 MPI processor grid
Created 0 atoms
 Time spent = 4.94815e-05 secs
Created 1 atoms
 Time spent = 2.64095e-05 secs
Created 0 atoms
 Time spent = 1.25775e-05 secs
Created 0 atoms
 Time spent = 1.4719e-05 secs
Created 0 atoms
 Time spent = 1.1865e-05 secs
Created 0 atoms
 Time spent = 1.44825e-05 secs
Created 0 atoms
 Time spent = 1.3084e-05 secs
Created 0 atoms
 Time spent = 1.37665e-05 secs
Created 0 atoms
 Time spent = 1.59105e-05 secs
Neighbor list info ...
 update every 20 steps, delay 0 steps, check no
 max neighbors/atom: 2000, page size: 100000
 master list distance cutoff = 10.8835
 ghost atom cutoff = 10.8835
 binsize = 5.44177, bins = 2 1 1
 1 neighbor lists, perpetual/occasional/extra = 1 0 0
 (1) pair quip, perpetual
     attributes: full, newton on
     pair build: full/bin/atomonly
     stencil: full/bin/3d
     bin: standard
Setting up Verlet run ...
 Unit style    : metal
 Current step  : 0
 Time step     : 0.001
SYSTEM ABORT: Traceback (most recent call last)
File "/opt/quip/src/Potentials/IPModel_TS.f95", line 507 kind unspecified
IPModel_TS_Calc: local_virial calculation requested but not supported yet.

Here's my LAMMPS input file - as far as I can tell nothing in here needs the stress, let alone the per-atom stress:

units metal
atom_style atomic
atom_modify map array
boundary p p p
box tilt large
region cell prism    0 4.84038096902 0 4.19189288951 0 5.328524     -2.42019047353 0.0 0.0     units box
create_box 2 cell
create_atoms 2 single  1.12339341     -1.94577446      3.55234934
create_atoms 2 single  1.12339341      1.94577446      1.77617467
create_atoms 2 single -2.24678682      0.00000000     -0.00000000
create_atoms 1 single  1.67106932     -0.55758571      4.13708042
create_atoms 1 single -0.35265127      1.72598134      7.68942976
create_atoms 1 single -1.31841805     -1.16839563      5.91325509
create_atoms 1 single  1.67106932      0.55758571     -4.13708042
create_atoms 1 single -1.31841805      1.16839563     -0.58473108
create_atoms 1 single -0.35265127     -1.72598134     -2.36090575

fix 1 all nve

pair_style      quip
pair_coeff      * * params.xml "IP TS" 8 14

neighbor 0.3 bin
neigh_modify delay 0 every 20 check no

mass 2 28.084999992775298238711911835708
mass 1 15.998999995884350511232696590014
run 0

params.xml is as follows:

<TS_params label="screened_LDA" betapol="0.75" cutoff="20.0 20.0 18.0 0.0" cutoff_coulomb="20.0" cutoff_ms="18.0" tolpol="1e-10" yuksmoothlength="10.0" iesr="-1 -1 -1" a_ew="1e-06" n_types="2" gcut="0.0" pred_order="2" maxipol="60" raggio="0.0" tewald="F" yukalpha="0.1">

  <per_type_data atomic_num="8" pol="14.131863" z="-1.4295594" type="1" />
  <per_type_data atomic_num="14" pol="0.0" z="2.8591188" type="2" />

  <per_pair_data C_pol="0.44302622" atnum_j="8" atnum_i="8" D_ms="0.00030700577" gamma_ms="12.165654" B_pol="1.1221903" R_ms="7.0252019" />
  <per_pair_data C_pol="-1.5003213" atnum_j="8" atnum_i="14" D_ms="0.0020129372" gamma_ms="11.350477" B_pol="1.973181" R_ms="4.5780828" />
  <per_pair_data C_pol="0.0" atnum_j="14" atnum_i="14" D_ms="0.33967532" gamma_ms="-0.17694797" B_pol="0.0" R_ms="-0.085202834" />

</TS_params>
gabor1 commented 5 years ago

quite possibly not, because lammps does domain decomposition and assembles the total virial from the local virials?

On 2 Oct 2019, at 15:31, James Kermode notifications@github.com wrote:

Is the QUIP LAMMPS interface expected to work for potentials which do not implement a local_virial? I'm trying to use the QUIP TS potential (which does not have local virials) from LAMMPS and I get the following:

root@051844fcec0c:~/machome# lmp_mpi < lammps.in LAMMPS (12 Dec 2018) Created triclinic box = (0 0 0) to (4.84038 4.19189 5.32852) with tilt (-2.42019 0 0) 1 by 1 by 1 MPI processor grid Created 0 atoms Time spent = 4.94815e-05 secs Created 1 atoms Time spent = 2.64095e-05 secs Created 0 atoms Time spent = 1.25775e-05 secs Created 0 atoms Time spent = 1.4719e-05 secs Created 0 atoms Time spent = 1.1865e-05 secs Created 0 atoms Time spent = 1.44825e-05 secs Created 0 atoms Time spent = 1.3084e-05 secs Created 0 atoms Time spent = 1.37665e-05 secs Created 0 atoms Time spent = 1.59105e-05 secs Neighbor list info ... update every 20 steps, delay 0 steps, check no max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 10.8835 ghost atom cutoff = 10.8835 binsize = 5.44177, bins = 2 1 1 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair quip, perpetual attributes: full, newton on pair build: full/bin/atomonly stencil: full/bin/3d bin: standard Setting up Verlet run ... Unit style : metal Current step : 0 Time step : 0.001 SYSTEM ABORT: Traceback (most recent call last) File "/opt/quip/src/Potentials/IPModel_TS.f95", line 507 kind unspecified IPModel_TS_Calc: local_virial calculation requested but not supported yet.

Here's my LAMMPS input file - as far as I can tell nothing in here needs the stress, let alone the per-atom stress:

units metal atom_style atomic atom_modify map array boundary p p p box tilt large region cell prism 0 4.84038096902 0 4.19189288951 0 5.328524 -2.42019047353 0.0 0.0 units box create_box 2 cell create_atoms 2 single 1.12339341 -1.94577446 3.55234934 create_atoms 2 single 1.12339341 1.94577446 1.77617467 create_atoms 2 single -2.24678682 0.00000000 -0.00000000 create_atoms 1 single 1.67106932 -0.55758571 4.13708042 create_atoms 1 single -0.35265127 1.72598134 7.68942976 create_atoms 1 single -1.31841805 -1.16839563 5.91325509 create_atoms 1 single 1.67106932 0.55758571 -4.13708042 create_atoms 1 single -1.31841805 1.16839563 -0.58473108 create_atoms 1 single -0.35265127 -1.72598134 -2.36090575

fix 1 all nve

pair_style quip pair_coeff params.xml "IP TS" 8 14

neighbor 0.3 bin neigh_modify delay 0 every 20 check no

mass 2 28.084999992775298238711911835708 mass 1 15.998999995884350511232696590014 run 0

params.xml is as follows:

<TS_params label="screened_LDA" betapol="0.75" cutoff="20.0 20.0 18.0 0.0" cutoff_coulomb="20.0" cutoff_ms="18.0" tolpol="1e-10" yuksmoothlength="10.0" iesr="-1 -1 -1" a_ew="1e-06" n_types="2" gcut="0.0" pred_order="2" maxipol="60" raggio="0.0" tewald="F" yukalpha="0.1"

< per_type_data atomic_num="8" pol="14.131863" z="-1.4295594" type="1" /> < per_type_data atomic_num="14" pol="0.0" z="2.8591188" type="2" />

< per_pair_data C_pol="0.44302622" atnum_j="8" atnum_i="8" D_ms="0.00030700577" gamma_ms="12.165654" B_pol="1.1221903" R_ms="7.0252019" /> < per_pair_data C_pol="-1.5003213" atnum_j="8" atnum_i="14" D_ms="0.0020129372" gamma_ms="11.350477" B_pol="1.973181" R_ms="4.5780828" /> < per_pair_data C_pol="0.0" atnum_j="14" atnum_i="14" D_ms="0.33967532" gamma_ms="-0.17694797" B_pol="0.0" R_ms="-0.085202834" />

</ TS_params> — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

-- Gábor

Gábor Csányi Professor of Molecular Modelling Engineering Laboratory Pembroke College University of Cambridge

Pembroke College supports CARA. A Lifeline to Academics at Risk. http://www.cara.ngo/

jameskermode commented 5 years ago

I wondered about that - but I don't even need the total virial, just forces and energies. I guess I'll have to look at the code...

gabor1 commented 5 years ago

but lammps might not accept something that doesn’t have a virial

On 2 Oct 2019, at 15:39, James Kermode notifications@github.com wrote:

I wondered about that - but I don't even need the total virial, just forces and energies. I guess I'll have to look at the code...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

-- Gábor

Gábor Csányi Professor of Molecular Modelling Engineering Laboratory Pembroke College University of Cambridge

Pembroke College supports CARA. A Lifeline to Academics at Risk. http://www.cara.ngo/

bernstei commented 5 years ago

Or the interface tries to get the virial whether or not LAMMPS really needs it.

                                    Noam

On Oct 2, 2019, at 10:40 AM, gabor1 notifications@github.com wrote:

but lammps might not accept something that doesn’t have a virial

On 2 Oct 2019, at 15:39, James Kermode notifications@github.com wrote:

I wondered about that - but I don't even need the total virial, just forces and energies. I guess I'll have to look at the code...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

-- Gábor

Gábor Csányi Professor of Molecular Modelling Engineering Laboratory Pembroke College University of Cambridge

Pembroke College supports CARA. A Lifeline to Academics at Risk. http://www.cara.ngo/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/libAtoms/QUIP/issues/154?email_source=notifications&email_token=AAJFRNJDZYU3ZGTWQ7DR2DDQMSXENA5CNFSM4I4XE762YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAE7U2A#issuecomment-537524840, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFRNKVRBNMRGYLEVBFJ7LQMSXENANCNFSM4I4XE76Q.


|| |U.S. NAVAL| |RESEARCH| LABORATORY Noam Bernstein, Ph.D. Center for Materials Physics and Technology U.S. Naval Research Laboratory T +1 202 404 8628 F +1 202 404 7546 https://www.nrl.navy.mil https://www.nrl.navy.mil/

jameskermode commented 5 years ago

Exactly, I think its the latter

https://github.com/libAtoms/QUIPforLAMMPS/blob/master/src/USER-QUIP/pair_quip.cpp#L57

has a vflag option, if this is 0 it should avoid asking QUIP for a virial.

@albapa any idea how to set vflag=0 in the LAMMPS input file?

jameskermode commented 5 years ago

No, I'm wrong - digging a little deeper QUIP always tries to compute the virial regardless of whether it's needed or not by LAMMPS

https://github.com/libAtoms/QUIP/blob/726c743dafcc57a710906b6d007d6639f2eaeedc/src/Potentials/quip_lammps_wrapper.f95#L143

So I could either change this, or work around by coding a dummy virial and local_virial in my TS potential which is zero.

albapa commented 5 years ago

The problem is that we never implemented the information flow from LAMMPS to QUIP on what's needed.

albapa commented 5 years ago

Looking at the code, it does calculate the virial, so it wouldn't be a big deal to do the local_virial as well. All that matters is that it sums to the total virial, unless you want to use it later for heat transport, in which case it needs to be done more carefully.

jameskermode commented 5 years ago

Good idea, that sounds like the best solution, I'll do that.