Replies: 13 comments 1 reply
-
Is the simulation stable? It is possible that the logger is only printing the interaction energy and not the total energy. OpenMM is bio-md code, so it should be working with interaction energies. @jharrymoore Do you have an idea? |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the issue - @ilyes319 is correct - openMM expects just the interaction energies, so the difference you see is exactly the sum of E0s for the system. Also from a quick look at the temperature it appears something has exploded - could you check whether your minimised structure is visually sensible? I suspect it is, in which case you will need to look at how the potential was fitted. Could you share the log file from the training run? |
Beta Was this translation helpful? Give feedback.
-
Make sure that when you do the training, the energies are in eV and distances in Angstrom, and forces are in eV/Angstrom. MACE training only works in those units. Your output shows energies in kJ/mol.... |
Beta Was this translation helpful? Give feedback.
-
Thank you very much! @ilyes319 and @jharrymoore . The md simulation is not stable (I mean that the temperature is increasing from 62K~1000K during simulation, and there are some unreasonable geometries which have O-O bonds at the end of the simulation). The reason is that the model is very rough currently. I want to utilize the model to run short MD, discard unreasonable structures, perform DFT calculations upon chosen structures (based on model deviation), and finally improve the model. The current explosion is as expected. Now the problem about energies is solved. The OpenMM prints interaction energies. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry that I also have a very related problem: there are mirror molecules in the trajectory. After the md simulation is done, I use the following Python script to convert the .dcd and .pdb files together into a .xyz file: import mdtraj as md
t = md.load('output.dcd', top='minimised_system.pdb')
t.unitcell_vectors *= 10.0 # nm to A
t.xyz *= 10.0 # nm to A
f = open('output.xyz', 'w+')
for i in range(t.n_frames):
f.write(str(t.n_atoms))
f.write('\nLattice=\"')
f.write(' '.join(map(str,t.unitcell_vectors[i,:,:].flatten())))
f.write('\" Properties=species:S:1:pos:R:3 pbc="T T T"\n')
for j in range(t.n_atoms):
f.write(t.topology.atom(j).element.symbol+' ')
f.write(' '.join(format(x,'.8f') for x in t.xyz[i,j,:]))
f.write('\n')
f.close() I find that for some snapshots, some water molecules run out of the box (which may be normal), but this water molecule is exactly at the position of a water molecule inside of the box (they just differ by one lacttice vector length). If I use this snapshot to perform PBC-DFT calculation, it will complain about there are two atoms whose distance is zero. Is there something about wrap/unwrap missing in my python script? Thanks again for your kind help. |
Beta Was this translation helpful? Give feedback.
-
@gabor1 , thanks for your kind remind. I do use the energy (in eV) and forces (in eV/A) during training. Here are the first few
and here are the final few lines of training output
The output which includes |
Beta Was this translation helpful? Give feedback.
-
Just to clarify this - openMM uses kJ/mol and nm as internal units, so the writeout here is expected. MACE must be fitted as Gabor outlines above and the conversion is handled internally in the openmm interface |
Beta Was this translation helpful? Give feedback.
-
I see you set unwrap=True in your initial script- you need to wrap molecules back into the periodic box before you try to compute anything else. I recommend using the following as a starting point https://docs.mdanalysis.org/1.0.0/documentation_pages/transformations/wrap.html |
Beta Was this translation helpful? Give feedback.
-
Yes, files are attached minimised_system_and_log.zip
Just to make it clear: it is O.K. for me to set What makes me confused is that even if I set |
Beta Was this translation helpful? Give feedback.
-
Yes, either setting is fine, but will dictate how the trajectory is processed after the fact - if you use |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for all the kind help. I'm still checking where is wrong in my md trajectory, but before I find the final answer, I have three questions related to the box in a MACE+OPENMM md simulation: (1) If I use the (2) In the source code the
I'm simulating a periodic water box and I did not specify (3) My xyz file always include correct box information (see below), no matter when training or running md. Do I need to take care of questions (1) and (2)?
|
Beta Was this translation helpful? Give feedback.
-
Hello. This is regarding the comment that says MACE can only be trained on
|
Beta Was this translation helpful? Give feedback.
-
Only that energies, forces and distances need to be consistent. the XYZ file defines Angstroms as the distance. We already have options that provide inter-atomic repulsion at close range, which is based on the ZBL function and mandates the use of eVs for energies. In the near future we plan to have options which automatically use covalent radius information based on the elements, and that will also require the distances to be in Angstrom. |
Beta Was this translation helpful? Give feedback.
-
Dear MACE developers and users,
I've trained a rough model for liquid water (using periodic box). If this model is applied to evaluate the energies of geometries in the training set, the obtained energies are good as expected (which is around -133048 eV). But when I use this model to run a short md trajectory, the output is strange:
The energies shown in md are around -65023 kJ/mol, i.e. -673.9 eV, which is far from the energy of a water box (around -133048 eV). I do not know where is wrong during the md simulation. The python script used to run md is
Please see the attached files
h2o_md.xyz
andh2o_md_1.model
h2o_md.zip
By the way, all the computations are performed on CPU since we have very limited GPU resources. Thanks to anyone for any kind help!
Beta Was this translation helpful? Give feedback.
All reactions