andreww / fox

A Fortran XML library
https://andreww.github.io/fox/
Other
58 stars 50 forks source link

could not initialise potential from xml_label #75

Closed marian-code closed 3 years ago

marian-code commented 3 years ago

Hi,

I have been trying to run QUIP pair_style in lammps. My main aim is to use Tangney-Scandolo potential, but I have been getting various errors and have not been able to successfully run any simulation.

I am using potential file that is located in QUIP/share/Parameters/ip.parms.TS.xml. When I take the file as is I get this error from LAMMPS:

ERROR(FoX)
Cannot open second root element (Possibly near line=0 col=949)

After this I have tried to modify the file and left only the first section of it:

<TS_params label="ewald_GGA" betapol="0.75" cutoff="20.0 22.0 18.0 0.0" n_types="2" yuksmoothlength="0.0" pred_order="2" 
  maxipol="60" tolpol="1e-10" yukalpha="0.0" tewald="T" a_ew="1e-06" iesr="-1 -1 -1">

  <per_type_data atomic_num="8" pol="8.89378" z="-1.38257" type="1" />
  <per_type_data atomic_num="14" pol="0.0" z="2.76514" type="2" />

  <per_pair_data C_pol="0.0" atnum_j="8" atnum_i="8" D_ms="0.00024748" gamma_ms="12.07092" B_pol="0.0" R_ms="7.17005" /> 
  <per_pair_data C_pol="-1.50435" atnum_j="8" atnum_i="14" D_ms="0.0019033" gamma_ms="11.1523" B_pol="2.02989" R_ms="4.6371" />
  <per_pair_data C_pol="0.0" atnum_j="14" atnum_i="14" D_ms="-0.0020846" gamma_ms="10.45517" B_pol="0.0" R_ms="5.75038" />

</TS_params>

After this modification the xml is read OK but I get new error:

SYSTEM ABORT: proc=0 Potential_read_params_xml: could not initialise potential from xml_label. param_str=<TS_params label-
="ewald_GGA" betapol="0.75" cutoff="20.0 22.0 18.0 0.0" n_types="2" yuksmoothlength="0.0" pred_order-
="2"   maxipol="60" tolpol="1e-10" yukalpha="0.0" tewald="T" a_ew="1e-06" iesr="-1 -1 -1">   <per_ty-
pe_data atomic_num="8" pol="8.89378" z="-1.38257" type="1" />   <per_type_data atomic_num="14" pol="-
0.0" z="2.76514" type="2" />   <per_pair_data C_pol="0.0" atnum_j="8" atnum_i="8" D_ms="0.00024748"
gamma_ms="12.07092" B_pol="0.0" R_ms="7.17005" />   <per_pair_data C_pol="-1.50435" atnum_j="8" atnu-
m_i="14" D_ms="0.0019033" gamma_ms="11.1523" B_pol="2.02989" R_ms="4.6371" />   <per_pair_data C_pol-
="0.0" atnum_j="14" atnum_i="14" D_ms="-0.0020846" gamma_ms="10.45517" B_pol="0.0" R_ms="5.75038" />
</TS_params>
--------------------------------------------------------------------------

The relevant part of LAMMPS input script:

pair_style  quip
pair_coeff * * ip.parms.TS.xml "TS_params xml_label=ewald_GGA" 8 14

I have no idea how to fix this and would appreciate any help.

andreww commented 3 years ago

Thanks for the report. From what I can see, the first error (Cannot open second root element (Possibly near line=0 col=949)) should only be generated by FoX when it is asked to read a document that is not XML well formed. Specifically, you should see this for documents which look something like:

<root_node_1>
      <some_more_nodes/>
 </root_node_1>
 <root_node_2>
      <some_more_nodes_or_not/>
 </root_node_2>

This is not permitted so FoX errors out. To check that this is really a problem with the XML file and not a bug in FoX, you could try running the XML file through the xmllint command line tool (usually installed on Linux systems).

The second error looks like a problem in lammps rather than FoX. I wonder if it (or quip) was expecting additional information? But that's something for lammps/quip (which use FoX) I suspect.

marian-code commented 3 years ago

Oh, I am really sorry. I have realized right now that I have incorrectly opened this issue here. My aim was to post it in QUIP repository. I am closing this, since as you correctly suggested the issue here is on the side of QUIP/LAMMPS. But thanks for the answer anyway.